/* Golden Gully 2.0.0: chunky glossy treasure in a sunburnt outback. */
@font-face { font-family: 'Alfa Slab One'; src: url(../fonts/alfa-slab-one.2.0.0.woff2) format('woff2'); font-display: block; }
@font-face { font-family: 'Nunito'; font-weight: 800; src: url(../fonts/nunito-800.2.0.0.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; font-weight: 600; src: url(../fonts/nunito-600.2.0.0.woff2) format('woff2'); font-display: swap; }

:root {
  --ol: #1E0E06; --wood: #7A5534; --brass: #D4A64A; --rim: #E8B84A; --cream: #FFF3DA; --tan: #F2D9A8;
  --ochre: #B5532A; --sienna: #8A3B1E; --dust: #E8B98A; --shaft: #3A2418; --gold: #F2C230; --goldhi: #FFF3B0; --goldlo: #A8740E;
  --sky: #7EC3E8; --sundown: #F29A4A; --dusk: #5B4A7A; --green: #2E9A4A; --red: #C4141E;
  --slab: 'Alfa Slab One', Georgia, serif; --body: 'Nunito', system-ui, sans-serif;
  --fs: 1; /* text size: 1 normal, 1.18 large */
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #140804; color: var(--cream); font-family: var(--body); font-weight: 800; overflow: hidden;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
body.large-text { --fs: 1.18; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
input { font: inherit; }
a { color: var(--goldhi); }
#app { position: fixed; inset: 0; height: 100dvh; overflow: hidden; }
canvas#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ------------------------------------------------------------ text helpers */
.slab { font-family: var(--slab); font-weight: 400; letter-spacing: .01em; }
.ink { color: var(--cream); text-shadow: 0 2px 0 var(--ol), 2px 0 0 var(--ol), -2px 0 0 var(--ol), 0 -2px 0 var(--ol), 2px 2px 0 var(--ol), -2px 2px 0 var(--ol), 2px -2px 0 var(--ol), -2px -2px 0 var(--ol), 0 4px 0 var(--ol); }
.ink-gold { color: var(--gold); text-shadow: 0 2px 0 #5a2a0a, 2px 0 0 #5a2a0a, -2px 0 0 #5a2a0a, 0 -2px 0 #5a2a0a, 2px 2px 0 #5a2a0a, -2px 2px 0 #5a2a0a, 2px -2px 0 #5a2a0a, -2px -2px 0 #5a2a0a, 0 5px 0 #3a1404; }
.label { font-size: calc(12px * var(--fs)); letter-spacing: .08em; color: var(--tan); text-transform: uppercase; }
.small { font-size: calc(13px * var(--fs)); font-weight: 600; color: var(--tan); }
.muted { opacity: .75; }

/* ------------------------------------------------------------ timber signs */
.sign { position: relative; border-radius: 14px; border: 4px solid var(--ol);
  background:
    repeating-linear-gradient(180deg, transparent 0 30px, rgba(0,0,0,.17) 30px 32px),
    linear-gradient(180deg, #B07A46 0, #8A5A30 12%, #6A4222 60%, #4E2E16 100%);
  box-shadow: 0 5px 0 var(--ol), 0 10px 18px rgba(0,0,0,.35); }
.sign::before { content: ''; position: absolute; inset: 4px; border-radius: 10px; border: 2px solid rgba(232,184,74,.9); pointer-events: none; }
.sign::after { content: ''; position: absolute; inset: 7px; pointer-events: none;
  background: radial-gradient(circle at 4px 4px, #FFE9A0 0 1.5px, var(--brass) 2px 4px, transparent 4.5px) top left / 12px 12px no-repeat,
              radial-gradient(circle at 8px 4px, #FFE9A0 0 1.5px, var(--brass) 2px 4px, transparent 4.5px) top right / 12px 12px no-repeat,
              radial-gradient(circle at 4px 8px, #FFE9A0 0 1.5px, var(--brass) 2px 4px, transparent 4.5px) bottom left / 12px 12px no-repeat,
              radial-gradient(circle at 8px 8px, #FFE9A0 0 1.5px, var(--brass) 2px 4px, transparent 4.5px) bottom right / 12px 12px no-repeat; }
.sign .edge { position: absolute; left: 12px; right: 12px; top: 1px; height: 2px; border-radius: 2px; background: #E8B07A; opacity: .9; }
.paper { background: linear-gradient(180deg, #FFF8E6, #F4E4C0); color: #3a2418; border: 4px solid var(--ol); border-radius: 12px; box-shadow: 0 5px 0 var(--ol), 0 10px 18px rgba(0,0,0,.3); }
.paper .label, .paper .small { color: #7a5a3a; }

/* ------------------------------------------------------------ buttons */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 22px;
  border-radius: 14px; border: 3.5px solid var(--ol); font-family: var(--slab); font-size: calc(20px * var(--fs)); color: #3a1404;
  background: linear-gradient(180deg, #FFF3B0 0, #FFD84A 30%, #F2B020 70%, #C8860E 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.75), inset 0 -3px 0 rgba(120,60,0,.35), 0 4px 0 var(--ol), 0 8px 14px rgba(0,0,0,.3);
  transition: transform .06s, box-shadow .06s; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn:active, .btn.down { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,.75), inset 0 -3px 0 rgba(120,60,0,.35), 0 0 0 var(--ol), 0 3px 6px rgba(0,0,0,.3); }
.btn.red { color: var(--cream); text-shadow: 0 2px 0 #4a0a0a; background: linear-gradient(180deg, #FF8A6A 0, #E8402A 35%, #B8201A 75%, #7A1010 100%); }
.btn.green { color: var(--cream); text-shadow: 0 2px 0 #0a3a14; background: linear-gradient(180deg, #9AF0A0 0, #3CC85A 35%, #1E9A3A 75%, #0E5A20 100%); }
.btn.wood { color: var(--cream); text-shadow: 0 2px 0 var(--ol); background: linear-gradient(180deg, #C08A56 0, #8A5A30 30%, #5A3618 100%); }
.btn.blue { color: var(--cream); text-shadow: 0 2px 0 #0a2040; background: linear-gradient(180deg, #9AD8FF 0, #3A9AE8 35%, #1E6AB8 75%, #0E3A70 100%); }
.btn.small { min-height: 42px; padding: 6px 14px; font-size: calc(16px * var(--fs)); border-radius: 12px; }
.btn.wide { width: 100%; }
.btn[disabled] { filter: grayscale(.8) brightness(.8); pointer-events: none; }
.btn .price { display: inline-flex; align-items: center; gap: 4px; font-size: .85em; }
.coin { display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; border: 2px solid #5a2a0a; vertical-align: -0.15em;
  background: radial-gradient(circle at 35% 30%, #FFF6C0 0, #F2C230 50%, #8A5A08 100%); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.iconbtn { width: 52px; height: 52px; border-radius: 14px; border: 3.5px solid var(--ol); display: grid; place-items: center;
  background: linear-gradient(180deg, #C08A56 0, #8A5A30 30%, #5A3618 100%); box-shadow: inset 0 2px 0 rgba(255,220,170,.5), 0 4px 0 var(--ol), 0 6px 10px rgba(0,0,0,.3); }
.iconbtn:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,220,170,.5), 0 0 0 var(--ol); }
.iconbtn svg { width: 30px; height: 30px; }

/* ------------------------------------------------------------ screens */
.screen { position: absolute; inset: 0; display: none; opacity: 0; transition: opacity .28s ease; }
.screen.on { display: block; }
.screen.vis { opacity: 1; }
.pad-safe { padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); }

/* title */
#s-title { display: none; text-align: center; }
#s-title.on { display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.logo { margin-top: max(4vh, calc(14px + var(--safe-t))); width: min(92vw, 560px); }
.logo svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 14px rgba(0,0,0,.35)); }
.title-menu { display: flex; flex-direction: column; gap: 12px; width: min(84vw, 360px); }
.title-menu .row { display: flex; gap: 10px; }
.title-menu .row .btn { flex: 1; }
.title-foot { padding-bottom: calc(12px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.promise { font-size: calc(13px * var(--fs)); color: var(--cream); text-shadow: 0 2px 0 var(--ol); }
.tg-mark { font-family: var(--slab); font-size: 13px; letter-spacing: .12em; color: var(--goldhi); opacity: .9; text-shadow: 0 2px 0 var(--ol); }
.camp-sign { align-self: center; font-size: calc(15px * var(--fs)); font-weight: 800; color: var(--cream); text-shadow: 0 1px 0 var(--ol); background: rgba(42,22,12,.78); border: 2px solid rgba(255,214,120,.55); border-radius: 999px; padding: 5px 16px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.camp-sign:empty { display: none; }

/* top bar used by map, town, modes */
.topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l)); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .grow { flex: 1; }
.topbar h2 { margin: 0; font-family: var(--slab); font-weight: 400; font-size: calc(24px * var(--fs)); }
.pouch-chip { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px 0 8px; border-radius: 26px; border: 3.5px solid var(--ol);
  background: linear-gradient(180deg, #6A3A1A, #4A240E 20%, #220E04); box-shadow: 0 4px 0 var(--ol); font-family: var(--slab); font-size: calc(20px * var(--fs)); color: #FFE27A; text-shadow: 0 2px 0 var(--ol); }
.pouch-chip .coin { width: 26px; height: 26px; }

/* map */
#s-map .scroller { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
#s-map { background: radial-gradient(ellipse at 50% 30%, #6A3A22, #2A160C 75%); }
#s-map .mapwrap { position: relative; margin: 0 auto; box-shadow: 0 0 0 4px var(--ol), 0 0 40px rgba(0,0,0,.6); }
#s-map .mapwrap svg { display: block; }
.peg { position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; border: 4px solid var(--ol);
  display: grid; place-items: center; font-family: var(--slab); font-size: 20px; color: #3a1404;
  background: radial-gradient(circle at 35% 30%, #FFF6C0, #F2C230 55%, #A8740E); box-shadow: 0 4px 0 var(--ol), 0 8px 12px rgba(0,0,0,.35); }
.peg.locked { background: radial-gradient(circle at 35% 30%, #c8c0b0, #8a8070 60%, #4a4440); color: #2a2420; }
.peg.tough { background: radial-gradient(circle at 35% 30%, #FFB0A0, #E8402A 55%, #7A1010); color: var(--cream); text-shadow: 0 2px 0 var(--ol); }
.peg.boss { width: 74px; height: 74px; margin: -37px 0 0 -37px; background: radial-gradient(circle at 35% 30%, #a0a0a8, #4a4a50 55%, #1a1a1e); color: #FFE27A; text-shadow: 0 2px 0 var(--ol); }
.peg.current { animation: pegPulse 1.2s ease-in-out infinite; }
.peg .stars { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); display: flex; gap: 0; }
.peg .stars i { width: 18px; height: 18px; display: block; background: no-repeat center / contain; }
.peg .tag { position: absolute; top: -12px; right: -14px; width: 30px; height: 30px; }
@keyframes pegPulse { 0%, 100% { box-shadow: 0 4px 0 var(--ol), 0 0 0 0 rgba(255,226,122,.8); } 50% { box-shadow: 0 4px 0 var(--ol), 0 0 0 14px rgba(255,226,122,0); } }
.gate-sign { position: absolute; left: 50%; transform: translate(-50%, -50%); width: min(86%, 340px); padding: 12px 14px; text-align: center; z-index: 2; }
.gate-sign .t { font-family: var(--slab); font-size: calc(17px * var(--fs)); }
.gate-sign .small { color: var(--tan); margin-top: 4px; }
.gate-sign .btn { margin-top: 8px; }
.map-blue { position: absolute; width: 64px; height: 77px; margin: -88px 0 0 10px; pointer-events: none; transition: left .6s, top .6s; }

/* town */
#s-town .pano { position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-x; overscroll-behavior: contain; scrollbar-width: none; }
#s-town .pano::-webkit-scrollbar { display: none; }
#s-town .panoin { position: relative; height: 100%; }
#s-town .panoin svg { height: 100%; width: auto; display: block; }
.plot { position: absolute; border-radius: 12px; }
.pan-arrow { position: absolute; bottom: calc(136px + var(--safe-b)); width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ol); background: rgba(58,36,24,.82); box-shadow: 0 3px 0 var(--ol); display: flex; align-items: center; justify-content: center; z-index: 2; transition: opacity .2s; padding: 0; }
.pan-arrow svg { width: 24px; height: 24px; }
.pan-arrow.r svg { transform: scaleX(-1); }
.pan-arrow.off { opacity: 0; pointer-events: none; }
.plot:focus-visible { outline: 3px solid #FFE27A; }
.plot .tagline { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); white-space: nowrap; padding: 4px 10px; border-radius: 10px; border: 3px solid var(--ol);
  background: #FFF3DA; color: #3a2418; font-size: calc(13px * var(--fs)); box-shadow: 0 3px 0 var(--ol); }
.plot .tagline.can { background: #FFE27A; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -5px); } }
.town-folk { position: absolute; left: 0; right: 0; top: calc(70px + var(--safe-t)); display: flex; justify-content: center; pointer-events: none; z-index: 4; }
.speech { display: flex; align-items: center; gap: 10px; max-width: min(94vw, 560px); padding: 8px 14px 8px 8px; border-radius: 16px; border: 3.5px solid var(--ol);
  background: #FFF8E6; color: #3a2418; box-shadow: 0 4px 0 var(--ol), 0 8px 14px rgba(0,0,0,.3); pointer-events: auto; font-size: calc(15px * var(--fs)); }
.speech .face { width: 54px; height: 54px; flex: none; }
.speech .who { font-family: var(--slab); font-size: calc(13px * var(--fs)); color: var(--sienna); }
.town-dock { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center; padding: 10px 8px calc(10px + var(--safe-b)); z-index: 4; }
.town-dock .btn { padding: 6px 12px; min-width: 0; }
@media (max-width: 400px) { .town-dock .btn { padding: 6px 9px; font-size: calc(15px * var(--fs)); } }
.stage-sign { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); padding: 6px 16px; z-index: 3; font-family: var(--slab); font-size: calc(18px * var(--fs)); white-space: nowrap; }
.build-anim { position: absolute; pointer-events: none; z-index: 3; }

/* modes */
.list { position: absolute; inset: 0; overflow-y: auto; padding: calc(78px + var(--safe-t)) 14px calc(20px + var(--safe-b)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); max-width: 1100px; margin: 0 auto; }
.mode-card { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.mode-card h3 { margin: 0; font-family: var(--slab); font-weight: 400; font-size: calc(22px * var(--fs)); }
.mode-card p { margin: 0; font-weight: 600; font-size: calc(14px * var(--fs)); color: var(--tan); line-height: 1.35; }
.mode-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-card .best { font-size: calc(14px * var(--fs)); color: #FFE27A; }
.mode-card.locked { filter: grayscale(.6) brightness(.8); }

/* ------------------------------------------------------------ game HUD */
#s-game { touch-action: none; pointer-events: none; }
#s-game .hud { pointer-events: none; }
.hud { position: absolute; z-index: 3; pointer-events: none; }
.hud > * { pointer-events: auto; }
.moves-sign { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.moves-sign .num { font-family: var(--slab); line-height: 1; }
.moves-sign.low .num { color: #FF9A8A; animation: lowPulse .9s ease-in-out infinite; }
@keyframes lowPulse { 50% { transform: scale(1.1); } }
.goal-sign { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; transform-origin: 50% -30px; }
.goal-sign.swing { animation: swing .9s ease-out; }
@keyframes swing { 20% { transform: rotate(3deg); } 45% { transform: rotate(-2deg); } 70% { transform: rotate(1deg); } 100% { transform: rotate(0); } }
.goal-sign .chains { position: absolute; top: -40px; left: 18%; right: 18%; height: 40px; pointer-events: none;
  background: repeating-linear-gradient(180deg, #6a6a72 0 6px, transparent 6px 9px) left / 4px 100% no-repeat, repeating-linear-gradient(180deg, #6a6a72 0 6px, transparent 6px 9px) right / 4px 100% no-repeat; }
.goal-sign .goals { display: flex; gap: 14px; align-items: center; justify-content: center; }
.goal { display: flex; align-items: center; gap: 6px; }
.goal .gi { width: 44px; height: 44px; flex: none; }
.goal .gn { font-family: var(--slab); line-height: 1; }
.goal .gsub { font-size: calc(12px * var(--fs)); color: var(--tan); }
.goal.done .gn::after { content: ' ✓'; color: #9AF0A0; }
.pouch { position: absolute; display: grid; place-items: center; }
.pouch svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pouch .num { position: relative; margin-top: 30%; font-family: var(--slab); color: #FFE27A; text-shadow: 0 2px 0 var(--ol), 2px 0 0 var(--ol), -2px 0 0 var(--ol), 0 -2px 0 var(--ol); }
.pouch.bulge { animation: bulge .35s ease-out; }
@keyframes bulge { 40% { transform: scale(1.14, 1.08); } }
.starbar { position: absolute; height: 16px; border-radius: 8px; background: #2a160c; border: 3px solid var(--ol); }
.starbar .fill { position: absolute; left: 2px; top: 2px; bottom: 2px; border-radius: 5px; background: linear-gradient(90deg, #F29A4A, #FFE27A); width: 0; transition: width .4s; }
.starbar .st { position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.fever { position: absolute; height: 44px; border-radius: 22px; background: #140804; border: 4px solid var(--ol); box-shadow: inset 0 0 0 2px var(--rim); }
.fever .lamp { position: absolute; left: 2px; top: -6px; width: 44px; height: 52px; }
.fever .bar { position: absolute; left: 48px; right: 50px; top: 9px; height: 18px; border-radius: 9px; background: #1a0e08; overflow: hidden; }
.fever .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 9px; background: linear-gradient(90deg, #F29A4A, #FFE27A); transition: width .35s; }
.fever .bar i::after { content: ''; position: absolute; left: 10px; right: 10px; top: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.55); }
.fever .bar b { position: absolute; inset: 0; text-align: center; font-family: var(--slab); font-weight: 400; font-size: 12px; line-height: 18px; color: #C08A52; letter-spacing: .06em; text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.fever .pct { position: absolute; right: 10px; top: 0; line-height: 36px; font-family: var(--slab); font-size: 13px; color: #FFE27A; }
.fever.on { box-shadow: inset 0 0 0 2px var(--rim), 0 0 22px 4px rgba(255,210,90,.75); }
.fever.on .bar b { color: #4A1A04; text-shadow: none; }
.bluedog { position: absolute; pointer-events: none; }
.bluedog img { width: 100%; height: 100%; display: block; transform-origin: 50% 100%; }
.bluedog.hop img { animation: hop .45s ease-out; }
@keyframes hop { 35% { transform: translateY(-14%) scale(1.04, .96); } 60% { transform: translateY(0) scale(.97, 1.03); } }
.bubble { position: absolute; max-width: 260px; padding: 10px 14px; border-radius: 18px; border: 3.5px solid var(--ol); background: #FFF8E6; color: #3a2418;
  font-size: calc(15px * var(--fs)); line-height: 1.3; box-shadow: 0 4px 0 var(--ol); opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s; pointer-events: none; }
.bubble.on { opacity: 1; transform: none; }
.bubble::after { content: ''; position: absolute; right: -14px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-left: 14px solid var(--ol); border-right: 0; }
.belt { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #6A3A1A, #4A240E 15%, #220E04); border-top: 3px dashed var(--brass); padding: 10px 8px calc(10px + var(--safe-b)); }
.tool { position: relative; width: 76px; height: 72px; border-radius: 14px; border: 3.5px solid var(--ol); color: var(--cream); font-size: calc(14px * var(--fs));
  background: linear-gradient(180deg, #B07A46, #8A5A30 12%, #4E2E16); box-shadow: inset 0 0 0 2px rgba(232,184,74,.8), 0 5px 0 var(--ol); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 6px; text-shadow: 0 2px 0 var(--ol); }
.tool svg { width: 34px; height: 34px; position: absolute; top: 7px; left: 50%; margin-left: -17px; }
.tool .cost { position: absolute; top: -12px; right: -10px; min-width: 32px; height: 32px; padding: 0 4px; border-radius: 16px; border: 2.5px solid #5a2a0a; display: grid; place-items: center;
  font-family: var(--slab); font-size: 14px; color: #3a1404; text-shadow: none; background: radial-gradient(circle at 35% 30%, #FFF6C0, #F2C230 55%, #A8740E); }
.tool .cost.free { background: radial-gradient(circle at 35% 30%, #c8ffd0, #3CC85A 55%, #0E5A20); color: #fff; text-shadow: 0 1px 0 #0a3a14; }
.tool:active { transform: translateY(4px); box-shadow: inset 0 0 0 2px rgba(232,184,74,.8), 0 1px 0 var(--ol); }
.tool.armed { box-shadow: inset 0 0 0 2px rgba(232,184,74,.8), 0 5px 0 var(--ol), 0 0 0 4px #FFE27A; }
.tool[disabled] { filter: grayscale(.9) brightness(.7); pointer-events: none; }
.belt .pause { width: 56px; height: 56px; }
.timer { position: absolute; font-family: var(--slab); text-align: center; }
.notice { position: absolute; z-index: 6; left: 50%; transform: translate(-50%, -8px); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
  padding: 8px 16px; border-radius: 14px; border: 3.5px solid var(--ol); background: #FFF8E6; color: #3a2418; box-shadow: 0 4px 0 var(--ol); font-size: calc(15px * var(--fs)); text-align: center; max-width: 92vw; }
.notice.on { opacity: 1; transform: translate(-50%, 0); }
.notice { bottom: calc(150px + var(--safe-b)); }
#app[data-screen="s-game"] .notice { bottom: auto; top: var(--notice-top, 24%); }
#app[data-screen="s-map"] .notice { bottom: calc(40px + var(--safe-b)); }
.praise { position: absolute; z-index: 4; left: 50%; pointer-events: none; font-family: var(--slab); font-size: 40px; white-space: nowrap; transform: translate(-50%, -50%) rotate(-5deg) scale(0); opacity: 0; }
.praise.go { animation: praise 1.1s ease-out forwards; }
@keyframes praise { 0% { transform: translate(-50%, -50%) rotate(-5deg) scale(.3); opacity: 0; } 18% { transform: translate(-50%, -50%) rotate(-5deg) scale(1.15); opacity: 1; } 30% { transform: translate(-50%, -50%) rotate(-5deg) scale(1); } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) rotate(-5deg) scale(1); opacity: 0; } }
.hand { position: absolute; z-index: 5; width: 54px; height: 54px; pointer-events: none; }
.tut-line { position: absolute; z-index: 5; display: flex; align-items: center; gap: 8px; pointer-events: none; padding: 6px 12px 6px 6px; border-radius: 16px; border: 3.5px solid var(--ol);
  background: #FFF8E6; color: #3a2418; box-shadow: 0 4px 0 var(--ol); font-size: calc(15px * var(--fs)); line-height: 1.25; opacity: 0; transition: opacity .3s; }
.tut-line.on { opacity: 1; }
.tut-line .face { width: 44px; height: 44px; flex: none; }

/* ------------------------------------------------------------ modals */
.veil { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(20,8,3,.62); padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); }
.veil.on { display: flex; }
.modal { width: min(94vw, 440px); max-height: 100%; overflow-y: auto; padding: 18px 16px 16px; animation: pop .28s cubic-bezier(.2,1.4,.4,1); text-align: center; overscroll-behavior: contain; }
.modal.wide { width: min(96vw, 720px); }
@keyframes pop { from { transform: scale(.8) translateY(20px); opacity: 0; } }
.modal h2 { margin: 2px 0 10px; font-family: var(--slab); font-weight: 400; font-size: calc(28px * var(--fs)); line-height: 1.1; }
.modal h3 { margin: 12px 0 6px; font-family: var(--slab); font-weight: 400; font-size: calc(18px * var(--fs)); }
.modal p { margin: 6px 0; font-weight: 600; font-size: calc(15px * var(--fs)); line-height: 1.4; color: var(--tan); }
.modal .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.modal .actions.row { flex-direction: row; }
.modal .actions.row .btn { flex: 1; }
.modal .close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 12px; z-index: 2; font-family: var(--slab); font-size: 20px; color: var(--cream); border: 3px solid var(--ol); background: #5a3618; box-shadow: 0 3px 0 var(--ol); }
.stars-big { display: flex; justify-content: center; gap: 4px; margin: 4px 0 6px; }
.stars-big i { width: 64px; height: 64px; display: block; background: no-repeat center / contain; transform: scale(0); }
.stars-big i:nth-child(2) { margin-top: -14px; width: 76px; height: 76px; }
.stars-big i.pop { animation: starPop .45s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.tally { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; margin: 8px auto; max-width: 300px; font-size: calc(16px * var(--fs)); }
.tally .v { text-align: right; font-family: var(--slab); color: #FFE27A; }
.boosters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.booster { position: relative; border-radius: 12px; border: 3px solid var(--ol); padding: 6px 2px 6px; background: #3a2010; color: var(--cream); font-size: calc(12px * var(--fs)); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 96px; }
.booster svg { width: 40px; height: 40px; }
.booster.on { background: #6a8a2a; box-shadow: inset 0 0 0 3px #FFE27A; }
.booster .p { font-family: var(--slab); color: #FFE27A; font-size: 13px; }
.booster .tick { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ol); background: #3CC85A; display: none; place-items: center; color: #fff; font-size: 15px; }
.booster.on .tick { display: grid; }
.booster .free { position: absolute; top: -8px; left: -6px; padding: 1px 6px; border-radius: 8px; border: 2px solid var(--ol); background: #3CC85A; color: #fff; font-size: 11px; }
.field { display: flex; flex-direction: column; gap: 4px; text-align: left; margin: 8px 0; }
.field input[type=text] { height: 50px; border-radius: 12px; border: 3.5px solid var(--ol); padding: 0 14px; font-size: calc(18px * var(--fs)); color: #3a2418; background: #FFF8E6; font-weight: 800; }
.badges { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 6px 0; }
.badges button { height: 40px; border-radius: 10px; font-size: 22px; border: 2.5px solid transparent; background: rgba(0,0,0,.25); }
.badges button.on { border-color: #FFE27A; background: rgba(255,226,122,.25); }
.err { color: #FF9A8A; font-size: calc(14px * var(--fs)); min-height: 1.2em; }
.notice-line { font-weight: 600; font-size: calc(13px * var(--fs)); color: var(--tan); line-height: 1.35; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 2px solid rgba(0,0,0,.2); text-align: left; font-size: calc(15px * var(--fs)); }
.set-row .small { display: block; font-size: calc(12px * var(--fs)); }
.set-row.stack { flex-direction: column; align-items: stretch; }
.set-row.stack .skins { justify-content: center; margin-top: 6px; }
.toggle { width: 62px; height: 34px; border-radius: 17px; border: 3px solid var(--ol); background: #3a2010; position: relative; flex: none; }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #c8b8a0; transition: left .15s; }
.toggle.on { background: #3CC85A; }
.toggle.on::after { left: 31px; background: #fff; }
input[type=range] { width: 46%; accent-color: #F2C230; }
.seg { display: flex; border: 3px solid var(--ol); border-radius: 12px; overflow: hidden; flex: none; }
.seg button { padding: 6px 10px; background: #3a2010; font-size: calc(13px * var(--fs)); }
.seg button.on { background: #F2C230; color: #3a1404; }
.skins { display: flex; gap: 8px; }
.skins button { width: 64px; height: 64px; border-radius: 12px; border: 3px solid var(--ol); background: #1a0c06; padding: 4px; position: relative; }
.skins button.on { box-shadow: 0 0 0 3px #FFE27A; }
.skins button[disabled] { filter: grayscale(1) brightness(.5); }
.skins button span { position: absolute; bottom: -2px; left: 0; right: 0; font-size: 10px; text-shadow: 0 1px 0 #000; }
.built-with { font-size: 12px; color: var(--tan); margin-top: 12px; font-weight: 600; }

/* leaderboard */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.tabs button { padding: 6px 12px; border-radius: 10px; border: 3px solid var(--ol); background: #3a2010; font-size: calc(13px * var(--fs)); }
.tabs button.on { background: #F2C230; color: #3a1404; }
.lb { text-align: left; margin-top: 6px; }
.lb .r { display: grid; grid-template-columns: 40px 32px 1fr auto; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: calc(15px * var(--fs)); }
.lb .r:nth-child(odd) { background: rgba(0,0,0,.18); }
.lb .r.me { background: rgba(255,226,122,.3); box-shadow: inset 0 0 0 2px #FFE27A; }
.lb .r .rk { font-family: var(--slab); color: #FFE27A; text-align: right; }
.lb .r .sc { font-family: var(--slab); }
.lb .gap { text-align: center; opacity: .6; }

/* finds cabinet */
.cabinet { display: grid; gap: 12px; text-align: left; }
.fset { padding: 10px; border-radius: 12px; background: rgba(0,0,0,.22); border: 2px solid rgba(232,184,74,.5); }
.fset h3 { margin: 0 0 6px; }
.fset .slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.fslot { aspect-ratio: 1; border-radius: 10px; background: linear-gradient(180deg, rgba(180,220,255,.18), rgba(120,160,200,.08)); border: 2px solid rgba(255,255,255,.25); display: grid; place-items: center; }
.fslot svg { width: 86%; height: 86%; }
.fslot.empty svg { filter: brightness(0) opacity(.35); }
.fslot.spin svg { animation: spin 2.4s linear; }
@keyframes spin { to { transform: rotateY(360deg); } }

/* gazette */
.gazette { background: linear-gradient(180deg, #F8F0DC, #E8DCC0); color: #2a1a10; border: 4px solid var(--ol); border-radius: 6px; padding: 14px; text-align: left; transform: rotate(-1.5deg); animation: flutter .8s cubic-bezier(.2,1.2,.4,1); }
@keyframes flutter { from { transform: translateY(-120vh) rotate(25deg); } 70% { transform: rotate(-4deg); } }
.gazette .mast { font-family: var(--slab); font-size: calc(30px * var(--fs)); text-align: center; border-bottom: 3px double #2a1a10; padding-bottom: 4px; }
.gazette .date { text-align: center; font-size: 12px; border-bottom: 1px solid #2a1a10; padding: 3px 0; margin-bottom: 8px; }
.gazette .head { font-family: var(--slab); font-size: calc(22px * var(--fs)); line-height: 1.1; margin: 6px 0; text-align: center; }
.gazette .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: calc(13px * var(--fs)); font-weight: 600; }
.gazette h4 { margin: 6px 0 2px; font-family: var(--slab); font-weight: 400; font-size: 14px; }
.gazette p { color: #2a1a10; font-size: calc(13px * var(--fs)); margin: 2px 0; }

/* cold open */
#s-cold { background: #000; }
#s-cold .line { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); width: min(92vw, 520px); }
#s-cold .skip { position: absolute; right: calc(14px + var(--safe-r)); top: calc(14px + var(--safe-t)); font-size: 14px; color: var(--tan); padding: 10px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0; }
.cal div { aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-size: 13px; background: rgba(0,0,0,.25); }
.cal div.done { background: #F2C230; color: #3a1404; }
.cal div.today { box-shadow: inset 0 0 0 2.5px #FFE27A; }
.cal div.h { background: none; font-size: 11px; color: var(--tan); }

.hide { display: none !important; }
.ios-guide { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
.ios-guide div { flex: 1; padding: 8px; border-radius: 12px; background: rgba(0,0,0,.25); font-size: 13px; }
.ios-guide svg { width: 46px; height: 46px; display: block; margin: 0 auto 4px; }

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