/* ============================================================================
   GIELINOR GRANDMASTER - Old School RuneScape trivia gauntlet
   Design system: authentic OSRS interface (riveted bronze panels, stone
   buttons, parchment scrolls, OSRS chat fonts with hard black shadow).
   No external CSS frameworks. Phone-first + desktop.
   ========================================================================== */

/* ---- Fonts: WolfieMario's pixel-perfect OSRS chat fonts -------------------*/
@font-face {
  font-family: "RSChat";
  src: url("assets/fonts/rs-chat-07.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "RSChat";
  src: url("assets/fonts/rs-chat-bold.ttf") format("truetype");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "RSBold";
  src: url("assets/fonts/rs-chat-bold.ttf") format("truetype");
  font-weight: 700; font-display: swap;
}

/* ---- Tokens --------------------------------------------------------------*/
:root {
  /* world */
  --world-0: #0e0b07;
  --world-1: #1c160e;
  --world-2: #2a2114;

  /* interface stone (the brown OSRS panel) */
  --stone-0: #1d180f;   /* deep inset */
  --stone-1: #3b3424;   /* panel face */
  --stone-2: #4d4430;   /* raised face */
  --stone-3: #645838;   /* highlight edge */
  --stone-edge: #0c0a06;

  /* bronze / gold frame */
  --bronze-0: #7a5a26;
  --bronze-1: #b5893f;
  --bronze-2: #e9c46a;
  --gold: #ffc132;
  --gold-bright: #ffe14d;

  /* text */
  --ink: #f0e6cf;          /* default light text on stone */
  --ink-dim: #c9bb98;
  --rs-yellow: #ffff00;    /* the iconic OSRS interface yellow */
  --rs-orange: #ff981f;    /* level-up / examine orange */
  --rs-green: #3cff5e;     /* correct / level up */
  --rs-green-2: #2fae3e;
  --rs-red: #ff4338;       /* wrong / danger */
  --rs-red-2: #b3261b;
  --rs-cyan: #7fd6ff;      /* NPC dialogue */

  /* parchment (scrolls / explanations) */
  --parch-0: #e7d5a8;
  --parch-1: #d6bf8d;
  --parch-2: #c2a86a;
  --parch-ink: #2e2208;

  --shadow-hard: 1px 1px 0 #000, 2px 2px 0 rgba(0,0,0,.35);
  --radius: 6px;
  --tap: 46px;

  /* fluid type scale - grows on big screens, stays compact on phones */
  --fs-body: clamp(16px, 0.55vw + 13px, 21px);
  --fs-sm:   clamp(14px, 0.45vw + 11.5px, 18px);
  --fs-lead: clamp(17px, 0.9vw + 13px, 24px);
}

/* ---- Reset ---------------------------------------------------------------*/
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "RSChat", "Trebuchet MS", system-ui, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.4;
  color: var(--ink);
  background: var(--world-0);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;                /* single-screen client feel */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
img { display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* ---- World background (behind everything) --------------------------------*/
#world {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(120,90,40,.14), transparent 55%),
    radial-gradient(140% 120% at 50% 120%, #000 10%, transparent 60%),
    linear-gradient(180deg, var(--world-2), var(--world-1) 45%, var(--world-0));
}
#world::after {            /* vignette + faint grime */
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 220px 40px rgba(0,0,0,.75);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/></svg>");
  pointer-events: none;
}

/* ---- Ambient sprite layer (floating GE items) ----------------------------*/
#sprites { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; transition: opacity .4s ease; }
body.in-game #sprites { opacity: .22; }
.spr { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.spr img {
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.55));
}
.spr .ge {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
  font-size: 12px; color: var(--rs-yellow); text-shadow: var(--shadow-hard);
  white-space: nowrap; font-weight: 700;
}
.spr .ge::before { content: "▲ "; color: var(--rs-green); }

/* ---- App root ------------------------------------------------------------*/
/* #app owns the scroll; .screen is at least one viewport tall and centres its
   own content, so short screens sit centred and tall ones scroll without clipping. */
#app {
  position: relative; z-index: 2;
  height: 100dvh; width: 100%;
  overflow-y: auto; overflow-x: hidden;
  padding: clamp(10px, 2vw, 22px);
}
.screen {
  width: 100%; max-width: 1040px; margin: 0 auto;
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  gap: 14px;
  animation: screen-in .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes screen-in { from { opacity: 0; transform: translateY(10px) scale(.99);} to { opacity: 1; transform: none; } }

/* ============================================================================
   Core OSRS components
   ========================================================================== */

/* interface stone panel with riveted bronze frame */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, var(--stone-2), var(--stone-1) 60%, #322b1d);
  border: 3px solid var(--bronze-0);
  border-radius: 4px;
  box-shadow:
    0 0 0 2px var(--stone-edge),
    0 0 0 3px var(--bronze-1),
    inset 0 0 0 1px rgba(255,225,150,.10),
    inset 0 2px 0 rgba(255,235,180,.18),
    inset 0 -3px 8px rgba(0,0,0,.5),
    0 18px 40px rgba(0,0,0,.55);
  background-clip: padding-box;
}
.panel.thick { border-width: 4px; }
/* corner rivets */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--bronze-2), var(--bronze-0) 70%, #3a2a10);
  box-shadow: 0 0 0 1px #000;
}
.panel::before { top: 4px; left: 4px; }
.panel::after  { top: 4px; right: 4px; }

/* parchment scroll surface */
.scroll {
  position: relative;
  color: var(--parch-ink);
  background:
    radial-gradient(120% 140% at 50% 0%, var(--parch-0), var(--parch-1) 55%, var(--parch-2));
  border: 2px solid #7c5a2a;
  border-radius: 8px;
  box-shadow: 0 0 0 2px #3a280f, inset 0 0 22px rgba(120,80,20,.35),
              inset 0 1px 0 rgba(255,255,255,.4), 0 16px 36px rgba(0,0,0,.5);
}
.scroll::before {
  content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23p)' opacity='0.06'/></svg>");
  mix-blend-mode: multiply;
}

