:root {
  color-scheme: dark;
  --ink: #f7f3dd;
  --soft: #c1d0c0;
  --mint: #b5edb3;
  --gold: #f1c889;
  --rule: #496359;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  font: 100%/1.5 "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: #102523;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 84% 24%, #203c33, transparent 54%); }
.shell { width: min(1080px, 90%); margin-inline: auto; }
.mast { border-bottom: 1px solid #354e46; }
.nav, .meta, .title-row, footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav { min-height: 55px; }
.brand { display: inline-flex; align-items: center; gap: 13px; font-size: 1.12rem; font-weight: 750; letter-spacing: -.035em; }
.gem { width: 16px; height: 16px; transform: rotate(-30deg) skew(5deg); display: inline-block; background: linear-gradient(125deg, #edfbd0 0 31%, #a9e4b1 31% 65%, #5a997d 65%); border-radius: 2px; }
a, summary { color: var(--soft); }
a { text-underline-offset: 4px; }
.nav a { font-size: .92rem; }
.title-row { align-items: baseline; padding: clamp(24px, 3.5vw, 44px) 0 23px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.8rem); letter-spacing: -.052em; line-height: 1.05; }
h1 em { color: var(--mint); font-family: Georgia, serif; font-weight: 400; }
.title-row p, .meta, #steps { font: .88rem/1.35 var(--mono); }
.title-row p { color: var(--soft); white-space: nowrap; }
.title-row p span { padding: 0 6px; color: #85a48c; }
.board { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(18px, 4vw, 60px); align-items: center; }
.card { padding: clamp(26px, 3.4vw, 44px); min-width: 0; background: #1b3630; border: 1px solid #3d584c; border-radius: 14px; }
.meta { color: var(--gold); }
#category, #tally { color: var(--soft); }
h2 { font-size: clamp(1.6rem, 2.65vw, 2.18rem); line-height: 1.21; letter-spacing: -.028em; margin: 22px 0 27px; overflow-wrap: anywhere; }
h3 { font-size: 1.28rem; letter-spacing: -.02em; }
label { display: block; font-size: .95rem; font-weight: 600; margin-bottom: 8px; }
input { width: 100%; display: block; border-radius: 7px; border: 1px solid #739180; background: #0c2421; color: var(--ink); padding: 13px 14px; font: inherit; }
input::placeholder { color: #a5b7aa; }
.actions { display: flex; gap: 14px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
button { font: inherit; font-weight: 650; cursor: pointer; }
.primary, .quiet { min-height: 44px; border-radius: 7px; }
.primary { color: #153327; background: var(--mint); padding: 10px 26px; border: 1px solid transparent; }
.primary:hover { background: #d7f8c5; }
.quiet { color: var(--soft); padding: 6px 8px; background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
h2:focus, h3:focus { outline: none; }
.quarry { display: flex; flex-direction: column; justify-content: center; padding: 12px 0; min-width: 0; }
.visual { width: 100%; margin: auto 0; position: relative; background: radial-gradient(ellipse at center, #365443 0%, transparent 69%); }
canvas { width: 100%; max-height: 320px; object-fit: contain; display: block; image-rendering: pixelated; }
.round { margin: 14px auto 0; width: min(100%, 340px); }
#steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; list-style: none; margin: 12px 0 0; padding: 0; }
#steps li { border-top: 3px solid #4a6455; color: var(--soft); padding-top: 6px; }
#steps .current { border-color: var(--gold); color: var(--gold); }
#steps .solved { border-color: var(--mint); color: var(--mint); }
#steps .missed { border-color: #a79d8e; }
#explain, #copy-status { color: var(--soft); margin: 6px 0 16px; overflow-wrap: anywhere; }
#copy-status:empty { display: none; }
#verdict { color: var(--gold); }
#verdict.match { color: var(--mint); }
#retry:not(:empty) { color: var(--gold); margin: 0 0 10px; overflow-wrap: anywhere; }
#alternative { margin-bottom: 18px; border-left: 2px solid var(--mint); padding-left: 12px; color: var(--soft); }
#alternative strong { display: block; color: var(--ink); }
#examples { margin-top: 20px; }
summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
dl, #recap { padding: 0; margin: 10px 0 22px; }
dt { font-weight: 650; }
dd { margin: 2px 0 12px; color: var(--soft); }
#recap { list-style: none; }
#recap li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
#recap small { display: block; color: var(--soft); overflow-wrap: anywhere; }
.extras { margin: 24px 0 40px; max-width: 70ch; }
.extras details { color: var(--soft); }
.extras summary { padding: 15px 0; }
details p { color: var(--soft); max-width: 72ch; margin: 0 0 16px; }
footer { border-top: 1px solid #385348; align-items: baseline; padding: 18px 0 32px; font-size: .92rem; color: var(--soft); }
footer details { max-width: 62ch; text-align: right; }
@media (max-width: 690px) {
  .shell { width: min(92%, 550px); }
  .nav { min-height: 52px; }
  .title-row { display: block; padding: 24px 0 16px; }
  .title-row p { margin-top: 8px; }
  .board { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  h2 { margin: 18px 0 22px; }
  .quarry { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 14px; align-items: center; padding: 11px 17px; border-left: 0; border-top: 1px solid var(--rule); }
  .round { margin-top: 0; }
  .extras { margin: 16px 0 26px; }
}

.result-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secondary { min-height: 44px; border-radius: 7px; padding: 10px 18px; background: transparent; color: var(--mint); border: 1px solid #779380; }
.secondary:hover { background: #27453a; }
#share-preview { margin-top: 18px; }
#save-card { display: inline-flex; align-items: center; }
#scene { height: auto; }
#share-status:not(:empty) { margin-top: 12px; color: var(--mint); }
#share-fallback { width: 100%; min-height: 112px; font: inherit; color: var(--ink); background: var(--pine, #102523); }
#result-card { max-height: none; border-radius: 10px; image-rendering: auto; }
.complete .visual, .complete .round { display: none; }
#alternative { margin: 16px 0 22px; }
@media (max-width: 690px) {
  .board { gap: 0; }
  .card { padding: 23px 20px 24px; }
  .title-row { padding: 21px 0 17px; }
  .quarry { grid-template-columns: minmax(105px, 37%) minmax(0, 1fr); border: 0; gap: 16px; padding: 8px 4px 0; }
  .complete .quarry { display: block; padding: 16px 0 0; }
  .round { width: 100%; margin: 0; }
  .round .meta { display: block; }
  .round .meta > span:first-child { display: none; }
  .extras { margin: 12px 0 24px; }
}
