/* live.css
   Styles for the real-time delivery moments (Part 0) and the companion player
   features (Part A): the live connection banner and pause veil, cheer prompt,
   quest log, sticker album, relay handoff, accessibility quick settings, recap
   card panel, ask-a-god, photo captions, and the wake-the-troll moment.

   Matches the existing dark Norse look (main.css tokens). Tap targets stay
   large for small hands. Everything respects the .reduce-motion body class and
   prefers-reduced-motion: animations become instant, never removed in a way
   that hides content. Per-device text size is driven by --font-scale and high
   contrast by body.high-contrast (Feature 8). */

/* ---- accessibility: text size and high contrast (Feature 8) ---- */
:root { --font-scale: 1; }
/* Scale the root so em/rem/percentage text grows for young or older readers.
   Fixed-px legacy text stays put; the companion screens below use rem so they
   scale fully. */
html { font-size: calc(100% * var(--font-scale)); }

body.high-contrast {
  --gold: #ffe08a;
  --cream: #ffffff;
  --panel: rgba(255, 255, 255, 0.16);
}
body.high-contrast .panel-note,
body.high-contrast .cc-meta,
body.high-contrast .hub-tile-sub { color: #e8eefc; }
body.high-contrast .btn-small { border-color: var(--gold-bright, #ffe08a); }
body.high-contrast .chapter-card,
body.high-contrast .hub-tile,
body.high-contrast .overlay-card { border-width: 2px; }

.a11y-screen { max-width: 620px; margin: 0 auto; }
.a11y-group { margin-bottom: 18px; }
.a11y-options { display: flex; flex-wrap: wrap; gap: 10px; }
.a11y-opt, .a11y-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  border: 2px solid rgba(201, 168, 76, 0.45);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.a11y-opt.chosen, .a11y-toggle.on { border-color: var(--amber); background: rgba(245, 166, 35, 0.22); }
.a11y-toggle { width: 100%; text-align: left; }

/* ---- live connection banner (broadcast, GM feature 6) ---- */
.live-banner {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, 94vw);
  background: rgba(6, 8, 15, 0.97);
  color: var(--on-dark); /* always-dark broadcast banner; see --on-dark */
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 12px 14px;
  z-index: 150;
  box-shadow: var(--shadow);
  animation: live-banner-in 0.35s ease both;
}
.live-banner-art { width: 40px; height: 40px; flex: none; }
.live-banner-text { flex: 1; font-size: 0.95rem; line-height: 1.35; }
.live-banner-close { flex: none; }
@keyframes live-banner-in {
  from { transform: translateX(-50%) translateY(-120%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
body.reduce-motion .live-banner { animation: none; }

/* ---- pause veil (game.paused) ---- */
.live-pause-veil {
  position: fixed;
  inset: 0;
  z-index: 175;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(22, 32, 78, 0.7), rgba(6, 8, 15, 0.92));
  backdrop-filter: blur(3px);
}
.live-pause-card {
  text-align: center;
  max-width: 420px;
  background: linear-gradient(180deg, #11173a, #0a0e2e);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.live-pause-art { width: 88px; height: 88px; }
.live-pause-text { margin-top: 14px; font-size: 1.05rem; color: var(--on-dark); line-height: 1.4; }

/* spotlight: a soft gold vignette while a hero is in the spotlight */
body.live-spotlight::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  box-shadow: 0 0 180px 40px rgba(255, 224, 138, 0.45) inset;
  animation: live-spot-pulse 2.4s ease-in-out infinite;
}
@keyframes live-spot-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
body.reduce-motion.live-spotlight::after { animation: none; }

/* ---- cheer prompt (Feature 1) ---- */
.cheer-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, 92vw);
  background: rgba(6, 8, 15, 0.97);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 16px;
  z-index: 150;
  box-shadow: var(--shadow);
  text-align: center;
  animation: live-banner-in 0.3s ease both;
}
.cheer-art { width: 52px; height: 52px; }
.cheer-text { margin: 8px 0 12px; font-size: 1rem; line-height: 1.35; color: var(--on-dark); }
.cheer-actions { display: flex; gap: 10px; justify-content: center; }
body.reduce-motion .cheer-prompt { animation: none; }

/* ---- quest log (Feature 2) ---- */
.quest-log { max-width: 720px; margin: 0 auto; }
.ql-header { display: flex; align-items: center; gap: 12px; background: var(--panel); border-left: 6px solid var(--gold); border-radius: 12px; padding: 12px 14px; }
.ql-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: contain; background: rgba(255, 255, 255, 0.06); }
.ql-name { font-family: var(--font-head); color: var(--gold); font-size: 1.3rem; }
.ql-real { font-size: 0.9rem; color: var(--muted, #cdd6ef); }
.ql-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.ql-stat { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; padding: 12px; }
.ql-stat-icon { width: 28px; height: 28px; object-fit: contain; }
.ql-stat-n { font-family: var(--font-head); color: var(--gold-bright); font-size: 1.3rem; }
.ql-stat-l { font-size: 0.85rem; color: var(--muted, #cdd6ef); }
.ql-titles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ql-title-badge { background: var(--gold); color: #3a2300; border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; font-weight: 700; }
.ql-title-empty, .ql-empty { font-size: 0.9rem; color: var(--muted, #aebbe0); font-style: italic; }
.ql-runes { display: flex; flex-wrap: wrap; gap: 12px; }
.ql-rune { text-align: center; }
.ql-rune-img { width: 48px; height: 48px; object-fit: contain; }
.ql-rune-glyph { display: block; color: var(--gold-bright); font-family: var(--font-rune); font-size: 1.4rem; }
.ql-rune-name { font-size: 0.8rem; color: var(--muted, #cdd6ef); }
.ql-finds { display: flex; flex-direction: column; gap: 6px; }
.ql-find { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 10px; padding: 8px 12px; }
.ql-find-check { width: 20px; height: 20px; }
.ql-find-label { font-size: 0.95rem; }
.ql-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ql-photo { margin: 0; }
.ql-photo-img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(201, 168, 76, 0.4); }
.ql-photo-cap { font-size: 0.8rem; color: var(--muted, #cdd6ef); margin-top: 4px; }

/* ---- sticker album (Feature 7) ---- */
.sticker-album { max-width: 720px; margin: 0 auto; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.sticker-cell { text-align: center; background: var(--panel); border: 2px solid rgba(201, 168, 76, 0.3); border-radius: 16px; padding: 14px; }
.sticker-cell.earned { border-color: var(--amber); background: rgba(245, 166, 35, 0.14); }
.sticker-cell.locked { opacity: 0.55; filter: grayscale(0.6); }
.sticker-art { width: 64px; height: 64px; object-fit: contain; }
.sticker-name { font-family: var(--font-head); color: var(--gold); margin-top: 6px; font-size: 1rem; }
.sticker-hint { font-size: 0.8rem; color: var(--muted, #cdd6ef); margin-top: 2px; }

/* ---- relay / pass the phone (Feature 3) ---- */
.relay-card { text-align: center; }
.relay-now { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 16px 0; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--amber); }
.relay-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: contain; background: rgba(255, 255, 255, 0.06); }
.relay-turn-label { font-size: 0.95rem; color: var(--muted, #cdd6ef); }
.relay-turn-name { font-family: var(--font-head); color: var(--gold); font-size: 1.6rem; }
.relay-sub { margin: 12px 0 6px; color: var(--muted, #aebbe0); font-size: 0.9rem; }
.relay-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---- recap card panel (Feature 9) ---- */
.recap-card-panel { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }

/* ---- ask a god (Feature 6) ---- */
.ask-god { max-width: 620px; margin: 0 auto; }
.ask-list { display: flex; flex-direction: column; gap: 10px; }
.ask-chapter { text-align: left; }

/* ---- photo caption editor (Feature 5) ---- */
.photo-cap-card { max-width: 520px; }
.photo-cap-preview { position: relative; margin: 10px 0; }
.photo-cap-img { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; border: 1px solid rgba(201, 168, 76, 0.4); background: #000; }
.photo-cap-sticker-mark { position: absolute; right: 12px; bottom: 12px; width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.photo-cap-stickers { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.photo-cap-sticker-opt { width: var(--tap); height: var(--tap); border-radius: 12px; border: 2px solid rgba(201, 168, 76, 0.4); background: rgba(255, 255, 255, 0.08); cursor: pointer; padding: 4px; }
.photo-cap-sticker-opt.chosen { border-color: var(--amber); background: rgba(245, 166, 35, 0.22); }
.photo-cap-sticker-img { width: 100%; height: 100%; object-fit: contain; }

/* scrapbook sticker overlay and caption button (Feature 5) */
.scrap-img-wrap { position: relative; }
.scrap-sticker { position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.scrap-caption-btn { margin-top: 6px; width: 100%; }

/* ---- wake the troll (Feature 10) ---- */
.wake-troll-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  cursor: pointer;
  background: radial-gradient(circle at 50% 40%, rgba(22, 32, 78, 0.75), rgba(6, 8, 15, 0.95));
}
.wake-troll-img { width: 200px; height: 200px; object-fit: contain; }
.wake-troll-glyph { font-family: var(--font-head); color: var(--gold); font-size: 3rem; opacity: 0.7; }
.wake-troll-prompt {
  font-family: var(--font-head);
  color: var(--gold-bright);
  font-size: 1.1rem;
  text-align: center;
  padding: 0 24px;
  animation: blink 1.6s ease-in-out infinite;
}
body.reduce-motion .wake-troll-prompt { animation: none; }
