:root {
  color-scheme: dark;
  --ink: #f8f7ee;
  --muted: #b8bad0;
  --night: #101126;
  --panel: #181a36;
  --panel-2: #222545;
  --yellow: #ffdc51;
  --coral: #ff6f61;
  --cyan: #62d8e6;
  --purple: #9f87ff;
  --blue: #5281ff;
  --line: rgba(255,255,255,.14);
  --shadow: 0 24px 80px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(98,216,230,.15), transparent 29rem),
    radial-gradient(circle at 94% 88%, rgba(159,135,255,.15), transparent 31rem),
    var(--night);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, 980px); min-height: 100vh; margin: 0 auto; padding: 22px clamp(18px, 5vw, 42px) 48px; }
.screen { display: none; animation: enter .3s ease both; }
.screen.active { display: block; }

@keyframes enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.top-brand { display: flex; align-items: center; gap: 14px; padding: 8px 0 30px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup > strong { font-size: 1.35rem; letter-spacing: -.04em; }
.version-switch { display: flex; margin-left: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.version-switch button { min-height: 34px; padding: 0 12px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-size: .74rem; font-weight: 900; }
.version-switch button.selected { color: var(--night); background: var(--cyan); }
.brand-mark { position: relative; display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; transform: rotate(-18deg); }
.brand-mark i { display: block; width: 42px; height: 42px; border: 8px solid var(--yellow); border-right-color: transparent; border-radius: 50%; }
.brand-mark::before, .brand-mark::after { position: absolute; right: -2px; width: 15px; height: 6px; content: ""; background: var(--cyan); border-radius: 99px; }
.brand-mark::before { top: 7px; transform: rotate(-38deg); }
.brand-mark::after { bottom: 7px; transform: rotate(38deg); }

.welcome-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); align-items: center; gap: clamp(30px, 6vw, 68px); min-height: calc(100vh - 135px); padding-bottom: 36px; }
.welcome-copy { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; color: var(--yellow); font-size: .8rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 650px; margin-bottom: 20px; font-size: clamp(2.75rem, 7vw, 5.4rem); line-height: .94; letter-spacing: -.06em; }
h2 { margin-bottom: 14px; font-size: clamp(2.4rem, 7vw, 4.4rem); line-height: .98; letter-spacing: -.05em; }
.hook { max-width: 560px; margin-bottom: 30px; color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.28rem); }
.microcopy, .house-rule { margin: 12px 0 0; color: var(--muted); font-size: .82rem; text-align: center; }

.hero-art { position: relative; margin: 0; filter: drop-shadow(0 30px 54px rgba(0,0,0,.42)); transform: rotate(1.4deg); }
.hero-art::before, .hero-art::after { position: absolute; z-index: -1; content: ""; border-radius: 50%; }
.hero-art::before { width: 90px; height: 90px; top: -24px; right: -18px; background: var(--yellow); }
.hero-art::after { width: 58px; height: 58px; bottom: -17px; left: -15px; background: var(--coral); }
.hero-art img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: 3px solid rgba(255,255,255,.14); border-radius: 38px 19px 42px 25px; }

