/* ══════════════════════════════════════════════
   이 대화는 마키마가 듣고있다 - 메인 스타일
══════════════════════════════════════════════ */

/* ── 기본 리셋 & 변수 ─────────────────────── */
:root {
  --bg-deep:       #0a0608;
  --bg-dark:       #100c0e;
  --bg-card:       #1a1015;
  --bg-card2:      #231820;
  --bg-input:      #1e161a;
  --border:        #3a2535;
  --border-bright: #6b3a55;
  --red:           #c0392b;
  --red-bright:    #e74c3c;
  --red-glow:      #ff2244;
  --gold:          #d4a017;
  --gold-bright:   #f0c040;
  --text-primary:  #e8d5d5;
  --text-secondary:#a08898;
  --text-muted:    #6b5060;
  --makima:        #cc4477;
  --makima-bright: #ff66aa;
  --chainsaw:      #e67e22;
  --chainsaw-bright:#f39c12;
  --public:        #3498db;
  --public-bright: #5dade2;
  --dead-color:    #555566;
  --radius:        8px;
  --radius-lg:     14px;
  --shadow:        0 4px 24px rgba(0,0,0,0.7);
  --font-main:     'Noto Sans KR', sans-serif;
  --font-title:    'Cinzel', serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── 스크린 전환 ─────────────────────────── */
.screen {
  display: none;
  width: 100%;
  min-height: 100dvh;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ── 공통 버튼 ───────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #8b1a2e, #c0392b);
  color: #fff;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  position: relative; overflow: hidden;
  font-family: var(--font-main);
}
.btn-primary:hover { background: linear-gradient(135deg, #a02030, #e74c3c); box-shadow: 0 0 18px rgba(220,50,70,.5); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a1835, #4a2050);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
}
.btn-secondary:hover { background: linear-gradient(135deg, #3a2045, #5a3060); border-color: var(--makima); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
}
.btn-ghost:hover { border-color: var(--border-bright); color: var(--text-primary); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color .2s;
}
.btn-icon:hover { color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-large { padding: 16px 40px; font-size: 18px; border-radius: 12px; }

/* ══════════════════════════════════════════
   SCREEN 1: 랜딩
══════════════════════════════════════════ */
#screen-landing {
  position: relative;
  align-items: center;
  justify-content: flex-start;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(150,20,40,.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(100,10,60,.2) 0%, transparent 50%),
    var(--bg-deep);
}

.landing-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}

.blood-drip {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 2px; height: 40vh;
  background: linear-gradient(to bottom, transparent, var(--red), transparent);
  opacity: .3;
  animation: drip 4s ease-in-out infinite;
}
@keyframes drip { 0%,100%{height:30vh;opacity:.2} 50%{height:50vh;opacity:.5} }

.landing-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}

.landing-header { text-align: center; }

/* 눈 아이콘 — SVG 기반으로 이모지 없이 */
.eye-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  display: block;
  position: relative;
  animation: eye-pulse 3s ease-in-out infinite;
}
.eye-icon::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border: 2px solid rgba(220,50,80,.7);
  box-shadow: 0 0 14px rgba(220,50,80,.8), inset 0 0 10px rgba(200,30,60,.3);
}
.eye-icon::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  background: radial-gradient(circle, #e74c3c 0%, #8b1a2e 70%);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(220,50,80,.9);
}
@keyframes eye-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

.title-main {
  font-family: var(--font-main);
  font-size: clamp(24px, 7vw, 44px);
  font-weight: 900;
  line-height: 1.25;
  color: #fff;
  text-shadow:
    0 0 20px rgba(220,50,80,.8),
    0 0 60px rgba(180,20,50,.4);
  letter-spacing: -0.5px;
}

.title-sub {
  margin-top: 10px;
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 4px;
}

.game-desc-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
}

.game-desc-card h2 {
  font-size: 16px; font-weight: 700;
  color: var(--red-bright);
  letter-spacing: 0.5px;
}

.game-desc-card > p {
  font-size: 13px; color: var(--text-secondary); line-height: 1.8;
}
.game-desc-card > p strong { color: var(--text-primary); }

.role-cards {
  display: flex; gap: 10px;
}

.role-card {
  flex: 1;
  background: var(--bg-card2);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  transition: border-color .2s;
}
.role-card:hover { border-color: var(--border-bright); }

.role-card strong { font-size: 11px; font-weight: 700; }
.role-card p { font-size: 10px; color: var(--text-muted); line-height: 1.5; }

