:root {
  --bg: #140f2e;
  --bg2: #1f1748;
  --card: rgba(255, 255, 255, .07);
  --card-solid: #261d55;
  --text: #f7f4ff;
  --muted: #b3a9d9;
  --line: rgba(255, 255, 255, .14);
  --pink: #ff4d6d;
  --violet: #8b5cf6;
  --amber: #fbbf24;
  --grad: linear-gradient(120deg, #ff4d6d 0%, #c026d3 50%, #8b5cf6 100%);
  --accent: #ff4d6d;
  --good: #34d399;
  --l1: #10b981;
  --l2: #f59e0b;
  --l3: #ec4899;
  --c: #8b5cf6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; color: var(--text); background: var(--bg); }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; line-height: 1.45;
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(255, 77, 109, .28), transparent 60%),
    radial-gradient(900px 700px at 110% 10%, rgba(139, 92, 246, .32), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(6, 182, 212, .18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: #ff8fa3; }
h1, h2, h3 { line-height: 1.15; margin: .4em 0; letter-spacing: -.01em; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.big { font-size: 1.3em; }
.hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center { text-align: center; padding: 28px 16px; }

.btn {
  font: inherit; font-weight: 600; border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 10px 20px; margin: 4px; cursor: pointer; min-height: 44px;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.btn:hover { border-color: rgba(255, 255, 255, .45); transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(236, 72, 153, .35); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(236, 72, 153, .5); }
.btn.sel { border-color: #fff; background: rgba(255, 255, 255, .16); }
.btn.xl { font-size: 1.15em; padding: 14px 30px; }

.bar { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(20, 15, 46, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.logo { font-weight: 900; letter-spacing: -.02em; }
.logo span, .logo-big span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.score b { display: inline-block; min-width: 2ch; padding: 2px 10px; margin-left: 4px; border-radius: 999px; background: var(--grad); color: #fff; }
.joincode b, .code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; justify-content: center; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; animation: pop .35s ease; }
.chip.off { opacity: .4; text-decoration: line-through; }

.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8em; color: #fff; font-weight: 600; }
.tag.l1 { background: var(--l1); } .tag.l2 { background: var(--l2); } .tag.l3 { background: var(--l3); }

/* Landing */
.landing { max-width: 980px; margin: 0 auto; padding: 48px 16px 32px; text-align: center; }
.hero { padding: 8px 0 24px; }
.logo-big { font-size: clamp(2.8em, 9vw, 5em); margin: 0; letter-spacing: -.04em; font-weight: 900; }
.tagline { font-size: clamp(1.4em, 4vw, 2em); font-weight: 800; margin: 4px 0 8px; }
.sub { color: var(--muted); font-size: 1.1em; max-width: 560px; margin: 0 auto; }
.landing-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 28px 0 12px; }
.occasions .chip { font-size: .9em; animation: none; }
.game-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 24px 0; }
.mini { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 8px; font-weight: 700; font-size: .9em; border-top: 3px solid var(--c); }
.mini span { display: block; font-size: 1.8em; margin-bottom: 4px; }
.features { list-style: none; padding: 0; text-align: left; max-width: 520px; margin: 16px auto; }
.features li { padding: 10px 0; border-bottom: 1px solid var(--line); }

.write { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 12px 0; }
.write input, .write textarea {
  font: inherit; font-size: 1.1em; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, .08); color: var(--text); width: min(100%, 360px);
}
.write input::placeholder, .write textarea::placeholder { color: var(--muted); }
.write input:focus, .write textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 77, 109, .25); }
.landing .write input { width: 180px; text-transform: uppercase; letter-spacing: 2px; text-align: center; }
.write textarea { width: 100%; }

/* Big screen */
.screen { min-height: 100vh; display: flex; flex-direction: column; font-size: clamp(16px, 1.6vw, 26px); }
.lobby { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; justify-content: center; padding: 32px 16px; flex: 1; }
.lobby-left, .lobby-right { text-align: center; max-width: 520px; }
.lobby-left h1 { font-size: 2.4em; }
.qr { background: #fff; border-radius: 24px; padding: 14px; width: min(60vh, 80vw, 420px); margin: 0 auto; box-shadow: 0 0 0 6px rgba(255, 255, 255, .08), 0 20px 60px rgba(139, 92, 246, .45); }
.qr svg { width: 100%; height: auto; display: block; }
.stage { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 24px 16px; text-align: center; position: relative; animation: rise .35s ease; }
.game-name { display: inline-block; margin: 0 0 8px; padding: 4px 14px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 700; font-size: .85em; }
.stage h1 { font-size: 2.3em; }
.stage h1.talk { font-size: 2.7em; margin: 1em 0; }
.stage h1.quote { font-size: 2.4em; font-style: italic; }
.controls { display: flex; justify-content: center; flex-wrap: wrap; padding: 12px; border-top: 1px solid var(--line); background: rgba(20, 15, 46, .6); }
.opts { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.opt { background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px; font-size: 1.1em; text-align: left; }
.opt.right { border-color: var(--good); box-shadow: 0 0 0 2px var(--good), 0 0 30px rgba(52, 211, 153, .35); animation: pop .4s ease; }
.letter { display: inline-block; width: 1.7em; height: 1.7em; line-height: 1.7em; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; text-align: center; margin-right: 10px; font-size: .85em; }
.answers { list-style: none; padding: 0; text-align: left; max-width: 760px; margin: 0 auto; }
.answers li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.story { text-align: left; max-width: 800px; margin: 0 auto; font-size: 1.15em; }
.story .starter { font-weight: 700; }

/* Menu */
.menu { max-width: 1100px; margin: 0 auto; padding: 16px; text-align: center; }
.levels { display: flex; flex-wrap: wrap; justify-content: center; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; text-align: left; }
.games.compact { grid-template-columns: 1fr; }
.game-card {
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 28%, transparent), rgba(255, 255, 255, .04) 60%);
  border: 1px solid var(--line); border-radius: 22px; padding: 18px; position: relative;
  transition: transform .15s ease, box-shadow .2s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px color-mix(in srgb, var(--c) 35%, transparent); }
.game-card.disabled { opacity: .45; }
.game-card .icon { font-size: 2.2em; line-height: 1; }
.game-card h3 { color: #fff; font-size: 1.25em; }
.game-card .btn.primary { background: var(--c); box-shadow: none; }
.preview { display: inline-block; text-align: left; margin: 8px 0 16px; padding-left: 1.4em; }
.preview li { padding: 4px 0; }

/* Phone */
.phone { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.phone-main { flex: 1; padding: 16px; animation: rise .3s ease; }
.choices { display: flex; flex-direction: column; }
.choices .btn { text-align: left; font-size: 1.1em; padding: 14px 18px; border-radius: 18px; }
.prev { font-size: 1.2em; font-style: italic; background: var(--card); border-radius: 16px; padding: 14px; }

/* Timers and acting */
.timer { font-size: 5.5em; font-weight: 900; line-height: 1; margin: 12px 0; background: linear-gradient(120deg, #22d3ee, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.timer.low { background: var(--grad); -webkit-background-clip: text; background-clip: text; animation: pulse 1s ease infinite; }
.timer.small-timer { font-size: 3.2em; }
.word { font-size: 2.6em; margin: 16px 0; }
.act-buttons { display: flex; justify-content: center; flex-wrap: wrap; }

/* Celebration */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -10%; font-size: 2.4em; animation: fall 2.6s ease-in forwards; }
.confetti span:nth-child(1) { left: 8%; animation-delay: 0s; }
.confetti span:nth-child(2) { left: 28%; animation-delay: .3s; }
.confetti span:nth-child(3) { left: 50%; animation-delay: .1s; }
.confetti span:nth-child(4) { left: 72%; animation-delay: .45s; }
.confetti span:nth-child(5) { left: 90%; animation-delay: .2s; }

@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(360deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .confetti { display: none; } }
