/* =====================================================================================================
   UCA The Black - interface in the spirit of a phone's own dark mode: true black, layered greys,
   frosted materials, one system font, continuous rounded corners, springy motion. The game world keeps
   its own look; only the interface around it follows these rules.
   ===================================================================================================== */
:root {
  /* the layers of dark: black canvas, then three raised greys */
  --bg: #000; --g1: #1c1c1e; --g2: #2c2c2e; --g3: #3a3a3c; --g4: #48484a;
  --sep: rgba(84, 84, 88, 0.55); --fill: rgba(118, 118, 128, 0.24); --fill2: rgba(118, 118, 128, 0.16);
  --label: #fff; --label2: rgba(235, 235, 245, 0.62); --label3: rgba(235, 235, 245, 0.32);
  --tint: #5ce1e6; --tint-ink: #00282b; --red: #ff453a; --green: #30d158; --yellow: #ffd60a; --orange: #ff9f0a;
  --material: rgba(30, 30, 32, 0.72); --material-thin: rgba(30, 30, 32, 0.5);
  --blur: blur(30px) saturate(180%);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --r-xl: 28px; --r-l: 20px; --r-m: 14px; --r-s: 10px;
  /* legacy names still used by the game code and the ghost subtitles */
  --ink: #050507; --bone: #f2f2f7; --muted: var(--label2); --ember: var(--tint); --eye: #ff5d6c;
  --line: var(--sep); --glass: var(--material);
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
  --rounded: ui-rounded, 'SF Pro Rounded', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: 'New York', ui-serif, 'Iowan Old Style', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); font-family: var(--sans); font-size: 16px; overflow: hidden; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--tint); text-decoration: none; }
kbd { display: inline-block; min-width: 1.7em; padding: 1px 6px; margin: 0 1px; border-radius: 6px; font: 600 12px var(--rounded); text-align: center; background: var(--g3); color: var(--label); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6); }
.muted { color: var(--label2); }
.center { text-align: center; }

/* ---------- buttons: filled, tinted, plain ---------- */
.screen button, .card button { display: block; width: 100%; padding: 13px 16px; margin: 7px 0; border: 0; border-radius: var(--r-m); background: var(--fill); color: var(--label); font: 600 1rem var(--sans); letter-spacing: -0.01em; transition: transform 0.25s var(--spring), background 0.2s, filter 0.2s; }
.screen button:hover, .card button:hover { background: rgba(118, 118, 128, 0.32); }
.screen button:active, .card button:active { transform: scale(0.97); filter: brightness(1.15); }
button.primary { background: var(--tint); color: var(--tint-ink); font-size: 1.06rem; box-shadow: 0 6px 24px rgba(92, 225, 230, 0.25); }
button.primary:hover { background: #77e8ec; }
button.primary small { display: block; font-weight: 500; font-size: 0.78rem; opacity: 0.7; margin-top: 1px; }
button.ghost { background: transparent; color: var(--tint); }
button.ghost:hover { background: var(--fill2); }
button.danger { background: rgba(255, 69, 58, 0.16); color: var(--red); width: auto; }
.row { display: flex; gap: 8px; }
.row > button { flex: 1; }
.small { padding: 7px 14px !important; width: auto !important; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.screen.dim { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes cardIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.card { width: min(400px, 100%); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: var(--r-xl); padding: 24px 20px 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), inset 0 0.5px 0 rgba(255, 255, 255, 0.12); text-align: center; animation: popIn 0.45s var(--spring); }
.card h2 { font: 700 1.6rem/1.15 var(--display); letter-spacing: -0.02em; margin: 2px 0 6px; }
.kicker { font: 600 0.72rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tint); }

/* title */
.title { justify-content: space-between; padding-top: 8vh; pointer-events: none; }
.title > * { pointer-events: auto; }
.brand { text-align: center; }
.brand .kicker { color: rgba(255, 255, 255, 0.55); letter-spacing: 0.5em; font-weight: 700; }
.brand h1 { font: 700 clamp(3rem, 11vw, 6.2rem)/0.95 var(--serif); letter-spacing: -0.01em; margin: 8px 0 0; color: #050507; -webkit-text-stroke: 0.8px rgba(255, 255, 255, 0.28); text-shadow: 0 0 50px rgba(255, 255, 255, 0.35); }
.brand .sub { font: italic 500 clamp(1.05rem, 2.8vw, 1.5rem) var(--serif); margin: 8px 0 0; color: rgba(255, 255, 255, 0.92); text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.menu { width: min(440px, 100%); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: var(--r-xl); padding: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 0.5px 0 rgba(255, 255, 255, 0.12); animation: popIn 0.6s var(--spring); }
.menu .row button { font-size: 0.92rem; padding: 12px 8px; }
.menu .foot { margin: 10px 0 2px; font-size: 0.76rem; color: var(--label3); text-align: center; }
.menu .foot a { color: var(--label2); }

/* every list screen is one card in the middle of the screen, whatever the device */
.screen.sheet { inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(920px, calc(100vw - 24px)); max-height: min(86vh, calc(100dvh - 24px)); justify-content: flex-start; align-items: stretch; padding: 0 18px 18px; overflow-y: auto; overscroll-behavior: contain; background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: var(--r-xl); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5), 0 40px 120px rgba(0, 0, 0, 0.7), inset 0 0.5px 0 rgba(255, 255, 255, 0.12); animation: cardIn 0.5s var(--spring); scrollbar-width: thin; scrollbar-color: var(--g3) transparent; }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; margin: 0 -18px 12px; padding: 16px 18px 12px; background: linear-gradient(var(--g1) 70%, rgba(28, 28, 30, 0)); border-radius: var(--r-xl) var(--r-xl) 0 0; }
.sheet-head h2 { font: 700 1.55rem var(--display); letter-spacing: -0.02em; margin: 0; flex: 1; }
.sheet-head button { width: auto; margin: 0; padding: 8px 14px; border-radius: 99px; }
.sheet > p.muted { margin: -4px 0 14px; font-size: 0.9rem; }
.sheet > * { flex-shrink: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--fill); font: 600 0.9rem var(--rounded); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 10px var(--tint); display: inline-block; }

