/* © 2026 PleasantlyStuck · TRIPLE DUTY — all rights reserved. Proprietary; see LICENSE. */
/* TRIPLE DUTY — inherits the PleasantlyStuck "Ember & Ink" design tokens. */
:root {
  --ink-bg:      #211A17;
  --ink-surface: #2C231E;
  --tile-face:   #3B2F28;
  --tile-face-hi:#4C3E34;
  --text-primary:#EFE6D8;
  --text-muted:  #A6927E;
  --ember-core:  #E0714A;
  --ember-deep:  #B4522F;
  --gold-bank:   #D8B267;
  --valid-teal:  #79B592;
  --danger-red:  #D66A5C;
  --line-subtle: #382C25;
  --on-accent:   #1E140D;
  --frame-bg: radial-gradient(1100px 760px at 50% 18%, #2A211B 0%, #16100C 72%);
  --modal-scrim: rgba(11,15,20,.85);
  --gate-scrim:  rgba(26,19,10,.72);
  --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --press:  inset 0 1px 0 var(--tile-face-hi), inset 0 -2px 0 rgba(20,14,9,.62), 0 3px 8px rgba(0,0,0,.4);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ink-bg:      #ECE4D4;
  --ink-surface: #FAF5EC;
  --tile-face:   #E4DAC6;
  --tile-face-hi:#FFFDF7;
  --text-primary:#241C12;
  --text-muted:  #6B6152;
  --ember-core:  #CE560F;
  --ember-deep:  #A8430B;
  --gold-bank:   #97701A;
  --valid-teal:  #0B7355;
  --danger-red:  #C13330;
  --line-subtle: #D8CDB8;
  --frame-bg: radial-gradient(1100px 760px at 50% 18%, #F5EFE2 0%, #E4DAC7 72%);
  --modal-scrim: rgba(245,239,226,.94);
  --gate-scrim:  rgba(26,19,10,.55);
  --press: inset 0 1px 0 var(--tile-face-hi), inset 0 -2px 0 rgba(120,100,70,.22), 0 2px 5px rgba(90,70,40,.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 10px)
           calc(env(safe-area-inset-bottom, 0px) + 10px) calc(env(safe-area-inset-left, 0px) + 10px);
  background: var(--frame-bg);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; overscroll-behavior: none;
}
@media (min-width: 440px) { body { padding: 28px; } }
.archivo { font-family: 'Archivo Black', Inter, sans-serif; }

#frame {
  position: relative; width: 393px; height: 852px;
  background: var(--ink-bg); overflow: hidden; border-radius: 44px;
  box-shadow: 0 0 0 10px #05070a, 0 0 0 12px #1b222c, 0 30px 80px rgba(0,0,0,.6);
  transform-origin: center center; flex: 0 0 auto;
}
body.fullbleed #frame { border-radius: 22px; box-shadow: 0 6px 26px rgba(0,0,0,.32); }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ---- shared ---- */
.label { font-size: 12px; font-weight: 600; letter-spacing: .96px; color: var(--text-muted); text-transform: uppercase; }
.microlabel { font-size: 10px; font-weight: 600; letter-spacing: .8px; color: var(--text-muted); text-transform: uppercase; }
.btn { cursor: pointer; user-select: none; transition: transform .09s var(--spring); }
.btn:active { transform: scale(.95); }
.card { background: var(--ink-surface); border-radius: 16px; }
.sitebacklink { position: absolute; top: 32px; left: 20px; z-index: 3; font-size: 12px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.sitebacklink:active { color: var(--text-primary); }
.themetoggle { position: absolute; top: 26px; right: 16px; z-index: 3; width: 34px; height: 34px; padding: 0; border: none; background: transparent; color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.themetoggle:active { color: var(--text-primary); transform: scale(.92); }
.themetoggle svg { width: 20px; height: 20px; display: block; }
.themetoggle .moon { display: none; }
:root[data-theme="light"] .themetoggle .sun { display: none; }
:root[data-theme="light"] .themetoggle .moon { display: block; }
.soundtoggle { right: 58px; }
.soundtoggle .snd-off { display: none; }
.soundtoggle.muted .snd-on { display: none; }
.soundtoggle.muted .snd-off { display: block; }
.soundtoggle.muted { color: var(--danger-red); }

@keyframes td-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes td-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes td-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ============ HOME ============ */
#home { padding: 84px 22px 30px; align-items: center; }
.wordmark { display: flex; align-items: center; justify-content: center; gap: 9px; animation: td-in .5s both; }
.td-tile {
  width: 40px; height: 40px; border-radius: 8px; position: relative;
  background: var(--tile-face); box-shadow: var(--press);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo Black', sans-serif; font-size: 22px; color: var(--text-primary);
}
/* the "three shadows" motif — one tile casting two offset echoes.
   nudge the whole lockup left by the shadow spread so it reads visually centred. */
.wordmark { transform: translateX(-4px); }
.td-tile::before, .td-tile::after { content: ""; position: absolute; inset: 0; border-radius: 8px; z-index: -1; }
.td-tile::before { transform: translate(4px, 4px); background: var(--gold-bank); opacity: .55; }
.td-tile::after  { transform: translate(7px, 7px); background: var(--ember-core); opacity: .40; }
.td-txt { display: flex; flex-direction: column; line-height: 1; font-family: 'Archivo Black', sans-serif; }
.td-txt .mut { font-size: 15px; letter-spacing: 2px; color: var(--text-muted); }
.td-txt .emph { font-size: 30px; letter-spacing: 1px; color: var(--ember-core); }
.tagline { margin-top: 12px; font-size: 13px; color: var(--text-muted); letter-spacing: .3px; animation: td-in .5s .05s both; }

.daily.card { width: 100%; margin-top: 26px; padding: 16px 16px 14px; animation: td-in .5s .1s both; }
.daily .top { display: flex; justify-content: space-between; align-items: center; }
.daily .streak { display: flex; align-items: center; gap: 3px; }
.daily .streak .n { font-family: 'Archivo Black', sans-serif; font-size: 15px; color: var(--ember-core); }
/* "three clues -> one word" mechanic illustration: three clue lines whose blanks
   line up in a column above a single shared answer tile. */
.dailypreview { display: flex; flex-direction: column; align-items: center; gap: 9px; margin: 15px 0 12px; }
.mini-clues { display: flex; flex-direction: column; gap: 11px; }
/* three "sentences": grey word-bars with the shared ember word in a DIFFERENT spot each row */
.mini-clue { display: flex; gap: 5px; align-items: center; justify-content: center; }
.mini-clue i { width: 16px; height: 6px; border-radius: 3px; background: var(--line-subtle); }
.mini-clue .mb { width: 28px; height: 8px; border-radius: 4px; background: var(--ember-core); }
.mini-word { margin-top: 4px; font-family: 'Archivo Black', sans-serif; font-size: 11px; letter-spacing: 1.5px; color: var(--on-accent); background: var(--gold-bank); border-radius: 8px; padding: 4px 10px; }
.pill { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--on-accent); background: var(--gold-bank); border-radius: 20px; padding: 7px; }
.daily.done .pill { background: var(--valid-teal); }

.records { display: flex; gap: 8px; width: 100%; margin-top: 14px; animation: td-in .5s .15s both; }
.records .cell { flex: 1; background: var(--ink-surface); border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; min-height: 70px; }
.records .cell .microlabel { text-align: center; line-height: 1.25; }
.records .v { font-family: 'Archivo Black', sans-serif; font-size: 20px; }
.records .v.ember { color: var(--ember-core); }

.howto { margin: 16px auto 0; display: inline-flex; align-items: center; gap: 7px; background: transparent; border: 1px solid var(--line-subtle); color: var(--text-muted); border-radius: 20px; padding: 7px 15px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.howto:active { transform: scale(.95); }
.howto svg { width: 15px; height: 15px; }

.thumb { margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.play.btn { position: relative; width: 100%; height: 58px; border-radius: 16px; background: var(--ember-core); color: var(--on-accent); font-family: 'Archivo Black', sans-serif; font-size: 17px; letter-spacing: .8px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 8px 22px rgba(224,113,74,.35); }
.play.btn .glow { position: absolute; inset: 0; background: radial-gradient(120px 60px at 50% 120%, rgba(255,220,180,.5), transparent 70%); pointer-events: none; }
.outline-gold.btn { width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--text-muted); color: var(--text-primary); font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: .6px; display: flex; align-items: center; justify-content: center; }
.textrow { display: flex; gap: 22px; justify-content: center; margin-top: 2px; }
.textrow > div { font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; padding: 4px; }
.textrow > div:active { color: var(--text-primary); }

/* ============ ROUND ============ */
#game { padding: 20px 20px 22px; }
#ghud { display: flex; align-items: center; justify-content: space-between; }
#ghud .rnd { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--text-muted); }
.starsofar { display: flex; gap: 3px; flex: 1; justify-content: center; }
.starsofar b { font-size: 13px; color: var(--line-subtle); }
.starsofar b.on { color: var(--gold-bank); }
#pause { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; gap: 3px; }
#pause i { width: 3px; height: 13px; border-radius: 2px; background: var(--text-muted); }

#potmeter { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 14px; }
#potmeter .plabel { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--text-muted); }
#potmeter .stars { display: flex; gap: 5px; font-size: 22px; }
#potmeter .stars b { color: var(--gold-bank); transition: color .3s, opacity .3s; }
#potmeter .stars b.spent { color: var(--line-subtle); opacity: .5; }

#cluestack { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.clue {
  background: var(--ink-surface); border-radius: 14px; padding: 15px 16px;
  position: relative; animation: td-pop .34s var(--spring) both;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
}
.clue .cnum { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-muted); }
.clue .ctext { margin-top: 5px; font-size: 16px; line-height: 1.4; color: var(--text-primary); }
.clue .cblank { display: inline-block; min-width: 46px; border-bottom: 2.5px solid var(--ember-core); vertical-align: baseline; text-align: center; font-family: 'Archivo Black', sans-serif; color: var(--valid-teal); }
/* revealed clues fill the stack and centre their content — kills the dead band.
   size tracks worth: one open clue becomes the hero until another is requested. */
/* all three clues shown, equal cards filling the stack */
.clue { padding: 12px 15px; }
.clue:not(.locked) { flex: 1 1 0; display: flex; flex-direction: column; justify-content: center; min-height: 62px; }
#cluestack { gap: 8px; }
/* a locked clue is a dashed, PRICED row that is itself the reveal button */
.clue.locked { display: flex; align-items: center; justify-content: space-between; border: 1.5px dashed var(--line-subtle); background: transparent; box-shadow: none; padding: 16px; animation: none; }
.clue.locked .cnum { color: var(--text-muted); }
.clue.locked .price { font-size: 12px; font-weight: 700; letter-spacing: .3px; color: var(--ember-core); }
.clue.locked.next { cursor: pointer; }
.clue.locked.next:active { transform: scale(.985); }
.clue.locked.waiting { opacity: .45; }
.clue.locked.waiting .price { display: none; }
.clue .clabel { display: none; margin-top: 8px; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--valid-teal); animation: td-in .4s both; }
.clue.solved { border: 1.5px solid var(--valid-teal); }
.clue.solved .clabel { display: block; }
.clue.solved .cblank { color: var(--valid-teal); border-bottom-color: var(--valid-teal); }