.role-card.makima   { border-color: rgba(204,68,119,.3); }
.role-card.makima strong { color: var(--makima-bright); }
.role-card.chainsaw { border-color: rgba(230,126,34,.3); }
.role-card.chainsaw strong { color: var(--chainsaw-bright); }
.role-card.public   { border-color: rgba(52,152,219,.3); }
.role-card.public strong { color: var(--public-bright); }

.rule-list h3 { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.rule-list ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rule-list li {
  font-size: 12px; color: var(--text-secondary); padding-left: 10px;
  position: relative;
}
.rule-list li::before {
  content: '—';
  position: absolute; left: 0;
  color: var(--text-muted);
}
.rule-list li strong { color: var(--text-primary); }

.btn-large .btn-text { position: relative; z-index: 1; }
.btn-large .btn-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,50,80,.3), transparent 70%);
  animation: glow-pulse 2s ease-in-out infinite;
}
@keyframes glow-pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* ══════════════════════════════════════════
   공통 헤더
══════════════════════════════════════════ */
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  position: sticky; top: 0; z-index: 100;
  min-height: 52px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.my-label { font-size: 12px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   SCREEN 2: 로비
══════════════════════════════════════════ */
#screen-lobby { background: var(--bg-deep); }

.lobby-content {
  flex: 1;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
}

.lobby-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
}

.section-title {
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  letter-spacing: 0.5px;
}

.room-list {
  display: flex; flex-direction: column; gap: 10px;
}

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  transition: all .2s;
}
.room-card:hover { border-color: var(--border-bright); background: var(--bg-card2); }
.room-card.full { opacity: .5; cursor: not-allowed; }
.room-card.in-game { border-color: rgba(150,10,30,.4); }

.room-info { display: flex; flex-direction: column; gap: 4px; }
.room-name { font-size: 14px; font-weight: 700; }
.room-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.room-status { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.room-status.waiting  { background: rgba(52,152,219,.2); color: var(--public-bright); }
.room-status.playing  { background: rgba(192,57,43,.2); color: var(--red-bright); }
.room-status.countdown{ background: rgba(214,160,23,.2); color: var(--gold-bright); }
.room-lock { color: var(--text-muted); font-size: 12px; }

.room-join-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
}
.room-join-btn:hover { border-color: var(--red); color: var(--red-bright); }

.room-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 40px 0; }

/* ── 모달 ────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.8);
}
.modal-box h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.modal-box label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
}
.label-hint { color: var(--text-muted); font-size: 11px; }

.modal-box input[type="text"],
.modal-box input[type="password"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.modal-box input:focus { border-color: var(--border-bright); }

.modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ══════════════════════════════════════════
   SCREEN 3: 대기실
══════════════════════════════════════════ */
#screen-waiting {
  background: var(--bg-deep);
  flex-direction: column;
}

.waiting-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100dvh - 52px);
}

.waiting-sidebar {
  width: 180px; min-width: 140px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}

.waiting-sidebar h3 { font-size: 13px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }

.player-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.player-list li {
  font-size: 12px; color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-card2);
  border-radius: 6px;
  display: flex; align-items: center; gap: 6px;
}
.player-list li .dot {
  width: 6px; height: 6px;
  background: #2ecc71; border-radius: 50%; flex-shrink: 0;
}
.player-list li.me { color: var(--gold-bright); font-weight: 600; }

.player-count {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-card2);
  padding: 2px 8px; border-radius: 10px;
}

