/* ==========================================================================
   GPT Mafia v2 — black/white minimal design system
   Type scale: 12 / 14 / 16 / 20 / 28 / 40   Weights: 400 / 500 / 600
   Space scale: 4 / 8 / 12 / 16 / 24 / 32 / 48
   Day = white surface, Night = inverted black surface (body.night)
   ========================================================================== */

:root {
    --bg: #ffffff;
    --fg: #0a0a0a;
    --muted: #8f8f8f;
    --line: #e6e6e6;
    --soft: #f5f5f5;
    --font: "Noto Sans KR", system-ui, -apple-system, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body.night {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
    --muted: #7d7d7d;
    --line: #262626;
    --soft: #161616;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    transition: background 0.6s var(--ease), color 0.6s var(--ease);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    font-size: 16px;
    color: var(--fg);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus { border-color: var(--fg); }
input::placeholder, textarea::placeholder { color: var(--muted); }

.icon { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- layout primitives ---------- */
.page {
    max-width: 960px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.page-center {
    justify-content: center;
    align-items: center;
    gap: 32px;
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* ---------- typography ---------- */
.t-display { font-size: 40px; font-weight: 600; letter-spacing: 0.02em; }
.t-title { font-size: 28px; font-weight: 600; }
.t-section { font-size: 20px; font-weight: 600; }
.t-body { font-size: 16px; font-weight: 400; }
.t-sub { font-size: 14px; color: var(--muted); }
.t-meta { font-size: 12px; color: var(--muted); }
.t-mono { font-family: var(--mono); letter-spacing: 0.12em; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover { background: var(--soft); border-color: var(--fg); }

.btn-solid {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.btn-solid:hover { background: var(--fg); opacity: 0.85; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
}

.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: var(--soft); border-color: transparent; }

.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ---------- card ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    background: var(--bg);
}

/* ---------- avatar / player grid ---------- */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 24px 16px;
    justify-items: center;
    padding: 24px 0;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 84px;
    transition: opacity 0.3s;
}

.player .avatar {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    border: 1.5px solid var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    position: relative;
    transition: transform 0.15s var(--ease), border-color 0.2s, color 0.2s;
    background: var(--bg);
}

.player .name {
    font-size: 12px;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button.player:hover .avatar { transform: scale(1.06); }
button.player:active .avatar { transform: scale(0.96); }

.player.me .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--fg); }

.player.dead { opacity: 0.4; }
.player.dead .avatar { border-color: var(--muted); color: var(--muted); border-style: dashed; }

.player.teammate .name::after { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--fg); margin-left: 4px; vertical-align: middle; }

/* ---------- per-profile status badges (voted / talking to AI) ---------- */
.player { position: relative; }

.player .pbadge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--bg);
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
    z-index: 2;
    animation: pbadge-in 0.25s var(--ease);
}

.player .pbadge em { font-style: normal; }

.player .pbadge.voted { padding: 3px; }

@keyframes pbadge-in {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- connection buffering: whitened avatar + 3 bouncing dots ---------- */
.player.connecting .avatar {
    opacity: 0.45;
    filter: grayscale(0.6) brightness(1.35);
}

.player.connecting .name { opacity: 0.55; }

.player .conn-dots { display: none; }

.player.connecting .conn-dots {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.player.connecting .conn-dots i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--fg);
    opacity: 0.7;
    animation: conn-bounce 1.1s ease-in-out infinite;
}

.player.connecting .conn-dots i:nth-child(2) { animation-delay: 0.18s; }
.player.connecting .conn-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes conn-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* selection mark (vote / night target) */
.player.selected .avatar { background: var(--fg); color: var(--bg); }

.player .mark {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--bg);
    display: none;
    align-items: center;
    justify-content: center;
}

.player.selected .mark { display: flex; }

.players-grid.dimmed .player:not(.me) { opacity: 0.25; pointer-events: none; }

/* ---------- prompt (the one current action) ---------- */
.prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 500;
    padding: 16px 0 0;
}

.prompt .t-sub { font-size: 14px; font-weight: 400; }

/* ---------- header ---------- */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.top .day-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.day-chip .phase-name { font-size: 14px; font-weight: 500; color: var(--muted); }

.phase-timer {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
}

/* ---------- question dots ---------- */
.dots { display: inline-flex; gap: 4px; }
.dots i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--fg);
    transition: opacity 0.2s;
}
.dots i.used { opacity: 0.2; }