/* ============ ANSWER ============ */
#answerwrap { margin-top: 12px; }
#feedback { text-align: center; height: 16px; font-size: 12px; font-weight: 700; letter-spacing: .5px; margin-bottom: 6px; }
#feedback.miss { color: var(--danger-red); animation: td-shake .4s; }
#feedback.note { color: var(--gold-bank); }
#feedback.hit { color: var(--valid-teal); }
/* ---- tile input: staging row + tile tray ---- */
#staging { display: flex; align-items: center; gap: 8px; min-height: 54px; padding-bottom: 10px; border-bottom: 2px dashed var(--line-subtle); }
#stagingtiles { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
#stagingtiles .ghosthint { color: var(--text-muted); font-size: 13px; }
#backspace { width: 44px; height: 46px; border-radius: 10px; border: 1.5px solid var(--line-subtle); display: flex; align-items: center; justify-content: center; font-size: 17px; color: var(--text-muted); flex: 0 0 auto; }
#tray { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.ltile { width: 40px; height: 46px; border-radius: 9px; background: var(--tile-face); box-shadow: var(--press); display: flex; align-items: center; justify-content: center; font-family: 'Archivo Black', sans-serif; font-size: 20px; color: var(--text-primary); cursor: pointer; user-select: none; }
.ltile:active { transform: scale(.9); }
.ltile.staged { background: var(--tile-face-hi); box-shadow: inset 0 1px 0 var(--tile-face-hi), 0 0 0 1.5px var(--ember-core), 0 3px 8px rgba(0,0,0,.4); animation: td-pop .2s var(--spring) both; }
#tray .ltile.used { opacity: .22; pointer-events: none; box-shadow: none; }
#staging.shake { animation: td-shake .4s; }
#staging.floatup { transition: transform .45s var(--spring), opacity .45s; transform: translateY(-150px) scale(.82); opacity: 0; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1; height: 50px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-family: 'Archivo Black', sans-serif; font-size: 14px; letter-spacing: .5px; }
.actions .submit { background: var(--ember-core); color: var(--on-accent); }
#hintline { text-align: center; min-height: 15px; font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--gold-bank); margin-bottom: 4px; }
.undertext { display: flex; justify-content: center; gap: 28px; margin-top: 12px; }
.undertext .ulink { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.undertext .ulink.disabled { opacity: .4; pointer-events: none; }
.undertext #hintBtn:active { color: var(--gold-bank); }
.undertext #showAnsBtn:active { color: var(--danger-red); }
/* correct-answer reward: a soft full-screen teal flash */
#winwash { position: absolute; inset: 0; z-index: 30; background: var(--valid-teal); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#winwash.on { opacity: .18; }

/* ============ PAUSE ============ */
#paused { position: absolute; inset: 0; z-index: 40; background: var(--modal-scrim); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px; }
#paused.on { display: flex; }
#paused .title { font-family: 'Archivo Black', sans-serif; font-size: 26px; letter-spacing: 2px; margin-bottom: 8px; }
#paused .btn { width: 100%; max-width: 260px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; letter-spacing: .5px; text-decoration: none; }
#paused .resume { background: var(--ember-core); color: var(--on-accent); font-family: 'Archivo Black', sans-serif; }
#paused .ptoggle { border: 1.5px solid var(--line-subtle); color: var(--text-primary); }
#paused .quit { color: var(--danger-red); border: 1.5px solid var(--danger-red); }

/* ============ RESULTS ============ */
#results { padding: 40px 22px 26px; }
#resinner { display: flex; flex-direction: column; align-items: center; height: 100%; width: 100%; }
.resbadge { font-family: 'Archivo Black', sans-serif; font-size: 22px; letter-spacing: 1px; color: var(--gold-bank); text-align: center; animation: td-pop .5s var(--spring) both; }
.restotal { margin-top: 6px; display: flex; align-items: baseline; gap: 6px; }
.restotal .v { font-family: 'Archivo Black', sans-serif; font-size: 52px; color: var(--ember-core); }
.restotal .max { font-size: 15px; font-weight: 700; color: var(--text-muted); }
.resgrid { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; width: 100%; }
.resrow { display: flex; align-items: center; justify-content: space-between; background: var(--ink-surface); border-radius: 11px; padding: 9px 14px; }
.resrow .rw { font-family: 'Archivo Black', sans-serif; font-size: 14px; letter-spacing: 1px; }
.resrow .rs { font-size: 15px; letter-spacing: 2px; color: var(--gold-bank); }
.resrow .rs .off { color: var(--line-subtle); }
.resmeta { margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-align: center; }
#sharecard { margin-top: auto; width: 100%; background: var(--ink-surface); border-radius: 14px; padding: 13px 16px; display: flex; flex-direction: column; gap: 6px; }
#sharecard .path { font-size: 17px; letter-spacing: 3px; }
#results .thumb { margin-top: 14px; }

/* ============ GATE ============ */
#gate { position: absolute; inset: 0; z-index: 60; background: var(--gate-scrim); display: none; align-items: center; justify-content: center; padding: 26px; }
#gate.on { display: flex; }
.gatecard { background: var(--ink-surface); border-radius: 20px; padding: 24px 20px; width: 100%; max-width: 340px; animation: td-pop .4s var(--spring) both; }
.gatebrand { font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: 2px; color: var(--ember-core); text-align: center; }
.gatetitle { font-family: 'Archivo Black', sans-serif; font-size: 22px; text-align: center; margin: 4px 0 16px; }
.gatesteps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 11px; }
.gatesteps li { font-size: 13.5px; line-height: 1.4; color: var(--text-primary); }
.gatesteps b { color: var(--ember-core); }
.gatebtn { margin-top: 20px; height: 50px; border-radius: 14px; background: var(--ember-core); color: var(--on-accent); font-family: 'Archivo Black', sans-serif; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.gateskip { text-align: center; margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ============ STATS SHEET ============ */
#statsDim { position: absolute; inset: 0; z-index: 45; background: var(--modal-scrim); opacity: 0; pointer-events: none; transition: opacity .25s; }
#statsDim.on { opacity: 1; pointer-events: auto; }
#statsSheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--ink-surface); border-radius: 22px 22px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 22px); transform: translateY(101%); transition: transform .3s var(--spring); box-shadow: 0 -8px 30px rgba(0,0,0,.35); }
#statsSheet.on { transform: none; }
.statshead { display: flex; justify-content: space-between; align-items: center; font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: 1px; margin-bottom: 14px; }
.statsx { font-size: 15px; color: var(--text-muted); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.statsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scell { background: var(--ink-bg); border-radius: 11px; padding: 11px 13px; display: flex; flex-direction: column; gap: 4px; }
.scell .sv { font-family: 'Archivo Black', sans-serif; font-size: 19px; }
.scell .sv.ember { color: var(--ember-core); }
.histwrap { margin-top: 16px; }
.histbars { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 62px; margin-top: 8px; }
.hbar { flex: 0 0 20px; height: 100%; display: flex; align-items: flex-end; background: var(--ink-bg); border-radius: 4px; overflow: hidden; }
.hbar i { display: block; width: 100%; background: var(--gold-bank); border-radius: 4px; transition: height .3s var(--spring); }
.histwrap .noh { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ============ TOAST ============ */
#toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); z-index: 70; background: var(--text-primary); color: var(--ink-bg); font-size: 13px; font-weight: 700; padding: 10px 18px; border-radius: 22px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 300px; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
body.reduce-motion * { animation-duration: .001s !important; transition-duration: .001s !important; }