.countdown-display {
  background: rgba(192,57,43,.15);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.countdown-display.hidden { display: none; }
.countdown-label { font-size: 10px; color: var(--text-muted); }
.countdown-num {
  font-size: 40px; font-weight: 900;
  color: var(--red-bright);
  text-shadow: 0 0 20px var(--red-glow);
  animation: count-pulse .5s ease-in-out infinite alternate;
}
@keyframes count-pulse { from{transform:scale(1)} to{transform:scale(1.15)} }

.waiting-iframe-wrap {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.iframe-notice {
  background: rgba(100,30,50,.3);
  border-bottom: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 11px; color: var(--text-muted);
  text-align: center;
}

#surf-iframe {
  flex: 1;
  border: none;
  width: 100%; height: 100%;
  background: #fff;
}

/* ══════════════════════════════════════════
   SCREEN 4: 게임 HUD
══════════════════════════════════════════ */
#screen-game {
  background: var(--bg-deep);
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.game-hud {
  display: flex; align-items: center;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  gap: 10px;
  min-height: 56px;
  position: sticky; top: 0; z-index: 100;
}

.hud-day {
  font-size: 15px; font-weight: 900;
  color: var(--gold-bright);
  min-width: 60px;
  text-shadow: 0 0 10px rgba(240,192,64,.4);
}

.hud-center {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}

.hud-phase {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}

.hud-timer-wrap { width: 100%; max-width: 260px; }

/* ── 타이머 (읽기 전용) ───────────────────── */
.hud-timer {
  font-size: 18px; font-weight: 900;
  text-align: center;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  transition: color .3s;
}
.hud-timer.warning { color: var(--red-bright); animation: timer-warn .5s ease-in-out infinite alternate; }
@keyframes timer-warn { from{opacity:1} to{opacity:.5} }

/* 읽기전용 타이머 (일반 유저) */
#hud-timer-readonly {
  font-size: 18px; font-weight: 900;
  text-align: center;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  transition: color .3s;
}
#hud-timer-readonly.warning { color: var(--red-bright); animation: timer-warn .5s ease-in-out infinite alternate; }

/* ── 시간 조정 컨트롤 (마키마 전용) ──────── */
.hud-time-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.hud-time-controls.hidden { display: none; }

