:root {
  --ink: #0d3151;
  --muted: #456477;
  --cream: #fcf8ed;
  --line: #0d315126;
  --green: #0d3151;
  --accent: #f16c4d;
}

body { background: #9addf0; color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #f16c4d; outline-offset: 4px; }
.vignette { background: linear-gradient(180deg, #fcf8ed55, transparent 34%, transparent 61%, #0d315122); }
.masthead { top: 22px; left: 32px; max-width: min(480px, 49vw); }
.game-brand { display: inline-block; padding: 2px; margin-bottom: 14px; border-radius: 8px; }
.game-brand img { display: block; width: 174px; height: auto; filter: drop-shadow(0 2px 9px #fcf8edaa); }
.masthead .eyebrow { font-size: 9px; font-weight: 800; letter-spacing: .16em; margin-bottom: 7px; }
.masthead h1 { font-family: Arial, Helvetica, sans-serif; font-size: clamp(28px, 3.2vw, 42px); font-weight: 800; letter-spacing: -.04em; line-height: 1.06; text-shadow: 0 2px 12px #fcf8edb3; }
.tagline { margin-top: 8px; font-size: 11px; letter-spacing: .015em; line-height: 1.45; max-width: 330px; }
.top-actions { top: 26px; right: 30px; }
.segmented, .icon-button { background: #fcf8ede8; border: 1px solid #ffffffd9; }
.segmented button.active { background: #0d3151; color: #fcf8ed; }
.segmented button, .icon-button { font-weight: 700; }
.score { color: #0d3151; }
.score-number { font-weight: 700; }
.specimen { top: 206px; width: 188px; padding: 10px 12px; }
.specimen canvas { width: 160px; height: 78px; }
.specimen-name { font-size: 16px; }
.specimen-note { margin: 4px 0; font-size: 9px; line-height: 1.5; }
.status { left: 50% !important; transform: translateX(-50%) !important; }
.status, .panel, .specimen, .result-card, .water-dock, .help-card, .audio-pop, .toast { background: #fcf8edee; border-color: #ffffffeb; color: #0d3151; }
.panel { border-radius: 20px; box-shadow: 0 16px 65px #0d31512b; }
.section-head { color: #456477; font-weight: 700; }
.shelf-tabs { background: #d8f1f5; }
.shelf-tab { color: #365e74; }
.shelf-tab.active { background: #fffdf7; color: #0d3151; }
.shelf-tab.active[data-shelf=lab] { color: #0d3151; }
.stone-choice:hover:not(:disabled), .stone-choice.selected { border-color: #0183aa; }
.stone-choice.selected::after { background: #f16c4d; }
.range-label, .range-value, .object-name, .specimen-name { color: #0d3151; }
input[type=range] { background: linear-gradient(to right, #0183aa 0%, #0183aa var(--fill), #b9dce5 var(--fill), #b9dce5 100%); }
input[type=range]::-webkit-slider-thumb { border-color: #0d3151; background: #fcf8ed; }
input[type=range]::-moz-range-thumb { border-color: #0d3151; background: #fcf8ed; }
.launch-button, body[data-lab=true] .launch-button { background: #0d3151; border-color: #0d3151; color: #fcf8ed; font-weight: 700; border-radius: 999px; }
.launch-button:hover:not(:disabled), body[data-lab=true] .launch-button:hover { background: #155476; }
.launch-button:disabled, body[data-lab=true] .launch-button:disabled { background: #617d8d; border-color: #617d8d; }
.status-dot, body[data-lab=true] .status-dot { background: #f16c4d; }
.specimen-name, .result-title, .loader-title, .help-card h2 { font-family: Arial, Helvetica, sans-serif; font-weight: 800; letter-spacing: -.025em; }
.specimen-rule, body[data-lab=true] .specimen-rule { background: #d8f1f5; color: #0d3151; }
.result-card { border-left: 4px solid #f16c4d; }
.result-eyebrow { color: #0d3151; font-weight: 800; }
.help-card { border-radius: 20px; }
.loader, .error { background: #fcf8ed; color: #0d3151; }
.loading-rings { border-color: #0183aa70; }
.loading-rings::before { border-color: #0183aa; }
.footer-signature { color: #0d315199; font-weight: 700; }

.masthead { pointer-events: auto; }
.game-brand:hover img { filter: drop-shadow(0 5px 12px #0183aa66); }
.world-wrap { position: relative; }
.world-trigger { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; max-width: 165px; padding: 0 12px; border: 1px solid #ffffffd9; border-radius: 999px; background: #fcf8ede8; color: #0d3151; font-size: 11px; font-weight: 800; white-space: nowrap; backdrop-filter: blur(12px); }
.world-trigger:hover, .world-trigger[aria-expanded=true] { background: #e9f8f9; border-color: #0183aa; }
.world-trigger svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.world-trigger span { overflow: hidden; text-overflow: ellipsis; }
.world-picker { position: absolute; z-index: 10; top: calc(100% + 10px); right: 0; width: min(410px, calc(100vw - 28px)); max-height: calc(100vh - 100px); overflow-y: auto; padding: 15px; background: #fcf8edf5; border: 1px solid #ffffffeb; border-radius: 18px; box-shadow: 0 14px 40px #0d31512a; backdrop-filter: blur(16px); }
.world-picker-heading { margin-bottom: 10px; color: #456477; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
#start-sound { display: block; width: 100%; margin-bottom: 12px; border: 1px solid #0183aa; background: #e3f5f7; color: #0d3151; border-radius: 999px; padding: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; }
#start-sound:hover { background: #c6ecf2; }
.world-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.world-choice { min-height: 44px; border: 1px solid #bdd6dc; border-radius: 9px; background: #fffdf7; color: #0d3151; font-size: 11px; font-weight: 700; line-height: 1.2; padding: 7px 6px; }
.world-choice:hover { border-color: #0183aa; background: #e9f8f9; }
.world-choice.active { background: #0d3151; border-color: #0d3151; color: #fcf8ed; }
.world-description { min-height: 2.6em; margin: 9px 0 0; font-size: 11px; line-height: 1.5; color: #456477; }
.language-button { min-width: 42px; height: 39px; padding: 0 9px; border: 1px solid #ffffffd9; border-radius: 999px; background: #fcf8ede8; color: #0d3151; font-size: 11px; font-weight: 800; }
.language-button:hover { background: #e9f8f9; }
.audio-pop { width: 190px; z-index: 12; }
.audio-pop label { font-size: 11px; align-items: center; gap: 9px; }
.audio-option { justify-content: flex-start !important; cursor: pointer; }
.audio-option input { accent-color: #0183aa; width: 16px; height: 16px; }
.score { top: 136px; }
.score .stat-label, .score .mini { font-size: 11px; }
.result-card { top: 190px; }
.metric-detail { color: #0d3151; font-size: 12px; font-weight: 700; margin-top: 9px; }
body[data-environment=cosmic] .vignette, body[data-environment=magnetic] .vignette, body[data-environment=lava] .vignette { background: linear-gradient(180deg, #040c2477, transparent 35%, transparent 70%, #02081677); }
body[data-environment=cosmic] .masthead, body[data-environment=magnetic] .masthead, body[data-environment=lava] .masthead { color: #fcf8ed; }
body[data-environment=cosmic] .game-brand img, body[data-environment=magnetic] .game-brand img, body[data-environment=lava] .game-brand img { background: #fcf8ede0; border-radius: 7px; padding: 2px; }
body[data-environment=cosmic] .score, body[data-environment=magnetic] .score, body[data-environment=lava] .score { color: #fcf8ed; }
@media (prefers-reduced-motion: reduce) { .world-choice, .game-brand img, button { transition: none !important; } .stone-choice:hover:not(:disabled) { transform: none; } .status-dot, .loading-rings, .result-card { animation: none !important; } }

@media (max-width: 1050px) { .world-trigger { width: 39px; padding: 0; } .world-trigger span { display: none; } }
@media (max-width: 1100px) and (min-width: 651px) { .specimen { display: none !important; } }

@media(max-width: 650px) {
  .masthead { top: max(16px, env(safe-area-inset-top)); left: 16px; max-width: calc(100% - 130px); }
  .game-brand { margin-bottom: 5px; }
  .game-brand img { width: 118px; }
  .masthead .eyebrow { font-size: 7px; margin-bottom: 3px; }
  .masthead h1 { font-size: 27px; }
  .masthead .tagline { display: none; }
  .top-actions { top: max(94px, calc(env(safe-area-inset-top) + 78px)); right: 14px; }
  .segmented button { padding: 8px 9px; font-size: 9px; }
  .icon-button { width: 34px; height: 34px; }
  .score { top: 144px; color: #0d3151; }
  .result-card { top: 144px; }
  .specimen { display: none !important; }
  .panel { border-radius: 16px; }
  .status { max-width: calc(100% - 24px); white-space: normal; text-align: center; justify-content: center; }
  .world-trigger { width: 34px; min-height: 34px; padding: 0; }
  .world-trigger span { display: none; }
  .world-picker { position: fixed; top: max(139px, calc(env(safe-area-inset-top) + 123px)); right: 13px; width: calc(100vw - 26px); max-height: calc(100vh - 150px); padding: 11px; border-radius: 13px; }
  .world-picker-heading { font-size: 11px; margin-bottom: 7px; }
  .world-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .world-choice { min-height: 42px; font-size: 10px; padding: 5px 3px; }
  .world-description { font-size: 11px; min-height: 2.5em; margin-top: 7px; }
  #start-sound { font-size: 10px; padding: 7px; }
  .language-button { height: 34px; min-width: 35px; padding: 0 5px; font-size: 10px; }
  .score { top: 146px; right: 19px; }
  .result-card { top: 226px; }
  .audio-pop { right: -50px; }
}

@media(max-width: 650px) and (max-height: 740px) { .score { display: none; } .result-card { top: 159px; } .world-description { min-height: 0; } }

@media(max-width: 390px) {
  .masthead h1 { font-size: 22px; }
  .game-brand img { width: 105px; }
  .masthead .eyebrow { display: none; }
}
