: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; }
.meta, .title-row, footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
a, summary { color: var(--soft); }
a { text-underline-offset: 4px; }
.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-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 5px; 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); }
  .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; }
}

main.shell { display: flow-root; }
.scene-controls { display:flex; justify-content:center; align-items:center; gap:8px; }

.scene-controls button {
  display:inline-flex; align-items:center; justify-content:center; gap:9px; min-height:44px;
  padding:4px 12px; border:0; background:transparent; color:#cbd9cb; font-size:.875rem;
}
.scene-controls button:hover { color:#ffe1a0; }
.scene-controls button[aria-pressed="true"] { color:#efcf92; }
.scene-controls button:focus-visible { outline-offset:-4px; }
.music-bars { display:inline-flex; gap:2px; align-items:center; height:15px; }
.music-bars i { display:block; width:3px; height:6px; border-radius:2px; background:currentColor; }
.music-bars i:nth-child(2) { height:13px; }
.music-bars i:nth-child(3) { height:9px; }
#mine-music[aria-pressed="true"] i { animation:mine-beat 1.24s ease-in-out infinite alternate; }
#mine-music i:nth-child(2) { animation-delay:-.6s; }
#mine-music i:nth-child(3) { animation-delay:-.2s; }
@keyframes mine-beat { to { transform:scaleY(.4); } }
.motion-symbol { width:12px;height:12px;border:2px solid currentColor;border-radius:50%; }
#mine-motion[aria-pressed="true"] .motion-symbol { background:currentColor;box-shadow:inset 0 0 0 2px #11282b; }
.board:not(.welcome) #mine-motion { display:none; }
.board:not(.welcome) .scene-controls { order:3; grid-column:1/-1; }
@media (prefers-reduced-motion:reduce) { .music-bars i { animation:none !important; } }

.welcome #mine-effects { display:none; }
#reward-slot:empty { display:none; }
@media (max-width:690px) {
  #reward-slot .visual {
    margin:10px 0 12px; background:radial-gradient(ellipse at center,#2e5144,#142e2c);
    border:1px solid #466455; border-radius:9px; overflow:hidden;
  }
  #reward-slot #scene { height:clamp(114px,32vw,160px); }
  .quarry:not(:has(> .visual)) { grid-template-columns:1fr; }
}

/* Shared guide and entrance palette. */
body {
  background: #0b1a21;
  --soft: #b6c8c9;
}
main.shell:has(.welcome) { width: 100%; }
.board.welcome {
  --gutter: max(6vw, calc((100% - 1232px) / 2));
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.14fr);
  grid-template-rows: minmax(clamp(440px, 40vw, 595px), auto) auto;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  align-items: stretch;
  gap: 0;
  padding-inline: var(--gutter);
  background: radial-gradient(ellipse at 56% 56%, #19424a, transparent 63%), #0a1a22;
}
.welcome .card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  grid-area: 1 / 1;
  min-width: 0;
  padding: 46px 0;
  background: none;
  border: 0;
}
.welcome .quarry { display: contents; }
.welcome .visual {
  position: absolute;
  inset: 0 0 60px auto;
  width: min(62%, 1000px);
  margin: 0;
  z-index: -1;
  background: none;
  mask-image: linear-gradient(90deg, transparent, #000 24%);
}
.welcome #scene {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: 50% 49%;
  image-rendering: auto;
}
.game-kind {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: clamp(19px, 2vw, 30px);
  color: #8cddc9;
  font: 650 .82rem/1.25 var(--mono);
  letter-spacing: .15em;
  text-transform: uppercase;
}
.ore-mark {
  display: inline-block;
  width: 16px;
  height: 23px;
  flex: none;
  background: conic-gradient(from 148deg at 47% 50%, #50bca9 0deg 156deg, #c8fff0 156deg 235deg, #81e4cc 235deg);
  clip-path: polygon(63% 0, 100% 32%, 75% 83%, 28% 100%, 0 65%, 17% 21%);
}
#intro h1 {
  font: 800 clamp(3.9rem, 6.55vw, 6.45rem)/.94 system-ui, sans-serif;
  letter-spacing: -.052em;
  color: #f8f4e7;
}
#intro h1 em {
  display: block;
  color: #85dec8;
  font: inherit;
}
#intro-copy {
  max-width: 36ch;
  margin: 24px 0;
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.55;
  color: #c4d4d4;
}
.intro-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.board .primary {
  min-height: 50px;
  padding: 10px 26px;
  border: 1px solid #ffe5a0;
  border-radius: 5px;
  box-shadow: 0 3px #986b34;
  background: #ffd07e;
  color: #241d15;
}
#start::before {
  content: "";
  display: inline-block;
  width: .6em;
  height: .75em;
  margin-right: .65em;
  background: currentColor;
  clip-path: polygon(0 0,100% 50%,0 100%);
}
.board .primary:hover { background: #ffe2a5; }
.board .primary:active { transform: translateY(2px); box-shadow: 0 1px #986b34; }
#intro-rules {
  min-height: 44px;
  padding: 5px 3px;
  border: 0;
  background: none;
  color: #d5e3e0;
  text-decoration: underline;
  text-decoration-color: #65827c;
  text-underline-offset: 5px;
}
#intro-rules:hover { color: #ffdb98; }
#intro noscript { display: block; margin-top: 10px; }
.round-facts { display: none; }
.welcome .round-facts, .welcome .scene-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 60px;
  border-top: 1px solid #30454a;
}
.welcome .round-facts {
  grid-area: 2 / 1;
  gap: 14px;
  color: #c1d0ce;
  font: .85rem/1.45 var(--mono);
}
.round-facts i { width: 3px; height: 3px; background: #70bca8; transform: rotate(45deg); }
.welcome .scene-controls { grid-area: 2 / 2; justify-content: flex-end; gap: 10px; }
.welcome .scene-controls button { font-weight: 550; }
.guide-heading { display: none; }
main .extras {
  width: min(88%, 1232px);
  max-width: none;
  margin: clamp(32px,4vw,64px) auto 56px;
  display: grid;
  grid-template-columns: minmax(0,.52fr) minmax(0,1fr);
  gap: 24px;
}
main .guide-heading {
  display: block;
  margin: 2px 0 0;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  letter-spacing: -.055em;
  line-height: 1.12;
}
main .guide-entries details { border-bottom: 1px solid #2d4145; }
main .guide-entries details:first-child { border-top: 1px solid #2d4145; }
main .guide-entries summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 15px 1px;
  list-style: none;
  color: #d8e4df;
}
main .guide-entries summary::-webkit-details-marker { display: none; }
main .guide-entries summary::after { content: "+"; color: #97cabc; font: 1.25rem/1 var(--mono); }
main .guide-entries details[open] summary::after { content: "−"; }
#rules { scroll-margin-top: 18px; }
body > .shell:not(main) { width: min(88%,1232px); }
@media (max-width: 760px) {
  .board.welcome {
    --gutter: max(5.5vw, 18px);
    grid-template: auto auto auto / 1fr auto;
  }
  .welcome .visual {
    position: relative;
    inset: auto;
    grid-area: 1 / 1 / 2 / -1;
    width: calc(100% + 2 * var(--gutter));
    margin-inline: calc(-1 * var(--gutter));
    height: clamp(175px, 52vw, 290px);
    mask-image: linear-gradient(#000 76%, transparent);
  }
  .welcome #scene { object-position: 50% 48%; }
  .welcome .card { grid-area: 2 / 1 / 3 / -1; padding: 2px 0 25px; }
  .game-kind { margin-bottom: 11px; font-size: .75rem; }
  .ore-mark { width: 12px; height: 17px; }
  #intro h1 { font-size: clamp(2.2rem, 8.4vw, 3.7rem); line-height: 1.02; letter-spacing: -.048em; }
  #intro h1 em { display: inline; }
  #intro-copy { margin: 12px 0 16px; }
  .welcome .round-facts { grid-area: 3 / 1 / 4 / -1; gap: 10px; min-height: 43px; }
  .welcome .scene-controls { grid-area: 4 / 1 / 5 / -1; justify-content: flex-start; min-height: 44px; }
  .welcome .scene-controls button:first-of-type { padding-left: 0; }
  main .extras { display: block; width: calc(100% - 2 * max(5.5vw, 18px)); margin-block: 26px 34px; }
  main .guide-heading { margin-bottom: 14px; }
}

#intro-rules { display: inline-flex; align-items: center; font-weight: 650; }
.support-links, .support-header { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.support-links a { display: inline-flex; align-items: center; min-height: 44px; }
.support-links a[aria-current="page"] { color: var(--gold); text-decoration-thickness: 2px; }
.support-header { justify-content: space-between; padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.support-brand { font-size: 1.25rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.support-brand em { color: var(--mint); font-family: Georgia, serif; }
.support-article { max-width: 44rem; padding-block: clamp(2.5rem, 7vw, 5rem); }
.support-article h1 { text-wrap: balance; }
.support-lede { color: var(--soft); font-size: 1.2rem; margin: 1rem 0 2.5rem; }
.support-article section { padding-block: 1.5rem; border-top: 1px solid var(--rule); }
.support-article h2 { font-size: 1.5rem; margin: 0 0 .6rem; }
.support-article section p { line-height: 1.65; }
.worked-clue { margin-top: 1.25rem; background: #1b3630; border-left: 3px solid var(--gold); padding: 1rem 1.25rem; }
.worked-clue h3 { font-size: 1.08rem; margin-bottom: .4rem; }
.back-to-game { display: inline-flex; align-items: center; font-weight: 650; text-decoration: none; margin-top: .5rem; }

/* Round view: the clue and the mine share the same stage as the entrance. */
body {
  --mint: #85dec8;
  --gold: #ffd07e;
  --rule: #344b50;
}
.title-row h1 {
  font: 800 clamp(1.35rem, 2.5vw, 2rem)/1.15 system-ui, sans-serif;
  letter-spacing: -.05em;
}
.title-row h1 em { color: var(--mint); font: inherit; }
.title-row .ore-mark { vertical-align: -.055em; margin-right: .37em; }
main:not(:has(.welcome)) .extras { width: 100%; }
.board:not(.welcome) input {
  border-color: #678181;
  background: #11272e;
  color: #f8f4e7;
}
.board:not(.welcome) .secondary { border-color: #587877; }
.board:not(.welcome) .secondary:hover { background: #17353a; }
#play > .meta, #finish > .meta {
  justify-content: flex-start;
  gap: 12px;
  font-weight: 600;
  color: var(--mint);
}
#category { border-left: 1px solid var(--rule); padding-left: 12px; }
#result-note:not(:empty) { margin-bottom: 16px; }
#finish details, #examples { border-top: 1px solid var(--rule); }
#end-early { margin-top: 12px; font-size: .9rem; }
@media (min-width: 691px) {
  main.shell:not(:has(.welcome)) { width: min(88%, 1232px); }
  .title-row {
    min-height: 76px;
    padding: 20px 0;
    align-items: center;
    border-bottom: 1px solid var(--rule);
  }
  body:has(.board:not(.welcome)) {
    background: radial-gradient(ellipse 58% 470px at 84% 248px, #183943, transparent), #0b1a21;
  }
  .board:not(.welcome) {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
    gap: clamp(24px, 5vw, 76px);
    padding: clamp(28px, 3.4vw, 48px) 0 32px;
    align-items: start;
    border-bottom: 1px solid var(--rule);
  }
  .board:not(.welcome) .card {
    border: none;
    background: none;
    padding: clamp(12px, 2.25vw, 32px) 0 0;
  }
  #clue, #summary {
    color: #f8f4e7;
    font-size: clamp(1.85rem, 3.4vw, 3.12rem);
    line-height: 1.1;
    letter-spacing: -.048em;
    margin: 18px 0 30px;
    text-wrap: balance;
  }
  #answer { padding: 15px 17px; }
  #form .actions { margin-top: 16px; gap: 18px; }
  .board:not(.welcome) .quarry { padding: 0; gap: 0; }
  .board:not(.welcome) .visual {
    border-radius: 6px;
    overflow: hidden;
    background: #10242c;
  }
  .board:not(.welcome) #scene { max-height: none; image-rendering: auto; }
  .board:not(.welcome) .round { width: 100%; margin: 18px 0 0; }
  .round .meta { color: #f0f6ef; }
  #tally { color: var(--mint); }
  #steps { margin: 10px 0 8px; gap: 7px; }
  #steps li { border-color: #3d5558; }
  #steps .current { border-color: var(--gold); }
  #steps .solved { border-color: var(--mint); }
  #steps .missed { border-color: #a79d8e; }
  .board:not(.welcome) .scene-controls { justify-content: flex-end; }
  .board:not(.welcome) .scene-controls button:last-of-type:not([hidden]) { padding-right: 0; }
  .board.complete .scene-controls { margin-top: 8px; }
  #verdict { font-size: 1.38rem; }
  #alternative { padding: 9px 14px; background: #142a2e; }
  #end-early { padding-left: 0; }
  #result-card { border: 1px solid #385356; border-radius: 6px; }
  #review summary, #share-preview summary, #examples summary { padding-block: 12px; }
}
@media (max-width: 690px) {
  .board:not(.welcome) .card, #reward-slot .visual {
    background: #12282e;
    border-color: #385256;
  }
}
.intro-note {
  max-width: 44ch;
  margin: 18px 0 0;
  font-size: .9rem;
  line-height: 1.5;
  color: #9fb5b2;
}
.intro-note a { color: #d5e3e0; text-underline-offset: 3px; }
.intro-note a:hover { color: #ffdb98; }

.practice-page .support-lede { margin-bottom: 1.5rem; }
.practice-page h1 em { white-space: normal; }
.practice-page section p + p { margin-top: .8rem; }
#practice-board {
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #1b3630;
  padding: clamp(1.25rem, 4vw, 2rem);
  margin-bottom: 2rem;
}
.practice-filter { margin-bottom: 1rem; }
.practice-filter label { display: block; margin-bottom: .3rem; }
.practice-filter select { font: inherit; color: var(--ink); background: #102523; border: 1px solid var(--rule); border-radius: 6px; min-height: 44px; padding-inline: .65rem; max-width: 100%; }
.question-count { font-size: .75em; font-weight: 400; color: var(--soft); }
#practice-board h2 { margin: 1.25rem 0; }
#practice-board .meta { flex-wrap: wrap; }
#practice-board .primary { background: #f1c889; color: #182c25; }
#practice-board .primary:hover { background: #ffdc9d; }
#feedback:not(:empty) { margin: 1rem 0; }
#feedback strong, .bank-group dt { color: var(--mint); }
.bank-topics {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding-bottom: 1.75rem;
}
.bank-topics a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.bank-group details { border-bottom: 1px solid var(--rule); }
.bank-group summary {
  padding: .85rem .25rem;
  color: var(--ink);
  font-weight: 550;
  cursor: pointer;
}
.bank-group dl { margin: .25rem 0 1rem; }
.bank-group dt { font-weight: 650; }
.bank-group dd { margin: .15rem 0 .85rem; }
.clue-source, .return-to-topics { display: inline-block; padding-block: .6rem; }
.return-to-topics { margin-top: .6rem; }
@media (max-width: 650px) {
  .practice-page { padding-top: 1.6rem; }
  .practice-page h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
  body:has(.practice-page) .support-header { gap: .25rem; }
}


/* In-round title: same look as the former second H1 (one H1 per page). */
.title-row .game-title { margin: 0; font: 800 clamp(1.35rem, 2.5vw, 2rem)/1.15 system-ui, sans-serif; letter-spacing: -.05em; }
.title-row .game-title em { color: var(--mint); font: inherit; }