/* missions: grouped cards */
.mlist { width: 100%; display: grid; gap: 14px; }
.chapter { border-radius: var(--r-l); padding: 14px; background: var(--g1); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.06); }
.chapter header span { font: 600 0.72rem var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--label3); }
.chapter header h3 { font: 700 1.2rem var(--display); letter-spacing: -0.01em; margin: 2px 0; }
.chapter header p { margin: 0 0 12px; color: var(--label2); font-size: 0.88rem; }
.chapter.c1 header span { color: #64d2ff; } .chapter.c2 header span { color: var(--orange); } .chapter.c3 header span { color: #bf5af2; } .chapter.c4 header span { color: var(--red); }
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .mgrid { grid-template-columns: repeat(2, 1fr); } }
.mcard { text-align: left !important; margin: 0 !important; position: relative; min-height: 96px; background: var(--g2) !important; border-radius: var(--r-m) !important; }
.mcard:hover { background: var(--g3) !important; }
.mcard .num { position: absolute; right: 12px; top: 8px; font: 700 1.5rem var(--rounded); color: var(--label3); }
.mcard b { display: block; font: 600 0.98rem var(--sans); margin-bottom: 6px; padding-right: 22px; }
.mcard small { display: block; color: var(--label2); font-weight: 400; font-size: 0.75rem; margin-top: 6px; }
.mcard.locked { opacity: 0.35; cursor: default; }
.stars i, .rstars .star { display: inline-block; width: 13px; height: 13px; margin-right: 3px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: var(--g4); }
.stars i.on, .rstars li.on .star { background: var(--yellow); }

/* result */
.rstars { list-style: none; padding: 0; margin: 14px 0; text-align: left; border-radius: var(--r-m); overflow: hidden; background: var(--fill2); }
.rstars li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: var(--label3); font-weight: 500; }
.rstars li + li { box-shadow: inset 0 0.5px 0 var(--sep); }
.rstars li.on { color: var(--label); }
.rstars .star { width: 18px; height: 18px; }
.rstars li.on .star { animation: pop 0.6s var(--spring) both; }
.rstars li.on:nth-child(2) .star { animation-delay: 0.2s; }
.rstars li.on:nth-child(3) .star { animation-delay: 0.4s; }
@keyframes pop { 0% { transform: scale(0.2) rotate(-60deg); } 100% { transform: none; } }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 12px; }
.tiles div { padding: 10px 6px; border-radius: var(--r-m); background: var(--fill2); }
.tiles span { display: block; font: 600 0.66rem var(--sans); color: var(--label3); text-transform: uppercase; letter-spacing: 0.06em; }
.tiles b { font: 700 1.15rem var(--rounded); }

/* wardrobe */
.skins { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.skin { margin: 0 !important; text-align: center; background: var(--g1) !important; border-radius: var(--r-l) !important; padding: 14px 12px !important; }
.skin canvas { display: block; margin: 0 auto 8px; width: 96px; height: 96px; }
.skin b { display: block; font: 600 0.98rem var(--sans); }
.skin small { display: block; color: var(--label2); font-weight: 400; min-height: 2.6em; font-size: 0.78rem; margin-top: 2px; }
.skin .act { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 99px; background: var(--fill); font: 600 0.78rem var(--rounded); }
.skin.on { box-shadow: 0 0 0 2px var(--tint) inset; }
.skin.on .act { background: var(--tint); color: var(--tint-ink); }

/* settings: an inset grouped list with switches and segmented controls */
.opts { width: 100%; max-width: 620px; margin: 0 auto 14px; border-radius: var(--r-m); background: var(--g1); overflow: hidden; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 14px; }
.opt + .opt { box-shadow: inset 0 0.5px 0 var(--sep); }
.opt > span { font-size: 0.98rem; }
.opt > button { width: auto !important; margin: 0 !important; }
/* the switch */
.tog { position: relative; width: 51px !important; height: 31px; padding: 0 !important; border-radius: 99px !important; background: rgba(120, 120, 128, 0.32) !important; font-size: 0 !important; color: transparent !important; transition: background 0.25s; }
.tog::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.35s var(--spring); }
.tog.on { background: var(--green) !important; }
.tog.on::after { transform: translateX(20px); }
.opt > button.tog:not(.wide) { width: 51px !important; flex: none; }
.opt > button.tog.wide { width: auto !important; font-size: 0.95rem !important; color: var(--label2) !important; background: transparent !important; padding: 0 4px !important; }
.opt > button.tog.wide::after { display: none; }
.seg { display: flex; padding: 2px; border-radius: 9px; background: rgba(118, 118, 128, 0.24); }
.seg button { width: auto !important; margin: 0 !important; padding: 6px 14px; border-radius: 7px !important; background: transparent !important; font: 600 0.85rem var(--sans) !important; transition: background 0.25s; }
.seg button.on { background: #636366 !important; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); }

/* how to play */
.howto { width: 100%; display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .howto { grid-template-columns: 1fr; } }
.howto > div { background: var(--g1); border-radius: var(--r-l); padding: 14px 16px; }
.howto h3 { font: 700 1.05rem var(--display); margin: 4px 0 10px; }
.howto dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; }
.howto dt { white-space: nowrap; font-size: 0.88rem; }
.howto dd { margin: 0; color: var(--label2); font-size: 0.88rem; }
.howto ul { margin: 0; padding-left: 18px; color: var(--label2); display: grid; gap: 7px; font-size: 0.9rem; }

