:root {
  --ink: #2f332d;
  --blue: #244553;
  --paper: #faf2df;
  --muted: #615d4d;
  --edge: #c9b386;
  --rust: #8c4227;
  --gold: #bc852e;
  --base: 16px;
  color: var(--ink);
  background: #ded0ae;
  font-family:
    system-ui,
    -apple-system,
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    sans-serif;
  font-size: var(--base);
}
html[data-font="150"] {
  --base: 24px;
}
html[data-font="200"] {
  --base: 32px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0 auto;
  max-width: 1240px;
  background: var(--paper);
  box-shadow: 0 0 32px #5c3c2220;
  line-height: 1.65;
}
a {
  color: var(--blue);
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
button,
select,
textarea {
  font: inherit;
}
button,
a.portal,
select {
  min-height: 44px;
}
button {
  border: 1px solid #938461;
  background: #fff8e9;
  color: var(--ink);
  border-radius: 3px;
  padding: 0.5em 0.75em;
  cursor: pointer;
  line-height: 1.5;
}
button:hover:not(:disabled) {
  background: #eee0bf;
  border-color: var(--blue);
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b66631;
  outline-offset: 3px;
}
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff7e6;
  font-weight: 700;
}
.skip {
  position: absolute;
  left: 0;
  top: -100px;
  background: white;
  padding: 1em;
  z-index: 5;
}
.skip:focus {
  top: 0;
}
header {
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--blue);
  color: var(--paper);
  border-bottom: 5px solid var(--gold);
}
header h1 {
  font-family: serif;
  font-size: 1.8rem;
  letter-spacing: 0.1em;
  margin: 0.18em 0;
}
header p {
  margin: 0;
  color: #dfd2b2;
}
.eyebrow {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
}
.portal {
  color: var(--paper);
  border: 1px solid #e0cd9766;
  padding: 0.6em 0.8em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 28px;
  border-bottom: 1px solid var(--edge);
  font-size: 0.8rem;
}
.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar select {
  background: var(--paper);
  border: 1px solid var(--edge);
  color: var(--ink);
  padding: 4px 8px;
}
.prototype {
  color: var(--rust);
  font-weight: 700;
}
#save-status {
  color: var(--muted);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 14px 28px;
  background: #f0e5c9;
}
nav button {
  flex: 1;
  min-width: 100px;
  background: transparent;
  border-color: transparent;
}
nav button[aria-current="page"] {
  background: var(--paper);
  border-color: var(--edge);
  font-weight: 700;
  box-shadow: 0 3px 0 var(--gold);
}
#notice {
  margin: 0 28px;
  overflow-wrap: anywhere;
}
#notice:not(:empty) {
  margin-top: 12px;
  padding: 10px 14px;
  background: #e5ebdf;
  border-left: 4px solid var(--blue);
}
main {
  padding: 22px 28px 32px;
  min-height: 460px;
}
h2,
h3 {
  font-family: serif;
  line-height: 1.4;
}
h2 {
  font-size: 1.5rem;
  margin: 0 0 0.6em;
}
h3 {
  font-size: 1.1rem;
  margin: 0 0 0.65em;
}
p {
  margin: 0.5em 0 1em;
}
section {
  min-width: 0;
}
.panel {
  padding: 20px;
  background: #fff9ec;
  border: 1px solid var(--edge);
  border-top: 3px solid var(--gold);
  margin-bottom: 18px;
}
.caption {
  font-size: 0.85rem;
  color: var(--muted);
}
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--edge);
  margin-bottom: 20px;
}
.hero img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  object-position: 50% 55%;
  display: block;
  image-rendering: pixelated;
}
.hero-caption {
  background: var(--blue);
  color: var(--paper);
  padding: 12px 18px;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.hero-caption span {
  font-size: 0.8rem;
  color: #ddcfac;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.actions button {
  flex: 1;
  min-width: 150px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  border: 1px solid var(--edge);
  border-top: 3px solid var(--blue);
  padding: 12px 14px;
  background: #eee5cc;
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}
.stat strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.board {
  padding: 14px;
  background: #d6b781;
  border: 1px solid #9d763e;
}
.board-row {
  display: grid;
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 7px;
}
.board-row:last-child {
  margin-bottom: 0;
}
.cell {
  position: relative;
  min-width: 0;
  padding: 10px 5px;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 3px;
  background: #e9cc92;
  border: 2px solid #a67c42;
  min-height: 140px;
  color: #403723;
  overflow-wrap: anywhere;
}
.cell.hard {
  background: #d0ad75;
}
.cell.rock {
  background: #b39e7f;
}
.cell.empty {
  background: #eee6d0;
  border-style: dashed;
  min-height: 140px;
}
.cell[aria-pressed="true"] {
  border: 3px solid var(--blue);
  box-shadow: inset 0 0 0 2px #fff1c9;
}
.cell .coordinate {
  font-size: 0.68rem;
}
.cell .terrain {
  font-size: 0.75rem;
  font-weight: 700;
}
.cell .reach {
  font-size: 0.67rem;
}
.cell .glyph {
  font-size: 2rem;
  line-height: 1.3;
  color: #785b31;
}
.sprite {
  display: block;
  flex-shrink: 0;
  background-image: url("assets/fossils-atlas.png");
  background-size: 300% 200%;
  width: 68px;
  height: 68px;
  image-rendering: pixelated;
  border-radius: 2px;
}
.sprite.field {
  background-image: url("assets/field-atlas.png");
}
.sprite.large {
  width: 130px;
  height: 130px;
}
.tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px;
  font-size: 0.85rem;
}
.tool .sprite {
  width: 42px;
  height: 42px;
}
.tool[aria-pressed="true"] {
  border: 2px solid var(--blue);
  background: #dae3df;
}
.selected {
  background: #f1e2bb;
  border-left: 4px solid var(--blue);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-weight: 700;
}
.forecast {
  padding: 16px;
  border: 1px solid var(--edge);
  background: #fcf6e8;
}
.forecast h3 {
  color: var(--blue);
}
ul {
  padding-left: 1.35em;
  margin: 0.5em 0;
}
li {
  margin: 0.4em 0;
}
.warning {
  color: var(--rust);
  font-weight: 700;
}
.condition {
  list-style: none;
  padding: 0;
}
.condition li {
  display: flex;
  gap: 8px;
}
.condition .mark {
  font-weight: 700;
  color: var(--blue);
}
.result {
  background: #e8eddd;
  border: 2px solid var(--blue);
  padding: 20px;
  margin: 20px 0;
}
.result.failed {
  background: #f2dfcc;
  border-color: var(--rust);
}
.result > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
}
.specimen {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--edge);
  padding: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.specimen div {
  min-width: 0;
  flex: 1;
}
.quality {
  height: 10px;
  background: #d5c49e;
  position: relative;
  margin: 7px 0;
}
.quality span {
  display: block;
  height: 100%;
  background: var(--blue);
}
details {
  border: 1px solid var(--edge);
  padding: 0 14px;
  margin: 12px 0;
  background: #fff8e9;
}
summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  font-weight: 700;
}
details p {
  padding: 8px 0;
  overflow-wrap: anywhere;
}
.steps {
  list-style: none;
  padding: 0;
  counter-reset: work;
}
.steps li {
  counter-increment: work;
  border-bottom: 1px solid var(--edge);
  padding: 12px 0;
  overflow-wrap: anywhere;
}
.steps li:before {
  content: counter(work, decimal-leading-zero) " · ";
  color: var(--rust);
  font-weight: 700;
}
textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--edge);
  background: #fffaf0;
  padding: 10px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.save-label {
  display: block;
  margin-bottom: 10px;
}
.storage-error {
  border: 2px solid var(--rust);
  background: #fae8d3;
  padding: 18px;
  margin-bottom: 20px;
}
footer {
  padding: 24px 28px;
  border-top: 4px double var(--edge);
  font-size: 0.8rem;
  color: var(--muted);
}
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
footer p {
  margin: 0 0 7px;
}
@media (max-width: 1000px) {
  header {
    padding: 20px;
    align-items: flex-start;
    flex-direction: column;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .toolbar,
  nav {
    padding-left: 18px;
    padding-right: 18px;
  }
  main {
    padding: 20px 18px;
  }
  #notice {
    margin-left: 18px;
    margin-right: 18px;
  }
  .hero img {
    height: 190px;
  }
}

