:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07080d;
  color: #f7f8ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #07080d; overscroll-behavior: none; }
body { min-height: 100dvh; overflow: hidden; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid rgba(255,255,255,.9); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  --game-accent: #7c5cff;
  --game-accent-2: #16d9e3;
  --game-bg: #0f1021;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 6%, color-mix(in srgb, var(--game-accent) 18%, transparent), transparent 35%),
    radial-gradient(circle at 92% 94%, color-mix(in srgb, var(--game-accent-2) 14%, transparent), transparent 34%),
    #07080d;
  transition: background .35s ease;
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px;
}
.brand, .top-actions, .meta-right, .title-row, .result-actions, .sheet-actions { display: flex; align-items: center; }
.brand { gap: 9px; font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.brand-mark, .onboarding-logo {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--game-accent), var(--game-accent-2));
  color: white;
  font-weight: 1000;
  box-shadow: 0 0 28px color-mix(in srgb, var(--game-accent) 35%, transparent);
}
.brand-mark { width: 28px; height: 28px; border-radius: 9px; }
.top-actions { gap: 8px; }
.xp-pill, .category-pill, .meta-right span, .onboarding-chips span {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(12px);
}
.xp-pill { padding: 8px 10px; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .06em; }
.streak { min-width: 28px; text-align: center; font-size: 14px; font-weight: 900; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  background: rgba(255,255,255,.06); cursor: pointer; font-size: 20px;
}

.feed-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 14px calc(54px + env(safe-area-inset-bottom));
  touch-action: pan-x;
  user-select: none;
}
.game-card {
  position: relative;
  width: min(100%, 520px);
  height: min(78dvh, 720px);
  min-height: 500px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 30px;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--game-accent) 24%, transparent), transparent 34%),
    radial-gradient(circle at 78% 78%, color-mix(in srgb, var(--game-accent-2) 17%, transparent), transparent 35%),
    var(--game-bg);
  box-shadow: 0 24px 70px rgba(0,0,0,.44), inset 0 1px rgba(255,255,255,.08);
  transform: translateY(18px) scale(.985);
  opacity: 0;
  transition: transform .18s cubic-bezier(.2,.9,.3,1), opacity .18s ease, background .28s ease;
}
.game-card.card-in { transform: translateY(0) scale(1); opacity: 1; }
.game-card.card-out { transform: translateY(-70px) scale(.965); opacity: 0; }
.game-meta-row { z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 17px 18px 0; }
.category-pill { padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.meta-right { gap: 7px; }
.meta-right span { padding: 6px 8px; border-radius: 9px; color: rgba(255,255,255,.72); font-size: 10px; font-weight: 800; }
.game-host { min-height: 0; position: relative; display: grid; place-items: stretch; padding: 12px 18px 8px; }
.game-copy { padding: 8px 20px 22px; }
.title-row { justify-content: space-between; gap: 12px; }
.title-row h1 { margin: 0; font-size: clamp(28px, 8vw, 42px); line-height: .98; letter-spacing: -.045em; }
.title-row span { color: rgba(255,255,255,.5); font-size: 10px; font-weight: 850; letter-spacing: .13em; white-space: nowrap; }
.game-copy p { margin: 9px 0 0; color: rgba(255,255,255,.66); font-size: 14px; }
.skip-hint { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.52); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.skip-hint span { color: var(--game-accent-2); font-weight: 900; }

.game-area { position: relative; width: 100%; min-height: 100%; display: grid; place-items: center; overflow: hidden; border-radius: 24px; }
.game-prompt, .symbol-prompt { font-weight: 800; font-size: 14px; color: rgba(255,255,255,.7); }
button { -webkit-user-select: none; user-select: none; }

.tap-rush { min-height: 320px; }
.tap-target {
  position: absolute; width: 66px; height: 66px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--game-accent); color: white; font-size: 25px;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--game-accent) 13%, transparent), 0 14px 32px rgba(0,0,0,.26);
}
.tap-target.pop { animation: pop .16s ease; }

.stop-game { gap: 38px; align-content: center; padding: 20px; }
.stop-track { position: relative; width: 92%; height: 22px; border-radius: 999px; background: rgba(255,255,255,.1); box-shadow: inset 0 2px 5px rgba(0,0,0,.24); }
.stop-zone { position: absolute; inset-block: 0; border-radius: inherit; background: color-mix(in srgb, var(--game-accent-2) 70%, white 8%); box-shadow: 0 0 24px color-mix(in srgb, var(--game-accent-2) 45%, transparent); }
.stop-marker { position: absolute; top: 50%; width: 10px; height: 44px; border-radius: 999px; background: white; transform: translate(-50%,-50%); box-shadow: 0 3px 14px rgba(0,0,0,.4); }
.primary-game-button { min-width: 150px; min-height: 58px; border: 0; border-radius: 18px; background: linear-gradient(135deg,var(--game-accent),var(--game-accent-2)); font-weight: 1000; letter-spacing: .1em; cursor: pointer; box-shadow: 0 14px 35px color-mix(in srgb, var(--game-accent) 26%, transparent); }

