/* ============================================
   TaWo - Discord Light Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f2f3f5;
  --bg-sidebar: #f2f3f5;
  --bg-card: #f2f3f5;
  --bg-input: #ebedef;
  --bg-message-hover: #f2f3f5;
  --bg-overlay: rgba(0, 0, 0, 0.5);

  --text-primary: #2e3338;
  --text-secondary: #6d6f78;
  --text-muted: #8e9297;
  --text-inverse: #ffffff;

  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-light: rgba(88, 101, 242, 0.1);
  --danger: #ed4245;
  --danger-hover: #d83c3e;
  --success: #57f287;
  --success-dark: #3ba55c;
  --warning: #fee75c;
  --warning-dark: #f0b232;

  --border: #e3e5e8;
  --border-strong: #d3d5d9;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);

  --font-primary: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  --font-mono: 'Consolas', 'Monaco', monospace;

  --topbar-height: 52px;
  --sidebar-width: 220px;
  --info-panel-width: 260px;
  --tab-height: 44px;
  --input-height: 48px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-inverse);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
}

.btn-success {
  background-color: var(--success-dark);
  color: var(--text-inverse);
}

.btn-success:hover:not(:disabled) {
  background-color: #2d9348;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-secondary);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--bg-secondary);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ============================================
   Form Inputs
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  transition: border-color 0.15s ease;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  background-color: var(--bg-primary);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236d6f78' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-error {
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: 1.2em;
}

/* ============================================
   Auth Page (Login/Register)
   ============================================ */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--bg-secondary);
  padding: 20px;
  overflow: auto;
}

.auth-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  animation: fadeIn 0.3s ease;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.auth-logo {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-toggle a {
  font-weight: 600;
  cursor: pointer;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border);
}

/* ============================================
   Lobby Page
   ============================================ */
.lobby-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: var(--bg-secondary);
}