.job-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.job-card {
  border: 1px solid var(--edge);
  padding: 16px;
  min-width: 0;
  background: #faf0d9;
}
.job-card button {
  width: 100%;
}
.kit-card {
  margin-bottom: 0;
}
.kit-card button {
  width: 100%;
}
.display-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.display-slot {
  border: 1px solid var(--edge);
  padding: 14px;
  min-width: 0;
  background: #eee5cc;
}
.display-slot label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}
.display-slot select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--edge);
}
.display-slot p {
  overflow-wrap: anywhere;
}
@media (max-width: 650px) {
  .job-list,
  .display-slots {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .board[data-width="4"] .board-row,
  .board[data-width="5"] .board-row {
    grid-template-columns: 1fr;
  }
  .board[data-width="4"] .cell,
  .board[data-width="5"] .cell {
    display: grid;
    grid-template-columns: 64px 1fr;
    text-align: left;
    padding: 10px 12px;
    gap: 4px 12px;
    min-height: 100px;
  }
  .board[data-width="4"] .cell .sprite,
  .board[data-width="5"] .cell .sprite,
  .board[data-width="4"] .cell .glyph,
  .board[data-width="5"] .cell .glyph {
    grid-row: 1/4;
    grid-column: 1;
  }
  .board[data-width="4"] .coordinate,
  .board[data-width="5"] .coordinate,
  .board[data-width="4"] .terrain,
  .board[data-width="5"] .terrain,
  .board[data-width="4"] .reach,
  .board[data-width="5"] .reach {
    grid-column: 2;
  }
}
@media (max-width: 480px) {
  header {
    padding: 18px 14px;
  }
  header h1 {
    font-size: 1.45rem;
    letter-spacing: 0.04em;
  }
  .toolbar,
  nav {
    padding: 10px 12px;
    gap: 8px;
  }
  main {
    padding: 16px 12px;
  }
  #notice {
    margin-left: 12px;
    margin-right: 12px;
  }
  .panel {
    padding: 14px;
  }
  .board {
    padding: 8px;
  }
  .board-row {
    gap: 5px;
  }
  .cell {
    min-height: 118px;
  }
  .cell.empty {
    min-height: 118px;
  }
  .sprite {
    width: 48px;
    height: 48px;
  }
  .tools {
    grid-template-columns: 1fr;
  }
  .hero img {
    height: 160px;
  }
  .stat {
    padding: 8px 10px;
  }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
    min-width: 0;
  }
  footer {
    padding: 18px 14px;
  }
  html[data-font="150"] .board-row,
  html[data-font="200"] .board-row {
    grid-template-columns: 1fr;
  }
  html[data-font="150"] .cell,
  html[data-font="200"] .cell {
    min-height: 100px;
    display: grid;
    grid-template-columns: 64px 1fr;
    text-align: left;
    padding: 10px 12px;
    gap: 4px 12px;
  }
  html[data-font="150"] .cell .sprite,
  html[data-font="200"] .cell .sprite,
  html[data-font="150"] .cell .glyph,
  html[data-font="200"] .cell .glyph {
    grid-row: 1/4;
    grid-column: 1;
  }
  html[data-font="150"] .coordinate,
  html[data-font="200"] .coordinate,
  html[data-font="150"] .terrain,
  html[data-font="200"] .terrain,
  html[data-font="150"] .reach,
  html[data-font="200"] .reach {
    grid-column: 2;
  }
  .sprite.large {
    width: 100px;
    height: 100px;
  }
}

.cell:disabled {
  opacity: 1;
  cursor: default;
}
.tool:disabled {
  opacity: 0.8;
}

.mini-map-wrap {
  display: none;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .mini-map-wrap {
    display: block;
  }
  .mini-map {
    display: grid;
    grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
    gap: 3px;
    border: 1px solid var(--edge);
    padding: 5px;
  }
  .mini-map span {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-height: 32px;
    background: #e9cc92;
    border: 1px solid #a67c42;
    color: #403723;
    font-size: 0.85rem;
  }
  .mini-map span.hard {
    background: #d0ad75;
  }
  .mini-map span.rock {
    background: #b39e7f;
  }
  .mini-map span.empty {
    background: #eee6d0;
    border-style: dashed;
  }
  .mini-map span.mini-selected {
    outline: 3px solid var(--blue);
    outline-offset: -3px;
    text-decoration: underline;
    font-weight: 700;
  }
  html[data-font="150"] nav button,
  html[data-font="200"] nav button {
    font-size: 0.9rem;
    padding: 0.4em;
  }
}