.number-game { gap: 20px; align-content: center; }
.choice-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.number-choice, .count-choice, .symbol-cell, .odd-cell {
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.07); cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.05); backdrop-filter: blur(8px);
}
.number-choice { min-height: 130px; border-radius: 25px; font-size: clamp(40px, 13vw, 72px); font-weight: 950; }
.number-choice:active, .count-choice:active, .symbol-cell:active, .odd-cell:active { transform: scale(.96); }

.reaction-game { align-content: center; }
.reaction-orb {
  width: min(60vw, 230px); aspect-ratio: 1; border: 1px solid rgba(255,255,255,.12); border-radius: 50%;
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.7); font-weight: 1000; font-size: 24px; letter-spacing: .12em;
  box-shadow: 0 0 0 18px rgba(255,255,255,.025); cursor: pointer; transition: .12s ease;
}
.reaction-orb.is-go { background: var(--game-accent-2); color: #051311; transform: scale(1.05); box-shadow: 0 0 0 18px color-mix(in srgb,var(--game-accent-2) 12%,transparent), 0 0 60px color-mix(in srgb,var(--game-accent-2) 40%,transparent); }

.symbol-game, .odd-game { align-content: center; gap: 14px; }
.symbol-grid, .odd-grid { width: 100%; display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
.symbol-cell, .odd-cell { min-height: 64px; border-radius: 17px; font-size: 28px; }
.odd-grid { grid-template-columns: repeat(4,1fr); }

.memory-game { align-content: center; gap: 22px; }
.memory-grid { width: min(88%, 330px); aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.memory-pad { border: 0; border-radius: 28px; opacity: .42; cursor: pointer; transition: transform .12s ease, opacity .12s ease, filter .12s ease; }
.memory-pad:disabled { cursor: default; }
.memory-pad:nth-child(1) { background: #ff6b7a; }
.memory-pad:nth-child(2) { background: #ffd166; }
.memory-pad:nth-child(3) { background: #4dd7a8; }
.memory-pad:nth-child(4) { background: #5b8cff; }
.memory-pad.lit { opacity: 1; transform: scale(.94); filter: brightness(1.3); box-shadow: 0 0 32px rgba(255,255,255,.24); }

.swipe-call { align-content: center; gap: 4px; }
.direction-arrow { font-size: clamp(100px, 35vw, 180px); line-height: .8; font-weight: 300; text-shadow: 0 0 42px color-mix(in srgb,var(--game-accent) 45%,transparent); }
.direction-label { margin-top: 20px; font-weight: 950; letter-spacing: .2em; color: rgba(255,255,255,.7); }

.lane-game { padding: 8px; }
.lanes { position: relative; width: 100%; height: 100%; min-height: 320px; overflow: hidden; border-radius: 24px; background: linear-gradient(90deg, transparent 33%, rgba(255,255,255,.08) 33%, rgba(255,255,255,.08) 34%, transparent 34%, transparent 66%, rgba(255,255,255,.08) 66%, rgba(255,255,255,.08) 67%, transparent 67%); }
.lane-player, .lane-obstacle { position: absolute; left: 50%; transform: translateX(-50%); transition: left .1s ease; }
.lane-player { bottom: 8%; color: var(--game-accent-2); font-size: 36px; text-shadow: 0 0 22px var(--game-accent-2); }
.lane-obstacle { top: -12%; color: var(--game-accent); font-size: 46px; }
.lane-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: rgba(255,255,255,.24); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; pointer-events: none; }

.count-game { align-content: center; gap: 16px; }
.count-cloud { position: relative; width: 100%; height: 260px; }
.count-dot { position: absolute; font-size: 27px; color: var(--game-accent-2); text-shadow: 0 0 18px color-mix(in srgb,var(--game-accent-2) 40%,transparent); }
.count-choices { width: 100%; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.count-choice { min-height: 62px; border-radius: 18px; font-size: 22px; font-weight: 900; }

.hold-game { align-content: center; }
.hold-ring { position: relative; width: min(57vw, 215px); aspect-ratio: 1; overflow: hidden; border: 2px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(255,255,255,.055); cursor: pointer; box-shadow: 0 0 0 14px rgba(255,255,255,.025); }
.hold-progress { position: absolute; inset: 0; transform: scaleY(0); transform-origin: bottom; background: linear-gradient(0deg,var(--game-accent),var(--game-accent-2)); }
.hold-inner { position: absolute; inset: 22%; display: grid; place-items: center; border-radius: 50%; background: var(--game-bg); font-weight: 1000; letter-spacing: .12em; }

.result-overlay { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: rgba(4,5,10,.48); backdrop-filter: blur(12px); }
.result-card { width: min(100%, 330px); padding: 26px; border: 1px solid rgba(255,255,255,.13); border-radius: 26px; background: rgba(13,14,24,.92); box-shadow: 0 25px 70px rgba(0,0,0,.42); text-align: center; }
.result-word { display: block; color: var(--game-accent-2); font-size: 12px; font-weight: 950; letter-spacing: .18em; }
.result-score { display: block; margin-top: 7px; font-size: 35px; letter-spacing: -.04em; }
.result-detail { display: block; margin-top: 5px; color: rgba(255,255,255,.58); font-size: 13px; }
.result-actions { justify-content: center; gap: 10px; margin-top: 22px; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 18px; border-radius: 15px; cursor: pointer; font-weight: 850; }
.primary-button { border: 0; background: linear-gradient(135deg,var(--game-accent),var(--game-accent-2)); color: white; box-shadow: 0 12px 30px color-mix(in srgb,var(--game-accent) 23%,transparent); }
.secondary-button { border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.06); }
.success-pulse { animation: successPulse .45s ease; }
.fail-shake { animation: failShake .35s ease; }

.onboarding { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 28%, rgba(124,92,255,.24), transparent 34%), rgba(6,7,12,.94); backdrop-filter: blur(18px); }
.onboarding-card { width: min(100%, 410px); text-align: center; }
.onboarding-logo { width: 72px; height: 72px; margin: 0 auto 28px; border-radius: 22px; font-size: 30px; }
.eyebrow { margin: 0; color: rgba(255,255,255,.48); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.onboarding h2 { margin: 10px 0 8px; font-size: clamp(37px, 11vw, 58px); line-height: .92; letter-spacing: -.055em; }
.onboarding-card > p:not(.eyebrow) { max-width: 330px; margin: 14px auto; color: rgba(255,255,255,.62); line-height: 1.5; }
.onboarding-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 23px 0; }
.onboarding-chips span { padding: 7px 9px; border-radius: 999px; color: rgba(255,255,255,.7); font-size: 10px; }
.start-button { width: 100%; min-height: 56px; font-size: 16px; }
.onboarding small { display: block; margin-top: 14px; color: rgba(255,255,255,.36); line-height: 1.45; }

.sheet-backdrop { position: absolute; inset: 0; z-index: 59; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
.stats-sheet { position: absolute; z-index: 60; left: 0; right: 0; bottom: 0; max-height: 78dvh; overflow: auto; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.12); border-radius: 26px 26px 0 0; background: #11121b; box-shadow: 0 -25px 65px rgba(0,0,0,.42); }
.sheet-handle { width: 40px; height: 4px; margin: 2px auto 17px; border-radius: 99px; background: rgba(255,255,255,.18); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-header h2 { margin: 4px 0 0; font-size: 26px; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 18px; }
.stat-cell { padding: 14px 11px; border: 1px solid rgba(255,255,255,.09); border-radius: 15px; background: rgba(255,255,255,.04); }
.stat-cell span { display: block; color: rgba(255,255,255,.42); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.stat-cell strong { display: block; margin-top: 4px; font-size: 21px; }
.privacy-note { color: rgba(255,255,255,.46); font-size: 11px; line-height: 1.5; }
.sheet-actions { gap: 8px; }
.sheet-actions > * { flex: 1; }

@keyframes pop { 50% { transform: scale(1.28); } }
@keyframes successPulse { 50% { box-shadow: 0 24px 90px color-mix(in srgb,var(--game-accent-2) 34%,transparent); } }
@keyframes failShake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

@media (max-width: 430px) {
  .topbar { min-height: 58px; padding-inline: 13px; }
  .brand span:last-child { display: none; }
  .feed-stage { padding-inline: 9px; }
  .game-card { height: calc(100dvh - 118px); min-height: 480px; border-radius: 25px; }
  .game-host { padding-inline: 14px; }
  .game-copy { padding-inline: 17px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}

@media (min-width: 800px) {
  .game-card { height: min(78dvh, 760px); }
  .topbar { padding-inline: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
