:root {
  --bg: #101018;
  --surface: #1e1e2b;
  --surface-2: #2b2b3b;
  --text: #fff;
  --muted: #b4b4c4;
  --accent: #ffc83d;
  --accent-ink: #2a1e00;
  --danger: #ff8a8a;
  --gutter: 16px;
  --tile: clamp(136px, 40vw, 200px);
  --radius: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

@media (min-width: 700px) {
  :root { --gutter: 32px; --tile: clamp(170px, 23vw, 250px); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.4; overscroll-behavior-y: none; }
h1, h2, p { margin: 0; }
svg { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.logo { font-size: 24px; font-weight: 900; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.logo b { color: var(--accent); font-weight: 900; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 10px; font-weight: 800; font-size: 18px; white-space: nowrap; }
.btn svg { width: 24px; height: 24px; }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--play { background: #fff; color: #101018; }
.btn--play:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.btn--glass { background: rgba(120, 120, 140, .5); color: #fff; backdrop-filter: blur(6px); }
.btn--quiet { background: var(--surface-2); color: #fff; min-height: 46px; font-size: 16px; }
.btn--wide, .btn--grow { flex: 1; width: 100%; }

.round { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; background: rgba(16, 16, 24, .72); color: #fff; }
.round svg { width: 24px; height: 24px; }
.round--heart { width: 52px; height: 52px; background: var(--surface-2); color: var(--muted); }
.round--heart[aria-pressed="true"] { color: #ff5d73; }

.avatar { display: block; aspect-ratio: 1; border-radius: 16%; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; }
.avatar--add { display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.avatar--add svg { width: 44%; height: 44%; }

.error { color: var(--danger); font-weight: 700; }

/* landing */
.landing__top { position: absolute; z-index: 2; inset: 0 0 auto; padding: calc(16px + var(--safe-top)) var(--gutter); }
.landing__hero { position: relative; min-height: min(100dvh, 860px); display: flex; align-items: center; justify-content: center; padding: calc(84px + var(--safe-top)) var(--gutter) 56px; overflow: hidden; }
.landing__hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16, 16, 24, .78), rgba(16, 16, 24, .66) 45%, var(--bg)); }
.wall { position: absolute; inset: -22% -30%; align-content: start; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; transform: rotate(-9deg); }
.wall > div { aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; }
.wall svg { width: 100%; height: 100%; }
.landing__copy { position: relative; z-index: 1; width: min(100%, 640px); text-align: center; }
.landing__copy h1 { font-size: clamp(36px, 9.5vw, 60px); line-height: 1.04; font-weight: 900; letter-spacing: -.02em; text-wrap: balance; }
.landing__sub { margin-top: 12px; font-size: clamp(18px, 4.6vw, 24px); font-weight: 700; }
.signup { margin-top: 26px; display: grid; gap: 12px; text-align: left; }
.signup__label { text-align: center; color: #e8e8f2; }
.signup__row { display: grid; gap: 10px; }
.signup input[type="email"], .player-form input:not([type]) { width: 100%; min-height: 56px; padding: 0 16px; border-radius: 10px; background: rgba(30, 30, 43, .86); border: 1.5px solid #6e6e84; font-size: 18px; }
.signup input::placeholder, .player-form input::placeholder { color: var(--muted); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: #e8e8f2; }
.check input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--accent); }
@media (min-width: 560px) { .signup__row { grid-template-columns: 1fr auto; } }

.bands { display: grid; gap: 1px; background: var(--surface-2); border-block: 1px solid var(--surface-2); }
.bands article { padding: 32px var(--gutter); background: var(--bg); }
.bands h2 { font-size: 24px; font-weight: 900; }
.bands p { margin-top: 6px; color: var(--muted); font-size: 17px; }
@media (min-width: 700px) { .bands { grid-template-columns: repeat(3, 1fr); } }

.faq { padding: 36px var(--gutter) calc(48px + var(--safe-bottom)); max-width: 760px; margin: auto; }
.faq h2 { font-size: 26px; font-weight: 900; margin-bottom: 14px; }
.faq details { background: var(--surface); margin-bottom: 8px; border-radius: 10px; }
.faq summary { min-height: 58px; display: flex; align-items: center; padding: 12px 18px; font-size: 18px; font-weight: 800; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq p { padding: 0 18px 18px; color: var(--muted); font-size: 17px; }

/* centred pages */
.centre { min-height: 100dvh; width: min(100%, 460px); margin: auto; padding: calc(32px + var(--safe-top)) var(--gutter) calc(32px + var(--safe-bottom)); display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: center; }
.centre--wide { width: min(100%, 560px); }
.centre .logo { margin-bottom: 12px; }
.centre h1 { font-size: 32px; font-weight: 900; }
.centre p { color: var(--muted); font-size: 17px; }
.centre strong { color: var(--text); overflow-wrap: anywhere; }

.player-form { display: grid; gap: 16px; margin-top: 8px; }
.pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pick__avatar { padding: 3px; border-radius: 18%; border: 3px solid transparent; opacity: .62; }
.pick__avatar[aria-pressed="true"] { border-color: var(--accent); opacity: 1; }
.ages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ages__chip { min-height: 56px; border-radius: 12px; background: var(--surface); font-size: 22px; font-weight: 900; }
.ages__chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* who's playing */
.who { min-height: 100dvh; padding: calc(20px + var(--safe-top)) var(--gutter) calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 28px; }
.who .logo { align-self: flex-start; }
.who h1 { margin-top: auto; font-size: clamp(30px, 7vw, 46px); font-weight: 900; }
.who__grid { margin-bottom: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 150px)); justify-content: center; gap: 22px; width: 100%; }
.who__player { display: grid; gap: 10px; font-size: 20px; font-weight: 800; color: var(--muted); text-align: center; }
@media (min-width: 700px) { .who__grid { grid-template-columns: repeat(auto-fit, 170px); gap: 30px; } }

/* browse */
.browse { padding-bottom: calc(92px + var(--safe-bottom)); }
.topbar { position: fixed; z-index: 5; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + var(--safe-top)) var(--gutter) 10px; background: linear-gradient(180deg, rgba(16, 16, 24, .82), transparent); transition: background-color .2s; }
.topbar--solid { background: var(--bg); }
.topbar__player { width: 44px; }

.hero { position: relative; padding: calc(70px + var(--safe-top)) var(--gutter) 0; }
.hero__art { aspect-ratio: 4 / 5; max-height: 62dvh; width: 100%; overflow: hidden; border-radius: 18px; }
.hero__art svg, .hero__art img { width: 100%; height: 100%; object-fit: cover; }
.hero__copy { position: absolute; inset: auto calc(var(--gutter) + 16px) 16px; display: grid; justify-items: center; gap: 6px; text-align: center; text-shadow: 0 1px 12px rgba(0, 0, 0, .55); }
.hero__copy h1 { font-size: 42px; line-height: 1.05; font-weight: 900; letter-spacing: -.02em; }
.hero__tags { color: #f1f1f7; font-size: 15px; font-weight: 700; }
.hero__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 8px; text-shadow: none; }
.hero__actions .btn { padding: 0 8px; }
@media (min-width: 700px), (orientation: landscape) {
  .hero { padding: 0; }
  .hero__art { aspect-ratio: auto; height: min(58dvh, 620px); max-height: none; border-radius: 0; }
  .hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16, 16, 24, .72), transparent 62%), linear-gradient(0deg, var(--bg), transparent 34%); pointer-events: none; }
  .hero__copy { z-index: 1; inset: auto auto 44px var(--gutter); width: min(46%, 440px); justify-items: start; text-align: left; }
  .hero__copy h1 { font-size: clamp(42px, 6vw, 68px); }
  .hero__tags { font-size: 17px; }
  .hero__actions { display: flex; }
  .hero__actions .btn { padding: 0 24px; }
}

.row { margin-top: 24px; }
.row__title { padding: 0 var(--gutter); font-size: 20px; font-weight: 900; }
.row__scroll { display: flex; gap: 10px; padding: 10px var(--gutter) 4px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.row__scroll::-webkit-scrollbar { display: none; }
.tile { position: relative; flex: none; width: var(--tile); aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; scroll-snap-align: start; background: var(--surface); transition: transform .12s; }
.tile:active { transform: scale(.96); }
.tile svg, .tile img { width: 100%; height: 100%; object-fit: cover; }
.tile__title { position: absolute; inset: auto 0 0; padding: 30px 10px 10px; background: linear-gradient(0deg, rgba(0, 0, 0, .72), transparent); font-size: 18px; font-weight: 900; line-height: 1.1; text-align: left; }
.tile__soon { position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(16, 16, 24, .78); font-size: 13px; font-weight: 800; }

.tabs { position: fixed; z-index: 5; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + var(--safe-bottom)); background: rgba(16, 16, 24, .96); border-top: 1px solid var(--surface-2); }
.tabs__tab { display: grid; justify-items: center; gap: 2px; min-height: 58px; align-content: center; color: var(--muted); font-size: 13px; font-weight: 800; }
.tabs__tab svg { width: 28px; height: 28px; }
.tabs__tab[aria-current="page"] { color: #fff; }

.mine { padding-top: calc(76px + var(--safe-top)); }
.mine h1 { padding: 0 var(--gutter); font-size: 30px; font-weight: 900; }
.mine__empty { padding: 12px var(--gutter); color: var(--muted); font-size: 18px; }

.explore__back { margin: 0 var(--gutter) 10px; background: var(--surface); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px var(--gutter); }
.grid .tile { display: block; width: auto; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; } }

/* launch splash */
.splash { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; background: var(--bg); animation: splash-out .3s ease-in 1.15s forwards; }
.splash .logo { font-size: clamp(40px, 11vw, 76px); animation: splash-in .75s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes splash-in { from { transform: scale(.55); opacity: 0; } }
@keyframes splash-out { to { opacity: 0; } }

/* details sheet */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgba(0, 0, 0, .68); }
.sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 600px; max-height: 92dvh; margin: auto auto 0; border-radius: 22px 22px 0 0; overflow: auto; }
.sheet__art { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.sheet__art > svg, .sheet__art > img { width: 100%; height: 100%; object-fit: cover; }
.sheet__art .round { position: absolute; top: 12px; right: 12px; }
.sheet__body { display: grid; gap: 8px; padding: 18px var(--gutter) calc(20px + var(--safe-bottom)); }
.sheet__body h2 { font-size: 30px; font-weight: 900; line-height: 1.1; }
.sheet__body .hero__tags { color: var(--muted); }
.sheet__body > p:last-of-type { font-size: 18px; }
.sheet__actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 22px; } }

/* player */
.stage { position: fixed; inset: 0; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage__load { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: var(--bg); text-align: center; }
.stage__load h1 { font-size: 30px; font-weight: 900; }
.stage__load p { max-width: 340px; color: var(--muted); font-size: 18px; }
.stage__poster { width: min(46vw, 34vh, 240px); aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; }
.stage__poster svg, .stage__poster img { width: 100%; height: 100%; object-fit: cover; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage__rotate { display: none; position: absolute; z-index: 2; inset: 0; place-items: center; background: var(--bg); color: var(--accent); }
.stage__rotate svg { width: 120px; height: 120px; animation: tip 1.8s ease-in-out infinite alternate; }
@keyframes tip { from { transform: rotate(0); } to { transform: rotate(90deg); } }
@media (orientation: portrait) { .stage[data-orientation="landscape"] .stage__rotate { display: grid; } }
@media (orientation: landscape) { .stage[data-orientation="portrait"] .stage__rotate { display: grid; } }
.leave { position: fixed; z-index: 3; top: calc(10px + var(--safe-top)); left: calc(10px + env(safe-area-inset-left, 0px)); display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: rgba(16, 16, 24, .6); color: #fff; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.leave svg { position: relative; z-index: 1; width: 26px; height: 26px; }
.leave i { position: absolute; inset: 0; background: var(--accent); transform: translateY(100%); }
.leave--holding i { transform: translateY(0); transition: transform 1.2s linear; }

/* grown-up check */
.gate { width: min(100% - 32px, 360px); margin: auto; padding: 22px; border-radius: 20px; text-align: center; }
.gate h2 { font-size: 24px; font-weight: 900; }
.gate p { margin-top: 4px; font-size: 22px; font-weight: 800; }
.gate__out { display: block; margin: 12px 0; min-height: 46px; padding: 6px; border-radius: 10px; background: var(--bg); font-size: 26px; font-weight: 900; }
.gate__out--wrong { animation: shake .3s; }
.gate__keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gate__keys button { display: grid; place-items: center; min-height: 58px; border-radius: 12px; background: var(--surface-2); font-size: 24px; font-weight: 900; }
.gate__keys svg { width: 22px; height: 22px; }
.gate__keys .gate__cancel { font-size: 17px; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* grown-ups page */
.parents { width: min(100%, 620px); margin: auto; padding: calc(16px + var(--safe-top)) var(--gutter) calc(32px + var(--safe-bottom)); display: grid; gap: 22px; }
.parents .round { background: var(--surface); }
.parents h1 { font-size: 32px; font-weight: 900; }
.parents section { display: grid; gap: 10px; padding: 18px; border-radius: 16px; background: var(--surface); justify-items: start; }
.parents h2 { font-size: 20px; font-weight: 900; }
.parents p { color: var(--muted); font-size: 17px; overflow-wrap: anywhere; }
.parents__player { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; width: 100%; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