/* ---------- chat ---------- */
.chat-dock {
    margin-top: auto;
    padding-top: 16px;
}

.chat-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 168px;
    overflow-y: auto;
    padding: 8px 4px;
    mask-image: linear-gradient(to bottom, transparent, black 24px);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 24px);
}

.chat-line { font-size: 14px; }
.chat-line b { font-weight: 600; margin-right: 8px; }
.chat-line.ghost { color: var(--muted); font-style: italic; }
.chat-line.event { color: var(--muted); font-size: 12px; }

/* moderator (사회자) announcements */
.chat-line.moderator {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    padding: 3px 0;
    margin: 2px 0;
}

.chat-line.moderator::before,
.chat-line.moderator::after {
    content: "";
    display: inline-block;
    width: 18px;
    height: 1px;
    background: var(--line);
    vertical-align: middle;
    margin: 0 8px;
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.chat-form input { flex: 1; border: none; padding: 8px 4px; border-radius: 0; }
.chat-form input:focus { border: none; }

body.ghost-self .chat-form input { color: var(--muted); font-style: italic; }

/* ---------- toast ---------- */
.toast-area {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 60;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--fg);
    color: var(--bg);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 999px;
    animation: toast-in 0.55s var(--ease) both;
    max-width: 80vw;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- sheet (bottom) ---------- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 40;
}

.sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 105%);
    width: min(520px, 100vw);
    background: var(--bg);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 24px;
    z-index: 50;
    transition: transform 0.3s var(--ease);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet.open { transform: translate(-50%, 0); }

.sheet-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }

/* ---------- fullscreen overlay (role card / result) ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
    text-align: center;
    padding: 24px;
}

.overlay.open { opacity: 1; pointer-events: auto; }

.overlay .big-icon {
    width: 96px;
    height: 96px;
    border: 1.5px solid var(--fg);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- role draw (slot-style shuffle -> reveal) ---------- */
.big-icon.rolling {
    border-style: dashed;
    animation: draw-pulse 0.5s ease-in-out infinite;
}

.big-icon.rolling .icon {
    opacity: 0.55;
    filter: blur(0.6px);
}

@keyframes draw-pulse {
    50% { transform: scale(1.06) rotate(2deg); }
}

.big-icon.pop {
    animation: draw-pop 0.5s var(--ease);
}

@keyframes draw-pop {
    0% { transform: scale(0.55); opacity: 0; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); }
}

.reveal-fade { animation: fade-up 0.4s var(--ease) both; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- icon radio (mission types) ---------- */
.icon-radio { display: flex; gap: 8px; }

.icon-radio button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.icon-radio button.active { border-color: var(--fg); color: var(--fg); }

/* ---------- lists (waiting / admin) ---------- */
.list { display: flex; flex-direction: column; }

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.list-row:last-child { border-bottom: none; }
.list-row .actions { margin-left: auto; opacity: 0; transition: opacity 0.15s; }
.list-row:hover .actions { opacity: 1; }

/* status dot: shape + fill (never color alone) */
.status-dot { width: 8px; height: 8px; border-radius: 999px; border: 1.5px solid var(--fg); flex: none; }
.status-dot.on { background: var(--fg); }
.status-dot.off { border-color: var(--muted); background: transparent; }

/* ---------- collapsible (progressive disclosure) ---------- */
details.fold { border-top: 1px solid var(--line); padding-top: 12px; }
details.fold summary {
    list-style: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
details.fold summary::-webkit-details-marker { display: none; }
details.fold[open] summary { color: var(--fg); margin-bottom: 12px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- projector (main screen) ---------- */
.projector {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 48px;
    text-align: center;
    padding: 48px;
}

.projector .phase-giant { font-size: clamp(64px, 14vw, 160px); font-weight: 600; line-height: 1; display: flex; align-items: center; gap: 24px; }
.projector .counts { display: flex; gap: 48px; font-size: 28px; }
.projector .ticker { min-height: 32px; font-size: 20px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
    .page { padding: 16px; }
    .players-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 16px 8px; }
    .player { width: 72px; }
    .player .avatar { width: 48px; height: 48px; font-size: 16px; }
    .field-grid { grid-template-columns: 1fr; }
    .t-display { font-size: 28px; }
}

/* ---------- utilities ---------- */
.hidden { display: none !important; }

/* ---------- practice observer panel (dev AI rooms) ---------- */
.practice-toggle {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 45;
    background: var(--bg);
}

.practice-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--line);
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    z-index: 44;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease);
}