/* OSRS stone button */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 11px 18px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
  color: var(--ink);
  text-shadow: var(--shadow-hard);
  background: linear-gradient(180deg, #5b5036, #43391f 55%, #352c18);
  border: 2px solid #20190d;
  border-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255,235,170,.30),
    inset 0 -3px 6px rgba(0,0,0,.45),
    0 3px 0 #18130a, 0 5px 10px rgba(0,0,0,.45);
  transition: transform .06s ease, filter .12s ease, box-shadow .06s ease, color .12s ease;
}
.btn:hover { color: var(--rs-yellow); filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,235,170,.2), inset 0 -2px 5px rgba(0,0,0,.5), 0 1px 0 #18130a; }
.btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #c9982f, #9a6f1d 55%, #7a560f);
  border-color: #2a1d06; color: #1c1405;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  box-shadow: inset 0 1px 0 rgba(255,245,200,.55), inset 0 -3px 8px rgba(80,50,0,.5),
              0 3px 0 #5a3f0c, 0 6px 14px rgba(0,0,0,.5);
}
.btn-primary:hover { color: #0d0a02; filter: brightness(1.07); }
.btn-danger { background: linear-gradient(180deg,#a23128,#7c2018 55%,#5e1610); border-color:#2a0a06; }
.btn-ghost { background: linear-gradient(180deg,#3a3220,#2b2415); }
.btn-sm { min-height: 38px; padding: 7px 12px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

/* headings */
.title {
  font-family: "RSBold","RSChat",sans-serif; font-weight: 700;
  color: var(--gold); text-shadow: 2px 2px 0 #000, 0 0 18px rgba(255,180,40,.25);
  line-height: 1;
}
.h1 { font-size: clamp(34px, 8vw, 62px); }
.h2 { font-size: clamp(22px, 4.5vw, 32px); }
.subtle { color: var(--ink-dim); }
.yellow { color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.green  { color: var(--rs-green); text-shadow: var(--shadow-hard); }
.red    { color: var(--rs-red);  text-shadow: var(--shadow-hard); }
.cyan   { color: var(--rs-cyan); text-shadow: var(--shadow-hard); }
.shadow-text { text-shadow: var(--shadow-hard); }

/* ============================================================================
   LOGIN / MENU screen
   ========================================================================== */
.login { align-items: center; text-align: center; gap: 18px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.brand .crest { width: clamp(72px,16vw,108px); height: auto; image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.6)); animation: bob 4.5s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-7px);} }
.brand .tag { color: var(--ink-dim); font-size: var(--fs-sm); max-width: 34ch; }

/* welcome / onboarding */
.welcome { align-items: center; text-align: center; gap: clamp(10px,1.6vw,16px); }
.wel-card { width: 100%; max-width: min(720px, 94vw); margin: 0 auto; padding: clamp(16px,2.4vw,28px);
  display: flex; flex-direction: column; gap: clamp(12px,1.8vw,18px); text-align: left; }
.wel-scroll { padding: clamp(12px,1.6vw,18px) clamp(14px,2vw,22px); font-size: var(--fs-body); line-height: 1.5; }
.wel-feats { display: flex; flex-direction: column; gap: clamp(8px,1.2vw,14px); }
.wel-feat { display: flex; align-items: center; gap: 14px; font-size: var(--fs-body); color: var(--ink); text-shadow: var(--shadow-hard); }
.wel-ico { font-size: clamp(26px,2.2vw,38px); flex: none; width: clamp(36px,3vw,48px); text-align: center; }
.wel-how { background: linear-gradient(180deg,#2c2516,#211b0f); border-radius: 6px; padding: clamp(12px,1.8vw,18px);
  box-shadow: inset 0 0 0 1px rgba(255,225,150,.1); }
.wel-how-title { font-weight: 700; color: var(--gold); text-shadow: var(--shadow-hard); margin-bottom: 6px; font-size: var(--fs-lead); }
.wel-how ul { margin: 0; padding-left: 20px; font-size: var(--fs-sm); line-height: 1.65; color: var(--ink-dim); }
.wel-cta { display: flex; flex-direction: column; gap: 10px; }

.menu-card { width: 100%; max-width: 460px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.nameplate {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 5px;
  background: linear-gradient(180deg,#2c2516,#211b0f);
  box-shadow: inset 0 0 0 1px rgba(255,225,150,.12), inset 0 2px 6px rgba(0,0,0,.5);
}
.nameplate .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nameplate .rsn { color: var(--rs-yellow); font-weight: 700; text-shadow: var(--shadow-hard);
  font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nameplate .lvl { color: var(--ink-dim); font-size: 13px; }
.menu-actions { display: flex; flex-direction: column; gap: 10px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* "log in" world meta footer */
.world-meta { display:flex; gap:14px; flex-wrap:wrap; justify-content:center; color:var(--ink-dim);
  font-size:13px; text-shadow: var(--shadow-hard); }
.world-meta b { color: var(--rs-green); }

/* ============================================================================
   ADVENTURE picker (modes + skills)
   ========================================================================== */
.picker { gap: 14px; overflow-y: auto; padding: 4px; }
.section-head { display:flex; align-items:center; gap:10px; margin: 2px 2px 0; }
.section-head .line { flex:1; height:2px; background: linear-gradient(90deg, var(--bronze-1), transparent); }

.mode-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px){ .mode-grid { grid-template-columns: repeat(3,1fr);} }
.mode-card { padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: transform .12s ease, filter .12s ease; }
.mode-card:hover { transform: translateY(-3px); filter: brightness(1.06); }
.mode-card .mc-title { font-family:"RSBold"; color: var(--gold); font-size: var(--fs-lead); text-shadow: var(--shadow-hard); }
.mode-card .mc-emoji { font-size: clamp(28px,2.4vw,38px); line-height: 1; }
.mode-card .mc-desc { color: var(--ink-dim); font-size: var(--fs-sm); }
.mode-card .mc-badge { align-self:flex-start; margin-top:4px; font-size:12px; color:var(--rs-yellow);
  background:#231c0f; padding:3px 8px; border-radius:4px; box-shadow: inset 0 0 0 1px rgba(255,225,150,.18); }

.skill-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
@media (min-width: 560px){ .skill-grid { grid-template-columns: repeat(3,1fr);} }
@media (min-width: 820px){ .skill-grid { grid-template-columns: repeat(5,1fr);} }
.skill-tile {
  display:flex; flex-direction:column; align-items:center; gap:4px; padding: 12px 8px;
  background: linear-gradient(180deg,#3a3220,#2a2315); border-radius:6px;
  box-shadow: inset 0 0 0 1px rgba(255,225,150,.10), inset 0 -3px 7px rgba(0,0,0,.4), 0 3px 0 #1a1409;
  cursor:pointer; transition: transform .1s ease, filter .12s ease; text-align:center;
}
.skill-tile:hover { transform: translateY(-2px); color: var(--rs-yellow); filter: brightness(1.08); }
.skill-tile .st-ico { font-size: 26px; line-height: 1; }
.skill-tile .st-name { font-size: 13px; font-weight: 700; text-shadow: var(--shadow-hard); }
.skill-tile .st-lvl { font-size: 12px; color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.skill-tile .st-lvl b { color: var(--ink); }

/* ============================================================================
   GAME screen
   ========================================================================== */
.game { gap: 10px; }
.hud {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px;
}
.hud .stat { display:flex; flex-direction:column; line-height:1.05; }
.hud .stat .k { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing:.5px; }
.hud .stat .v { font-size: 18px; font-weight:700; color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.hud .stat .v.gp { color: var(--gold); }
.hud .grow { flex: 1; }
.hud .iconbtn { width: 40px; height: 40px; min-height: 0; padding: 0; font-size: 18px; }

/* skill xp bar (orange OSRS xp bar) */
.xpbar { height: 9px; border-radius: 4px; background:#1a140a; overflow:hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 1px 2px rgba(0,0,0,.6); }
.xpbar > i { display:block; height:100%; width:0%;
  background: linear-gradient(180deg, #ffc24a, #ff8a1f); transition: width .5s cubic-bezier(.2,.8,.3,1); }

.game-body { display:grid; grid-template-columns: 1fr; gap: 10px; align-items: stretch; }
@media (min-width: 860px){ .game-body { grid-template-columns: minmax(0,1fr) 250px; } }

.q-wrap { display:flex; flex-direction:column; gap:12px; min-height:0; }

/* compact ladder strip (mobile / no side panel) */
.ladder-mini { display:flex; align-items:center; gap:10px; padding:8px 12px; font-size:13px; }
.ladder-mini .lm-seg { display:flex; flex-direction:column; line-height:1.05; }
.ladder-mini .lm-k { font-size:10px; color:var(--ink-dim); text-transform:uppercase; letter-spacing:.5px; }
.ladder-mini .lm-v { font-weight:700; color:var(--rs-yellow); text-shadow:var(--shadow-hard); font-size:15px; }
.ladder-mini .lm-v.now { color:var(--gold); }
.ladder-mini .lm-v.safe { color:var(--rs-green); }
.ladder-mini .lm-arrow { color:#8a7c58; }
.ladder-mini .grow { flex:1; }
@media (min-width: 860px){ .ladder-mini { display:none; } }
.ladder.side-ladder { display:none; }
@media (min-width: 860px){ .ladder.side-ladder { display:flex; } }
.q-meta { display:flex; align-items:center; gap:8px; font-size:var(--fs-sm); color:var(--ink-dim); }
.q-tier { color: var(--rs-orange); font-weight:700; text-shadow: var(--shadow-hard); }
.q-cat  { color: var(--rs-cyan); }
.q-box { padding: 16px 18px; }
.q-text { font-size: clamp(19px, 1.6vw + 12px, 28px); font-weight: 700; color: var(--ink);
  text-shadow: var(--shadow-hard); line-height: 1.32; }
/* the question is programmatically focused for screen readers each render; it is not
   keyboard-tabbable, so suppress the off-brand default focus ring (SR still announces it). */
.q-text:focus { outline: none; }

.answers { display: grid; grid-template-columns: 1fr; gap: 9px; }
@media (min-width: 600px){ .answers { grid-template-columns: 1fr 1fr; } }
.ans {
  display:flex; align-items:center; gap:10px; text-align:left;
  min-height: clamp(52px, 6vw, 62px); padding: 10px clamp(12px, 1.4vw, 18px);
  font-size: clamp(15px, 0.5vw + 13px, 18px); font-weight:700;
  color: var(--ink); text-shadow: var(--shadow-hard);
  background: linear-gradient(180deg, #4a4029, #38301b 60%, #2c2515);
  border: 2px solid #1c160c; border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.22), inset 0 -3px 6px rgba(0,0,0,.45), 0 3px 0 #16110a;
  transition: transform .07s ease, filter .12s ease, color .12s ease;
}
.ans .key { width:26px; height:26px; flex:none; display:grid; place-items:center; border-radius:4px;
  background:#231c0f; color: var(--gold); font-size:14px; box-shadow: inset 0 0 0 1px rgba(255,225,150,.2); }
.ans:hover:not([disabled]) { color: var(--rs-yellow); filter: brightness(1.08); }
.ans:active:not([disabled]) { transform: translateY(2px); }
.ans.correct { background: linear-gradient(180deg,#2f7d2c,#1f5e1d); border-color:#0c3309; color:#eaffea; }
.ans.correct .key { background:#0c3309; color: var(--rs-green); }
.ans.wrong { background: linear-gradient(180deg,#8c2a22,#641a14); border-color:#3a0c08; color:#ffe9e7; }
.ans.wrong .key { background:#3a0c08; color: var(--rs-red); }
.ans.faded { opacity:.32; filter: grayscale(.6); }

/* lifelines */
.lifelines { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.ll {
  display:flex; align-items:center; gap:7px; min-height:42px; padding:8px 14px; font-size:var(--fs-sm); font-weight:700;
  color: var(--ink); text-shadow: var(--shadow-hard);
  background: linear-gradient(180deg,#403720,#2e2714); border:2px solid #1a140a; border-radius:6px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.2), 0 3px 0 #15100a;
}
.ll:hover:not([disabled]) { color: var(--rs-orange); filter:brightness(1.08); }
.ll[disabled] { opacity:.4; text-decoration: line-through; filter: grayscale(.5); cursor:not-allowed; }
.ll .lic { font-size:18px; }

/* GP ladder (gauntlet, side panel) - rungs flex to fill the panel height evenly */
.ladder { padding: 8px; display:flex; flex-direction:column-reverse; gap:2px; }
.rung { display:flex; align-items:center; justify-content:space-between; gap:8px;
  flex: 1 1 0; min-height: 26px;
  padding:4px 10px; border-radius:4px; font-size:13px; color: var(--ink-dim); }
.rung .n { width: 22px; color:#8a7c58; font-size:12px; }
.rung .amt { font-weight:700; }
.rung.bank .amt { color: var(--rs-green); }
.rung.bank { box-shadow: inset 0 0 0 1px rgba(60,255,94,.18); }
.rung.done { color: var(--ink); }
.rung.done .amt { color: var(--rs-yellow); }
.rung.cur { background: linear-gradient(90deg, rgba(255,193,50,.22), transparent);
  box-shadow: inset 0 0 0 1px var(--gold); color:#fff; }
.rung.cur .amt { color: var(--gold-bright); }
.rung.top .amt { color: var(--gold); }

/* timer - always on, prominent + visible */
.timer-wrap { display:flex; align-items:center; gap:10px; padding:7px 12px; }
.timer-ico { font-size:18px; }
.timer-bar { flex:1; height:13px; border-radius:7px; background:#1a140a; overflow:hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 1px 2px rgba(0,0,0,.6); }
.timer-bar > i { display:block; height:100%; width:100%;
  background: linear-gradient(180deg,#56d05b,#2f9e35); transition: width .1s linear, background .3s; }
.timer-num { min-width: 2.2ch; text-align:center; font-weight:700; font-size:19px;
  color: var(--rs-green); text-shadow: var(--shadow-hard); }
.timer-wrap.warn .timer-bar > i { background: linear-gradient(180deg,#ffce4a,#ff9c1f); }
.timer-wrap.warn .timer-num { color: var(--rs-orange); }
.timer-wrap.danger .timer-bar > i { background: linear-gradient(180deg,#ff5b4a,#c2261b); }
.timer-wrap.danger .timer-num { color: var(--rs-red); animation: tpulse .5s ease-in-out infinite; }
.timer-wrap.done { opacity:.5; }
@keyframes tpulse { 0%,100%{ transform:scale(1);} 50%{ transform:scale(1.2);} }

/* answer selected (first tap) + lock-in hint (double-tap to confirm) */
.ans-txt { flex:1; min-width:0; }
.ans-lock { display:none; font-size:12px; color: var(--gold-bright); text-shadow: var(--shadow-hard); white-space:nowrap; }
.ans.selected { border-color: var(--gold); color: var(--rs-yellow);
  box-shadow: inset 0 0 0 2px var(--gold), inset 0 1px 0 rgba(255,235,170,.3), 0 0 16px rgba(255,193,50,.45), 0 3px 0 #16110a;
  animation: selpulse 1.1s ease-in-out infinite; }
.ans.selected .key { background: var(--gold); color:#1c1405; }
.ans.selected .ans-lock { display:inline; }
@keyframes selpulse {
  0%,100%{ box-shadow: inset 0 0 0 2px var(--gold), 0 0 8px rgba(255,193,50,.3), 0 3px 0 #16110a; }
  50%{ box-shadow: inset 0 0 0 2px var(--gold-bright), 0 0 20px rgba(255,193,50,.6), 0 3px 0 #16110a; }
}
.confirm-hint { display:none; text-align:center; font-size:var(--fs-sm); font-weight:700; color: var(--rs-yellow);
  text-shadow: var(--shadow-hard); padding:2px; }
.confirm-hint.show { display:block; animation: fade .2s ease; }

/* challenge banner */
.challenge-banner { padding:8px 14px; text-align:center; font-size:var(--fs-sm); color:var(--ink);
  text-shadow:var(--shadow-hard); border-radius:6px;
  background: linear-gradient(180deg, rgba(255,193,50,.16), rgba(255,193,50,.04));
  box-shadow: inset 0 0 0 1px rgba(255,193,50,.35); }

/* report-a-question link */
.report-link { display:inline-flex; align-items:center; gap:5px; margin-top:8px; font-size:var(--fs-sm);
  color: var(--ink-dim); text-shadow: var(--shadow-hard); background:none; }
.report-link:hover { color: var(--rs-orange); }
.report-link.done { color: var(--rs-green); pointer-events:none; }

/* explanation reveal */
.explain { margin-top: 2px; padding: 12px 16px; font-size:var(--fs-body); line-height:1.5; }
.explain .who { font-weight:700; color: var(--parch-ink); }
.explain.scroll { animation: unfurl .4s ease; }
@keyframes unfurl { from { transform: scaleY(.7); opacity:0; transform-origin: top; } to { transform:none; opacity:1; } }

/* XP drop */
.xpdrop { position: fixed; z-index: 60; pointer-events:none; font-weight:700; font-size: 20px;
  color: var(--rs-orange); text-shadow: var(--shadow-hard); display:flex; align-items:center; gap:6px; }
.xpdrop img { width: 18px; height:18px; image-rendering: pixelated; }
.xpdrop.fast { color: var(--gold-bright); font-size: 22px; }
.xpdrop.bonus { color: var(--rs-green); font-size: 15px; }
@keyframes xpfloat { 0%{ transform: translateY(0); opacity:0;} 12%{opacity:1;} 100%{ transform: translateY(-70px); opacity:0;} }

/* ============================================================================
   Overlays: level-up, quest-complete, death, modal
   ========================================================================== */
.overlay { position: fixed; inset:0; z-index: 80;
  display:flex; flex-direction:column; align-items:center;
  overflow-y:auto; -webkit-overflow-scrolling: touch;
  background: rgba(0,0,0,.66); backdrop-filter: blur(2px); padding: 16px; animation: fade .25s ease; }
/* center the card vertically, but let it scroll when it is taller than the phone
   (grid place-items:center used to clip the top/bottom off-screen = unreachable buttons) */
.overlay > * { margin-block: auto; flex-shrink: 0; }
@keyframes fade { from {opacity:0;} to {opacity:1;} }

/* level-up fanfare (OSRS yellow box) */
.levelup { width: min(440px,92vw); padding: 18px 20px; text-align:center;
  background: linear-gradient(180deg,#2c2516,#1d1810); animation: pop .4s cubic-bezier(.2,.9,.3,1.4); }
@keyframes pop { from{ transform: scale(.7); opacity:0;} to{ transform: none; opacity:1;} }
.levelup .lu-ico { font-size: 44px; }
.levelup .lu-head { font-family:"RSBold"; color: var(--rs-yellow); font-size: 22px; text-shadow: var(--shadow-hard); margin: 6px 0; }
.levelup .lu-sub { color: var(--ink); font-size: 16px; }
.levelup .lu-lvl { color: var(--rs-green); font-weight:700; }

/* quest complete scroll */
.quest { width: min(520px,94vw); padding: 26px; text-align:center; }
.quest .q-banner { font-family:"RSBold"; font-size: 30px; color:#7a1b14; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.quest .q-reward { margin-top: 10px; font-size: 17px; }

/* death screen */
.death { width: min(520px,94vw); padding: 28px; text-align:center;
  background: linear-gradient(180deg,#2a1413,#160a09); border-color:#5a1a14;
  box-shadow: 0 0 0 2px #000, 0 0 0 3px #7c2018, inset 0 -3px 8px rgba(0,0,0,.6), 0 18px 40px rgba(0,0,0,.6); }
.death .skull { font-size: 56px; filter: grayscale(.2); }
.death .d-head { font-family:"RSBold"; font-size: 26px; color: var(--rs-red); text-shadow: var(--shadow-hard); margin: 8px 0; }
.death .d-sub { color: var(--ink-dim); }

/* generic modal */
.modal { width: min(460px,94vw); padding: 18px; display:flex; flex-direction:column; gap: 12px; }
.modal h3 { font-family:"RSBold"; color: var(--gold); font-size: 20px; text-shadow: var(--shadow-hard); }
.field { display:flex; flex-direction:column; gap:6px; }
.field label { font-size: 13px; color: var(--ink-dim); }
.input {
  width:100%; padding: 11px 12px; font-family:inherit; font-size:17px; font-weight:700;
  color: var(--rs-yellow); text-shadow: var(--shadow-hard);
  background:#15110a; border:2px solid #3a2f18; border-radius:5px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.6);
}
.input:focus { outline:none; border-color: var(--gold); }
.name-status { min-height: 16px; font-size: 12px; font-weight: 700; text-shadow: var(--shadow-hard); margin-top: 2px; }
.name-status.dim { color: var(--ink-dim); font-weight: 400; }
.name-status.ok  { color: var(--rs-green); }
.name-status.bad { color: var(--rs-red); }
.toggle-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 8px 0;
  border-bottom: 1px solid rgba(255,225,150,.08); }
.toggle-row:last-child { border-bottom:none; }
.switch { width:52px; height:28px; border-radius:14px; background:#15110a; position:relative;
  box-shadow: inset 0 0 0 2px #3a2f18; transition: background .2s; flex:none; }
.switch > i { position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%;
  background: linear-gradient(180deg,#b9a36c,#7c6a3c); transition: left .18s; box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.switch.on { background: #2f6e2c; }
.switch.on > i { left: 27px; background: linear-gradient(180deg,#bdf0a6,#6fbf5a); }

/* ============================================================================
   Bank PIN pad
   ========================================================================== */
.pin-wrap { display:flex; flex-direction:column; align-items:center; gap:10px; }
.pin-title { font-weight:700; color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.pindots { display:flex; gap:14px; justify-content:center; margin: 4px 0; }
.pindot { width:18px; height:18px; border-radius:50%; background:#15110a;
  box-shadow: inset 0 0 0 2px #3a2f18, inset 0 2px 3px rgba(0,0,0,.6); transition: all .12s; }
.pindot.on { background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--bronze-0) 75%);
  box-shadow: inset 0 0 0 2px #3a2f18, 0 0 8px rgba(255,193,50,.6); }
.pinpad { display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; width:100%; max-width:300px; }
.pinkey { min-height:54px; font-size:22px; font-weight:700; color: var(--ink); text-shadow: var(--shadow-hard);
  background: linear-gradient(180deg,#5b5036,#43391f 55%,#352c18); border:2px solid #20190d; border-radius:6px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.3), inset 0 -3px 6px rgba(0,0,0,.45), 0 3px 0 #18130a; transition: transform .06s; }
.pinkey:hover { color: var(--rs-yellow); filter: brightness(1.08); }
.pinkey:active { transform: translateY(3px); }
.pinkey.aux { font-size:18px; background: linear-gradient(180deg,#3a3220,#2b2415); }
.pin-msg { min-height:18px; font-size:13px; text-align:center; }

/* ============================================================================
   HISCORES
   ========================================================================== */
.hiscores { gap: 12px; overflow:hidden; height: 100%; }
.hs-tabs { display:flex; gap:6px; flex-wrap:wrap; }
.tab { padding: 8px 14px; font-weight:700; font-size:14px; color: var(--ink-dim);
  background: linear-gradient(180deg,#352d1b,#272014); border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,225,150,.1); text-shadow: var(--shadow-hard); }
.tab.active { color: var(--rs-yellow); background: linear-gradient(180deg,#4d4129,#372d18); }
.tab:hover { color: var(--rs-yellow); }

.hs-panel { padding: 6px; overflow-y: auto; flex:1; }
/* skills table (personal) */
.skilltab { display:grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
@media (min-width: 640px){ .skilltab { grid-template-columns: repeat(3,1fr); } }
.skillcell { display:flex; align-items:center; gap:8px; padding: 8px 10px; border-radius:5px;
  background: linear-gradient(180deg,#322a1a,#262013); box-shadow: inset 0 0 0 1px rgba(255,225,150,.08); }
.skillcell .si { font-size: 20px; }
.skillcell .sn { font-size: var(--fs-sm); color: var(--ink-dim); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.skillcell .sl { font-weight:700; color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.skillcell .sl small { color:#8a7c58; }
/* per-skill progress cell (skill-guide style) */
.skillcell-bar { flex-direction:column; align-items:stretch; gap:5px; }
.skillcell-bar .sc-top { display:flex; align-items:center; gap:8px; }
.skillcell-bar .sc-bar { height:8px; border-radius:4px; background:#15110a; overflow:hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6); }
.skillcell-bar .sc-bar > i { display:block; height:100%; width:0%;
  background: linear-gradient(180deg,#ffc24a,#ff8a1f); transition: width .5s; }
.skillcell-bar .sc-xp { font-size:11px; color:#8a7c58; text-align:right; }

/* ranking rows */
.rank-list { display:flex; flex-direction:column; }
.rank-row { display:grid; grid-template-columns: 46px 1fr auto auto; gap: 10px; align-items:center;
  padding: 9px 10px; border-bottom: 1px solid rgba(255,225,150,.07); font-size: 15px; }
.rank-row:nth-child(odd){ background: rgba(255,225,150,.03); }
.rank-row .rk { color:#8a7c58; font-size:13px; }
.rank-row .rk.top { color: var(--gold); font-weight:700; }
.rank-row .nm { color: var(--ink); font-weight:700; text-shadow: var(--shadow-hard); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rank-row .lv { color: var(--rs-yellow); }
.rank-row .xp { color: var(--ink-dim); font-size:13px; }
.rank-row.you { background: linear-gradient(90deg, rgba(255,193,50,.18), transparent);
  box-shadow: inset 0 0 0 1px rgba(255,193,50,.35); }
.rank-row.you .nm { color: var(--gold-bright); }

/* daily share grid */
.daily-grid { display:flex; gap:5px; justify-content:center; flex-wrap:wrap; margin: 8px 0; }
.daily-grid .cell { width: 26px; height:26px; border-radius:4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.5); }
.cell.ok { background: linear-gradient(180deg,#46c14b,#2f8b34); }
.cell.no { background: linear-gradient(180deg,#c2433a,#8a2920); }
.cell.skip { background:#3a3220; }

/* result stats */
.stat-grid { display:grid; grid-template-columns: repeat(2,1fr); gap:8px; margin: 10px 0; }
.stat-box { padding: 10px; text-align:center; border-radius:5px;
  background: linear-gradient(180deg,#322a1a,#262013); box-shadow: inset 0 0 0 1px rgba(255,225,150,.08); }
.stat-box .sb-v { font-size: 22px; font-weight:700; color: var(--rs-yellow); text-shadow: var(--shadow-hard); }
.stat-box .sb-v.gp { color: var(--gold); }
.stat-box .sb-k { font-size: 12px; color: var(--ink-dim); }

/* music now-playing chip */
.nowplaying { display:flex; align-items:center; gap:8px; font-size:13px; color: var(--rs-green);
  text-shadow: var(--shadow-hard); }
.nowplaying .note { animation: spin 3s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg);} }

/* merch flash (correct answer burst) */
#merch-flash { position: fixed; inset:0; z-index: 55; pointer-events:none; opacity:0;
  background: radial-gradient(circle at 50% 50%, rgba(60,255,94,.28), transparent 60%); }
#merch-flash.go { animation: merch .6s ease; }
@keyframes merch { 0%{opacity:0;} 25%{opacity:1;} 100%{opacity:0;} }

/* utility */
.row { display:flex; gap:10px; align-items:center; }
.col { display:flex; flex-direction:column; gap:10px; }
.center { text-align:center; }
.mt { margin-top: 8px; } .mt2 { margin-top: 16px; }
.gap-sm { gap: 6px; }
.hide { display:none !important; }
.wrap { flex-wrap: wrap; }
.scrolly { overflow-y: auto; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #1a140a; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg,#6a5a32,#43381f); border-radius: 5px; border: 1px solid #000; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .05ms !important; }
}
.reduce-motion .brand .crest, .reduce-motion .nowplaying .note { animation: none !important; }

/* small phones */
@media (max-width: 380px) {
  body { font-size: 16px; }
  .menu-card { padding: 14px; }
  .q-box { padding: 12px 14px; }
}

/* ============================================================================
   SCENERY - living Gielinor backdrop (per-category, difficulty-aware, fx)
   ========================================================================== */
#scenery { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.scene-layer {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity 1.1s ease, filter 1.1s ease;
  will-change: opacity;
}
.scene-layer.peril::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 200px 40px rgba(120,8,4,.55);
  animation: peril-pulse 2.4s ease-in-out infinite;
}
@keyframes peril-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
body.in-game #scenery { filter: saturate(1.05); }

/* particle field */
.scene-fx { position: absolute; inset: 0; }
.scene-fx i {
  position: absolute; display: block; top: 100%;
  width: calc(6px * var(--s, 1)); height: calc(6px * var(--s, 1));
  border-radius: 50%; background: var(--accent); opacity: 0;
}
/* embers: glowing motes rising fast from the bottom */
.fx-embers i { box-shadow: 0 0 8px 1px var(--accent); animation: rise-fade linear infinite; }
/* motes: slow dust drifting up */
.fx-motes i { opacity: 0; animation: rise-fade linear infinite; filter: blur(.4px); }
/* quests share motes via fx-motes */
/* spark: quick darting sparks */
.fx-spark i { width: calc(3px * var(--s,1)); height: calc(10px * var(--s,1)); border-radius: 2px;
  box-shadow: 0 0 6px var(--accent); animation: rise-fast linear infinite; }
/* coins: rising gold ticks */
.fx-coins i { width: calc(7px * var(--s,1)); height: calc(7px * var(--s,1));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 6px var(--accent); animation: rise-fade linear infinite; }
/* sparkle / items: twinkling on the spot, scattered vertically */
.fx-sparkle i, .fx-stars i { top: auto; animation: twinkle ease-in-out infinite; box-shadow: 0 0 6px var(--accent); }
.fx-sparkle i { top: calc(var(--o) * 90%); }
.fx-stars i { width: 2px; height: 2px; background: #fff; box-shadow: 0 0 4px #cfe0ff; top: calc((var(--s) - .5) * 120%); }
/* leaves: gentle falling from the top */
.fx-leaves i { top: -6%; border-radius: 40% 60% 55% 45%; transform: rotate(20deg);
  animation: fall linear infinite; opacity: 0; }
/* drip: slow descending droplets (slayer caves) */
.fx-drip i { top: -4%; width: calc(3px*var(--s,1)); height: calc(9px*var(--s,1)); border-radius: 0 0 50% 50%;
  animation: fall linear infinite; }
/* clouds: big soft blobs drifting sideways */
.fx-clouds i { top: calc(var(--o) * 55%); width: calc(120px*var(--s,1)); height: calc(46px*var(--s,1));
  border-radius: 50%; background: radial-gradient(closest-side, rgba(220,235,255,.16), transparent);
  filter: blur(6px); animation: drift linear infinite; }

@keyframes rise-fade { 0% { opacity: 0; transform: translateY(0) scale(var(--s,1)); }
  12% { opacity: var(--o,.5); } 100% { opacity: 0; transform: translateY(-104vh) scale(calc(var(--s,1)*.6)); } }
@keyframes rise-fast { 0% { opacity: 0; transform: translateY(0); } 10% { opacity: var(--o,.7); }
  100% { opacity: 0; transform: translateY(-104vh); } }
@keyframes fall { 0% { opacity: 0; transform: translateY(0) rotate(0deg) translateX(0); }
  10% { opacity: var(--o,.5); } 100% { opacity: 0; transform: translateY(110vh) rotate(220deg) translateX(40px); } }
@keyframes drift { 0% { opacity: 0; transform: translateX(-30vw); } 15% { opacity: var(--o,.5); }
  85% { opacity: var(--o,.5); } 100% { opacity: 0; transform: translateX(120vw); } }
@keyframes twinkle { 0%,100% { opacity: 0; transform: scale(.6); } 50% { opacity: var(--o,.7); transform: scale(1.1); } }

/* the old world layer becomes a faint grain over scenery */
#world { opacity: .5; }

/* ============================================================================
   Per-question item art (richer question screens)
   ========================================================================== */
.q-box.has-art { padding-right: 96px; }
.q-art {
  position: absolute; top: 12px; right: 12px; width: 72px; height: 72px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(closest-side, rgba(255,225,150,.14), transparent 78%);
  animation: art-bob 3.6s ease-in-out infinite;
}
.q-art img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
.q-art-gp { font-size: 10px; font-weight: 700; color: var(--rs-yellow); text-shadow: var(--shadow-hard); white-space: nowrap; }
@keyframes art-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (max-width: 480px) {
  .q-box.has-art { padding-right: 74px; }
  .q-art { width: 56px; height: 56px; top: 10px; right: 8px; }
  .q-art img { width: 50px; height: 50px; }
}
.reduce-motion .scene-layer.peril::after, .reduce-motion .q-art { animation: none !important; }

/* ============================================================================
   PWA install ("Become a Member") + daily reminders
   ========================================================================== */
.cyan { color: var(--rs-cyan); text-shadow: var(--shadow-hard); }

/* the install bar in the main menu */
.install-bar {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 14px; min-height: 0;
  background: linear-gradient(180deg, #43381d, #2c2413 60%, #241d10);
  border-color: var(--bronze-0);
  box-shadow: inset 0 1px 0 rgba(255,235,170,.18), inset 0 -2px 6px rgba(0,0,0,.45), 0 1px 0 #18130a;
  animation: install-glow 3.2s ease-in-out infinite;
}
.install-bar:hover { color: var(--ink); }
.install-star { font-size: 22px; flex: none; filter: drop-shadow(0 0 5px rgba(255,193,50,.6)); }
.install-bar-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; flex: 1; }
.install-bar-txt b { color: var(--rs-yellow); text-shadow: var(--shadow-hard); font-size: 15px; }
.install-bar-txt .subtle { font-size: 11.5px; }
.install-go { font-size: 22px; color: var(--gold); flex: none; }
@keyframes install-glow {
  0%,100% { box-shadow: inset 0 1px 0 rgba(255,235,170,.18), inset 0 -2px 6px rgba(0,0,0,.45), 0 1px 0 #18130a, 0 0 0 rgba(255,193,50,0); }
  50%     { box-shadow: inset 0 1px 0 rgba(255,235,170,.18), inset 0 -2px 6px rgba(0,0,0,.45), 0 1px 0 #18130a, 0 0 10px rgba(255,193,50,.28); }
}
.reduce-motion .install-bar { animation: none; }

/* the "⭐ Member" chip next to the player's name */
.member-chip {
  display: inline-block; margin-left: 6px; font-size: 12px; vertical-align: middle;
  color: var(--gold-bright); text-shadow: 0 0 6px rgba(255,193,50,.6), var(--shadow-hard);
}

/* installed players get a gold trim glow on the crest */
.is-member .crest { filter: drop-shadow(0 0 7px rgba(255,193,50,.55)); }
.member-crest { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(255,193,50,.45); }

/* benefit list inside the install panel */
.install-benefits { display: flex; flex-direction: column; gap: 9px; margin: 2px 0 4px; }
.install-benefits .ib { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); color: var(--ink-dim); line-height: 1.4; }
.install-benefits .ib b { color: var(--ink); text-shadow: var(--shadow-hard); }
.install-benefits .ib-i { font-size: 18px; flex: none; width: 24px; text-align: center; }

/* iOS / fallback "Add to Home Screen" steps */
.ios-steps { display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(180deg,#2c2516,#211b0f); border-radius: 6px; padding: 12px 14px;
  border: 1px solid rgba(255,225,150,.12); }
.ios-step { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); color: var(--ink); line-height: 1.35; }
.ios-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bronze-0); color: #1a1308; font-weight: 700; font-size: 13px; }
.ios-share { display: inline-flex; vertical-align: middle; transform: translateY(4px);
  padding: 1px 5px; border-radius: 5px; background: rgba(127,214,255,.12); }
.ios-share svg { display: block; }

/* installed (standalone) gets safe-area breathing room under notches/home bars */
.is-standalone #app { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.reduce-motion .scene-fx { display: none; }

/* ============================================================================
   Mobile-app shell: bottom tab bar
   ========================================================================== */
#tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 60;
  width: min(520px, calc(100vw - 20px));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 7px 8px; gap: 2px;
  background: linear-gradient(180deg, #3b3424, #2a2114 60%, #221b0f);
  border: 2px solid #20190d; border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.22), inset 0 -3px 8px rgba(0,0,0,.45),
              0 8px 22px rgba(0,0,0,.55);
}
#tabbar.hidden { display: none; }
.tabbar-item {
  appearance: none; cursor: pointer; background: none; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 6px 2px; border-radius: 12px;
  color: var(--ink-dim); text-shadow: var(--shadow-hard);
  transition: color .12s ease, transform .08s ease, background .12s ease;
}
.tabbar-item:hover { color: var(--ink); }
.tabbar-item:active { transform: translateY(1px); }
.tabbar-item:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.tabbar-ico { font-size: 21px; line-height: 1; }
.tabbar-lbl { font-size: 11px; font-weight: 700; letter-spacing: .2px; }
.tabbar-item.active { color: var(--rs-yellow); }
.tabbar-item.active .tabbar-ico { filter: drop-shadow(0 0 7px rgba(255,193,50,.55)); }

/* center raised Play FAB */
.tabbar-fab {
  transform: translateY(-16px);
  background: linear-gradient(180deg, #c9982f, #9a6f1d 55%, #7a560f);
  border: 2px solid #2a1d06 !important; border-radius: 50%;
  width: 62px; height: 62px; margin: 0 auto; gap: 0;
  color: #1c1405;
  box-shadow: inset 0 1px 0 rgba(255,245,200,.55), inset 0 -3px 8px rgba(80,50,0,.5),
              0 5px 0 #5a3f0c, 0 8px 16px rgba(0,0,0,.5);
}
.tabbar-fab:hover { color: #0d0a02; filter: brightness(1.07); }
.tabbar-fab:active { transform: translateY(-13px); }
.tabbar-fab .tabbar-ico { font-size: 26px; }
.tabbar-fab .tabbar-lbl { font-size: 10px; margin-top: -1px; }
.tabbar-fab.active { color: #1c1405; }

/* give scrollable content room so the bar never covers it */
body.has-tabbar #app { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

/* ============================================================================
   Home tweaks: tappable nameplate, guest save hint, hero + daily CTA
   ========================================================================== */
.nameplate-btn {
  width: 100%; appearance: none; cursor: pointer; text-align: left;
  background: linear-gradient(180deg,#332c1c,#272010); border: 1px solid #15110a;
  border-radius: 10px; padding: 10px 12px; gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.14);
  transition: filter .12s ease, transform .08s ease;
}
.nameplate-btn:hover { filter: brightness(1.08); }
.nameplate-btn:active { transform: translateY(1px); }
.nameplate-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.who-ava { font-size: 24px; line-height: 1; flex: none; }
.np-go { margin-left: auto; color: var(--ink-dim); font-size: 22px; font-weight: 700; flex: none; }
.save-hint {
  width: 100%; appearance: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, rgba(255,193,50,.16), rgba(255,193,50,.07));
  border: 1px dashed rgba(255,193,50,.5); border-radius: 10px;
  padding: 9px 12px; color: var(--ink); text-shadow: var(--shadow-hard);
  font-size: var(--fs-sm); transition: filter .12s ease;
}
.save-hint:hover { filter: brightness(1.08); }
.save-hint:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.save-hint b { color: var(--gold-bright); }
.save-hint .sh-ico { font-size: 18px; flex: none; }
.save-hint .np-go { font-size: 18px; }
.hero-btn { font-size: 20px; min-height: 58px; }
.daily-cta { justify-content: space-between !important; }
.daily-cta .daily-streak { color: var(--rs-orange); font-size: 15px; }

/* ============================================================================
   Profile / You screen
   ========================================================================== */
.profile { gap: 12px; }
.profile .panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pf-card { gap: 12px !important; }
.pf-id { display: flex; align-items: center; gap: 12px; }
.pf-ava {
  font-size: 30px; line-height: 1; flex: none;
  width: 52px; height: 52px; display: grid; place-items: center;
  background: linear-gradient(180deg,#3b3424,#2a2114); border: 2px solid #20190d; border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,235,170,.2);
}
.pf-name { font-family: "RSBold"; color: var(--rs-yellow); font-size: 20px; text-shadow: var(--shadow-hard); display: flex; align-items: center; gap: 6px; }
.pf-sub { color: var(--ink-dim); font-size: var(--fs-sm); }
.pf-actions { display: flex; flex-direction: column; gap: 9px; }

/* ============================================================================
   Save sheet (slide-up bottom sheet) + save CTA + coachmark
   ========================================================================== */
.sheet-overlay { padding: 0; }
.sheet-overlay > * { margin-block: auto 0; }                 /* pin sheet to the bottom */
@media (min-width: 560px) { .sheet-overlay > * { margin-block: auto; } }   /* center on desktop */
.sheet {
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column; gap: 11px;
  padding: 14px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  animation: sheet-up .3s cubic-bezier(.2,.9,.3,1.1);
}
@media (min-width: 560px) { .sheet { border-radius: 16px; padding-bottom: 20px; } }
@keyframes sheet-up { from { transform: translateY(105%); } to { transform: none; } }
.reduce-motion .sheet { animation: none; }
.sheet-grab { width: 42px; height: 5px; border-radius: 3px; background: rgba(255,235,170,.3); margin: 0 auto 2px; }
.btn-save {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,193,50,.22), rgba(255,193,50,.1)) !important;
  border-color: rgba(255,193,50,.6) !important; color: var(--gold-bright);
  margin-top: 4px;
}
.btn-save:hover { color: #fff; }

.coachtip {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(127,214,255,.16), rgba(127,214,255,.07));
  border: 1px dashed rgba(127,214,255,.5);
  color: var(--ink); text-shadow: var(--shadow-hard); font-size: var(--fs-sm);
  animation: coach-pulse 2.2s ease-in-out infinite;
}
.coachtip .coach-ico { font-size: 20px; flex: none; }
.coachtip b { color: var(--rs-cyan); }
@keyframes coach-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(127,214,255,.0); } 50% { box-shadow: 0 0 0 3px rgba(127,214,255,.12); } }
.reduce-motion .coachtip { animation: none; }

/* ============================================================================
   Pinned bottom action bar - the advance button after answering. Fixed to the
   viewport so "Next rung" / "Next" / "See results" is ALWAYS reachable on mobile
   without scrolling (this was costing players who never scrolled to find it).
   ========================================================================== */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  display: none;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(16,13,7,0), #16110a 42%, #100d07);
  border-top: 1px solid rgba(255,225,150,.16);
  box-shadow: 0 -8px 22px rgba(0,0,0,.45);
  animation: bar-up .22s ease;
}
.action-bar.show { display: block; }
.action-bar .btn { width: 100%; max-width: 640px; margin: 0 auto; min-height: 56px; font-size: 19px; }
@keyframes bar-up { from { transform: translateY(100%); } to { transform: none; } }
.reduce-motion .action-bar { animation: none; }
/* reserve scroll room so the pinned bar never sits on top of the explanation */
body.revealed.in-game #app { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
