:root {
  color-scheme: dark;
  --deep: #061820;
  --panel: #0b2730;
  --panel-2: #103640;
  --foam: #dffff5;
  --muted: #8eb7b5;
  --aqua: #5ff0d2;
  --gold: #ffc85c;
  --rust: #d86c38;
  --coral: #ff7a70;
  --radius: 22px;
  font-family: Inter, ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--foam);
  background:
    radial-gradient(circle at 50% -10%, #174d58 0, transparent 38%),
    linear-gradient(180deg, #061820, #041016 70%);
}
button, a { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 540px); min-height: 100dvh; margin: auto; padding: max(10px, env(safe-area-inset-top)) 12px max(28px, env(safe-area-inset-bottom)); }
.game-header { min-height: 52px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; }
.header-status { display: flex; align-items: center; gap: 6px; }
.sync-status { color: var(--muted); font-size: 7px; font-weight: 850; white-space: nowrap; }
.sync-status[data-status="synced"] { color: var(--aqua); }
.sync-status[data-status="error"] { color: var(--rust); }
.back-link { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(95,240,210,.18); border-radius: 12px; color: var(--foam); background: rgba(255,255,255,.035); font-size: 28px; text-decoration: none; }
.brand-lockup { display: grid; gap: 1px; }
.brand-lockup span, .section-title span, .profile-card span { color: var(--aqua); font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.brand-lockup strong { font-size: 14px; }
.wallet { min-width: 66px; padding: 8px 10px; display: flex; justify-content: center; gap: 6px; border: 1px solid rgba(255,200,92,.2); border-radius: 999px; color: var(--gold); background: rgba(255,200,92,.055); font-size: 13px; }
.view-tabs { margin: 7px 0 9px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border: 1px solid rgba(95,240,210,.12); border-radius: 14px; background: rgba(4,16,22,.62); }
.view-tab { min-height: 36px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 900; }
.view-tab.is-active { color: #052129; background: var(--aqua); box-shadow: 0 0 20px rgba(95,240,210,.2); }
.game-view, .dashboard-view { min-width: 0; display: grid; gap: 10px; }
.game-view > *, .dashboard-view > * { min-width: 0; }
.mission-bar { padding: 2px 3px 0; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.mission-bar p { margin: 0 0 2px; color: var(--gold); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.mission-bar h1 { margin: 0; font-size: clamp(20px, 5vw, 25px); letter-spacing: -.045em; }
.mission-progress { min-width: 88px; display: grid; text-align: right; }
.mission-progress strong { color: var(--aqua); font-size: 21px; }
.mission-progress span { color: var(--muted); font-size: 8px; }
.stage-track { width: 100%; min-width: 0; min-height: 42px; display: grid; grid-template-columns: auto minmax(4px,1fr) auto minmax(4px,1fr) auto minmax(4px,1fr) auto minmax(4px,1fr) auto; align-items: center; }
.stage-step { display: grid; justify-items: center; gap: 3px; color: #587e7c; font-size: 7px; font-weight: 850; }
.stage-step i { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; font-style: normal; }
.stage-step.is-active { color: var(--foam); }
.stage-step.is-active i { color: #062028; border-color: var(--aqua); background: var(--aqua); box-shadow: 0 0 18px rgba(95,240,210,.3); }
.stage-step.is-complete i { color: #281900; border-color: var(--gold); background: var(--gold); }
.stage-line { min-width: 0; height: 2px; margin: 0 4px 13px; overflow: hidden; background: rgba(255,255,255,.07); }
.stage-line i { display: block; width: 0; height: 100%; background: var(--gold); transition: width 240ms ease; }
.playfield { position: relative; height: clamp(350px, 51dvh, 455px); overflow: hidden; border: 1px solid rgba(95,240,210,.16); border-radius: 26px; background: radial-gradient(circle at 50% 42%, rgba(31,111,116,.35), transparent 48%), linear-gradient(180deg, #0b3039, #071c25); box-shadow: inset 0 0 55px rgba(0,0,0,.28); touch-action: none; }
.playfield::before, .playfield::after { content: ""; position: absolute; border: 1px solid rgba(95,240,210,.07); border-radius: 50%; pointer-events: none; }
.playfield::before { width: 260px; height: 260px; left: -100px; bottom: -140px; }
.playfield::after { width: 190px; height: 190px; right: -110px; top: -95px; }
#relicCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.canvas-hud { position: absolute; z-index: 2; top: 10px; left: 11px; right: 11px; display: flex; justify-content: space-between; pointer-events: none; }
.canvas-hud span { padding: 5px 8px; border-radius: 999px; color: var(--muted); background: rgba(4,16,22,.68); font-size: 8px; font-weight: 900; letter-spacing: .07em; }
#techniqueValue.is-good { color: var(--aqua); }
.stroke-hint { position: absolute; z-index: 2; left: 50%; bottom: 9px; padding: 6px 10px; border-radius: 999px; color: #b9d3d1; background: rgba(4,16,22,.78); font-size: 8px; font-weight: 850; transform: translateX(-50%); pointer-events: none; white-space: nowrap; transition: opacity .25s; }
.stroke-hint.is-hidden { opacity: 0; }
.restoration-celebration { padding: 14px; text-align: center; border: 1px solid rgba(255,205,92,.4); border-radius: 20px; background: linear-gradient(135deg, #173d40, #102b32); }
.restoration-celebration h2 { margin: 4px 0 7px; color: var(--gold); font-size: clamp(19px, 5vw, 25px); }
.restoration-celebration p { margin: 4px 0 8px; color: var(--foam); font-size: 12px; }
.restoration-celebration #celebrationRelic { color: var(--aqua); font-weight: 850; }
.restoration-celebration:not([hidden]) ~ .tool-dock { display: none; }
.playfield.is-celebrating { border-color: rgba(255,205,92,.6); }
.playfield.celebration-motion { animation: restoration-glow 1.4s ease-out; }
@keyframes restoration-glow { 35% { box-shadow: inset 0 0 65px rgba(255,205,92,.3), 0 0 24px rgba(255,205,92,.3); } }
@media (prefers-reduced-motion: reduce) { .playfield.celebration-motion { animation: none; } }
.tool-dock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.tool-card { min-width: 0; min-height: 65px; padding: 7px 4px; display: grid; justify-items: center; gap: 1px; border: 1px solid rgba(255,255,255,.07); border-radius: 15px; color: var(--muted); background: rgba(11,39,48,.72); }
.tool-card:disabled { opacity: .35; cursor: default; }
.tool-card.is-active { color: var(--foam); border-color: rgba(95,240,210,.45); background: rgba(95,240,210,.08); box-shadow: inset 0 0 20px rgba(95,240,210,.06); }
.tool-icon { font-size: 17px; font-weight: 950; }
.tool-card strong { font-size: 9px; }
.tool-card small { overflow: hidden; max-width: 100%; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.object-picker-wrap, .dashboard-section, .profile-card, .next-card { padding: 16px; border: 1px solid rgba(95,240,210,.1); border-radius: var(--radius); background: rgba(11,39,48,.62); }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.035em; }
.section-title b, .section-title small { color: var(--muted); font-size: 8px; }
.object-picker { margin-top: 12px; display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.object-card { min-width: 105px; padding: 10px 7px; display: grid; justify-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; color: var(--foam); background: rgba(255,255,255,.025); }
.object-card.is-selected { border-color: var(--gold); background: rgba(255,200,92,.07); }
.object-card.is-locked { color: #557573; }
.object-card span { font-size: 22px; }
.object-art { width: 52px; height: 52px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: rgba(255,200,92,.07); }
.object-art img, .museum-art img, .next-art img { width: 100%; height: 100%; object-fit: contain; }
.object-card strong { font-size: 8px; text-align: center; }
.object-card small { color: var(--gold); font-size: 8px; }
.profile-card { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; }
.profile-avatar { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; color: #052129; background: linear-gradient(145deg, #fff, var(--aqua)); font-size: 22px; }
.profile-card h1 { margin: 1px 0; font-size: 18px; }
.profile-card p { margin: 0; color: var(--muted); font-size: 8px; }
.profile-card button, .shop-card button { padding: 7px 9px; border: 1px solid rgba(95,240,210,.22); border-radius: 999px; color: var(--aqua); background: rgba(95,240,210,.06); font-size: 8px; font-weight: 850; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat-card { padding: 12px 5px; display: grid; gap: 3px; text-align: center; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: rgba(11,39,48,.68); }
.stat-card strong { font-size: 18px; }
.stat-card span { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.next-card { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; border-color: rgba(255,200,92,.2); }
.next-card > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #291900; background: var(--gold); font-size: 20px; }
.next-card > .next-art:has(img) { overflow: hidden; background: rgba(255,200,92,.08); }
.next-card div { display: grid; gap: 2px; }
.next-card small { color: #b99d68; font-size: 7px; letter-spacing: .1em; }
.next-card strong { font-size: 10px; }
.next-card b { color: var(--gold); font-size: 8px; }
.museum-grid, .shop-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.museum-card, .shop-card { min-height: 88px; padding: 10px; display: grid; grid-template-columns: 35px 1fr; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: rgba(255,255,255,.025); }
.museum-card > span, .shop-card > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--gold); background: rgba(255,200,92,.07); font-size: 19px; }
.museum-card > .museum-art:has(img) { overflow: hidden; }
.museum-card.is-locked { opacity: .42; }
.museum-card div, .shop-card div { min-width: 0; display: grid; gap: 3px; }
.museum-card strong, .shop-card strong { font-size: 9px; }
.museum-card small, .shop-card small { color: var(--muted); font-size: 7px; }
.stars { color: var(--gold) !important; letter-spacing: .05em; }
.shop-card { min-height: 126px; grid-template-columns: 52px minmax(0,1fr) auto; gap: 11px; }
.shop-card.is-owned { border-color: rgba(95,240,210,.2); background: rgba(95,240,210,.035); }
.shop-card > .shop-swatch { position: relative; width: 52px; height: 52px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; font-size: 22px; }
.shop-swatch-bubble-lamp { color: var(--aqua) !important; background: radial-gradient(circle at 28% 30%, rgba(170,255,236,.75) 0 2px, transparent 3px), radial-gradient(circle at 70% 66%, rgba(95,240,210,.5) 0 4px, transparent 5px), #0b3039 !important; }
.shop-swatch-copper-tools { color: #f0a56d !important; background: linear-gradient(145deg, rgba(240,165,109,.2), rgba(67,31,23,.25)) !important; }
.shop-swatch-golden-rack { color: var(--gold) !important; background: radial-gradient(circle, rgba(255,200,92,.2), transparent 64%), #14282d !important; box-shadow: inset 0 -5px rgba(255,200,92,.18); }
.shop-card > .shop-copy { display: grid; gap: 4px; }
.shop-copy strong { font-size: 10px; }
.shop-copy small { max-width: 30ch; line-height: 1.35; }
.shop-copy em { color: #9bc9be; font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.shop-card > .shop-actions { display: grid; gap: 6px; }
.shop-actions button { min-width: 62px; }
.shop-actions button:first-child { color: var(--foam); border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.035); }
.shop-card button:disabled { color: var(--muted); opacity: .5; }
.history-list { margin-top: 10px; display: grid; gap: 5px; }
.history-item { padding: 8px 10px; display: flex; justify-content: space-between; border-radius: 12px; background: rgba(255,255,255,.025); font-size: 8px; }
.history-item span { color: var(--gold); }
.history-empty { color: var(--muted); font-size: 8px; }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 16px; display: grid; place-items: center; background: rgba(1,10,14,.84); backdrop-filter: blur(8px); }
.modal-backdrop[hidden], [hidden] { display: none !important; }
.modal-card { width: min(100%, 390px); max-height: min(90dvh, 660px); overflow-y: auto; padding: 24px 20px 18px; display: grid; justify-items: center; gap: 8px; border: 1px solid rgba(95,240,210,.28); border-radius: 26px; text-align: center; background: radial-gradient(circle at 50% 0, rgba(95,240,210,.13), transparent 35%), #09232c; box-shadow: 0 25px 80px rgba(0,0,0,.55); }
.modal-symbol { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid rgba(255,200,92,.32); border-radius: 22px; color: #211500; background: linear-gradient(145deg,#fff1ba,var(--gold) 62%,#b96829); box-shadow: 0 0 30px rgba(255,200,92,.25); font-size: 30px; }
.modal-kicker { margin: 4px 0 0; color: var(--aqua); font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.modal-card h2 { margin: 0; font-size: 23px; }
.modal-card > p:not(.modal-kicker) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.modal-content { width: 100%; display: grid; gap: 8px; }
.cosmetic-preview { position: relative; width: 100%; height: 170px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(95,240,210,.16); border-radius: 18px; background: radial-gradient(circle at 50% 45%, rgba(37,141,143,.3), transparent 40%), linear-gradient(180deg,#0b333b,#061b23); }
.cosmetic-preview span { position: relative; z-index: 2; width: 74px; height: 74px; display: grid; place-items: center; border-radius: 22px; font-size: 38px; }
.cosmetic-preview i, .cosmetic-preview b { position: absolute; display: block; pointer-events: none; }
.cosmetic-preview-bubble-lamp span { color: var(--aqua); background: rgba(95,240,210,.08); box-shadow: 0 0 36px rgba(95,240,210,.22); }
.cosmetic-preview-bubble-lamp i { inset: 0; background: radial-gradient(circle at 18% 72%, rgba(145,255,229,.65) 0 5px, transparent 6px), radial-gradient(circle at 78% 28%, rgba(145,255,229,.5) 0 8px, transparent 9px), radial-gradient(circle at 72% 82%, rgba(145,255,229,.4) 0 3px, transparent 4px), radial-gradient(circle at 30% 25%, rgba(145,255,229,.35) 0 4px, transparent 5px); }
.cosmetic-preview-copper-tools span { color: #f0a56d; background: rgba(240,165,109,.1); box-shadow: 0 0 30px rgba(240,165,109,.16); }
.cosmetic-preview-copper-tools i, .cosmetic-preview-copper-tools b { width: 145px; height: 12px; border-radius: 999px; background: linear-gradient(90deg,#6e3827,#f0a56d 48%,#8c4c31); box-shadow: 0 5px 12px rgba(0,0,0,.25); }
.cosmetic-preview-copper-tools i { transform: rotate(28deg); }
.cosmetic-preview-copper-tools b { transform: rotate(-28deg); }
.cosmetic-preview-golden-rack span { color: var(--gold); background: rgba(255,200,92,.08); box-shadow: 0 0 38px rgba(255,200,92,.2); }
.cosmetic-preview-golden-rack i { left: 12%; right: 12%; bottom: 26px; height: 9px; border-radius: 999px; background: linear-gradient(90deg,#8e5e1d,var(--gold),#8e5e1d); box-shadow: 0 0 18px rgba(255,200,92,.28); }
.cosmetic-preview-golden-rack b { inset: 0; background: radial-gradient(circle at 20% 25%, var(--gold) 0 2px, transparent 3px), radial-gradient(circle at 82% 32%, var(--gold) 0 3px, transparent 4px), radial-gradient(circle at 72% 76%, var(--gold) 0 2px, transparent 3px); }
.cosmetic-disclaimer { margin: 2px 0 0; color: #91b8af; font-size: 8px; line-height: 1.4; text-align: center; }
.story-hotspots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.story-hotspot { min-height: 94px; padding: 9px 6px; display: grid; place-items: center; gap: 4px; color: var(--text); border: 1px solid rgba(95,240,210,.16); border-radius: 13px; background: rgba(255,255,255,.035); }
.story-hotspot span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: var(--gold); background: rgba(255,200,92,.1); font-weight: 900; }
.story-hotspot strong { font-size: 8px; line-height: 1.25; }
.story-hotspot small, .story-progress { color: var(--muted); font-size: 7px; }
.story-hotspot.is-discovered { border-color: rgba(95,240,210,.6); background: rgba(95,240,210,.1); }
.story-hotspot.is-discovered span { color: #052e34; background: var(--aqua); }
.story-progress { margin: 1px 0 0; text-align: center; letter-spacing: .08em; text-transform: uppercase; }
.primary-button { width: 100%; min-height: 44px; margin-top: 5px; border: 0; border-radius: 14px; color: #062028; background: linear-gradient(90deg,var(--aqua),#8ff5c8); font-size: 11px; font-weight: 950; }
.text-button { border: 0; color: var(--muted); background: transparent; font-size: 9px; }
.mini-status { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.choice-grid, .ring-grid, .rhythm-grid, .gear-grid, .rune-grid { display: grid; gap: 7px; }
.choice-grid { grid-template-columns: repeat(3, 1fr); }
.ring-grid { grid-template-columns: repeat(3, 1fr); }
.rhythm-grid { grid-template-columns: repeat(4, 1fr); }
.gear-grid, .rune-grid { grid-template-columns: repeat(3, 1fr); }
.pressure-gauge { display: grid; justify-items: center; gap: 7px; padding: 12px; border: 1px solid rgba(95,240,210,.12); border-radius: 14px; background: rgba(4,16,22,.44); }
.pressure-gauge > div { width: 100%; height: 13px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.pressure-gauge i { display: block; width: 50%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--aqua), var(--gold)); transition: width 180ms ease; }
.pressure-gauge strong { color: var(--gold); font-size: 18px; }
.pressure-controls { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 7px; }
.pressure-lock { font-size: 10px; }
.mini-button { min-height: 52px; border: 1px solid rgba(255,255,255,.11); border-radius: 14px; color: var(--foam); background: rgba(255,255,255,.045); font-size: 20px; font-weight: 900; }
.mini-button.is-lit, .mini-button.is-correct { color: #062028; border-color: var(--aqua); background: var(--aqua); box-shadow: 0 0 22px rgba(95,240,210,.34); }
.mini-button.is-wrong { background: var(--coral); }
.key-detail-board { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border: 1px solid rgba(95,240,210,.18); border-radius: 16px; background: radial-gradient(circle at 50% 45%, rgba(95,240,210,.12), transparent 62%), #061b23; touch-action: manipulation; }
.key-detail-board > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.key-detail-board.is-wrong { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,111,97,.18); }
.key-detail-zone { --zone-progress: 0deg; position: absolute; display: grid; place-content: center; gap: 2px; padding: 3px; overflow: hidden; border: 2px dashed rgba(255,200,92,.88); border-radius: 13px; color: #fff8da; background: linear-gradient(rgba(4,22,29,.5),rgba(4,22,29,.5)), conic-gradient(rgba(95,240,210,.3) var(--zone-progress), transparent 0); box-shadow: 0 0 0 2px rgba(4,22,29,.55), inset 0 0 22px rgba(4,22,29,.65); text-shadow: 0 1px 3px #001014; }
.key-detail-zone span { font-size: 8px; font-weight: 950; line-height: 1.15; }
.key-detail-zone small { color: var(--gold); font-size: 8px; font-weight: 900; }
.key-detail-zone.is-complete { color: #052e34; border-style: solid; border-color: var(--aqua); background: rgba(95,240,210,.86); box-shadow: 0 0 22px rgba(95,240,210,.34); text-shadow: none; }
.key-detail-zone.is-complete small { color: #052e34; }
.key-detail-hint, .lock-help, .mini-feedback { min-height: 15px; margin: 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.modal-card:has(.triple-lock) { width: min(100%, 550px); max-height: 94dvh; padding: 18px; }
.modal-card:has(.triple-lock) .modal-symbol { display: none; }
.triple-lock { display: grid; gap: 8px; width: 100%; text-align: left; }
.triple-lock .key-detail-board { width: min(100%, 380px); justify-self: center; }
.triple-setup, .triple-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.triple-actions { padding-top: 12px; }
.triple-setup label, .triple-lock .mini-status, .triple-lock p { font-size: 12px; line-height: 1.45; }
.triple-lock p { margin: 0; }
.triple-difficulty { width: min(100%, 240px); }
.triple-difficulty input { display: block; width: 100%; height: 44px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
.triple-difficulty input::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: rgba(95,240,210,.35); }
.triple-difficulty input::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(95,240,210,.35); }
.triple-difficulty input::-webkit-slider-thumb { -webkit-appearance: none; width: 3px; height: 17px; margin-top: -7px; border: 0; border-radius: 1px; background: white; box-shadow: 0 0 5px rgba(255,255,255,.4); }
.triple-difficulty input::-moz-range-thumb { width: 3px; height: 17px; border: 0; border-radius: 1px; background: white; box-shadow: 0 0 5px rgba(255,255,255,.4); }
.triple-difficulty input:disabled { cursor: default; opacity: 1; }
.triple-difficulty-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.triple-difficulty-labels .is-current { color: var(--gold); font-weight: 900; }
.triple-lock .mini-button { min-height: 44px; min-width: 110px; padding: 10px 16px; font-size: 14px; touch-action: manipulation; }
.triple-lock progress { width: 100%; height: 8px; accent-color: var(--gold); }
.triple-rules { color: var(--muted); }
.triple-next { color: var(--gold); font-weight: 800; }
.key-coating { position: absolute; inset: 0; pointer-events: none; -webkit-mask-image: var(--key-silhouette); mask-image: var(--key-silhouette); -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.key-coating-section { --revealed: 0%; position: absolute; background: linear-gradient(to right, transparent 0 var(--revealed), #4ed3b2 var(--revealed) 100%); }
/* These disjoint regions partition the existing 3:2 key art, including its end cap. */
.key-coating-bow { inset: 0 auto 0 0; width: 32%; }
.key-coating-shaft { inset: 0 0 0 32%; clip-path: polygon(0 0, 100% 0, 100% 100%, 94.117647% 100%, 94.117647% 50%, 66.176471% 50%, 66.176471% 100%, 0 100%); }
.key-coating-teeth { left: 77%; top: 50%; width: 19%; bottom: 0; }
.triple-lock .key-detail-zone { min-height: 44px; min-width: 44px; background: transparent; box-shadow: none; }
.triple-lock .key-detail-zone span, .triple-lock .key-detail-zone small { position: relative; width: fit-content; justify-self: center; padding: 1px 3px; border-radius: 3px; background: rgba(4,22,29,.78); }
.triple-lock .key-detail-zone.is-complete { color: var(--foam); background: transparent; box-shadow: none; text-shadow: 0 1px 3px #001014; }
.triple-lock .key-detail-zone.is-complete small { color: var(--gold); }
.triple-lock .key-detail-zone span, .triple-lock .key-detail-zone small { font-size: 11px; }
.triple-lock .key-detail-zone.is-selected { outline: 3px solid white; outline-offset: -6px; }
.triple-lock .key-detail-zone.is-next { border-color: var(--gold); }
.triple-lock .key-detail-zone:disabled { opacity: 1; }
.triple-lock [data-zone]:focus-visible, .triple-lock button:focus-visible, .triple-lock input:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }
.triple-timing { position: relative; height: 34px; margin: 0 3px; border: 1px solid rgba(95,240,210,.4); border-radius: 8px; background: #041619; }
.triple-target { position: absolute; inset-block: 2px; border-radius: 5px; background: var(--gold); box-shadow: 0 0 12px rgba(255,200,92,.2); }
.triple-needle { position: absolute; top: -4px; bottom: -4px; width: 3px; transform: translateX(-50%); background: white; border-radius: 2px; box-shadow: 0 0 3px #001014; }
.triple-hit-marker { position: absolute; z-index: 1; top: -6px; bottom: -6px; width: 3px; transform: translateX(-50%); background: #ff4545; border-radius: 2px; box-shadow: 0 0 0 1px #411010, 0 0 8px rgba(255,69,69,.45); pointer-events: none; }
.triple-timing.is-hit { border-color: var(--aqua); box-shadow: 0 0 8px rgba(95,240,210,.35); }
.triple-hit-sparks { position: absolute; top: 50%; z-index: 2; pointer-events: none; }
.triple-hit-sparks i { position: absolute; left: 0; top: 0; width: 3px; height: 3px; opacity: 0; border-radius: 1px; background: #fff4b8; box-shadow: 0 0 3px var(--gold); }
.triple-round-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--gold); font-size: 12px; }
.triple-round-status span { color: var(--muted); }
.triple-records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 7px 4px; border: 1px solid rgba(95,240,210,.2); border-radius: 10px; background: rgba(4,22,29,.45); text-align: center; }
.triple-records span, .triple-records abbr { display: block; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.triple-records abbr { text-decoration: none; cursor: help; }
.triple-records strong { display: block; margin-top: 3px; color: var(--gold); font-size: 17px; font-variant-numeric: tabular-nums; }
.triple-records small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.triple-victory .triple-record-result { color: var(--gold); font-weight: 800; }
.triple-victory-stats { flex-wrap: wrap; }
.triple-lock.is-retuning .triple-target { outline: 2px solid white; outline-offset: 2px; box-shadow: 0 0 18px var(--gold); }
.triple-victory { display: grid; gap: 16px; width: 100%; text-align: center; }
.triple-victory img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; border: 1px solid rgba(255,200,92,.3); border-radius: 18px; background: radial-gradient(ellipse, rgba(255,200,92,.18), transparent 70%); }
.triple-victory-stats { display: flex; justify-content: center; gap: 24px; color: var(--muted); font-size: 12px; }
.triple-victory-stats strong { display: block; margin-bottom: 4px; color: var(--gold); font-size: 24px; }
.triple-victory p { margin: 0; color: var(--foam); font-size: 12px; line-height: 1.5; }
.triple-lock .key-detail-hint { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 400px) {
  .modal-card:has(.triple-lock) { padding: 12px; }
  .modal-card:has(.triple-lock) h2 { font-size: 20px; }
  .modal-card:has(.triple-lock) .modal-symbol { width: 36px; height: 36px; }
  .triple-lock { gap: 5px; }
  .triple-lock .key-detail-board { width: min(100%, 270px); }
  .triple-lock .key-detail-zone span, .triple-lock .key-detail-zone small { font-size: 10px; }
}
.lock-ring-grid { align-items: stretch; }
.lock-ring { min-width: 0; padding: 7px 5px; display: grid; justify-items: center; gap: 6px; border: 1px solid rgba(255,200,92,.18); border-radius: 50px 50px 14px 14px; background: rgba(4,16,22,.48); }
.lock-ring > strong { overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.lock-ring > output { width: 52px; height: 52px; display: grid; place-items: center; border: 3px double rgba(255,200,92,.7); border-radius: 50%; color: var(--gold); background: radial-gradient(circle,#143c41,#061820 72%); box-shadow: inset 0 0 15px rgba(255,200,92,.12); font-size: 23px; font-weight: 900; }
.lock-ring.is-aligned { border-color: rgba(95,240,210,.7); box-shadow: 0 0 18px rgba(95,240,210,.16); }
.lock-ring.is-aligned > output { color: #062028; border-color: var(--aqua); background: var(--aqua); box-shadow: 0 0 20px rgba(95,240,210,.3); }
.lock-ring-controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.lock-turn { min-height: 42px; padding: 0; font-size: 16px; }
.lock-check { width: 100%; font-size: 10px; }
.rune-sequence { padding: 9px 7px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(95,240,210,.12); border-radius: 14px; background: rgba(4,16,22,.44); }
.rune-sequence span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--gold); background: rgba(255,200,92,.07); font-size: 18px; font-weight: 900; }
.rune-sequence span.is-complete { color: #062028; background: var(--aqua); }
.rune-sequence i { color: var(--muted); font-size: 8px; font-style: normal; }
.rune-grid { touch-action: none; }
.rune-button { touch-action: none; user-select: none; }
.reveal-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.reveal-stat { padding: 9px 4px; display: grid; gap: 2px; border-radius: 12px; background: rgba(255,255,255,.04); }
.reveal-stat strong { color: var(--gold); font-size: 15px; }
.reveal-stat span { color: var(--muted); font-size: 7px; }
@media (max-width: 360px) {
  .app-shell { padding-inline: 8px; }
  .playfield { height: 350px; }
  .tool-card small { display: none; }
  .profile-card { grid-template-columns: 42px 1fr; }
  .profile-card button { grid-column: 1 / -1; }
  .museum-grid, .shop-grid { grid-template-columns: 1fr; }
  .shop-card { grid-template-columns: 48px minmax(0,1fr); }
  .shop-card > .shop-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
.fps-meter { position: fixed; z-index: 200; right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); padding: 6px 9px; border-radius: 9px; color: #061820; background: var(--aqua); font: 800 11px ui-monospace, monospace; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.back-link, .view-tab, .profile-card button, .shop-card button, .text-button { min-height: 44px; }
@media (orientation: landscape) and (max-height: 540px) {
  .app-shell { width: min(100%, 900px); }
  .game-view { grid-template-columns: minmax(300px, 1fr) minmax(260px, .72fr); align-items: start; }
  .mission-bar, .stage-track { grid-column: 1 / -1; }
  .playfield { height: calc(100dvh - 145px); grid-row: 3 / span 3; }
  .tool-dock, .object-picker-wrap { grid-column: 2; }
}

/* Spatial Helmet story and repair share the registered restored-art coordinate space. */
.helmet-board { position: relative; width: min(100%, 240px); margin: 0 auto; aspect-ratio: 2 / 3; }
.helmet-board img { display: block; width: 100%; height: 100%; object-fit: contain; }
.helmet-board .spatial-target { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 4px; border: 2px solid var(--gold); border-radius: 50%; color: #071b24; background: #ffe49d; font-size: 16px; font-weight: 800; }
.helmet-board .is-discovered, .helmet-board .is-correct { background: var(--aqua); border-color: var(--aqua); }
.helmet-board .spatial-target span { color: inherit; background: transparent; }
.stage-replay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
#loreText { text-align: left; font-size: 12px; line-height: 1.5; }
#loreText p { margin: 4px 0; }
.repair-pieces { display: flex; gap: 6px; justify-content: center; }
.repair-pieces button { min-width: 44px; min-height: 44px; font-size: 11px; touch-action: none; }
.repair-pieces button[aria-pressed="true"] { outline: 3px solid var(--gold); }
#miniGrid button small { display: block; font-size: 12px; }
#repairFeedback, #miniFeedback { font-size: 12px; line-height: 1.5; }
[hidden] { display: none !important; }
.museum-room { display:flex; flex-direction:column; gap:12px; text-align:left; padding:24px; color:#eaf5ee; background:linear-gradient(145deg,#143c43,#102832); border:1px solid #467d79; border-radius:18px; cursor:pointer; }
.museum-room > span { color:#e7c783; font-size:34px; }
.museum-room strong { font-size:21px; }
.museum-room p, .museum-card p { line-height:1.55; }
.museum-room progress, .conservation-work progress { width:100%; accent-color:#83c9b4; }
.museum-room-heading { grid-column:1/-1; }
.museum-room-heading a, .museum-card a { color:#a2d8ce; }
.museum-room-heading button, .museum-card button, .conservation-controls button, .conservation-fragments button { padding:12px 16px; border:1px solid #719b91; border-radius:10px; background:#183d40; color:#effbf6; cursor:pointer; }
.conservation-board { position:relative; height: min(44vh,390px); max-width:330px; margin:0 auto; touch-action:none; }
.conservation-board img { display:block; width:100%; height:100%; object-fit:contain; }
.conservation-board button { position:absolute; transform:translate(-50%,-50%); border:2px solid #c2e6c9; border-radius:12px; min-width:44px; min-height:44px; padding:8px; background:#244844ed; color:#fff8df; font-weight:700; font-size:12px; max-width:145px; cursor:pointer; }
.conservation-controls, .conservation-fragments { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.conservation-fragments button { touch-action:none; }
.conservation-fragments [aria-pressed="true"] { background:#8b663b; outline:2px solid #ffe4ac; }
.conservation-note { font-size:12px; line-height:1.45; color:#c4d7cd; }
.conservation-reward-art { display:block; width:150px; height:210px; object-fit:contain; margin:0 auto; }
.conservation-work button:focus-visible, .museum-room:focus-visible { outline:3px solid #ffe4ac; outline-offset:3px; }
.modal-card:has(.conservation-work) { width:min(100%,540px); max-height:94dvh; padding:16px; gap:6px; }
.modal-card:has(.conservation-work) .modal-symbol { display:none; }
.conservation-work { display:grid; gap:8px; }
.conservation-work p { margin:4px 0; }
.conservation-board { width:min(100%,255px); aspect-ratio:460/704; height:auto; }
.conservation-board .conservation-after { position:absolute; inset:0; opacity:0; pointer-events:none; }
.conservation-fragments button { display:grid; gap:4px; justify-items:center; padding:8px 12px; font-size:12px; }
.conservation-fragments .ceramic-piece { width:34px; height:26px; background:linear-gradient(120deg,#c9956c,#986b4e); border:2px solid #e1c098; clip-path:polygon(10% 5%,85% 0,100% 80%,40% 100%,0 65%); }
@media (max-height:740px) { .conservation-board { width:190px; } }
.planned-collection { grid-column:1/-1; margin-top:24px; }
.planned-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr)); gap:16px; }
.planned-exhibit { border:1px dashed #648a85; border-radius:18px; padding:22px; background:#102e36; }
.planned-exhibit h4 { font-size:21px; margin:12px 0; }
.planned-exhibit p, .planned-exhibit dd { line-height:1.6; }
.planned-exhibit small { display:block; color:#aacdc4; margin-top:12px; }
.planned-exhibit dt { color:#aacdc4; font-size:12px; margin-top:10px; }
.planned-exhibit dd { margin:0; }
.planned-exhibit summary { cursor:pointer; padding:12px 0; color:#e4cd98; }
.planned-exhibit a { color:#a5e1d4; }
