/* QuizFire Games: page shells for the hub (/games/), the feed (/games/play/) and the
   standalone game pages. The games themselves are styled by engine/engine.css. */
:root {
  color-scheme: dark;
  --bg: #10182d;
  --ink: #f7f8ff;
  --muted: #b9c8da;
  --line: #3a4d66;
  --orange: #ffb46e;
  --yt: #ff0033;
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(ellipse at 16% 5%, #263f62, transparent 54%),
    radial-gradient(ellipse at 94% 88%, #302746, transparent 48%), var(--bg);
  background-attachment: fixed;
}
a { color: inherit; }
.brand { display: block; width: 112px; height: 56px; border-radius: 18px; overflow: hidden; background: white; box-shadow: 0 5px 22px #0002; flex: none; }
.brand img { display: block; width: 112px; height: 112px; margin-top: -27px; }
.brand--sm { width: 88px; height: 44px; border-radius: 14px; }
.brand--sm img { width: 88px; height: 88px; margin-top: -22px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.yt-btn { display: inline-flex; align-items: center; gap: 10px; background: var(--yt); color: #fff; text-decoration: none; font-weight: 900; border-radius: 999px; padding: 10px 18px 10px 14px; box-shadow: 0 6px 22px #ff003333; transition: transform .15s, background .15s; white-space: nowrap; }
.yt-btn:hover { background: #ff2a52; transform: translateY(-1px); }
.yt-btn svg { width: 24px; height: 17px; }
.yt-btn svg rect { fill: #fff; } .yt-btn svg path { fill: var(--yt); }
a:focus-visible, button:focus-visible { outline: 3px solid #ffc467; outline-offset: 3px; }

/* ---------- Standalone game page ---------- */
.solo { min-height: 100dvh; max-width: 720px; margin: auto; display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.solo-head { display: flex; justify-content: center; align-items: center; position: relative; flex-shrink: 0; }
.solo-all { position: absolute; left: 0; color: var(--muted); text-decoration: none; font-weight: 800; font-size: .98rem; padding: 8px 4px; }
.solo-all:hover { color: #fff; }
.solo-yt { position: absolute; right: 0; padding: 8px 12px 8px 10px; font-size: .95rem; }
.solo #app { flex: 1; padding: 14px 0; }
@media (max-width: 520px) { .solo-yt b { display: none; } .solo-yt { padding: 8px 10px; } }

/* ---------- Feed (reels) ---------- */
.feed { overflow: hidden; height: 100dvh; }
.feed-top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px; pointer-events: none;
  background: linear-gradient(#10182df2 40%, #10182d00); }
.feed-top > * { pointer-events: auto; }
.feed-back { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; color: #fff; }
.feed-back span { font-size: 1.05rem; }
.feed-top .yt-btn { padding: 8px 14px 8px 11px; font-size: .95rem; }
.reel { height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.reel::-webkit-scrollbar { display: none; }
.slide { height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; position: relative; display: flex; justify-content: center; }
.slide-col { width: 100%; max-width: 520px; height: 100%; display: flex; flex-direction: column; padding: calc(max(10px, env(safe-area-inset-top)) + 58px) 16px 0; }
.slide-game { flex: 1; min-height: 0; display: flex; overflow-y: auto; scrollbar-width: none; }
.slide-game::-webkit-scrollbar { display: none; }
.slide-game > .qf-root { margin: auto 0; padding: 6px 0 10px; }
.slide-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); border-top: 1px solid #ffffff14; }
.slide-meta { flex: 1; min-width: 0; font-size: .92rem; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-meta b { color: #fff; }
.rail-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #ffffff22; background: #ffffff12; color: #fff; text-decoration: none; font-size: 1.15rem; cursor: pointer; transition: background .15s, transform .15s; font-family: inherit; }
.rail-btn:hover { background: #ffffff24; }
.rail-btn:active { transform: scale(.94); }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn--yt { background: var(--yt); border-color: var(--yt); }
.rail-btn--yt svg rect { fill: #fff; } .rail-btn--yt svg path { fill: var(--yt); }
.feed-nav { display: none; }
.feed-toast { position: fixed; z-index: 9; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; background: #fff; color: #172035; font-weight: 800; padding: 10px 16px; border-radius: 12px; transition: .25s; pointer-events: none; }
.feed-toast.show { opacity: 1; transform: translate(-50%, 0); }
.swipe-hint { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); color: var(--muted); font-weight: 700; font-size: .9rem; animation: hint 1.6s ease-in-out infinite; pointer-events: none; transition: opacity .3s; }
.swipe-hint.gone { opacity: 0; }
@keyframes hint { 50% { transform: translate(-50%, -6px); } }

/* Interstitial: the channel between games. */
.promo { margin: auto 0; text-align: center; padding: 10px 0; animation: qf-enter .3s ease-out both; }
.promo-kicker { color: #ff8aa0; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; margin: 0; }
.promo h2 { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.02; letter-spacing: -.045em; margin: 10px 0 12px; }
.promo h2 em { color: #ffbd73; font-style: normal; }
.promo p { color: #d2deec; font-size: 1.1rem; line-height: 1.4; margin: 0 auto 18px; max-width: 30ch; }
.promo .yt-btn { font-size: 1.15rem; padding: 14px 24px 14px 18px; }
.promo-thumb { display: block; margin: 20px auto 0; max-width: 360px; text-decoration: none; color: #fff; border-radius: 18px; overflow: hidden; border: 1px solid #ffffff22; background: #ffffff0d; text-align: left; }
.promo-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #1c2840; }
.promo-thumb span { display: block; padding: 10px 14px; font-weight: 800; }
.promo-thumb small { display: block; color: var(--muted); font-weight: 600; }
.promo-next { margin-top: 18px; color: var(--muted); font-weight: 700; }

@media (min-width: 860px) {
  .slide-col { padding-top: 78px; }
  .feed-nav { display: flex; flex-direction: column; gap: 12px; position: fixed; z-index: 5; right: 28px; top: 50%; transform: translateY(-50%); }
  .feed-nav .rail-btn { width: 52px; height: 52px; font-size: 1.3rem; }
  .feed-top { padding: 14px 28px; }
}

/* ---------- Hub ---------- */
.hub-top { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.hub-top nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.hub-top nav a:not(.yt-btn) { text-decoration: none; color: var(--muted); font-weight: 800; padding: 8px 10px; border-radius: 10px; }
.hub-top nav a:not(.yt-btn):hover { color: #fff; background: #ffffff10; }
.hub { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.hub-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; padding: 26px 0 34px; }
.hub-kicker { color: #ffbd73; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; margin: 0; }
.hub-hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: 1; letter-spacing: -.05em; margin: 12px 0 16px; }
.hub-hero h1 em { color: #ffbd73; font-style: normal; }
.hub-lede { color: #d2deec; font-size: 1.2rem; line-height: 1.45; max-width: 40ch; margin: 0 0 24px; }
.hub-ctas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hub-ctas .yt-btn { padding: 14px 22px 14px 16px; font-size: 1.05rem; }
.play-btn { display: inline-flex; align-items: center; gap: 10px; border: 0; background: var(--orange); color: #172035; border-radius: 18px; padding: 15px 26px; font-size: 1.2rem; font-weight: 900; box-shadow: 0 5px 0 #c87945; text-decoration: none; transition: transform .15s, background .15s; }
.play-btn:hover { background: #ffc58f; transform: translateY(-2px); }
.hub-stack { position: relative; height: 380px; }
.hub-stack a { position: absolute; width: 210px; aspect-ratio: 3 / 4; border-radius: 24px; text-decoration: none; box-shadow: 0 24px 50px #0006; transition: transform .25s; }
.hub-stack a:nth-child(1) { left: 6%; top: 40px; transform: rotate(-9deg); }
.hub-stack a:nth-child(2) { left: 30%; top: 0; z-index: 2; transform: rotate(1deg); }
.hub-stack a:nth-child(3) { left: 54%; top: 46px; transform: rotate(10deg); }
.hub-stack a:hover { transform: translateY(-8px) rotate(0); z-index: 3; }

.shelf { margin: 8px 0 34px; }
.shelf-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.shelf-head h2 { font-size: 1.6rem; letter-spacing: -.03em; margin: 0; }
.shelf-head p { color: var(--muted); margin: 0; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; text-decoration: none; color: #fff; padding: 14px;
  background: radial-gradient(circle at 30% 22%, #ffffff33, transparent 50%), linear-gradient(160deg, var(--h1), var(--h2));
  box-shadow: 0 1px 0 #ffffff30 inset, 0 12px 26px #0004; transition: transform .2s, box-shadow .2s; isolation: isolate; }
.tile:hover { transform: translateY(-4px); box-shadow: 0 1px 0 #ffffff30 inset, 0 20px 36px #0006; }
.tile-emoji { position: absolute; inset: 0 0 34% 0; display: grid; place-items: center; font-size: clamp(64px, 9vw, 86px); filter: drop-shadow(0 10px 12px #0004); transition: transform .3s; z-index: -1; }
.tile:hover .tile-emoji { transform: scale(1.08) rotate(-4deg); }
.tile-emoji .qf-emo { height: 1em; }
.tile b { font-size: 1.22rem; line-height: 1.1; letter-spacing: -.02em; text-shadow: 0 2px 10px #0005; }
.tile small { color: #ffffffd0; font-weight: 700; margin-top: 4px; font-size: .86rem; }
.tile::after { content: "▶"; position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #0000004d; font-size: .8rem; opacity: 0; transition: opacity .2s; }
.tile:hover::after { opacity: 1; }
.tile-play { font-size: .8rem; }

.channel { margin: 16px 0 30px; border-radius: 28px; padding: 28px; background: linear-gradient(135deg, #3a1424, #1f2440 60%); border: 1px solid #ff4d6d40; }
.channel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; justify-content: space-between; margin-bottom: 22px; }
.channel-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); letter-spacing: -.04em; margin: 6px 0 6px; line-height: 1.05; }
.channel-head p { color: #e2d3de; margin: 0; font-size: 1.08rem; }
.channel-head .yt-btn { padding: 14px 22px 14px 16px; font-size: 1.05rem; }
.vids { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; list-style: none; padding: 0; margin: 0; }
.vids a { display: block; text-decoration: none; color: #fff; border-radius: 16px; overflow: hidden; background: #ffffff0d; border: 1px solid #ffffff1a; transition: transform .2s; height: 100%; }
.vids a:hover { transform: translateY(-3px); }
.vids img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #1c2840; }
.vids span { display: block; padding: 10px 12px; font-weight: 800; line-height: 1.25; }
.vids small { display: block; color: var(--muted); font-weight: 600; margin-top: 2px; }

.hub-foot { max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; border-top: 1px solid #ffffff14; color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: 10px 20px; }
.hub-foot a { color: var(--muted); }
.hub-foot a:hover { color: #fff; }
.hub-foot span { margin-left: auto; }

@media (max-width: 820px) {
  .hub-hero { grid-template-columns: 1fr; padding-top: 10px; }
  .hub-stack { display: none; }
  .hub-top nav a.hide-sm { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .channel { padding: 20px; }
  .hub-foot span { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .tile-emoji, .hub-stack a, .swipe-hint, .promo { transition: none; animation: none; }
}