.practice-panel.enabled { display: flex; }
.practice-panel.open { transform: none; }

.practice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

.practice-head .btn.active { color: var(--fg); border-color: var(--fg); }

.practice-section h4 { margin: 0 0 4px; }

/* phase jump (debug) buttons */
.phase-jump { display: flex; flex-wrap: wrap; gap: 4px; }

.phase-jump .btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.phase-jump .btn.active {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.practice-log-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.practice-log-section > div { overflow-y: auto; flex: 1; }

.practice-log-line {
    margin: 0 0 2px;
    font-size: 12px;
    color: var(--muted);
    font-family: var(--mono);
    letter-spacing: 0;
    word-break: break-all;
}

@media (min-width: 1280px) {
    body:has(.practice-panel.open) .page { margin-right: 316px; }
}

/* ================================================================== */
/*  Dev simulation multi-view (/sim)                                   */
/* ================================================================== */
.sim-page {
    max-width: none;
    padding: 12px 16px 24px;
}

.sim-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.sim-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg);
}

.sim-card.dead { opacity: 0.55; }

.sim-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 500;
}

.sim-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.sim-card iframe {
    display: block;
    width: 100%;
    height: 560px;
    border: 0;
    background: var(--bg);
}

.sim-card-waiting { padding-bottom: 4px; }
.sim-card-waiting .sim-card-head { border-bottom: 0; }

/* the game screen inside a pane: tighter chrome, no dev-only widgets */
body.sim-pane .page { padding: 8px 10px 118px; }
body.sim-pane .practice-toggle { display: none; }

/* ---------- settings dashboard (bottom-right) ---------- */
.sim-settings-toggle {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 46;
    background: var(--bg);
}

.sim-settings {
    position: fixed;
    right: 16px;
    bottom: 68px;
    width: 320px;
    max-height: min(72vh, 680px);
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.sim-settings.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.sim-settings-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

.sim-settings-track {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    font-size: 13px;
}

.bias-meter { display: flex; gap: 3px; }

.bias-meter i {
    flex: 1;
    height: 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
}

.bias-meter i.zero { border-color: var(--fg); }
.bias-meter i.fill { background: var(--muted); }
.bias-meter i.current { background: var(--fg); border-color: var(--fg); }

.bias-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--muted);
}

.sim-durations { grid-template-columns: 1fr 1fr; gap: 8px; }

.sim-durations label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sim-durations input,
.sim-durations select {
    width: 100%;
    padding: 6px 8px;
    font-size: 14px;
}

.sim-settings input[type="range"] { flex: 1; accent-color: var(--fg); }

#composition-fields.locked label { color: var(--muted); }
#composition-fields.locked input,
#composition-fields.locked select { opacity: 0.5; }

/* ================================================================== */
/*  Toggle switch (sim controls)                                       */
/* ================================================================== */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.switch input { display: none; }

.switch .knob {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--soft);
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.switch .knob::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--line);
    transition: transform 0.15s var(--ease);
}

.switch input:checked + .knob { background: var(--fg); border-color: var(--fg); }
.switch input:checked + .knob::after { transform: translateX(14px); border-color: var(--fg); }
.switch:has(input:checked) { color: var(--fg); }

/* countdown that ticks but has no consequences */
.phase-timer.unenforced { color: var(--muted); text-decoration: line-through; }

/* ================================================================== */
/*  Player-grid affordance: vivid only when tappable                   */
/* ================================================================== */
.players-grid.muted .player { opacity: 0.45; }
.players-grid.muted .player.dead { opacity: 0.3; }

/* mafia teammates' current night picks (mafia eyes only) */
.avatar.pick-partial {
    background: color-mix(in srgb, var(--fg) 20%, transparent);
    border-color: var(--fg);
}

.avatar.pick-full {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

/* ================================================================== */
/*  Avatar effects: execution / night kill / doctor save               */
/* ================================================================== */
/* execution: the town's judgement - shake, stamp an X, fade to gray  */
.player.fx-executed .avatar {
    animation: fx-shake 0.8s var(--ease), fx-gray-out 2.4s var(--ease) forwards;
}

.player.fx-executed .avatar::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        linear-gradient(45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%),
        linear-gradient(-45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%);
    opacity: 0;
    animation: fx-x-stamp 2.4s var(--ease) forwards;
}

