:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  color: #171b1a;
  background: #f7f8f2;
  font-synthesis: none;
  --ink: #171b1a;
  --muted: #66706d;
  --line: #dde2dc;
  --lime: #dceac5;
  --purple: #5b4cad;
  --peach: #f7e3d9;
  --lavender: #efecf8;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f7f8f2; overflow-x: hidden; }
body.chat-open { overflow: hidden; }
button, input, textarea { font: inherit; }
button { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; min-height: 44px; padding: 10px 16px; font-weight: 700; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
button:hover:not(:disabled) { border-color: #abb6ad; transform: translateY(-1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #a895ff; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .48; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 12px 14px; }
input { min-height: 48px; }
textarea { min-height: 126px; resize: vertical; line-height: 1.55; }
.app-shell { min-height: 100vh; min-height: 100dvh; }
.site-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(18px, 5vw, 64px); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.brand { display: inline-flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 0; font-size: 17px; color: var(--ink); }
.brand:hover { transform: none; border-color: transparent; }
.brand-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #e7edde; color: #53635a; font-size: 12px; letter-spacing: .08em; font-weight: 900; }
.header-code { font-weight: 800; letter-spacing: .13em; }
.layout { width: min(1080px, calc(100% - 36px)); margin-inline: auto; }
.home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 44px; align-items: center; padding-block: clamp(42px, 9vw, 104px) 34px; }
.hero-copy { max-width: 620px; }
.pills { display: flex; gap: 7px; flex-wrap: wrap; }
.home .pills { gap: 0; margin-bottom: 12px; }
.home .pills .pill { border-radius: 0; padding: 0 12px; border-left: 1px solid var(--line); background: transparent; color: var(--muted); }
.home .pills .pill:first-child { padding-left: 0; border-left: 0; }
.home .pills .pill.purple-tint { color: var(--purple); }
.pill, .badge, .rule-chip { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 10px; background: #eaf0e6; color: #52635c; font-size: 12px; font-weight: 800; }
.purple-tint { background: var(--lavender); color: #5745b6; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-block: 20px 12px; font-size: clamp(38px, 6vw, 60px); line-height: 1.08; letter-spacing: -.04em; }
h2 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; letter-spacing: -.05em; }
.highlight { color: var(--purple); }
.lead { color: var(--muted); font-size: 20px; }
.home-actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.primary:hover:not(:disabled) { background: #343c39; }
.secondary { background: transparent; }
.full { width: 100%; }
.join-form { margin-top: 25px; max-width: 460px; }
.join-form label, .form-panel label, .label, .composer label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.input-row { display: flex; gap: 8px; }
.input-row button { flex: 0 0 auto; }
.helper { color: var(--muted); font-size: 13px; line-height: 1.55; }
.hero-art { min-height: 300px; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; transform: none; }
.speech { align-self: flex-end; border: 0; border-radius: 10px; background: #f0f3ed; padding: 9px 12px; font-size: 14px; font-weight: 800; }
.speech.bottom { align-self: flex-start; border-radius: 10px; background: #f7f8f2; }
.character-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.character { display: grid; gap: 5px; place-items: center; padding: 13px 8px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8f5; font-size: 12px; font-weight: 700; }
.face { font-size: 28px; letter-spacing: -.15em; }
.steps { grid-column: 1 / -1; display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 14px; }
.steps strong { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.steps span { color: var(--purple); font-size: 11px; }
.steps b { color: #a8b2a9; }
.game { padding-block: 34px 64px; }
.topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.topline h1 { margin: 6px 0 0; font-size: clamp(30px, 5vw, 48px); }
.topline.compact { align-items: center; margin-bottom: 16px; }
.eyebrow { color: var(--purple); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: clamp(18px, 3vw, 28px); box-shadow: none; }
.notice { margin: -6px 0 15px; color: #5745b6; font-size: 14px; }
.lobby-grid, .chat-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; min-height: 68px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-weight: 800; }
.person span:not(.avatar) { display: grid; gap: 4px; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 14px; background: var(--lime); color: var(--ink); font-size: 17px; font-weight: 900; }
.person:nth-child(2) .avatar, .suspect:nth-child(2) .avatar { background: var(--lavender); }
.person:nth-child(3) .avatar { background: var(--peach); }
.person:nth-child(4) .avatar { background: #cfeeff; }
.badge { padding: 3px 7px; background: #edf2e9; color: #53635a; font-size: 10px; margin-left: 5px; }
.room-note { margin: 18px 0 5px; font-size: 16px; font-weight: 900; }
.invite { display: grid; gap: 12px; text-align: center; }
.invite-actions { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; }
.invite-actions button { min-width: 0; padding-inline: 10px; }
.code { display: block; color: var(--purple); font-size: 38px; letter-spacing: .14em; }
.rules { margin: 14px 0; padding: 4px 0; color: var(--muted); font-size: 13px; }
.rules summary { cursor: pointer; color: var(--ink); font-weight: 800; }
.rules li { margin: 7px 0; }
.center { max-width: 650px; margin: 0 auto; }
.role-panel { text-align: center; }
.my-player { display: inline-flex; align-items: center; gap: 8px; margin: 20px auto; border: 1px solid var(--line); border-radius: 15px; padding: 12px 18px; }
.form-panel { display: grid; gap: 12px; }
.question { margin-block: 5px 12px; padding: 19px; border-radius: 16px; background: #f0f3ec; font-size: 20px; font-weight: 800; line-height: 1.45; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.chat-panel { min-height: min(660px, calc(100dvh - 190px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 800; }
.timer { color: var(--purple); font-variant-numeric: tabular-nums; }
.messages { flex: 1; min-height: 270px; overflow-y: auto; padding: 18px; }
.message { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; }
.message.mine { flex-direction: row-reverse; text-align: right; }
.message .avatar { width: 28px; height: 28px; margin-top: 3px; border-radius: 50%; font-size: 0; }
.message strong { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.message p { display: inline-block; max-width: min(500px, 72vw); margin: 0; border-radius: 12px; padding: 10px 12px; background: #f0f2ee; font-size: 14px; line-height: 1.45; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.mine p { background: var(--lime); }
.composer { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer-meta { display: flex; justify-content: space-between; margin-bottom: 6px; }
.composer-meta span { color: var(--muted); font-size: 12px; }
.send-button { min-width: 48px; font-size: 20px; }
.suspect-aside { padding: 10px 4px; }
.suspect-aside h2 { margin-bottom: 4px; font-size: 24px; }
.suspect { display: flex; align-items: center; gap: 9px; min-height: 56px; border-bottom: 1px solid var(--line); font-weight: 800; }
.suspect .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.suspect-aside .suspect { width: 100%; text-align: left; }
.suspect[aria-pressed="true"] { border-color: var(--purple); background: var(--lavender); }
.mobile-suspects { display: none; flex-shrink: 0; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.mobile-suspects summary { min-height: 32px; padding: 6px 0; font-size: 12px; cursor: pointer; }
.mobile-suspects > div { display: flex; gap: 6px; overflow-x: auto; }
.mobile-suspects .suspect { flex-shrink: 0; font-size: 12px; min-height: 44px; padding: 6px; }
.reply-button { display: block; margin-top: 4px; font-size: 11px; padding: 6px 10px; color: var(--muted); }
.mine .reply-button { margin-left: auto; }
blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--purple); background: var(--lavender); font-size: 12px; text-align: left; overflow-wrap: anywhere; white-space: pre-wrap; }
.reply-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.reply-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview button { flex-shrink: 0; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; margin-bottom: 14px; }
.candidate { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 120px; justify-content: center; }
.candidate.selected { border: 2px solid var(--purple); background: var(--lavender); }
.read-only-chat { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); }
.read-only-chat p { margin: 6px 0; font-size: 13px; }
.result { text-align: center; }
.result h2 { margin-block: 16px 10px; }
.reveal-card { display: inline-flex; align-items: center; gap: 10px; margin: 8px auto 18px; border: 2px solid var(--purple); border-radius: 17px; padding: 18px 24px; background: var(--lavender); }
.result-summary { font-size: 18px; font-weight: 800; }
.result .actions { justify-content: center; margin-block: 20px; }
.disclosure { margin-top: 18px; text-align: left; }
.disclosure p { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) {
  .site-header { min-height: 56px; padding: 10px 14px; }
  .site-header > span:not(.header-code) { display: none; }
  .layout { width: min(100% - 24px, 1080px); }
  .home { grid-template-columns: 1fr; gap: 20px; padding-block: 22px 18px; }
  .hero-art { min-height: 210px; order: -1; padding: 16px; box-shadow: none; }
  .speech { padding: 8px 10px; font-size: 13px; }
  .character { padding: 10px 6px; }
  .face { font-size: 24px; }
  .home h1 { font-size: clamp(36px, 11vw, 52px); }
  .home h1 { margin-block: 14px 8px; }
  .home .lead { margin-bottom: 12px; font-size: 16px; }
  .join-form { margin-top: 14px; }
  .steps { font-size: 12px; justify-content: space-between; }
  .lobby-grid, .chat-grid { grid-template-columns: 1fr; }
  .game { padding-block: 14px 24px; }
  .game > .topline { margin-bottom: 10px; }
  .game > .topline h1 { font-size: clamp(27px, 8vw, 38px); }
  .local-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 0 8px; }
  .local-tools .helper { margin: 0; font-size: 11px; }
  .local-tools details { flex-shrink: 0; }
  .local-tools details summary { font-size: 11px; }
  .local-tools details button { min-height: 36px; padding: 7px 10px; }
  .phase-lobby .lobby-grid { gap: 10px; }
  .phase-lobby .lobby-grid > .panel,
  .phase-lobby .lobby-grid > aside > .panel { padding: 14px; }
  .phase-lobby .topline.compact { margin-bottom: 9px; }
  .phase-lobby .room-note { margin: 10px 0 4px; font-size: 16px; }
  .phase-lobby .invite { gap: 8px; }
  .phase-lobby .code { font-size: 32px; }
  .phase-lobby .invite-actions { gap: 6px; }
  .phase-lobby .invite-actions button { padding-inline: 7px; font-size: 13px; }
  .phase-lobby .rules { margin: 6px 0; }
  .phase-role .role-panel { padding: 18px 14px; }
  .phase-role .role-panel h2 { margin-block: 12px 8px; font-size: clamp(24px, 7vw, 32px); }
  .phase-role .role-panel p { margin-bottom: 8px; }
  .phase-role .my-player { margin: 12px auto; }
  .phase-question .form-panel { padding: 14px; gap: 8px; }
  .phase-question .question { margin-block: 0 4px; padding: 14px; font-size: 18px; }
  .phase-question textarea { min-height: 96px; max-height: 28dvh; }
  .phase-question .helper { margin: 4px 0 0; }
  .phase-vote .vote-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
  .phase-vote .candidate { min-height: 84px; gap: 6px; padding: 8px 4px; }
  .phase-vote .candidate .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }
  .phase-vote .read-only-chat { max-height: min(32dvh, 230px); margin-top: 12px; padding-top: 10px; overflow: auto; }
  .chat-grid { min-height: calc(100dvh - 140px); }
  .chat-panel { min-height: calc(100dvh - 220px); }
  .suspect-aside { display: none; }
  .mobile-suspects { display: block; }
  .phase-chat .game { width: min(100% - 24px, 1080px); padding-block: 8px; }
  .phase-chat .game > .topline { margin-bottom: 6px; }
  .phase-chat .game > .topline h1 { font-size: clamp(24px, 8vw, 34px); }
  .phase-chat .notice { margin: -2px 0 6px; font-size: 12px; }
  .phase-chat .local-tools { margin-bottom: 4px; }
  .phase-chat .chat-head { padding: 10px 12px; font-size: 12px; }
  .phase-chat .messages { padding: 10px 12px; }
  .phase-chat .message { gap: 7px; margin-bottom: 10px; }
  .phase-chat .message p { padding: 8px 10px; font-size: 13px; }
  .phase-chat .composer { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  .phase-chat .composer input { min-height: 44px; }
  .phase-chat .send-button { min-width: 44px; }
}
@media (max-width: 390px) {
  .layout { width: min(100% - 28px, 1080px); }
  .home-actions { display: grid; }
  .input-row { gap: 5px; }
  .input-row button { padding-inline: 12px; }
  .topline h1 { font-size: 31px; }
  .phase-lobby .invite-actions { grid-template-columns: 1fr; }
}
.phase-chat { height: 100dvh; position: fixed; inset: 0; width: 100%; display: flex; flex-direction: column; overflow: hidden; }
.phase-chat > .site-header { flex-shrink: 0; }
.phase-chat .game { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-block: 12px; }
.phase-chat .game > :not(.chat-grid) { flex-shrink: 0; }
.phase-chat .chat-grid { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.phase-chat .chat-panel { min-height: 0; }
.phase-chat .messages { min-height: 0; overscroll-behavior: contain; overflow-anchor: none; -webkit-overflow-scrolling: touch; }
.phase-chat .chat-head, .phase-chat .composer { flex-shrink: 0; }
@media (max-height: 600px) {
  .phase-chat > .site-header { min-height: 48px; padding-block: 2px; }
  .phase-chat .game { padding-block: 6px; }
  .phase-chat .topline { margin-bottom: 6px; }
  .phase-chat .topline h1 { font-size: 20px; margin-top: 0; }
  .phase-chat .eyebrow { display: none; }
  .phase-chat .notice { margin: 0 0 4px; font-size: 12px; }
  .phase-chat .game > aside { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
  .phase-chat .game > aside .helper { margin: 0; }
  .phase-chat .game > aside summary { font-size: 12px; }
  .phase-chat .chat-head { padding-block: 10px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  .site-header { min-height: 50px; padding-block: 7px; }
  .home { gap: 12px; padding-block: 12px 10px; }
  .home .hero-art { min-height: 145px; padding: 10px; border-radius: 14px; }
  .home .speech { padding: 5px 8px; font-size: 11px; }
  .home .character-grid { gap: 6px; }
  .home .character { gap: 2px; padding: 5px; font-size: 10px; }
  .home .face { font-size: 18px; }
  .home h1 { margin-block: 8px 4px; font-size: clamp(34px, 10vw, 44px); }
  .home .lead { margin-bottom: 8px; font-size: 14px; }
  .home-actions { gap: 6px; }
  .home-actions button { min-height: 40px; padding-block: 8px; }
  .join-form { margin-top: 8px; }
  .join-form label { margin-bottom: 3px; }
  .join-form input, .join-form button { min-height: 42px; }
  .home .helper { font-size: 11px; }
  .home .steps { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } button:hover:not(:disabled) { transform: none; } }