/* ---------- HUD: frosted capsules ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.hud-block { background: var(--material-thin); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: 18px; padding: 8px 12px; box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.1); }
.hud-block.right { display: flex; align-items: center; gap: 8px; pointer-events: auto; padding: 6px 6px 6px 12px; border-radius: 99px; }
.hud-name { font: 600 0.9rem var(--sans); white-space: nowrap; letter-spacing: -0.01em; }
.hud-way { height: 3px; width: 140px; background: rgba(255, 255, 255, 0.12); border-radius: 3px; margin-top: 6px; overflow: hidden; }
#bar-way { height: 100%; width: 0; background: var(--tint); border-radius: 3px; transition: width 0.4s var(--spring); }
.stats { display: flex; gap: 14px; border-radius: 99px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font: 600 0.92rem var(--rounded); font-variant-numeric: tabular-nums; }
.stat.ember i { width: 9px; height: 9px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 8px var(--tint); }
.stat.deaths i { width: 11px; height: 9px; border-radius: 50%; background: #e5e5ea; box-shadow: inset 0 0 0 2.5px var(--red); }
.meter { display: flex; align-items: center; gap: 7px; font: 600 0.7rem var(--sans); color: var(--label2); }
.meter .track { width: 64px; height: 5px; background: rgba(255, 255, 255, 0.14); border-radius: 4px; overflow: hidden; }
#bar-shroud { height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #8e8e93, #f2f2f7); }
#bar-shroud.low { background: var(--red); opacity: 0.8; }
#bar-air { height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #64d2ff, #e4f7ff); transition: width 0.1s linear; }
#bar-air.low { background: var(--red); animation: airlow 0.8s ease-in-out infinite; }
@keyframes airlow { 50% { opacity: 0.45; } }
.meter.air span { color: #9fe3ff; }
.pip { font: 600 0.7rem var(--sans); padding: 4px 9px; border-radius: 99px; background: var(--fill); color: var(--label3); transition: all 0.3s var(--spring); }
.pip.ready { color: var(--tint-ink); background: var(--tint); }
.icon { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); font-size: 0.85rem; padding: 0; transition: transform 0.25s var(--spring); }
.icon:active { transform: scale(0.9); }
@media (max-width: 720px) { .meter span, .pip { display: none; } .hud-way { width: 90px; } .hud-name { font-size: 0.8rem; } .stats { gap: 9px; } }

/* tips: a banner that slides up, like a notification */
.tipbar { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 30px) scale(0.96); opacity: 0; transition: opacity 0.35s, transform 0.55s var(--spring); max-width: min(620px, 92vw); padding: 12px 16px; border-radius: var(--r-l); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), inset 0 0.5px 0 rgba(255, 255, 255, 0.12); font-size: 0.9rem; text-align: center; }
.tipbar b { color: var(--tint); margin-right: 6px; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; }
.tipbar.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#hud:has(#touch:not(.hidden)) .tipbar { bottom: auto; top: 118px; font-size: 0.8rem; max-width: min(520px, 70vw); padding: 9px 13px; }
/* short notes (caught, checkpoint): a small capsule */
.toast { position: fixed; left: 50%; top: max(96px, calc(env(safe-area-inset-top) + 86px)); transform: translate(-50%, -8px) scale(0.9); opacity: 0; transition: opacity 0.3s, transform 0.5s var(--spring); padding: 7px 16px; border-radius: 99px; background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font: 500 0.9rem var(--sans); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* touch: ghost controls - nearly invisible glass with drawn corners, so the world stays visible */
#touch { position: fixed; inset: 0; pointer-events: none; }
#touch button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; padding: 0; color: rgba(232, 226, 208, 0.7); background: rgba(5, 5, 7, 0.2); border: 1px solid rgba(232, 226, 208, 0.14); transition: background 0.12s, transform 0.08s, box-shadow 0.15s, color 0.15s; }
#touch svg { width: 44%; height: 44%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
.g-arrows { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 12px; }
.g-arrow { position: relative; width: 78px; height: 78px; border-radius: 18px; }
/* drawn corners: four little brackets, like the frame of an old lantern */
.g-arrow::before, .g-arrow::after, .g-leap::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 1.5px, linear-gradient(var(--c), var(--c)) top left / 1.5px 14px,
    linear-gradient(var(--c), var(--c)) top right / 14px 1.5px, linear-gradient(var(--c), var(--c)) top right / 1.5px 14px,
    linear-gradient(var(--c), var(--c)) bottom left / 14px 1.5px, linear-gradient(var(--c), var(--c)) bottom left / 1.5px 14px,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 1.5px, linear-gradient(var(--c), var(--c)) bottom right / 1.5px 14px;
  background-repeat: no-repeat; --c: rgba(232, 226, 208, 0.55); }