/* Top Bar (shared) */
.top-bar {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 16px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.top-bar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-title .icon {
  font-size: 1.25rem;
}

.top-bar-spacer {
  flex: 1;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.top-bar-user .display-name {
  font-weight: 600;
  color: var(--text-primary);
}

/* Lobby Content */
.lobby-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.lobby-header h2 {
  font-size: 1.25rem;
}

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

.room-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.room-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-card-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.room-card-status.waiting {
  background-color: var(--accent-light);
  color: var(--accent);
}

.room-card-status.playing {
  background-color: rgba(237, 66, 69, 0.1);
  color: var(--danger);
}

.room-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.room-card-info .player-count {
  display: flex;
  align-items: center;
  gap: 4px;
}

.room-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.empty-lobby {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-lobby .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-lobby p {
  font-size: 0.9375rem;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background-color: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: background-color 0.15s ease;
}

.modal-close:hover {
  background-color: var(--bg-secondary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ============================================
   Game Page Layout
   ============================================ */
.game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Game Top Bar */
.game-top-bar {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 16px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
  z-index: 10;
}

.game-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  white-space: nowrap;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.phase-indicator.phase-day {
  background-color: #fff8e1;
  color: #f57f17;
}

.phase-indicator.phase-night {
  background-color: #e8eaf6;
  color: #3949ab;
}

.phase-indicator.phase-vote {
  background-color: rgba(88, 101, 242, 0.1);
  color: var(--accent);
}

.phase-indicator .phase-emoji {
  font-size: 1rem;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
}

.timer-display.timer-warning {
  color: var(--danger);
  animation: pulse 1s ease infinite;
}

/* Game Main Area */
.game-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Player List Sidebar */
.player-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.player-sidebar-header {
  padding: 12px 12px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.player-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.player-section-title {
  padding: 8px 4px 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: default;
  transition: background-color 0.1s ease;
}

.player-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.player-item.dead {
  opacity: 0.5;
}

.player-item.dead .player-name {
  text-decoration: line-through;
}

.player-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.player-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.player-role-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
}

.player-role-tag.wolf {
  background-color: rgba(237, 66, 69, 0.1);
  color: var(--danger);
}

/* Chat Center Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Channel Tabs */
.channel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  height: var(--tab-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.channel-tab {
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  position: relative;
}

.channel-tab:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.channel-tab.active {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.channel-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background-color: var(--accent);
  border-radius: 1px;
}

.channel-tab .unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  background-color: var(--danger);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-message {
  display: flex;
  gap: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.1s ease;
}

.chat-message:hover {
  background-color: var(--bg-message-hover);
}

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-message-body {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chat-message-sender {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-message-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.chat-message-content {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

/* System Message */
.chat-message.system {
  justify-content: center;
  padding: 8px;
  gap: 0;
}

.chat-message.system .chat-message-content {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Game Event Message */
.chat-message.game-event {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 4px 0;
  gap: 0;
  flex-direction: column;
}

.chat-message.game-event.event-kill {
  border-left-color: var(--danger);
}

.chat-message.game-event.event-vote {
  border-left-color: var(--accent);
}

.chat-message.game-event.event-reveal {
  border-left-color: var(--warning-dark);
}

.chat-message.game-event.event-success {
  border-left-color: var(--success-dark);
}

.chat-message.game-event .event-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chat-message.game-event .event-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Chat Input */
.chat-input-area {
  padding: 0 16px 16px;
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-input);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 16px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent);
  background-color: var(--bg-primary);
}

.chat-input-wrapper.disabled {
  opacity: 0.5;
  pointer-events: none;
}

#chatInput {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

#chatInput::placeholder {
  color: var(--text-muted);
}

#chatSendBtn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
  transition: background-color 0.15s ease;
}

#chatSendBtn:hover {
  background-color: var(--accent-hover);
}

#chatSendBtn:disabled {
  background-color: var(--border);
  cursor: not-allowed;
}

/* Info Panel (Right Side) */
.info-panel {
  width: var(--info-panel-width);
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.info-panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.info-panel-section:last-child {
  border-bottom: none;
  flex: 1;
  overflow-y: auto;
}

.info-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Role Card */
.role-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.role-card .role-emoji {
  font-size: 2rem;
  margin-bottom: 4px;
}

.role-card .role-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.role-card .role-team {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.role-card .role-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Status Info */
.status-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.status-row .label {
  color: var(--text-secondary);
  font-weight: 600;
}

.status-row .value {
  color: var(--text-primary);
  font-weight: 600;
}

.status-row .value.alive {
  color: var(--success-dark);
}

.status-row .value.dead {
  color: var(--danger);
}

/* Ability Button */
#abilityBtn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 0.875rem;
}

/* Night Results */
.night-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.night-result-item {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
}

/* Info panel bottom split */
.info-panel-bottom {
  flex: 1 !important;
  overflow: hidden !important;
  padding: 8px !important;
}

.info-bottom-split {
  display: flex;
  height: 100%;
  gap: 0;
}

.info-bottom-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.info-bottom-col .info-section-title {
  font-size: 0.625rem;
  margin-bottom: 6px;
  padding: 0 4px;
  white-space: nowrap;
}

.info-bottom-divider {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.info-log-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 2px;
}

.info-log-empty {
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 4px;
  font-style: italic;
}

.info-log-entry {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  padding: 2px 4px;
  line-height: 1.4;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.info-log-entry:last-child {
  border-bottom: none;
}

.info-log-entry .log-phase {
  color: var(--text-muted);
  font-size: 0.625rem;
}

.info-log-entry .log-name {
  font-weight: 600;
  color: var(--text-primary);
}

.info-log-entry .log-result {
  color: #d64045;
  font-weight: 500;
}

.info-log-entry .log-result.safe {
  color: var(--success-dark);
}

.ability-log-group {
  margin-bottom: 4px;
}

.ability-log-group-title {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============================================
   Vote Overlay
   ============================================ */
.vote-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  z-index: 50;
  animation: slideUp 0.25s ease;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

.vote-overlay.hidden {
  display: none;
}

.vote-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.vote-header .vote-icon {
  font-size: 1.25rem;
}

.vote-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.vote-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vote-target-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.vote-target-btn:hover {
  background-color: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.vote-target-btn.selected {
  background-color: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.vote-target-btn.skip {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
}

.vote-target-btn.skip:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Second Vote (Yes/No) */
.vote-second-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.vote-second-section .defendant-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.vote-second-btns {
  display: flex;
  gap: 12px;
}

.vote-second-btns .btn {
  min-width: 100px;
}

/* ============================================
   Ability Modal
   ============================================ */
.ability-modal-content {
  max-height: 300px;
  overflow-y: auto;
}

.ability-target-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ability-target-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.1s ease;
  font-size: 0.9375rem;
}

.ability-target-item:hover {
  background-color: var(--bg-secondary);
}

.ability-target-item.selected {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   Toast / Notification
   ============================================ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  pointer-events: auto;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
  max-width: 360px;
}

.toast.toast-success {
  border-left: 3px solid var(--success-dark);
}

.toast.toast-error {
  border-left: 3px solid var(--danger);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning-dark);
}

.toast.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes phaseTransition {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.phase-enter {
  animation: phaseTransition 0.4s ease;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .info-panel {
    width: 220px;
  }

  .player-sidebar {
    width: 180px;
  }
}

@media (max-width: 768px) {
  .info-panel {
    display: none;
  }

  .player-sidebar {
    width: 160px;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .player-sidebar {
    display: none;
  }

  .lobby-content {
    padding: 16px;
  }

  .auth-card {
    padding: 24px;
  }
}

/* Player ready status */
.player-item .ready-icon { margin-right: 4px; }
.player-item.is-ready .player-name { }
.player-item.not-ready .player-name { opacity: 0.7; }

/* Bold player names */
.player-item .player-name { font-weight: 600; }

/* Chat message name styling */
.msg-sender { font-weight: 600; margin-right: 2px; }

/* Ready button */
.btn-ready { min-width: 80px; }
.btn-ready.is-ready { background: #57f287; color: #2e3338; }

/* Dead player in list */
.player-item.dead .player-name {
    color: #adb5bd !important;
    text-decoration: line-through;
}

/* Admin chat styling */
.msg-sender-admin {
    background: linear-gradient(135deg, #f1c40f, #e67e22, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}
.msg-sender-admin::before {
    content: '⭐ ';
    -webkit-text-fill-color: initial;
}
.admin-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #fff;
    font-size: 0.625rem;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
}

/* Ready button styles */
.btn-ready {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e3e5e8;
    background: #f2f3f5;
    color: #6d6f78;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-ready:hover {
    background: #e3e5e8;
}
.btn-ready.is-ready {
    background: #57f287;
    color: #2e3338;
    border-color: #57f287;
    font-weight: 600;
}

/* Ready badge */
.ready-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 3px;
}

/* System message styling */
.chat-message.system-message {
    background-color: #e3f2fd;
    border-radius: 6px;
    padding: 6px 10px;
}

.chat-message.system-message:hover {
    background-color: #d0e8fc;
}

.system-message .system-text {
    font-weight: 700;
}

/* Day skip button */
#daySkipBtn {
    white-space: nowrap;
}

/* Memo panel */
.memo-panel {
    background: #fff;
    border-bottom: 1px solid #e3e5e8;
    padding: 8px 16px;
}
.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Context menu */
.context-menu {
    max-height: 400px;
    overflow-y: auto;
}
.context-menu-item:hover {
    background: #f2f3f5;
}

/* Resize handles */
.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: #e3e5e8;
    transition: background 0.2s;
    flex-shrink: 0;
}
.resize-handle:hover {
    background: #5865f2;
}

/* Personal ability message (only visible to self, light red) */
.chat-message.personal-ability {
    background-color: rgba(237, 66, 69, 0.06);
    border-left: 3px solid rgba(237, 66, 69, 0.5);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    margin: 2px 0;
}
.chat-message.personal-ability .personal-ability-text {
    color: #d64045;
    font-size: 0.8125rem;
    font-weight: 500;
}
.chat-message.personal-ability .msg-time {
    color: rgba(214, 64, 69, 0.5);
}

/* Countdown overlay */
.countdown-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}
.countdown-number {
    font-size: 6rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 40px rgba(88, 101, 242, 0.8), 0 0 80px rgba(88, 101, 242, 0.4);
    animation: countdownPulse 1s ease-in-out;
}
.countdown-text {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
    text-align: center;
}
@keyframes countdownPulse {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Role emoji in right panel */
#roleEmoji {
    font-size: 3rem;
}

/* === Lobby Layout with Sidebar === */
.lobby-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.lobby-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.online-sidebar {
    width: 200px;
    background: #f2f3f5;
    border-right: 1px solid #e3e5e8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.online-sidebar-header {
    padding: 12px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6d6f78;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #e3e5e8;
}

.online-sidebar-header span {
    margin-left: 4px;
    color: #5865f2;
}

.online-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.online-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: #313338;
}

.online-user:hover {
    background: #e3e5e8;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ba55d;
    flex-shrink: 0;
}

.online-admin .online-name {
    font-weight: 600;
    color: #5865f2;
}

.online-admin-badge {
    font-size: 0.75rem;
}

.online-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Lobby Tabs === */
.lobby-tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid #e3e5e8;
    padding: 0 16px;
}

.lobby-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6d6f78;
    position: relative;
    transition: color 0.15s;
}

.lobby-tab:hover {
    color: #313338;
}

.lobby-tab.active {
    color: #5865f2;
}

.lobby-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 2px;
    background: #5865f2;
    border-radius: 1px;
}

/* === Notice Cards === */
.notice-card {
    background: #fff;
    border: 1px solid #e3e5e8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.notice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notice-title {
    font-weight: 600;
    font-size: 1rem;
    color: #313338;
}

.notice-meta {
    font-size: 0.75rem;
    color: #8b8d94;
}

.notice-body {
    font-size: 0.875rem;
    color: #4e5058;
    line-height: 1.6;
}

.notice-card-clickable {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.notice-card-clickable:hover {
    border-color: #5865f2;
    box-shadow: 0 1px 4px rgba(88, 101, 242, 0.15);
}

.notice-preview {
    font-size: 0.8125rem;
    color: #8b8d94;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notice-detail {
    background: #fff;
    border: 1px solid #e3e5e8;
    border-radius: 8px;
    padding: 20px;
}

.notice-back-btn {
    margin-bottom: 12px;
}

.notice-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e3e5e8;
}

.notice-detail-header h3 {
    margin: 0 0 4px 0;
    font-size: 1.125rem;
}

.notice-detail-body {
    font-size: 0.9375rem;
    color: #4e5058;
    line-height: 1.7;
}

/* === Static Pages (Rules, Guide) === */
.static-page {
    overflow-y: auto;
}

.static-page-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}

.static-page-inner h2 {
    margin: 0 0 20px 0;
}

.static-page-inner h3 {
    margin: 24px 0 12px 0;
    font-size: 1.0625rem;
    color: #313338;
}

.static-page-inner h4 {
    margin: 16px 0 8px 0;
    font-size: 0.9375rem;
    color: #6d6f78;
}

.static-page-inner p {
    font-size: 0.875rem;
    color: #4e5058;
    line-height: 1.6;
    margin: 4px 0;
}

/* Rule Cards */
.rule-card {
    display: flex;
    gap: 14px;
    background: #fff;
    border: 1px solid #e3e5e8;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.rule-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    font-weight: 700;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rule-body strong {
    font-size: 0.9375rem;
    display: block;
    margin-bottom: 4px;
}

/* Guide */
.guide-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guide-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    padding: 8px 12px;
    background: #f2f3f5;
    border-radius: 6px;
}

.guide-team {
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.team-village { background: #e3f2fd; color: #1565c0; }
.team-wolf { background: #fce4ec; color: #c62828; }
.team-rat { background: #f3e5f5; color: #6a1b9a; }

.guide-flow {
    padding-left: 20px;
    font-size: 0.875rem;
    line-height: 1.8;
    color: #4e5058;
}

.guide-flow strong {
    color: #313338;
}

/* Role Guide Cards */
.role-guide-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-guide-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #e3e5e8;
}

.role-guide-card.wolf {
    background: #fff5f5;
    border-color: #fecaca;
}

.role-guide-card.village {
    background: #f0f9ff;
    border-color: #bfdbfe;
}

.role-guide-emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.role-guide-info strong {
    font-size: 0.9375rem;
    display: block;
    margin-bottom: 2px;
}

.role-guide-info p {
    margin: 0;
    font-size: 0.8125rem;
}