.primary-action, .secondary-action, .text-action, .back-button, .icon-button { min-height: 54px; border-radius: 16px; cursor: pointer; }
.primary-action { width: 100%; padding: 0 20px; color: #151625; background: var(--yellow); border: 0; font-weight: 950; box-shadow: 0 12px 30px rgba(255,220,81,.17); }
.welcome-copy .primary-action { max-width: 350px; }
.primary-action span { float: right; font-size: 1.25rem; }
.primary-action:hover { filter: brightness(1.04); transform: translateY(-1px); }

.step-header { display: flex; align-items: center; gap: 14px; padding: 4px 0 36px; }
.step-header div { display: grid; }
.step-header span { color: var(--muted); font-size: .73rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.step-header strong { font-size: 1.05rem; }
.back-button, .icon-button { width: 46px; min-height: 46px; background: var(--panel); border: 1px solid var(--line); font-size: 1.25rem; }
.setup-panel { width: min(100%, 660px); margin: 7vh auto 0; }
.wide-panel { width: min(100%, 880px); margin-top: 3vh; }
.setup-intro { margin-bottom: 28px; color: var(--muted); font-size: 1.05rem; }

.player-count-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 26px; }
.full-only { display: none; }
.full-mode .full-only { display: block; }
.count-choice { min-height: 126px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 23px; cursor: pointer; text-align: center; transition: .18s ease; }
.count-choice:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.38); }
.count-choice strong { display: block; margin-bottom: 3px; font-size: 2.8rem; line-height: 1; }
.count-choice span { color: var(--muted); font-size: .82rem; }
.count-choice.selected { color: var(--night); background: var(--yellow); border-color: var(--yellow); transform: translateY(-3px) rotate(-1deg); }
.count-choice.selected span { color: rgba(16,17,38,.65); }
.locked-line { display: block; width: 100%; margin-top: 13px; padding: 12px; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.lock-dot { display: inline-block; margin-right: 6px; padding: 3px 7px; color: var(--night); background: var(--purple); border-radius: 999px; font-size: .66rem; font-weight: 950; text-transform: uppercase; }

.player-rows { display: grid; gap: 12px; margin-bottom: 26px; }
.player-row { display: grid; grid-template-columns: 1fr 130px; gap: 10px; padding: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 19px; }
.player-row.adult-only-row { grid-template-columns: 1fr; }
.field-wrap { display: grid; gap: 6px; }
.field-wrap label { color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .04em; }
input, select { width: 100%; min-height: 52px; padding: 0 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; outline: none; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(98,216,230,.11); }

.deck-grid { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 13px; margin: 26px 0; }
.deck-tile { position: relative; min-height: 265px; padding: 23px; overflow: hidden; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 25px; text-align: left; }
button.deck-tile { cursor: pointer; }
.deck-tile h3 { margin: 24px 0 9px; font-size: 1.4rem; line-height: 1.05; }
.deck-tile p { color: var(--muted); font-size: .9rem; }
.deck-tile > strong { position: absolute; left: 23px; bottom: 22px; color: var(--yellow); font-size: .8rem; }
.active-deck { color: var(--night); background: var(--yellow); border-color: var(--yellow); transform: rotate(-.6deg); box-shadow: var(--shadow); }
.active-deck p { color: rgba(16,17,38,.67); }
.active-deck > strong { color: var(--night); }
.deck-symbol { display: grid; width: 52px; height: 52px; place-items: center; color: var(--night); background: var(--coral); border-radius: 17px 12px 19px 11px; font-size: 1.7rem; font-weight: 950; transform: rotate(-6deg); }
.adult-symbol { background: var(--purple); }
.activity-symbol { background: var(--cyan); }
.deck-status { position: absolute; top: 22px; right: 20px; padding: 5px 8px; color: var(--night); background: var(--cyan); border-radius: 999px; font-size: .66rem; font-weight: 950; text-transform: uppercase; }
.active-deck .deck-status { background: var(--night); color: var(--ink); }
.pro-deck { opacity: .82; transition: .18s ease; }
.pro-deck:hover { opacity: 1; transform: translateY(-3px); border-color: rgba(255,255,255,.32); }
.pro-deck.active-deck { opacity: 1; }
.history-action { display: block; margin: 17px auto 0; padding: 8px 12px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: .82rem; text-decoration: underline; text-underline-offset: 4px; }

.game-screen { min-height: calc(100vh - 48px); }
.game-topbar { display: flex; align-items: center; gap: 14px; padding: 4px 0 22px; }
.progress-wrap { flex: 1; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.progress-track { height: 5px; overflow: hidden; background: rgba(255,255,255,.1); border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--yellow); border-radius: inherit; transition: width .28s ease; }
.mode-badge { padding: 8px 11px; color: var(--night); background: var(--cyan); border-radius: 999px; font-size: .72rem; font-weight: 950; text-transform: uppercase; letter-spacing: .06em; }
.turn-banner { margin: 4px 0 15px; text-align: center; }
.turn-banner span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.turn-banner strong { display: inline-block; margin-right: 7px; font-size: 1.42rem; }
.turn-banner small { color: var(--cyan); font-weight: 800; }

.question-card { position: relative; display: flex; min-height: clamp(390px, 56vh, 520px); padding: clamp(27px, 6vw, 44px); overflow: hidden; color: #131528; background: var(--yellow); border-radius: 31px; box-shadow: var(--shadow); flex-direction: column; justify-content: center; outline: none; transition: background .25s ease, transform .25s ease; isolation: isolate; }
.question-card.card-enter { animation: cardReveal .54s cubic-bezier(.18,.82,.23,1) both; }
.question-card:active { transform: scale(.992); }
@keyframes cardReveal {
  0% { opacity: 0; transform: translateY(28px) rotate(-1.8deg) scale(.965); filter: blur(4px); }
  65% { opacity: 1; transform: translateY(-4px) rotate(.5deg) scale(1.008); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.question-card.curious { background: var(--cyan); }
.question-card.personal { background: var(--coral); }
.question-card.warm { background: var(--yellow); }
.question-card.reflective { background: var(--cyan); }
.question-card.deep { color: var(--ink); background: linear-gradient(145deg, #6549d8, #7e4f9e); }
.question-card.deep .prompt-note { color: rgba(255,255,255,.78); }
.question-card.deep .question-number { color: rgba(255,255,255,.08); }
.question-card.deep .scribble { border-color: rgba(255,255,255,.3); }
.question-card.activity { color: var(--ink); background: linear-gradient(145deg, #6047cf, #247f9a); }
.question-card.activity .prompt-note { color: rgba(255,255,255,.76); }
.question-card.activity .question-number { color: rgba(255,255,255,.08); }
.question-card.activity .scribble { border-color: rgba(255,255,255,.3); }
.question-card.passed { animation: pass .28s ease; }
@keyframes pass { 50% { transform: translateX(20px) rotate(1deg); opacity: .55; } }
.card-meta { position: absolute; z-index: 3; top: 22px; left: 24px; right: 24px; display: flex; justify-content: space-between; gap: 12px; font-size: .75rem; font-weight: 950; text-transform: uppercase; letter-spacing: .08em; }
.question-number { position: absolute; right: -7px; bottom: -42px; color: rgba(19,21,40,.07); font-size: 11rem; font-weight: 950; letter-spacing: -.1em; }
.question-card h2 { position: relative; z-index: 2; max-width: 720px; margin: 0; font-size: clamp(1.9rem, 6vw, 3.35rem); line-height: 1.04; letter-spacing: -.045em; }
.prompt-note { position: relative; z-index: 2; margin: 20px 0 0; max-width: 520px; color: rgba(19,21,40,.68); font-size: .92rem; font-weight: 700; }
.scribble { position: absolute; width: 82px; height: 18px; left: 34px; bottom: 28px; border-top: 5px solid rgba(19,21,40,.23); border-radius: 50%; transform: rotate(-5deg); }
.card-spark { position: absolute; right: 29px; bottom: 29px; width: 64px; height: 64px; }
.card-spark i { position: absolute; left: 30px; bottom: 5px; width: 4px; height: 46px; background: currentColor; border-radius: 99px; opacity: .2; transform-origin: bottom; }
.card-spark i:nth-child(1) { transform: rotate(-44deg); }
.card-spark i:nth-child(2) { transform: rotate(0deg); }
.card-spark i:nth-child(3) { transform: rotate(44deg); }
.card-visual { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.card-visual i { position: absolute; display: block; opacity: .12; }
.question-card[data-visual="orbit"] .card-visual i { width: 112px; height: 112px; right: 7%; top: 18%; border: 18px solid currentColor; border-radius: 50%; animation: orbitPulse 4.6s ease-in-out infinite; }
.question-card[data-visual="orbit"] .card-visual i:nth-child(2) { width: 44px; height: 44px; right: 33%; top: 10%; border-width: 9px; animation-delay: -.8s; }
.question-card[data-visual="orbit"] .card-visual i:nth-child(3) { width: 72px; height: 72px; right: 23%; top: 55%; border-width: 12px; animation-delay: -1.7s; }
.question-card[data-visual="orbit"] .card-visual i:nth-child(4) { width: 26px; height: 26px; right: 7%; top: 66%; border-width: 0; background: currentColor; border-radius: 50%; animation-delay: -2.2s; }
.question-card[data-visual="orbit"] .card-visual i:nth-child(5) { display: none; }
@keyframes orbitPulse { 50% { transform: translateY(-10px) scale(1.08); opacity: .19; } }

.question-card[data-visual="rays"] .card-visual { transform: rotate(-13deg); }
.question-card[data-visual="rays"] .card-visual i { width: 20px; height: 62%; right: 15%; bottom: -12%; background: currentColor; border-radius: 99px; transform-origin: bottom; animation: raySwing 4.2s ease-in-out infinite; }
.question-card[data-visual="rays"] .card-visual i:nth-child(1) { transform: rotate(-44deg); }
.question-card[data-visual="rays"] .card-visual i:nth-child(2) { transform: rotate(-22deg); animation-delay: -.3s; }
.question-card[data-visual="rays"] .card-visual i:nth-child(3) { transform: rotate(0deg); animation-delay: -.6s; }
.question-card[data-visual="rays"] .card-visual i:nth-child(4) { transform: rotate(22deg); animation-delay: -.9s; }
.question-card[data-visual="rays"] .card-visual i:nth-child(5) { transform: rotate(44deg); animation-delay: -1.2s; }
@keyframes raySwing { 50% { opacity: .2; height: 70%; } }

.question-card[data-visual="stack"] .card-visual i { width: 42%; height: 18%; right: -7%; top: 16%; border: 12px solid currentColor; border-radius: 28px; transform: rotate(12deg); animation: stackDrift 5s ease-in-out infinite; }
.question-card[data-visual="stack"] .card-visual i:nth-child(2) { top: 38%; right: 2%; transform: rotate(-7deg); animation-delay: -.8s; }
.question-card[data-visual="stack"] .card-visual i:nth-child(3) { top: 61%; right: -10%; transform: rotate(18deg); animation-delay: -1.6s; }
.question-card[data-visual="stack"] .card-visual i:nth-child(n+4) { display: none; }
@keyframes stackDrift { 50% { translate: -12px 7px; opacity: .19; } }

.question-card[data-visual="bubbles"] .card-visual i { width: 76px; height: 76px; right: 13%; bottom: 16%; background: currentColor; border-radius: 50%; animation: bubbleFloat 4.8s ease-in-out infinite; }
.question-card[data-visual="bubbles"] .card-visual i:nth-child(2) { width: 32px; height: 32px; right: 34%; bottom: 18%; animation-delay: -.7s; }
.question-card[data-visual="bubbles"] .card-visual i:nth-child(3) { width: 48px; height: 48px; right: 24%; bottom: 44%; animation-delay: -1.5s; }
.question-card[data-visual="bubbles"] .card-visual i:nth-child(4) { width: 22px; height: 22px; right: 8%; bottom: 52%; animation-delay: -2.1s; }
.question-card[data-visual="bubbles"] .card-visual i:nth-child(5) { width: 38px; height: 38px; right: 39%; bottom: 60%; animation-delay: -2.8s; }
@keyframes bubbleFloat { 50% { transform: translateY(-16px) scale(1.1); opacity: .2; } }

.twist-panel { display: none; margin: 14px 0 0; padding: 18px 20px; background: var(--panel-2); border: 1px solid rgba(159,135,255,.5); border-radius: 18px; }
.twist-panel.open { display: block; animation: enter .22s ease both; }
.twist-panel .eyebrow { color: var(--purple); }
.twist-panel p:last-child { margin: 0; font-weight: 750; }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.game-actions .primary-action { grid-column: 1 / -1; }
.secondary-action { padding: 0 14px; background: var(--panel); border: 1px solid var(--line); font-weight: 850; }
.twist-action { border-color: rgba(159,135,255,.5); }

.finish-screen { min-height: calc(100vh - 72px); padding-top: 6vh; text-align: center; }
.finish-screen h2 { margin-bottom: 16px; font-size: clamp(2.7rem, 9vw, 4.8rem); line-height: .95; letter-spacing: -.055em; }
.finish-screen > p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; }
.finish-brand { display: grid; justify-items: center; gap: 9px; margin: 0 auto 32px; }
.finish-brand > strong { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1; letter-spacing: -.06em; }
.brand-mark-large { width: 112px; height: 112px; }
.brand-mark-large i { width: 98px; height: 98px; border-width: 17px; }
.brand-mark-large::before, .brand-mark-large::after { right: -2px; width: 32px; height: 11px; }
.brand-mark-large::before { top: 17px; }
.brand-mark-large::after { bottom: 17px; }
.finish-stats { margin: 26px auto 24px; max-width: 650px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem !important; }
.finish-screen .primary-action { max-width: 650px; }
.text-action { width: 100%; min-height: 42px; margin-top: 5px; color: var(--muted); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; }

.full-dialog { width: min(calc(100% - 32px), 590px); padding: 32px; color: var(--ink); background: var(--panel); border: 1px solid rgba(159,135,255,.48); border-radius: 28px; box-shadow: var(--shadow); }
.full-dialog::backdrop { background: rgba(5,6,17,.78); backdrop-filter: blur(7px); }
.full-dialog h2 { font-size: clamp(2.25rem, 7vw, 3.5rem); }
.full-dialog ul { display: grid; gap: 11px; margin: 24px 0; padding-left: 21px; color: var(--ink); }
.full-dialog li::marker { color: var(--cyan); }
.dialog-note { color: var(--muted); font-size: .9rem; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 40px; height: 40px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 1.2rem; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 5; padding: 11px 17px; color: var(--ink); background: #070812; border: 1px solid var(--line); border-radius: 99px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .22s ease; box-shadow: var(--shadow); font-size: .85rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .app-shell { padding-top: 14px; }
  .welcome-layout { grid-template-columns: 1fr; min-height: auto; padding: 12px 0 42px; }
  .hero-art { grid-row: 1; width: min(100%, 520px); margin: 0 auto; }
  .welcome-copy { grid-row: 2; }
  .welcome-copy .primary-action { max-width: none; }
  .setup-panel { margin-top: 2vh; }
  .deck-grid { grid-template-columns: 1fr; }
  .deck-tile { min-height: 220px; }
  .active-deck { transform: none; }
}

@media (max-width: 500px) {
  h1 { font-size: clamp(2.55rem, 13vw, 3.7rem); }
  .top-brand { padding-bottom: 18px; }
  .brand-lockup > strong { font-size: 1.12rem; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-mark i { width: 37px; height: 37px; border-width: 7px; }
  .brand-mark-large { width: 96px; height: 96px; }
  .brand-mark-large i { width: 84px; height: 84px; border-width: 15px; }
  .version-switch button { padding: 0 10px; }
  .player-count-choices { gap: 8px; }
  .count-choice { min-height: 108px; padding: 12px; }
  .count-choice strong { font-size: 2.25rem; }
  .player-row { grid-template-columns: 1fr 104px; }
  .question-card { min-height: 430px; border-radius: 25px; }
  .question-card h2 { font-size: clamp(1.85rem, 8.5vw, 2.65rem); }
  .full-dialog { padding: 28px 22px 22px; }
}

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