.g-arrow::after { display: none; }
.g-act { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 150px; height: 140px; }
.g-leap { position: absolute; right: 0; bottom: 0; width: 92px; height: 92px; border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(5, 5, 7, 0.12), 0 0 0 1px rgba(92, 225, 230, 0.12); }
.g-leap::before { border-radius: 50%; background: none; border: 1.5px solid transparent; border-top-color: rgba(232, 226, 208, 0.55); border-bottom-color: rgba(232, 226, 208, 0.55); transform: rotate(45deg); }
.g-leap .i-enter { display: none; }
.g-leap[data-alt="up"] { color: #eafdff; box-shadow: 0 0 0 1px rgba(92, 225, 230, 0.6), 0 0 18px rgba(92, 225, 230, 0.35); }
.g-leap[data-alt="up"] .i-leap { display: none; }
.g-leap[data-alt="up"] .i-enter { display: inline; }
.g-mini { position: absolute; width: 44px; height: 44px; border-radius: 50%; color: rgba(232, 226, 208, 0.5) !important; }
.g-mini.rush { right: 100px; bottom: 4px; }
.g-mini.shroud { right: 74px; bottom: 76px; }
#touch button.down { background: rgba(92, 225, 230, 0.16); color: #eafdff; transform: scale(0.95); box-shadow: 0 0 16px rgba(92, 225, 230, 0.35); }
#touch button.down::before { --c: rgba(92, 225, 230, 0.9); }
@media (max-height: 420px) { .g-arrow { width: 66px; height: 66px; } .g-leap { width: 80px; height: 80px; } .g-act { width: 136px; height: 124px; } .g-mini.shroud { bottom: 66px; } .g-mini.rush { right: 88px; } }

/* story */
#story-ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.subtitle { position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%); width: min(860px, 92vw); margin: 0; text-align: center; font-family: var(--serif); font-size: clamp(1.05rem, 2.5vw, 1.55rem); line-height: 1.5; color: #f6f1e4; opacity: 0; }
.skip { position: absolute; right: 16px; top: max(14px, env(safe-area-inset-top)); pointer-events: auto; border: 1px solid var(--line); border-radius: 99px; background: rgba(0, 0, 0, 0.4); }

@media (prefers-reduced-motion: reduce) { .rstars li.on .star { animation: none; opacity: 1; } }

/* narrator subtitles during play (where they sit; the look is .ghost-sub) */
.game-sub { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); margin: 0; width: max-content; max-width: min(760px, 92vw); font-family: var(--serif); font-size: clamp(1rem, 2.1vw, 1.25rem); line-height: 1.45; text-align: center; color: #f6f1e4; opacity: 0; pointer-events: none; }
#hud:has(#touch:not(.hidden)) .game-sub { bottom: max(14px, env(safe-area-inset-bottom)); max-width: min(440px, 46vw); font-size: 0.95rem; }

/* ================= ghost subtitles ================= */
.ghost-sub { --tint: 210, 235, 238; --glow: 92, 225, 230; isolation: isolate; padding: 14px 26px 16px; transition: opacity 0.6s; }
.ghost-sub.show { opacity: 1; }
.ghost-sub.ch-2 { --tint: 240, 214, 170; --glow: 255, 170, 90; }
.ghost-sub.ch-3 { --tint: 220, 214, 245; --glow: 182, 156, 255; }
.ghost-sub.ch-4 { --tint: 250, 225, 215; --glow: 255, 93, 108; }
/* the veil: a soft wisp of smoke behind the words that slowly drifts and breathes */
.ghost-sub .veil { position: absolute; inset: -10px -40px; z-index: -1; border-radius: 50%;
  background:
    radial-gradient(40% 60% at 30% 55%, rgba(0, 0, 0, 0.72), transparent 70%),
    radial-gradient(45% 70% at 70% 45%, rgba(0, 0, 0, 0.66), transparent 72%),
    radial-gradient(60% 90% at 50% 50%, rgba(var(--tint), 0.07), transparent 75%);
  background-size: 160% 100%, 150% 110%, 100% 100%;
  filter: blur(10px); animation: veilIn 1.2s ease-out both, veil 9s ease-in-out 1.2s infinite alternate; }
@keyframes veil { from { background-position: 0% 50%, 100% 40%, 50% 50%; transform: scale(1); } to { background-position: 100% 60%, 0% 50%, 50% 50%; transform: scale(1.06); } }
@keyframes veilIn { from { opacity: 0; transform: scaleX(0.6); } to { opacity: 1; transform: none; } }
.ghost-sub .txt { position: relative; }
/* each word condenses out of smoke, then breathes a little */
.ghost-sub .w { display: inline-block; opacity: 0; color: rgb(var(--tint)); text-shadow: 0 0 14px rgba(var(--tint), 0.35), 0 2px 10px #000;
  animation: wordIn 1.1s cubic-bezier(.2, .7, .2, 1) var(--d) forwards, breathe 5s ease-in-out calc(var(--d) + 1.1s) infinite; }
@keyframes wordIn { 0% { opacity: 0; filter: blur(9px); transform: translateY(10px) scale(1.15); letter-spacing: 0.25em; } 60% { opacity: 1; filter: blur(1px); } 100% { opacity: 1; filter: blur(0); transform: none; letter-spacing: normal; } }
@keyframes breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--j) * 0.5px - 1px)); } }
/* key words carry their own light */
.ghost-sub .k-eye { color: #ffd7db; text-shadow: 0 0 12px rgba(255, 93, 108, 0.9), 0 0 2px #ff5d6c, 0 2px 8px #000; }
.ghost-sub .k-light { color: #e9fdff; text-shadow: 0 0 14px rgba(92, 225, 230, 0.95), 0 0 30px rgba(92, 225, 230, 0.45), 0 2px 8px #000; }
.ghost-sub .k-king { color: #efe6ff; text-shadow: 0 0 14px rgba(182, 156, 255, 0.9), 0 2px 8px #000; }
.ghost-sub .k-shadow { color: #c9cdd3; text-shadow: 0 0 2px #000, 0 0 6px #000, 0 0 14px #000, 0 0 26px rgba(0, 0, 0, 0.95); letter-spacing: 0.03em; }
.ghost-sub .k-grin { color: #ffe1c2; text-shadow: 0 0 12px rgba(255, 138, 61, 0.85), 0 2px 8px #000; }
.ghost-sub .k-water { color: #dff6fa; text-shadow: 0 0 10px rgba(160, 225, 235, 0.8), 0 2px 8px #000; animation: wordIn 1.1s cubic-bezier(.2, .7, .2, 1) var(--d) forwards, ripple 2.6s ease-in-out calc(var(--d) + 1.1s) infinite; }
@keyframes ripple { 0%, 100% { transform: skewX(0) translateY(0); } 25% { transform: skewX(-4deg) translateY(1px); } 75% { transform: skewX(4deg) translateY(-1px); } }

/* moods */
.m-sorrow .w { animation: wordInSlow 1.6s ease-out var(--d) forwards, breathe 6s ease-in-out calc(var(--d) + 1.6s) infinite; }
@keyframes wordInSlow { 0% { opacity: 0; filter: blur(10px); transform: translateY(-8px); } 100% { opacity: 1; filter: blur(0); transform: none; } }
.m-hush .w { font-style: italic; animation: wordInSlow 1.8s ease-out var(--d) forwards, breathe 7s ease-in-out calc(var(--d) + 1.8s) infinite; }
.m-hush .w:not([class*=" k-"]) { color: rgba(var(--tint), 0.85); }
.m-dread .w:not(.k-light) { animation: wordIn 0.9s cubic-bezier(.2, .7, .2, 1) var(--d) forwards, tremble 0.18s steps(2) calc(var(--d) + 0.9s) infinite; }
@keyframes tremble { 0% { transform: translate(0.4px, 0); } 50% { transform: translate(-0.4px, 0.4px); } 100% { transform: translate(0, -0.3px); } }
.m-dread .veil { background:
    radial-gradient(40% 60% at 30% 55%, rgba(0, 0, 0, 0.82), transparent 70%),
    radial-gradient(45% 70% at 70% 45%, rgba(20, 0, 4, 0.75), transparent 72%),
    radial-gradient(70% 100% at 50% 60%, rgba(255, 93, 108, 0.12), transparent 75%); background-size: 160% 100%, 150% 110%, 100% 100%; }
.m-warning .w { animation: wordIn 0.7s cubic-bezier(.2, .7, .2, 1) var(--d) forwards; }
.m-warning .k-eye, .m-warning .k-grin { animation: wordIn 0.7s cubic-bezier(.2, .7, .2, 1) var(--d) forwards, warn 1.6s ease-in-out calc(var(--d) + 0.7s) infinite; }
@keyframes warn { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.45); } }
.m-hope .w { animation: wordRise 1.2s ease-out var(--d) forwards, breathe 5s ease-in-out calc(var(--d) + 1.2s) infinite; }
@keyframes wordRise { 0% { opacity: 0; filter: blur(8px); transform: translateY(14px); } 100% { opacity: 1; filter: blur(0); transform: none; } }
.m-hope .veil { background:
    radial-gradient(40% 60% at 30% 55%, rgba(0, 0, 0, 0.6), transparent 70%),
    radial-gradient(45% 70% at 70% 45%, rgba(0, 0, 0, 0.55), transparent 72%),
    radial-gradient(70% 100% at 50% 60%, rgba(92, 225, 230, 0.16), transparent 75%); background-size: 160% 100%, 150% 110%, 100% 100%; }
.m-tender .w:not([class*=" k-"]) { color: #fbf3e0; text-shadow: 0 0 16px rgba(255, 226, 170, 0.45), 0 2px 10px #000; }
.m-tender .w { animation: wordInSlow 1.5s ease-out var(--d) forwards, breathe 6s ease-in-out calc(var(--d) + 1.5s) infinite; }
.m-wonder .w { animation: wordIn 1.2s cubic-bezier(.2, .7, .2, 1) var(--d) forwards, shimmer 3.2s ease-in-out calc(var(--d) + 1.2s) infinite; }
@keyframes shimmer { 0%, 100% { text-shadow: 0 0 10px rgba(182, 156, 255, 0.35), 0 2px 10px #000; } 50% { text-shadow: 0 0 22px rgba(182, 156, 255, 0.8), 0 2px 10px #000; } }
.m-resolve .w { font-weight: 600; letter-spacing: 0.02em; animation: wordFirm 0.8s ease-out var(--d) forwards, breathe 6s ease-in-out calc(var(--d) + 0.8s) infinite; }
@keyframes wordFirm { 0% { opacity: 0; transform: scale(1.4); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: none; } }

/* embers rising from hopeful lines, ink dripping under dread */
.ghost-sub .mote { position: absolute; left: var(--x); bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: rgb(var(--glow)); box-shadow: 0 0 8px rgb(var(--glow)); opacity: 0; animation: mote 3.2s ease-out var(--d) infinite; }
.m-tender .mote { background: #ffe2aa; box-shadow: 0 0 8px #ffd27a; }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 15% { opacity: 0.9; } 100% { opacity: 0; transform: translate(10px, -46px) scale(0.4); } }
.ghost-sub .drip { position: absolute; left: var(--x); bottom: 2px; width: 2px; height: 0; border-radius: 0 0 2px 2px; background: linear-gradient(#050507, rgba(5, 5, 7, 0)); animation: drip 2.4s ease-in var(--d) infinite; }
@keyframes drip { 0% { height: 0; opacity: 0.9; } 70% { height: 14px; opacity: 0.8; } 100% { height: 18px; opacity: 0; transform: translateY(6px); } }

/* when the line is over, the words dissolve upward like smoke, one after another */
.ghost-sub.out .w { animation: wordOut 1s ease-in calc(var(--d) * 0.15) forwards !important; }
.ghost-sub.out .veil { animation: veilOut 1s ease-in forwards; }
.ghost-sub.out .mote, .ghost-sub.out .drip { display: none; }
@keyframes wordOut { from { opacity: 1; filter: blur(0); transform: none; } to { opacity: 0; filter: blur(8px); transform: translateY(-14px) scale(1.08); letter-spacing: 0.15em; } }
@keyframes veilOut { to { opacity: 0; transform: scaleX(1.3); } }

/* calm version (reduced motion): no movement, just a soft fade */
.ghost-sub.still .w, .ghost-sub.still .veil { animation: fadeOnly 0.6s ease-out forwards !important; }
.ghost-sub.still .mote, .ghost-sub.still .drip { display: none; }
.ghost-sub.still.out .w { animation: fadeAway 0.5s forwards !important; }
@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeAway { to { opacity: 0; } }

/* status chip: what is happening to the Black (hidden, seen, searched for) */
.state-chip { position: fixed; left: 50%; top: max(58px, calc(env(safe-area-inset-top) + 48px)); transform: translate(-50%, -6px); display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 10px; border-radius: 99px; background: rgba(5, 5, 7, 0.7); border: 1px solid var(--line); font-size: 0.82rem; letter-spacing: 0.03em; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; white-space: nowrap; }
.state-chip.show { opacity: 1; transform: translate(-50%, 0); }
.state-chip i { width: 14px; height: 9px; border-radius: 50%; background: #cfd8e0; position: relative; }
.state-chip i::after { content: ''; position: absolute; left: 4px; top: 1.5px; width: 6px; height: 6px; border-radius: 50%; background: #050507; }
.state-chip.safe i { background: transparent; border-top: 2px solid var(--ember); border-radius: 0 0 50% 50%; height: 6px; }
.state-chip.safe i::after { display: none; }
.state-chip.safe { border-color: rgba(92, 225, 230, 0.5); color: #dffbfd; }
.state-chip.seen { border-color: var(--eye); color: #ffd7db; animation: seenPulse 0.9s ease-in-out infinite; }
.state-chip.seen i { background: #ffd7db; box-shadow: 0 0 8px var(--eye); }
.state-chip.search { border-color: #f2c14e; color: #ffe9b5; }
.state-chip.search i { background: #ffe9b5; }
.state-chip.pass { border-color: rgba(92, 225, 230, 0.5); }
@keyframes seenPulse { 50% { box-shadow: 0 0 16px rgba(255, 93, 108, 0.45); } }

/* coach lessons: an icon and one short line */
.tipbar.coach { display: flex; align-items: center; gap: 12px; text-align: left; border-color: rgba(92, 225, 230, 0.55); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(92, 225, 230, 0.12) inset; }
.tipbar .ci { flex: none; width: 30px; height: 30px; padding: 4px; border-radius: 9px; background: rgba(92, 225, 230, 0.12); fill: none; stroke: var(--ember); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tipbar.coach.show .ci { animation: coachIcon 0.9s ease-out; }
@keyframes coachIcon { 0% { transform: scale(0.4) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: none; } }
.tipbar kbd { font-size: 11px; }

/* first-time touch guide */
.tguide { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; gap: 10px; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: rgba(3, 4, 6, 0.82); backdrop-filter: blur(3px); animation: tgIn 0.4s ease-out; }
@keyframes tgIn { from { opacity: 0; } }
.tguide h3 { font-family: var(--serif); font-weight: 600; margin: 8px 0 6px; font-size: 1.15rem; }
.tguide ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.86rem; color: var(--muted); }
.tguide li b { color: var(--bone); }
.tg-left, .tg-right { display: flex; flex-direction: column; justify-content: flex-end; }
.tg-right { align-items: flex-end; text-align: right; }
.tg-zone { position: relative; width: 150px; height: 110px; border-radius: 16px; border: 1px dashed rgba(232, 226, 208, 0.22); }
.tg-arrow { position: absolute; top: 50%; margin-top: -26px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; border: 1px solid rgba(232, 226, 208, 0.3); color: var(--bone); font-size: 1rem; }
.tg-arrow.l { left: 14px; } .tg-arrow.r { right: 14px; }
.tg-thumb { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px; border-radius: 50%; background: rgba(232, 226, 208, 0.25); box-shadow: 0 0 0 1px rgba(92, 225, 230, 0.5), 0 0 16px rgba(92, 225, 230, 0.35); animation: tgThumb 4s ease-in-out infinite; }
@keyframes tgThumb { 0%, 100% { transform: translate(-35px, 0); opacity: 0.9; } 40% { transform: translate(-35px, 0); } 50% { transform: translate(35px, 0); } 70% { transform: translate(35px, -22px); } 90% { transform: translate(35px, 0); } }
.tg-runes { position: relative; width: 170px; height: 120px; }
.tg-runes .r { position: absolute; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(232, 226, 208, 0.25); background: radial-gradient(circle at 38% 30%, rgba(48, 52, 58, 0.7), rgba(5, 5, 7, 0.7) 70%); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone); }
.tg-runes .leap { right: 0; bottom: 0; width: 74px; height: 74px; animation: tgTap 2.4s ease-in-out infinite; }
.tg-runes .rush { right: 84px; bottom: 0; width: 52px; height: 52px; animation: tgTap 2.4s ease-in-out 0.8s infinite; }
.tg-runes .shroud { right: 42px; bottom: 80px; width: 52px; height: 52px; animation: tgTap 2.4s ease-in-out 1.6s infinite; }
@keyframes tgTap { 0%, 70%, 100% { box-shadow: none; transform: none; } 80% { transform: scale(0.92); box-shadow: 0 0 18px rgba(92, 225, 230, 0.6); border-color: var(--ember); } }
.tg-go { grid-column: 1 / -1; margin: 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.tg-go b { color: var(--ember); }
@media (orientation: portrait) { .tguide { grid-template-columns: 1fr; } .tg-right { align-items: flex-start; text-align: left; } }
@media (prefers-reduced-motion: reduce) { .tg-thumb, .tg-runes .r { animation: none; } }

/* difficulty picker */
.dlist { width: min(980px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-bottom: 24px; }
@media (max-width: 760px) { .dlist { grid-template-columns: 1fr; } }
.dcard { text-align: left !important; margin: 0 !important; padding: 12px !important; display: flex !important; flex-direction: column; gap: 6px; }
.dcard canvas { width: 100%; height: auto; aspect-ratio: 240 / 150; border-radius: 10px; display: block; }
.dcard b { font-family: var(--serif); font-size: 1.25rem; }
.dcard p { margin: 0; color: var(--muted); font-weight: 400; letter-spacing: 0; font-size: 0.86rem; }
.dcard ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-weight: 400; letter-spacing: 0; font-size: 0.82rem; color: var(--muted); }
.dcard ul b { font-family: var(--sans); font-size: 0.86rem; color: var(--bone); }
.dcard .ic { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #cfd8e0; }
.dcard .ic.eye { background: var(--eye); } .dcard .ic.air { background: #bfe9ef; } .dcard .ic.cloak { background: #8f9bb3; }
.dcard.d-easy { border-color: rgba(127, 216, 220, 0.35) !important; }
.dcard.d-hard { border-color: rgba(242, 193, 78, 0.35) !important; }
.dcard.d-nightmare { border-color: rgba(255, 93, 108, 0.45) !important; background: linear-gradient(180deg, rgba(255, 93, 108, 0.08), rgba(255, 255, 255, 0.02)) !important; }
.dcard.on { box-shadow: 0 0 0 2px var(--ember) inset; }

/* ================= the same rules for the newer pieces ================= */
/* status: a black capsule at the top centre that grows with what it says */
.state-chip { top: max(10px, env(safe-area-inset-top)); padding: 7px 16px 7px 12px; border: 0 !important; border-radius: 99px; background: #000 !important; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08); font: 600 0.8rem var(--sans); letter-spacing: 0; transform: translate(-50%, -6px) scale(0.85); transition: opacity 0.25s, transform 0.5s var(--spring); z-index: 6; }
.state-chip.show { transform: translate(-50%, 0) scale(1); }
.state-chip.safe { color: #e4fbfc; } .state-chip.safe i { border-top-color: var(--tint); }
.state-chip.seen { color: #ffd4d1; animation: none; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1.5px var(--red); }
.state-chip.search { color: #fff1c2; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1.5px var(--yellow); }
.hud-top { padding-top: max(10px, env(safe-area-inset-top)); }
@media (min-width: 721px) { .state-chip { top: max(56px, calc(env(safe-area-inset-top) + 50px)); } }
/* coach banner */
.tipbar.coach { text-align: left; }
.tipbar .ci { background: rgba(92, 225, 230, 0.16); border-radius: 9px; stroke: var(--tint); }
.tipbar.coach.show .ci { animation: popIn 0.5s var(--spring); }
/* difficulty cards */
.dlist { width: 100%; gap: 10px; }
.dcard { background: var(--g1) !important; border-radius: var(--r-l) !important; border: 0 !important; transition: transform 0.3s var(--spring), box-shadow 0.3s; }
.dcard:hover { transform: translateY(-2px); }
.dcard canvas { border-radius: var(--r-m); }
.dcard b { font: 700 1.2rem var(--display); }
.dcard.d-easy { box-shadow: inset 0 0 0 1px rgba(100, 210, 255, 0.25); }
.dcard.d-hard { box-shadow: inset 0 0 0 1px rgba(255, 214, 10, 0.25); }
.dcard.d-nightmare { background: linear-gradient(180deg, rgba(255, 69, 58, 0.12), var(--g1) 60%) !important; box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.35); }
.dcard.on { box-shadow: inset 0 0 0 2px var(--tint) !important; }
.dcard .ic.eye { background: var(--red); }
/* touch guide */
.tguide { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%); }
.tguide h3 { font: 700 1.1rem var(--display); }
.tg-go b { color: var(--tint); }
/* story skip */
.skip { background: var(--material) !important; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 0 !important; color: var(--label) !important; font: 600 0.85rem var(--sans); }

/* achievements */
.achs { display: grid; gap: 0; border-radius: var(--r-m); background: var(--g1); overflow: hidden; }
.ach { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.ach + .ach { box-shadow: inset 0 0.5px 0 var(--sep); }
.ach > div { flex: 1; min-width: 0; }
.ach b { display: block; font: 600 0.95rem var(--sans); }
.ach small { display: block; color: var(--label2); font-size: 0.8rem; }
.ach em { font: 600 0.8rem var(--rounded); font-style: normal; color: var(--label3); }
.ach.got em { color: var(--green); }
.ach .bar { height: 4px; margin-top: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.ach .bar span { display: block; height: 100%; background: var(--tint); border-radius: 3px; }
.medal { flex: none; width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(from 210deg, #3a3a3c, #2c2c2e, #3a3a3c); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.ach.got .medal, .ach-toast .medal { background: conic-gradient(from 210deg, #ffd60a, #ff9f0a, #ffe680, #ffd60a); box-shadow: 0 0 14px rgba(255, 214, 10, 0.4); }
.ach-toast { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); z-index: 7; display: flex; align-items: center; gap: 12px; min-width: min(360px, 90vw); padding: 10px 16px 10px 10px; border-radius: 22px; background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 16px 40px rgba(0,0,0,.5), inset 0 0.5px 0 rgba(255,255,255,.12); transform: translate(-50%, -120%); opacity: 0; transition: transform 0.6s var(--spring), opacity 0.3s; pointer-events: none; }
.ach-toast.show { transform: translate(-50%, 0); opacity: 1; }
.ach-toast span { flex: 1; } .ach-toast b { display: block; font: 600 0.92rem var(--sans); } .ach-toast small { color: var(--label2); font-size: 0.78rem; }
.ach-toast em { font: 700 0.95rem var(--rounded); font-style: normal; color: var(--yellow); }
.menu .row button#btn-ach { font-size: 0.86rem; }

/* photo mode bar */
.photo-bar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 12; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; max-width: calc(100vw - 24px); padding: 10px 12px; border-radius: 24px; background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 20px 60px rgba(0,0,0,.55), inset 0 0.5px 0 rgba(255,255,255,.12); animation: popIn 0.45s var(--spring); }
.photo-bar button { width: auto; margin: 0; padding: 9px 14px; border: 0; border-radius: 12px; background: var(--fill); font: 600 0.85rem var(--sans); color: var(--label); }
.photo-bar .seg button { background: transparent; border-radius: 7px; }
.photo-bar .seg button.on { background: #636366; }
.photo-bar button.primary { background: var(--tint); color: var(--tint-ink); }
.photo-bar button.ghost { background: transparent; color: var(--tint); }
.photo-bar .zoom { display: flex; align-items: center; gap: 8px; font: 600 0.8rem var(--sans); color: var(--label2); }
.photo-bar input[type=range] { width: 110px; accent-color: var(--tint); }
.photo-hint { flex-basis: 100%; margin: 0; text-align: center; font-size: 0.72rem; color: var(--label3); }
body[data-mode="photo"] canvas#game { cursor: grab; }

/* generated runs: result */
.res-big { margin: 10px 0 14px; } .res-big b { display: block; font: 700 2.4rem var(--rounded); letter-spacing: -0.02em; } .res-big small { color: var(--label2); }
.res-nick { display: flex; gap: 8px; margin: 6px 0 10px; } .res-nick input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 0; background: var(--fill); color: var(--label); font: 500 0.95rem var(--sans); outline: none; }
.res-nick input:focus { box-shadow: 0 0 0 2px var(--tint); } .res-nick button { margin: 0 !important; width: auto !important; }
.res-board { list-style: none; margin: 0 0 12px; padding: 0; border-radius: var(--r-m); background: var(--fill2); max-height: 34vh; overflow: auto; text-align: left; }
.res-board li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 8px 14px; font-size: 0.9rem; }
.res-board li + li { box-shadow: inset 0 0.5px 0 var(--sep); }
.res-board li b { color: var(--label3); font-family: var(--rounded); } .res-board li em { font: 600 0.9rem var(--rounded); font-style: normal; }
.res-board li.empty, .res-board li.me { display: block; color: var(--label2); text-align: center; } .res-board li.me { color: var(--tint); font-weight: 600; }

/* talk to the developer */
.report { display: grid; gap: 10px; max-width: 620px; margin: 0 auto; width: 100%; }
.report textarea { min-height: 110px; resize: vertical; padding: 12px 14px; border: 0; border-radius: var(--r-m); background: var(--g1); color: var(--label); font: 400 0.95rem var(--sans); outline: none; }
.report textarea:focus { box-shadow: 0 0 0 2px var(--tint); }
.report .seg { align-self: start; } .report .seg button { padding: 7px 16px !important; }
.small-note { font-size: 0.78rem; margin: 0; text-align: center; }
.inbox-h { font: 700 1.05rem var(--display); max-width: 620px; margin: 18px auto 8px; width: 100%; }
.threads { display: grid; gap: 10px; max-width: 620px; margin: 0 auto; width: 100%; }
.thread { background: var(--g1); border-radius: var(--r-m); padding: 12px 14px; }
.thread.unread { box-shadow: inset 0 0 0 1.5px var(--tint); }
.thread .msgs { display: grid; gap: 6px; margin: 8px 0; }
.thread .msgs p { margin: 0; padding: 8px 12px; border-radius: 16px; max-width: 85%; font-size: 0.9rem; white-space: pre-wrap; }
.thread .msgs p.me { justify-self: end; background: var(--tint); color: var(--tint-ink); border-bottom-right-radius: 5px; }
.thread .msgs p.dev { justify-self: start; background: var(--g3); border-bottom-left-radius: 5px; }
.thread .reply { display: flex; gap: 8px; } .thread .reply input { flex: 1; min-width: 0; padding: 9px 12px; border: 0; border-radius: 99px; background: var(--fill); color: var(--label); font: 400 0.9rem var(--sans); outline: none; }
.thread .reply button { margin: 0 !important; width: auto !important; }
.inbox-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); vertical-align: middle; margin-left: 4px; }
.dev-msg { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.dev-msg p { color: var(--label2); white-space: pre-wrap; text-align: left; }
.dev-cta { display: block; margin: 6px 0; padding: 12px; border-radius: var(--r-m); background: var(--fill); color: var(--tint); font-weight: 600; }

/* rewarded offers: clearly optional, never in the way */
button.reward { background: rgba(255, 214, 10, 0.12) !important; color: #ffe680 !important; }
button.reward small { display: block; font-weight: 500; font-size: 0.72rem; opacity: 0.7; margin-top: 1px; }
.opt small { display: block; font-size: 0.78rem; }
body.has-banner #touch .g-arrows, body.has-banner #touch .g-act { bottom: 70px; }

/* short landscape screens (phones turned sideways): title left, menu right; every card fits and scrolls */
@media (max-height: 520px) and (orientation: landscape) {
  .title { flex-direction: row; align-items: center; justify-content: space-evenly; padding-top: max(10px, env(safe-area-inset-top)); gap: 16px; }
  .brand { flex: 1; max-width: 46vw; }
  .brand h1 { font-size: clamp(2.4rem, 14vh, 4.4rem); }
  .brand .sub { font-size: clamp(0.95rem, 5vh, 1.3rem); }
  .menu { width: min(430px, 50vw); padding: 10px; }
  .menu button { padding: 9px 10px; margin: 5px 0; font-size: 0.86rem; }
  .menu button.primary { font-size: 0.98rem; }
  .menu .foot { margin-top: 4px; font-size: 0.7rem; }
  .card { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px 16px 12px; }
  .card h2 { font-size: 1.3rem; }
  .screen.sheet { max-height: calc(100dvh - 16px); }
  .dlist { grid-template-columns: repeat(3, 1fr); }
  .dcard p { display: none; }
}

/* a game: no text selection or long-press menus (text fields stay selectable) */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