.btn-time {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 11px; font-weight: 700;
  padding: 3px 9px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all .2s;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.btn-time-minus {
  border-color: rgba(192,57,43,.4);
  color: var(--red-bright);
}
.btn-time-minus:hover {
  background: rgba(192,57,43,.15);
  border-color: var(--red);
  box-shadow: 0 0 8px rgba(192,57,43,.3);
}
.btn-time-plus {
  border-color: rgba(46,204,113,.3);
  color: #2ecc71;
}
.btn-time-plus:hover {
  background: rgba(46,204,113,.12);
  border-color: #2ecc71;
  box-shadow: 0 0 8px rgba(46,204,113,.25);
}

/* -15s 사용 완료 (Day당 1회 제한) */
.btn-time-minus.used,
.btn-time-minus:disabled {
  opacity: .35;
  cursor: not-allowed;
  border-color: rgba(100,60,60,.4);
  color: var(--text-muted);
  background: transparent;
  box-shadow: none;
}

.timer-bar-bg {
  width: 100%; height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
}
.timer-bar {
  height: 100%;
  background: linear-gradient(to right, var(--red), var(--red-bright));
  border-radius: 2px;
  width: 100%;
  transition: width 1s linear, background .5s;
}
.timer-bar.vote-bar { background: linear-gradient(to right, #2980b9, var(--public-bright)); }

.hud-right { min-width: 80px; text-align: right; }
.hud-role {
  font-size: 11px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  display: inline-block;
  letter-spacing: 0.3px;
}
.hud-role.role-makima   { background: rgba(204,68,119,.25); color: var(--makima-bright); border: 1px solid rgba(204,68,119,.4); }
.hud-role.role-chainsaw { background: rgba(230,126,34,.2); color: var(--chainsaw-bright); border: 1px solid rgba(230,126,34,.3); }
.hud-role.role-public   { background: rgba(52,152,219,.2); color: var(--public-bright); border: 1px solid rgba(52,152,219,.3); }

/* ── 게임 레이아웃 ───────────────────────── */
.game-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100dvh - 56px);
}

.game-sidebar {
  width: 190px; min-width: 150px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0;
  overflow-y: auto;
  padding: 10px;
}

.sidebar-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section.hidden { display: none; }

.sidebar-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.sidebar-title.makima-color   { color: var(--makima-bright); }
.sidebar-title.chainsaw-color { color: var(--chainsaw-bright); }

.sidebar-hint { font-size: 10px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }

.game-player-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.game-player-list li {
  font-size: 12px; color: var(--text-secondary);
  padding: 5px 8px;
  background: var(--bg-card2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid transparent;
}
.game-player-list li.me { color: var(--gold-bright); border-color: rgba(240,192,64,.2); }
.game-player-list li.dead { color: var(--dead-color); text-decoration: line-through; }
.game-player-list li .status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.game-player-list li .status-dot.alive { background: #2ecc71; }
.game-player-list li .status-dot.dead  { background: var(--dead-color); }

.action-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.action-list li {
  font-size: 12px;
  padding: 6px 10px;
  background: var(--bg-card2);
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; justify-content: space-between;
}
.action-list li:hover  { border-color: var(--border-bright); color: #fff; }
.action-list li.selected { border-color: var(--red); color: var(--red-bright); background: rgba(192,57,43,.15); }

.dominate-status, .kill-status {
  font-size: 11px;
  margin-top: 6px; padding: 6px 8px;
  background: rgba(204,68,119,.1);
  border-radius: 6px;
  border: 1px solid rgba(204,68,119,.2);
  display: none;
  color: var(--makima-bright);
}
.kill-status { color: var(--chainsaw-bright); background: rgba(230,126,34,.1); border-color: rgba(230,126,34,.2); }
.dominate-status.visible, .kill-status.visible { display: block; }

/* 지배 실패 상태 */
.dominate-status.fail {
  background: rgba(192,57,43,.12);
  border-color: rgba(192,57,43,.35);
  color: var(--red-bright);
}

/* 지배/처치 대상 목록 — 사용 완료 */
.action-list li.used {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 게임 메인 (채팅) ─────────────────────── */
.game-main {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── 투표 패널 ───────────────────────────── */
.vote-panel {
  background: rgba(41,128,185,.06);
  border-bottom: 1px solid rgba(41,128,185,.3);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.vote-panel.hidden { display: none; }

.vote-title { font-size: 13px; font-weight: 700; color: var(--public-bright); letter-spacing: 0.3px; }
.vote-timer-txt { font-size: 11px; color: var(--text-muted); }

.vote-candidates {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.vote-btn {
  padding: 7px 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
  display: flex; align-items: center; gap: 6px;
}
.vote-btn:hover    { border-color: var(--public); color: var(--public-bright); }
.vote-btn.voted    { border-color: var(--public); color: var(--public-bright); background: rgba(41,128,185,.15); }
.vote-btn .vote-count {
  background: rgba(41,128,185,.25);
  padding: 1px 6px; border-radius: 10px;
  font-size: 11px;
}

.vote-status-msg { font-size: 12px; color: var(--text-muted); }

/* ── 결과 패널 ───────────────────────────── */
.result-panel {
  background: rgba(192,57,43,.06);
  border-bottom: 1px solid rgba(192,57,43,.3);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 200px; overflow-y: auto;
}
.result-panel.hidden { display: none; }
.result-title { font-size: 13px; font-weight: 700; color: var(--red-bright); letter-spacing: 0.3px; }

.result-body { display: flex; flex-direction: column; gap: 8px; }
.result-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-secondary);
}
.result-votes-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; }
.result-votes-bar { height: 100%; background: var(--red); border-radius: 3px; transition: width .5s; }
.result-death-notice {
  font-size: 13px; font-weight: 700;
  color: var(--red-bright);
  padding: 8px 12px;
  background: rgba(192,57,43,.15);
  border-radius: 6px;
  border: 1px solid rgba(192,57,43,.3);
}

/* ── 채팅 로그 ───────────────────────────── */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 6px;
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 82%;
  animation: msg-in .2s ease-out;
}
@keyframes msg-in { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

.chat-msg.self   { align-self: flex-end; align-items: flex-end; }
.chat-msg.other  { align-self: flex-start; align-items: flex-start; }
.chat-msg.system { align-self: center; align-items: center; max-width: 100%; }

.chat-meta {
  font-size: 10px; color: var(--text-muted);
  display: flex; gap: 6px; align-items: center;
}
.chat-meta .sender-name { font-weight: 600; color: var(--text-secondary); }
.chat-meta .sender-name.me { color: var(--gold); }
.chat-meta .whisper-tag {
  font-size: 9px;
  color: #a090cc;
  background: rgba(120,80,200,.15);
  padding: 1px 5px; border-radius: 3px;
}
.chat-meta .dead-tag {
  font-size: 9px;
  color: var(--dead-color);
  background: rgba(60,60,80,.2);
  padding: 1px 5px; border-radius: 3px;
}

.chat-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px; line-height: 1.5;
  word-break: break-all;
}
.chat-msg.self  .chat-bubble {
  background: rgba(192,57,43,.25);
  border: 1px solid rgba(192,57,43,.4);
  color: var(--text-primary);
  border-bottom-right-radius: 3px;
}
.chat-msg.other .chat-bubble {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
}
.chat-msg.system .chat-bubble {
  background: rgba(100,50,80,.15);
  border: 1px solid rgba(150,50,80,.2);
  color: var(--text-muted);
  font-size: 11px; text-align: center;
  border-radius: 20px; padding: 5px 14px;
}

/* 귓속말 */
.chat-msg.whisper .chat-bubble {
  background: rgba(100,50,160,.2);
  border-color: rgba(130,70,200,.4);
  color: #c9b0ff;
}

/* 죽은 자 채팅 */
.chat-msg.ghost .chat-bubble {
  background: rgba(40,40,60,.2);
  border-color: rgba(70,70,100,.3);
  color: var(--dead-color);
  font-style: italic;
}

/* 승인 대기 (내 메세지) */
.chat-msg.pending-msg .chat-bubble {
  opacity: .55;
  border-style: dashed;
}

/* 마키마 시스템 */
.chat-msg.makima-sys .chat-bubble {
  background: rgba(204,68,119,.1);
  border-color: rgba(204,68,119,.3);
  color: var(--makima-bright);
}

/* ════════════════════════════════════════════
   인라인 검열 UI (마키마 전용 — 채팅 버블 하단)
════════════════════════════════════════════ */
.chat-censor-panel {
  margin-top: 4px;
  background: rgba(204,68,119,.08);
  border: 1px solid rgba(204,68,119,.3);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
  width: 100%;
  max-width: 320px;
  animation: msg-in .15s ease-out;
}

.censor-label {
  font-size: 10px;
  color: var(--makima-bright);
  letter-spacing: 0.5px;
  font-weight: 600;
}

.censor-edit {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 9px;
  font-size: 12px;
  font-family: var(--font-main);
  outline: none;
  resize: none;
  width: 100%;
  line-height: 1.4;
  transition: border-color .2s;
}
.censor-edit:focus { border-color: var(--makima); }

.censor-btns {
  display: flex; gap: 6px;
}
.btn-censor-approve {
  flex: 1; padding: 5px 0;
  background: rgba(46,204,113,.12);
  border: 1px solid rgba(46,204,113,.35);
  color: #2ecc71;
  border-radius: 5px;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  font-family: var(--font-main);
  letter-spacing: 0.3px;
  transition: all .2s;
}
.btn-censor-approve:hover { background: rgba(46,204,113,.22); border-color: #2ecc71; }

.btn-censor-reject {
  flex: 1; padding: 5px 0;
  background: rgba(192,57,43,.12);
  border: 1px solid rgba(192,57,43,.35);
  color: var(--red-bright);
  border-radius: 5px;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  font-family: var(--font-main);
  letter-spacing: 0.3px;
  transition: all .2s;
}
.btn-censor-reject:hover { background: rgba(192,57,43,.22); border-color: var(--red); }

/* ── 채팅 입력창 ──────────────────────────── */
.chat-input-area {
  padding: 10px 14px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}

.whisper-target-wrap {
  display: flex; align-items: center; gap: 8px;
}
.whisper-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.whisper-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
}
.whisper-select:focus { border-color: var(--border-bright); }

.chat-input-row {
  display: flex; gap: 8px;
}

#chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color .2s;
}
#chat-input:focus { border-color: var(--border-bright); }
#chat-input::placeholder { color: var(--text-muted); }

.btn-send {
  background: linear-gradient(135deg, #6b1a2e, #a0302b);
  border: 1px solid var(--red);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
  white-space: nowrap;
}
.btn-send:hover { background: linear-gradient(135deg, #8b2030, #c0392b); box-shadow: 0 0 12px rgba(192,57,43,.4); }

.dead-overlay {
  position: absolute; bottom: 60px; left: 0; right: 0;
  background: rgba(0,0,0,.8);
  border-top: 1px solid rgba(80,80,120,.4);
  padding: 10px 16px;
  text-align: center;
  font-size: 12px; color: var(--dead-color);
  letter-spacing: 0.3px;
}
.dead-overlay.hidden { display: none; }

/* ── 게임 종료 오버레이 ───────────────────── */
.game-end-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.game-end-overlay.hidden { display: none; }

.game-end-box {
  background: var(--bg-card);
  border: 2px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  max-width: 480px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
  box-shadow: 0 0 60px rgba(150,20,50,.4);
}

/* 눈 아이콘 (게임 종료용) */
.game-end-icon {
  width: 56px; height: 56px;
  position: relative;
  margin: 0 auto;
}
.game-end-icon::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border: 2px solid rgba(220,50,80,.8);
  box-shadow: 0 0 20px rgba(220,50,80,.9);
}
.game-end-icon::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 20px; height: 20px;
  background: radial-gradient(circle, #e74c3c 0%, #8b1a2e 70%);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(220,50,80,.9);
}
/* 공안 승리: 칼 느낌 — 다른 형태 */
.winner-public .game-end-icon::before {
  border-radius: 4px;
  transform: rotate(45deg);
  border-color: rgba(52,152,219,.8);
  box-shadow: 0 0 20px rgba(52,152,219,.8);
}
.winner-public .game-end-icon::after {
  background: radial-gradient(circle, #5dade2 0%, #1a6090 70%);
  box-shadow: 0 0 10px rgba(52,152,219,.9);
  border-radius: 2px;
  width: 6px; height: 28px;
  transform: translate(-50%,-50%) rotate(45deg);
}

#game-end-title {
  font-size: 22px; font-weight: 900;
  line-height: 1.3;
}
.winner-public  #game-end-title { color: var(--public-bright); }
.winner-makima  #game-end-title { color: var(--makima-bright); }

#game-end-reason { font-size: 13px; color: var(--text-secondary); }

.game-end-reveal {
  width: 100%;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 4px 0;
}
.reveal-card {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
  text-align: center;
  min-width: 80px;
}
.reveal-card.makima   { background: rgba(204,68,119,.15); border-color: rgba(204,68,119,.4); color: var(--makima-bright); }
.reveal-card.chainsaw { background: rgba(230,126,34,.15); border-color: rgba(230,126,34,.4); color: var(--chainsaw-bright); }
.reveal-card.public   { background: rgba(52,152,219,.15); border-color: rgba(52,152,219,.4); color: var(--public-bright); }
.reveal-card .reveal-name { color: var(--text-primary); margin-bottom: 2px; }
.reveal-card .reveal-dead { color: var(--dead-color); font-size: 10px; }

/* ── 토스트 ──────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--red);
  color: var(--red-bright);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.6);
  animation: toast-in .2s ease-out;
}
.toast.hidden { display: none; }
.toast.info    { border-color: var(--public); color: var(--public-bright); }
.toast.success { border-color: #2ecc71; color: #2ecc71; }
@keyframes toast-in { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ── 스크롤바 커스텀 ─────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ══════════════════════════════════════════
   모바일 반응형
══════════════════════════════════════════ */
@media (max-width: 600px) {

  /* 랜딩 */
  .role-cards { flex-direction: column; gap: 8px; }
  .role-card { flex-direction: row; align-items: center; gap: 12px; padding: 12px; }
  .role-card p { text-align: left; }

  /* 로비 */
  .lobby-actions { flex-direction: column; }
  .lobby-actions .btn-primary,
  .lobby-actions .btn-secondary,
  .lobby-actions .btn-ghost { width: 100%; }

  /* 대기실 */
  .waiting-layout { flex-direction: column; }
  .waiting-sidebar {
    width: 100%; min-width: unset;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; flex-wrap: wrap;
    max-height: 140px; overflow-y: hidden;
    gap: 8px; align-items: center;
  }
  .waiting-sidebar h3 { width: 100%; }
  .player-list { flex-direction: row; flex-wrap: wrap; }
  .countdown-display { padding: 6px 10px; flex-direction: row; align-items: center; gap: 8px; }
  .countdown-num { font-size: 24px; }
  .waiting-iframe-wrap { height: calc(100dvh - 240px); }

  /* 게임 HUD */
  .hud-day { font-size: 13px; min-width: 50px; }
  .hud-timer, #hud-timer-readonly { font-size: 15px; }
  .btn-time { font-size: 10px; padding: 2px 7px; }

  /* 게임 레이아웃 */
  .game-layout { flex-direction: column; }
  .game-sidebar {
    width: 100%; min-width: unset;
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: 150px; overflow-y: hidden;
    flex-direction: row; flex-wrap: wrap; gap: 8px;
    padding: 8px 10px;
  }
  .sidebar-section { border-bottom: none; padding: 4px 0; flex: 1; min-width: 110px; }
  .game-player-list { flex-direction: row; flex-wrap: wrap; }
  .game-player-list li { font-size: 11px; padding: 4px 6px; }
  .action-list li { font-size: 11px; padding: 5px 8px; }

  /* 채팅 */
  .chat-log { padding: 8px 10px; }
  .chat-bubble { font-size: 12px; padding: 7px 10px; }
  .chat-censor-panel { max-width: 100%; }

  /* 투표 */
  .vote-candidates { gap: 4px; }
  .vote-btn { padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 360px) {
  .title-main { font-size: 22px; }
  .game-sidebar { max-height: 130px; }
}
