: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); }
html { background: var(--bg); }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.45;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  min-height: 100vh;
}
/* Glow background on a fixed layer (background-attachment: fixed is unreliable on iPhone and iPad). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  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);
}
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; }
.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; }
.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; }
.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; }

/* Landing steps */
.join { margin: 18px 0 0; }
.landing .join input { width: 150px; text-transform: uppercase; letter-spacing: 2px; text-align: center; padding: 8px 12px; font-size: 1em; }
.step { text-align: left; margin: 36px 0; }
.step > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.5em; }
.num { display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--grad); color: #fff; font-size: .8em; flex: none; }
.step .chips { justify-content: flex-start; }
button.game-card { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.game-card.chosen { border-color: #fff; box-shadow: 0 0 0 3px var(--c), 0 14px 40px color-mix(in srgb, var(--c) 45%, transparent); }
.badge { position: absolute; top: 14px; right: 14px; background: var(--c); color: #fff; font-size: .75em; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; font-size: .85em; }
.meta span { background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 3px 10px; }
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.level-card { font: inherit; color: inherit; text-align: left; cursor: pointer; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.level-card.chosen { border-color: #fff; background: rgba(255, 255, 255, .14); box-shadow: 0 0 0 3px var(--pink); }
.level-card .age { color: var(--amber); font-weight: 700; font-size: .9em; }
.safe { display: flex; align-items: center; gap: 10px; margin: 16px 0; cursor: pointer; }
.safe input { width: 20px; height: 20px; accent-color: var(--pink); }
.step .landing-actions { align-items: flex-start; }
.planned { text-align: left; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 30%, transparent), rgba(255, 255, 255, .04) 70%); border: 1px solid var(--line); border-radius: 22px; padding: 16px 20px; margin-bottom: 18px; }
.planned h2 { font-size: 1.8em; margin: 0 0 6px; }
.planned p { margin: 4px 0; }
.planned .levels { justify-content: flex-start; margin: 8px -4px 0; }

/* 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; } }

/* Two Truths and a Lie, practice players */
.opt.lie { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink), 0 0 30px rgba(255, 77, 109, .4); animation: pop .4s ease; }
.truths { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.truth-row { display: flex; gap: 8px; align-items: center; }
.truth-row input[type=text], .truth-row input:not([type]) { flex: 1; font: inherit; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .08); color: var(--text); min-width: 0; }
.lie-pick { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 600; color: #ff8fa3; }
.lie-pick input { width: 18px; height: 18px; accent-color: var(--pink); }
.btn.small-btn { font-size: .8em; min-height: 36px; padding: 6px 14px; opacity: .85; }

/* Wolf in the Village */
.secret summary { list-style: none; cursor: pointer; text-align: center; font-weight: 800; font-size: 1.3em; padding: 28px 16px; border-radius: 22px; background: var(--grad); margin: 12px 0; }
.secret summary::-webkit-details-marker { display: none; }
.role-card { text-align: center; border-radius: 22px; padding: 20px; border: 1px solid var(--line); background: var(--card); margin: 12px 0; }
.role-card.wolf { background: linear-gradient(160deg, rgba(99, 102, 241, .45), rgba(255, 255, 255, .04)); }
.role-card.seer { background: linear-gradient(160deg, rgba(139, 92, 246, .45), rgba(255, 255, 255, .04)); }
.role-card.doctor { background: linear-gradient(160deg, rgba(16, 185, 129, .4), rgba(255, 255, 255, .04)); }
.role-icon { font-size: 4em; line-height: 1.1; }
.meta .premium { background: linear-gradient(120deg, #fbbf24, #f97316); color: #1b1530; font-weight: 700; }

/* Phones and tablets */
.bar { padding-top: max(12px, env(safe-area-inset-top)); }
.controls { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.bar > span { white-space: nowrap; }
@media (orientation: portrait) and (min-width: 600px) {
  .qr { width: min(38vh, 70vw, 380px); }
  .lobby { gap: 24px; }
}
@media (max-width: 600px) {
  .bar { gap: 8px; padding-left: 12px; padding-right: 12px; font-size: .9em; }
  .joincode b, .code { letter-spacing: 1px; }
  .screen .score { font-size: 0; }
  .screen .score b { font-size: 16px; }
  .screen .score::before { content: "Score"; font-size: 15px; margin-right: 4px; }
  html[lang="zh-Hans"] .screen .score::before { content: "得分"; }
  .lobby { gap: 20px; padding: 20px 16px; }
  .lobby-left h1 { font-size: 1.8em; }
  .stage h1, .stage h1.talk, .stage h1.quote { font-size: 1.7em; }
  .timer { font-size: 4em; }
  .step > h2 { font-size: 1.25em; }
  .btn.xl { padding: 12px 22px; }
}
@media (hover: none) { .btn:hover, .game-card:hover { transform: none; } }
.lang-pick { display: flex; justify-content: flex-end; gap: 4px; margin: -24px 0 8px; } .lang-pick .btn { min-height: 36px; padding: 6px 14px; font-size: .9em; }
.runs { margin-top: 14px; text-align: left; }
.runs h3 { margin: 0 0 2px; }
.run { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; margin-top: 10px; }
.run.chosen { border-color: var(--accent, #ff4d6d); }
.run-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.run-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 8px 0 10px; }
.run-step { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.run-step span { font-size: .8em; opacity: .75; }
.run-step.done { opacity: .45; }
.run-step.done b::after { content: " ✓"; }
.run-step.next { box-shadow: 0 0 0 2px var(--c); }
.runs.host { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; margin: 12px auto; max-width: 900px; }
.role-card.mystery { background: linear-gradient(160deg, rgba(220, 38, 38, .35), rgba(255, 255, 255, .04)); text-align: left; }
.role-card.mystery .role-icon, .role-card.mystery h2 { text-align: center; }
.role-card.mystery.culprit { box-shadow: 0 0 0 2px #dc2626; }
.round-info { background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 8px 10px; }
.crime { max-width: 760px; margin: 10px auto; font-size: 1.1em; }
.clues { list-style: none; padding: 0; max-width: 820px; margin: 10px auto; text-align: left; }
.clues li { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 6px 0; }
.clues li.new { border-color: #dc2626; background: rgba(220, 38, 38, .18); font-weight: 600; }
.cast { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; max-width: 900px; margin: 12px auto; text-align: left; }
.cast li { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; }
.cast li span { font-size: .85em; opacity: .8; }
.cast li i { font-style: normal; font-size: .85em; color: var(--muted, #b9b3d6); margin-top: 2px; }
.cast li.culprit { border-color: #dc2626; background: rgba(220, 38, 38, .25); }
.paywall { max-width: 640px; margin: 20px auto; text-align: center; border-radius: 26px; padding: 26px 22px; border: 1px solid var(--line);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 35%, transparent), rgba(255, 255, 255, .04) 70%); }
.paywall .icon { font-size: 3em; }
.paywall .price { font-size: 2em; font-weight: 800; margin: 10px 0; }
.paywall .price span { display: block; font-size: .4em; font-weight: 400; opacity: .8; }
.paywall .btn { margin: 6px 4px; }
.paywall form { margin-top: 14px; }
a.btn { text-decoration: none; display: inline-block; }
.resume-bar { display:flex; flex-wrap:wrap; gap:.6rem; align-items:center; justify-content:center; padding:.8rem 1rem; margin:0 0 1rem; border-radius:14px; background:#fff3c4; color:#3a2a00; }
.bar .snd { padding:.3rem .6rem; font-size:1.2rem; min-width:0; background:transparent; border:1px solid rgba(255,255,255,.2); }

/* End of a game on a phone: share, host your own, sign up */
.end-phone .big { font-size: 1.25rem; }
.end-actions { display: grid; gap: 10px; margin: 18px 0; }
.end-actions .btn { width: 100%; text-decoration: none; display: block; text-align: center; }
.end-phone .ask { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 14px 0; }
.end-phone .ask p { margin: 0 0 8px; }
.end-phone .ask .choices.row { display: flex; flex-direction: row; gap: 8px; }
.end-phone .ask .choices.row .btn { flex: 1; padding: 10px 6px; text-align: center; }
.signup { display: grid; gap: 8px; margin: 14px auto; max-width: 420px; text-align: left; }
.signup p { margin: 0; }
.landing-signup { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 24px auto; }
