:root {
  color-scheme: dark;
  --bg: #12150f;
  --panel: rgba(18, 21, 15, .86);
  --ink: #faf8f1;
  --muted: #cfd8d2;
  --accent: #087e6a;
  --accent-ink: #5fd3b8;
  --bar: calc(52px + env(safe-area-inset-top));
  --stage: 960px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--bg); color: var(--ink); }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--accent-ink); }
a:focus-visible, button:focus-visible, iframe:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.feed-bar {
  position: fixed; inset: 0 0 auto; z-index: 3; height: var(--bar);
  display: flex; align-items: center; gap: 12px;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid rgba(250, 248, 241, .08);
}
/* The hit area reaches 44px tall and, on phones, 44px wide into the bar's left padding. */
.feed-brand { display: inline-flex; align-items: center; flex: none; min-height: 44px; color: var(--ink); font-weight: 850; font-size: 17px; letter-spacing: -.02em; text-decoration: none; }
.feed-brand span { color: var(--accent-ink); }
.feed-meta { flex: 1; min-width: 0; overflow: hidden; }
.feed-next {
  min-height: 36px; padding: 6px 14px; border: 1px solid rgba(250, 248, 241, .28); border-radius: 999px;
  position: relative; flex: none; background: transparent; color: var(--ink); font-size: 14px; font-weight: 750; cursor: pointer;
}
/* 36px pill to the eye, 44px to the finger. */
.feed-next::after { content: ''; position: absolute; inset: -5px -1px; }
.feed-next:hover, .feed-next:active { background: rgba(250, 248, 241, .1); }
/* Phones: the brand shrinks to its initial so the progress strip and Next fit one row. */
@media (max-width: 420px) {
  .feed-bar { gap: 8px; }
  .feed-brand { font-size: 0; min-width: 44px; margin-left: -12px; padding-left: 12px; }
  .feed-brand::before { content: 'C'; font-size: 21px; }
  .feed-next { padding: 6px 12px; }
}

.feed {
  position: fixed; top: var(--bar); right: 0; bottom: 0; left: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.feed.is-locked { overflow-y: hidden; }
.slide {
  position: relative; height: 100%; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.slide-stage { position: relative; height: 100%; max-width: var(--stage); margin: 0 auto; overflow: hidden; background: #0b0d09; }
.game-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #faf8f1; }

.poster { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; }
.poster picture, .poster-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster-img { object-fit: cover; transform-origin: 50% 40%; }
.slide.is-current .poster-img { animation: kenburns 22s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.12) translate(-2%, 1%); } }
@media (prefers-reduced-motion: reduce) { .slide.is-current .poster-img { animation: none; } }
.poster-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 12, 8, .05) 20%, rgba(10, 12, 8, .55) 52%, rgba(10, 12, 8, .94) 100%); }
.poster-copy { position: relative; padding: 0 22px 12px; max-width: 620px; cursor: auto; }
.poster-count { margin: 0 0 8px; color: var(--accent-ink); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.poster-title { margin: 0 0 8px; font-size: clamp(32px, 7vw, 52px); line-height: 1.04; letter-spacing: -.035em; }
.poster-tagline { margin: 0 0 22px; color: var(--muted); font-size: 17px; line-height: 1.45; }
.poster-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: min(100%, 260px); min-height: 56px; padding: 14px 28px; border: 0; border-radius: 999px;
  background: var(--ink); color: #13221d; font-size: 19px; font-weight: 850; text-decoration: none; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.poster-play:active { transform: scale(.97); }
.poster-play.is-loading { background: rgba(250, 248, 241, .72); cursor: progress; }
.poster-play.is-loading::before { content: ''; width: 16px; height: 16px; border: 2px solid #13221d; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .poster-play.is-loading::before { animation: none; } }
.poster-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.poster-status { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.poster-status a { font-weight: 750; }
.poster-guide { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 14px; font-weight: 700; text-underline-offset: 4px; }
.poster-hint { position: relative; margin: 0; padding: 4px 22px 14px; color: rgba(250, 248, 241, .7); font-size: 13px; }
.poster-hint::before { content: '↑ '; }
.hint-fine { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hint-touch { display: none; }
  .hint-fine { display: inline; }
  .poster-hint::before { content: ''; }
}

.result {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2;
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  padding: 14px 12px 10px; border-radius: 18px; background: var(--panel); color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.result-handle { position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: rgba(250, 248, 241, .35); }
.result-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; min-width: 0; }
.result-stars { color: #ffd166; font-size: 16px; letter-spacing: .05em; }
.result-score { font-size: 20px; }
.result-unit { color: var(--muted); font-size: 13px; }
.result-best { padding: 1px 7px; border-radius: 999px; background: #ffd166; color: #2b2207; font-size: 12px; font-weight: 800; }
.result-replay, .result-next { min-height: 46px; border-radius: 999px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.result-replay { padding: 8px 14px; border: 1px solid rgba(250, 248, 241, .35); background: transparent; color: var(--ink); font-size: 14px; }
.result-next { padding: 8px 18px; border: 0; background: var(--ink); color: #13221d; font-size: 16px; }
.result-replay:active { background: rgba(250, 248, 241, .14); }
.result-next:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { .poster-play:active, .result-next:active { transform: none; } }

.slide.is-end .slide-stage { display: grid; place-items: center; padding: 24px; background: var(--bg); }
.end-copy { max-width: 460px; text-align: center; }
.end-copy h2 { margin: 0 0 12px; font-size: clamp(28px, 6vw, 40px); line-height: 1.1; letter-spacing: -.03em; }
.end-copy p { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.end-copy .poster-guide { display: flex; justify-content: center; margin-top: 8px; }

@media (max-width: 380px) {
  .result { grid-template-columns: 1fr 1fr; }
  .result-line { grid-column: 1 / -1; }
}
@media (min-width: 700px) {
  .poster-copy { padding: 0 40px 16px; }
  .poster-hint { padding: 4px 40px 18px; }
  .result { left: 50%; right: auto; width: min(560px, calc(100% - 20px)); transform: translateX(-50%); }
}
