:root {
  color-scheme: dark;
  --bg: #130e25;
  --surface: #211832;
  --line: #3b2c54;
  --text: #fbf5ff;
  --muted: #b8a7cc;
  --purple: #c69dff;
  --lime: #e1ff79;
  --ink: #221535;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(ellipse 420px 390px at 50% 218px, #42226480, transparent 92%),
    linear-gradient(#a475e809 1px, transparent 1px),
    linear-gradient(90deg, #a475e809 1px, transparent 1px),
    var(--bg);
  background-size: auto, 28px 28px, 28px 28px, auto;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { touch-action: manipulation; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(100%, 550px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 0 15px; border-bottom: 1px solid #8d6aa732; }
.brand { display: flex; align-items: center; gap: 9px; min-height: 44px; border: 0; background: transparent; padding: 0; color: var(--text); font-size: 1.06rem; letter-spacing: .065em; font-weight: 800; }
.brand-accent { color: var(--purple); }
.brand-icon { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 26px; height: 21px; border: 1px solid #c49afa; border-radius: 7px 7px 7px 2px; background: #8752c934; box-shadow: inset 0 0 0 2px #9867d124; rotate: -8deg; }
.brand-icon i { width: 3px; height: 5px; border-radius: 1px; background: var(--lime); }
.rule-button, .outline-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 13px; background: #1f1532; color: #dcd0ef; font-size: .875rem; font-weight: 680; white-space: nowrap; }
.rule-button span { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid #9477ba; border-radius: 50%; color: var(--purple); font: 700 11px ui-monospace, monospace; }
.rule-button:hover, .outline-button:hover { border-color: #9872c6; }
.landing { width: min(100%, 414px); margin-inline: auto; }
.hero { display: flex; flex-direction: column; align-items: center; padding: 12px 0 26px; text-align: center; }
.scene { width: min(100%, 314px); height: 212px; position: relative; display: grid; place-items: center; isolation: isolate; margin: 0 auto 0; }
.scene::before { content: ""; position: absolute; inset: 17px 3px -4px; z-index: -2; background: radial-gradient(ellipse at 50% 55%, #8D49E456, #4c267348 47%, transparent 72%); }
.orbit { position: absolute; left: 50%; top: 50%; border: 1px solid #bf85fa3b; border-radius: 50%; transform: translate(-50%, -50%) rotate(-13deg); }
.orbit-outer { width: 94%; height: 69%; border-style: dashed; border-color: #bf85fa37; }
.orbit-inner { width: 79%; height: 56%; }
.orbit-mid { width: 57%; height: 43%; border-color: #bf85fa24; }
.mascot { position: relative; z-index: 1; width: 160px; height: 160px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 10px 0 #1b0e3070) drop-shadow(0 0 19px #af64f54a); animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(-5px) rotate(-3deg); } 50% { transform: translateY(-13px) rotate(-3deg); } }
.shadow { position: absolute; width: 98px; height: 13px; left: 50%; bottom: 22px; translate: -50% 0; border-radius: 50%; background: #100a1d8a; filter: blur(4px); }
.spark, .pixel { display: block; position: absolute; color: #d4a9ff; }
.spark::after, .spark::before { content: ""; position: absolute; border-radius: 1px; background: currentColor; inset: 0 41%; }
.spark::after { inset: 41% 0; }
.spark-one { width: 21px; height: 21px; top: 25%; left: 17%; color: var(--lime); }
.spark-two { width: 16px; height: 16px; top: 26%; right: 12%; }
.spark-three { width: 11px; height: 11px; bottom: 26%; right: 21%; color: var(--lime); }
.pixel { width: 4px; height: 4px; background: currentColor; }
.pixel-one { top: 12%; right: 35%; }
.pixel-two { bottom: 27%; left: 17%; opacity: .7; }
.pixel-three { top: 36%; right: 18%; opacity: .65; }
.pixel-four { bottom: 20%; right: 12%; }
.party-label { display: flex; align-items: center; justify-content: center; gap: 9px; color: #caa8f5; font-size: .875rem; font-weight: 690; letter-spacing: .17em; }
.party-label span { width: 13px; height: 1px; background: #9f72cd; }
.hero h1 { margin: 5px 0 10px; font-size: clamp(2.75rem, 12.5vw, 4.15rem); font-weight: 900; letter-spacing: -.065em; line-height: 1.08; text-shadow: 0 5px #2d194f; white-space: nowrap; }
.hero h1 span { color: var(--lime); }
.hero h1 b { color: var(--purple); font-weight: 900; margin-left: .075em; }
.intro { color: var(--muted); font-size: .94rem; line-height: 1.6; }
.compact .scene { height: 158px; }
.compact .mascot { width: 114px; height: 114px; }
.compact .shadow { bottom: 12px; }
.entry-card, .room-panel { position: relative; border: 1px solid #513b6d; border-radius: 18px; padding: 19px; background: linear-gradient(160deg,#271b38,#1d1530 80%); box-shadow: 0 12px 30px #0b07185c, inset 0 1px #815bad26; }
.entry-head, .section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.entry-head h2, .section-heading h2 { font-size: 1.26rem; font-weight: 800; letter-spacing: -.02em; }
.capacity { display: flex; align-items: center; gap: 6px; border: 1px solid #5a4380; border-radius: 6px; padding: 4px 7px; color: #d9c9ef; background: #392650; font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.capacity span { color: var(--lime); font-size: .65rem; }
label { display: block; margin: 0 0 7px; color: #d6c8e9; font-size: .875rem; font-weight: 650; }
input { width: 100%; min-width: 0; min-height: 50px; padding: 10px 13px; border: 1px solid #4c3865; border-radius: 9px; background: #160f27; color: var(--text); font-size: 1rem; }
input::placeholder { color: #aa97c1; }
input[readonly] { color: var(--purple); }
.primary { width: 100%; min-height: 52px; position: relative; margin-top: 13px; padding: 9px 14px; border: 1px solid #edffab; border-radius: 9px; background: var(--lime); box-shadow: 0 3px 0 #a6c348; color: #242915; font-size: 1rem; font-weight: 850; text-align: center; }
.primary:not(:disabled):hover { background: #eeffa6; }
.primary:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #a6c348; }
.primary:disabled { background: #40394e; color: #b9aec9; border-color: #51465e; box-shadow: none; }
.key-icon { margin-right: 4px; font-size: 1.18rem; vertical-align: -.035em; }
.join-row { display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; margin: 5px 0 -9px; font-size: .875rem; color: var(--muted); }
.text-button { min-height: 44px; border: 0; padding: 0 3px; background: transparent; color: var(--purple); font-size: .875rem; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.join-form { margin-top: 13px; }
.cancel-join { display: block; margin: 5px auto -7px; }
.form-error { margin-top: 8px; color: #ffb1c7; font-size: .875rem; }
.landing-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: .8125rem; letter-spacing: .025em; }
.landing-foot span { color: var(--purple); margin-inline: 2px; }
.room-view { padding-top: 20px; }
.room-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.room-eyebrow { color: var(--muted); font-size: .875rem; margin-bottom: 2px; }
.room-code { color: var(--lime); letter-spacing: .12em; font: 800 2rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.room-panel { padding: 16px; }
.room-panel .section-heading { margin-bottom: 5px; }
.muted, .wait-note { color: var(--muted); font-size: .9rem; line-height: 1.55; }
.wait-note { margin: 12px 0 2px; text-align: center; }
.seats, .player-strip { list-style: none; margin: 13px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.seat { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 9px 4px 7px; border: 1px solid #49365f; border-radius: 10px; background: #2e2242; }
.avatar { display: inline-grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #c9a0ff; color: #2f2053; font-size: 1.2rem; font-weight: 900; }
.avatar-1, .avatar-7 { background: #e1ff79; color: #333719; }
.avatar-2, .avatar-8 { background: #ffb2de; color: #49233b; }
.avatar-3, .avatar-9 { background: #9de3fd; color: #183946; }
.avatar-4 { background: #ffc688; color: #4c2f13; }
.avatar-5 { background: #b1eac7; color: #1f422f; }
.avatar-6 { background: #ffb0a4; color: #4a2521; }
.seat-name { width: 100%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: .875rem; font-weight: 700; }
.seat-label { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.empty-seat { border-style: dashed; background: transparent; color: var(--muted); }
.empty-avatar { background: #332649; color: #b693d2; }
.room-actions { display: flex; justify-content: center; margin-top: 6px; }
.subdued { color: var(--muted); }
.small { font-size: .875rem; }
.game-panel { display: flex; flex-direction: column; }
.game-panel h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phase-badge { padding: 3px 6px; color: var(--purple); background: #432f5f; border-radius: 5px; font-size: .8125rem; font-weight: 680; }
.player-strip { display: flex; overflow-x: auto; margin-top: 6px; padding-bottom: 6px; overscroll-behavior-inline: contain; }
.game-player { display: grid; justify-items: center; flex: 0 0 64px; min-width: 0; gap: 3px; padding: 5px 3px 2px; border: 1px solid transparent; border-radius: 8px; }
.game-player.speaking { border-color: #8f6bb9; background: #3b2a52; }
.player-caption { min-width: 0; width: 100%; text-align: center; }
.player-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.game-player small { display: block; color: var(--purple); font-size: .75rem; }
.game-player.eliminated { opacity: .56; }
.word-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding: 6px 8px 6px 11px; margin: 5px 0 7px; border: 1px solid #665485; border-radius: 9px; background: #35264c; }
.word-card > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.word-card span { font-size: .875rem; color: #dcccf1; }
.word-card strong { color: var(--lime); font-size: 1.12rem; }
.word-card button { min-height: 44px; background: #2b1e42; }
.feed { min-height: 122px; max-height: min(34vh, 300px); overflow-y: auto; overscroll-behavior-y: contain; scrollbar-color: #6a507f transparent; list-style: none; margin: 4px 0 9px; padding: 4px 3px 7px; }
.system-note { display: flex; justify-content: center; text-align: center; margin: 8px 0; }
.system-note span { padding: 4px 8px; border-radius: 8px; background: #392952; color: #d2bee8; font-size: .8125rem; }
.chat-row { display: flex; align-items: flex-end; gap: 7px; margin: 10px 0; }
.chat-row > div { max-width: 82%; min-width: 0; }
.chat-row p { padding: 8px 11px; border-radius: 11px 11px 11px 2px; background: #3b2b52; overflow-wrap: anywhere; line-height: 1.5; }
.chat-row .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: .95rem; }
.chat-name { display: block; margin: 0 3px 3px; color: var(--muted); font-size: .8125rem; }
.my-chat { flex-direction: row-reverse; text-align: right; }
.my-chat p { border-radius: 11px 11px 2px 11px; background: #d9f977; color: #272d17; }
.clue-form > div { display: flex; gap: 8px; }
.clue-form button { width: auto; min-width: 58px; min-height: 46px; margin: 0; }
.clue-form input { min-height: 46px; }
.vote-panel { padding-top: 9px; border-top: 1px solid var(--line); }
.vote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.candidate { display: flex; align-items: center; gap: 6px; padding: 7px; color: var(--text); min-height: 45px; border: 1px solid #5a4372; border-radius: 8px; background: #2f2244; }
.candidate .avatar { width: 25px; height: 25px; border-radius: 7px; font-size: .95rem; }
.candidate span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.candidate[aria-pressed=true] { border-color: var(--lime); background: #4b3b47; }
.vote-panel .small { display: block; margin-inline: auto; }
.result-card { text-align: center; padding: 13px; border: 1px solid #62507a; border-radius: 11px; background: #332448; }
.result-card h3 { color: var(--lime); font-size: 1.65rem; margin-bottom: 4px; }
.result-card dl { display: flex; justify-content: center; gap: 8px; margin: 12px 0 2px; }
.result-card dl div { flex: 1; min-width: 0; padding: 7px; border-radius: 8px; background: #241934; }
.result-card dt { font-size: .875rem; color: var(--muted); }
.result-card dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.connection-note { margin-bottom: 9px; color: #ffceb2; font-size: .875rem; }
dialog { width: min(calc(100% - 32px), 406px); max-height: 85vh; margin: auto; padding: 0; border: 1px solid #785897; border-radius: 15px; background: #251a37; color: var(--text); box-shadow: 0 24px 70px #05020abd; }
dialog::backdrop { background: #0b071bd4; }
.dialog-body { padding: 16px 17px 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin: -4px -4px 10px 0; }
.dialog-head h2 { font-size: 1.3rem; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 8px; background: #3b2b50; color: var(--text); font-size: 1.35rem; }
.dialog-body label { margin-top: 13px; }
.rules { margin: 0; padding: 0 0 0 1.5em; }
.rules li { margin-block: 10px; padding-left: 4px; }
.rules li::marker { color: var(--purple); font-weight: 750; }
.rules strong, .rules span { display: block; }
.rules span { margin-top: 2px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.toast { position: fixed; inset: auto 12px max(17px, env(safe-area-inset-bottom)); z-index: 3; width: fit-content; max-width: calc(100% - 24px); margin: auto; padding: 10px 14px; border: 1px solid #9b77bb; border-radius: 11px; background: #38284d; color: var(--text); text-align: center; font-size: .9rem; box-shadow: 0 5px 17px #0805118b; }
@media (max-width: 360px) {
  .shell { padding-inline: 14px; }
  .hero { padding-bottom: 20px; }
  .scene { height: 180px; }
  .mascot { width: 136px; height: 136px; }
  .entry-card, .room-panel { padding: 14px; }
}
@media (min-width: 600px) {
  .shell { padding-top: 24px; }
  .hero { padding-top: 20px; }
  .scene { height: 224px; }
}
@media (max-width: 600px), (pointer: coarse) and (max-height: 520px) {
  html.game-active, .game-active body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .game-active .shell {
    position: fixed;
    inset-inline: 0;
    top: var(--game-viewport-top, 0px);
    height: var(--game-viewport-height, 100vh);
    height: var(--game-viewport-height, 100dvh);
    display: flex;
    flex-direction: column;
    padding: max(4px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .game-active .topbar { flex: none; padding-bottom: 4px; }
  .game-active #screen, .game-active .room-view, .game-active .game-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .game-active .room-view { padding-top: 4px; }
  .game-active .room-bar { flex: none; margin-bottom: 6px; }
  .game-active .room-bar > div { display: flex; align-items: baseline; gap: 8px; }
  .game-active .room-eyebrow { margin: 0; }
  .game-active .room-bar h1 { line-height: 1; }
  .game-active .room-code { font-size: 1.35rem; }
  .game-active .game-panel { padding: 10px; border-radius: 14px; overflow-y: auto; }
  .game-active .game-panel > :not(.feed) { flex-shrink: 0; }
  .game-active .game-panel > .section-heading { min-height: 30px; margin-bottom: 1px; }
  .game-active .game-panel h2 { font-size: 1.1rem; }
  .game-active .player-strip { gap: 4px; margin-block: 2px 0; padding-bottom: 3px; }
  .game-active .game-player { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; padding: 4px; }
  .game-active .game-player .avatar { width: 26px; height: 26px; border-radius: 7px; font-size: 1rem; }
  .game-active .player-caption { width: auto; max-width: 104px; text-align: left; }
  .game-active .player-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
  .game-active .word-card { min-height: 50px; margin: 4px 0 3px; padding: 2px 4px 2px 9px; }
  .game-active .feed { flex: 1; min-height: 0; max-height: none; margin-block: 2px 5px; }
  .game-active .chat-row { margin-block: 8px; }
  .game-active .chat-row p { padding: 7px 10px; }
  .game-active .vote-panel { padding-top: 6px; }
  .game-active .vote-hint { font-size: .8125rem; line-height: 1.35; }
  .game-active .vote-grid {
    max-height: 114px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    margin-top: 6px;
    padding: 1px 1px 3px;
  }
  .game-active .candidate span:last-child {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.1;
  }
  .game-active .vote-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
  .game-active .vote-actions .primary { flex: 1; min-height: 47px; margin: 0 0 3px; }
  .game-active .vote-actions .small { flex: 0 0 auto; padding-inline: 5px; white-space: nowrap; }
  .game-active .toast { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .game-active.clue-keyboard .toast { inset: calc(var(--game-viewport-top, 0px) + 10px) 12px auto; }
  .game-active.clue-keyboard .topbar,
  .game-active.clue-keyboard .room-bar,
  .game-active.clue-keyboard .player-strip { display: none; }
  .room-view[data-phase=finished] .feed { order: 1; }
}
@media (max-width: 600px) and (max-height: 540px), (pointer: coarse) and (max-height: 440px) {
  .game-active .topbar,
  .game-active .room-view[data-phase=vote] .player-strip { display: none; }
  .game-active .vote-grid { max-height: 98px; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot { animation: none; transform: translateY(-5px) rotate(-3deg); }
}