/* night kill: a sudden slash across the face, then slump             */
.player.fx-killed .avatar {
    animation: fx-slump 2.4s var(--ease) forwards;
}

.player.fx-killed .avatar::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(-55deg, transparent 47%, currentColor 47%, currentColor 53%, transparent 53%);
    transform: scaleX(0);
    animation: fx-slash 0.6s var(--ease) 0.3s forwards;
}

/* doctor save: pulse back to life                                     */
.player.fx-saved .avatar {
    animation: fx-revive 1.4s var(--ease);
}

.player.fx-saved .avatar::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid currentColor;
    animation: fx-pulse-ring 2s var(--ease) forwards;
}

@keyframes fx-shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-3px) rotate(-3deg); }
    45% { transform: translateX(3px) rotate(3deg); }
    70% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes fx-x-stamp {
    0%, 25% { opacity: 0; transform: scale(1.6); }
    45% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.9; transform: scale(1); }
}

@keyframes fx-gray-out {
    0%, 50% { opacity: 1; filter: none; }
    100% { opacity: 0.45; filter: grayscale(1); }
}

@keyframes fx-slash {
    0% { transform: scaleX(0) rotate(0deg); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0.9; }
}

@keyframes fx-slump {
    0%, 30% { transform: none; opacity: 1; filter: none; }
    55% { transform: rotate(7deg) translateY(1px); }
    100% { transform: rotate(0deg) translateY(4px); opacity: 0.45; filter: grayscale(1); }
}

@keyframes fx-revive {
    0% { transform: scale(0.72); opacity: 0.35; filter: grayscale(1); }
    55% { transform: scale(1.14); opacity: 1; filter: none; }
    100% { transform: scale(1); }
}

@keyframes fx-pulse-ring {
    0% { transform: scale(0.8); opacity: 0.9; }
    70% { transform: scale(1.5); opacity: 0.25; }
    100% { transform: scale(1.9); opacity: 0; }
}

/* ================================================================== */
/*  GPT sheet: private AI chat thread                                  */
/* ================================================================== */
.gpt-thread {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    min-height: 72px;
    overflow-y: auto;
    padding: 4px 0;
}

.gpt-msg {
    margin: 0;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.gpt-msg.me {
    align-self: flex-end;
    background: var(--fg);
    color: var(--bg);
    border-bottom-right-radius: 4px;
}

.gpt-msg.ai {
    align-self: flex-start;
    background: var(--soft);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}

#gpt-sheet .sheet-title .dots { margin-left: auto; }
#gpt-sheet .chat-form { display: flex; gap: 8px; }
#gpt-sheet .chat-form input { flex: 1; }

/* ================================================================== */
/*  Liar round (라이어 라운드)                                         */
/* ================================================================== */
.liar-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    padding: 8px 12px;
    margin: 8px 0 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
}

.liar-banner .icon { color: var(--fg); }

.liar-banner .kw {
    font-size: 14px;
    font-weight: 600;
    color: var(--bg);
    background: var(--fg);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.liar-banner .t-sub { font-size: 13px; }

.liar-vote-btn {
    font-size: 12px;
    font-weight: 500;
    color: var(--fg);
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.liar-vote-btn:hover { background: var(--bg); border-color: var(--fg); }

.liar-vote-btn.active {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

/* GPT lobby: a special non-player tile in the players grid */
.player.gpt-lobby .avatar {
    border-style: dashed;
    color: var(--muted);
}

/* sim dashboard chip (top bar), same size/tone as .day-chip */
.sim-liar-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

/* ===== liar drawing round: canvas sheet + feed drawings ===== */
#draw-canvas {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    touch-action: none;
    cursor: crosshair;
}

.draw-width-row { justify-content: flex-start; gap: 10px; margin-top: 10px; }
.draw-width-row input[type="range"] { flex: 1; accent-color: var(--fg); }
.draw-width-dot {
    flex: none;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--fg);
}

.draw-actions { justify-content: flex-end; margin-top: 10px; }

.chat-line.drawing b { display: block; margin-bottom: 4px; }

.chat-drawing {
    display: block;
    width: 150px;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
