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

:root {
  --bg: #0f1024;
  --surface: #181a35;
  --surface2: #1e2048;
  --border: #2a2d56;
  --accent: #4a7dff;
  --accent-hover: #5d8fff;
  --golden: #f59e0b;
  --green: #4ade80;
  --rose: #fb7185;
  --text: #eaeaf3;
  --muted: #5a5f8a;
  --text-secondary: #9aa0d3;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; width: 100%; min-height: 100svh; }
.screen.active { display: flex; align-items: center; justify-content: center; }

/* ── Setup ── */
.setup-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 48px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  text-align: center;
  border: 1px solid var(--border);
}
.setup-card h1 { font-size: 2.2rem; margin-bottom: 6px; color: var(--golden); }
.subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.3px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font);
}
input:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 11px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
  margin-top: 10px;
  font-family: var(--font);
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Game Layout ── */
.game-layout {
  display: grid;
  grid-template-columns: 180px 1fr 220px;
  gap: 16px;
  padding: 20px;
  width: 100%;
  max-width: 1050px;
  min-height: 100svh;
  align-items: start;
}

.sidebar { display: flex; flex-direction: column; gap: 14px; }
.info-card, .players-card, .action-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.info-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.info-row:last-child { margin-bottom: 0; }
.label { color: var(--muted); font-size: 0.85rem; }
.value { font-size: 1.3rem; font-weight: 700; }
.value.highlight { color: var(--golden); font-size: 1.6rem; }
.range-value { font-size: 0.95rem; color: var(--green); }

.players-card h3 {
  font-size: 0.8rem; color: var(--muted); margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.8px;
}
#players-list { list-style: none; }
#players-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
#players-list li:last-child { border-bottom: none; }
.player-indicator {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.player-indicator.active { background: var(--golden); box-shadow: 0 0 8px var(--golden); }
.player-indicator.won { background: var(--green); }
.player-name { flex: 1; color: var(--text); }
.player-last-guess { color: var(--text-secondary); font-size: 0.78rem; }

/* ── Main Area ── */
.main-area { display: flex; flex-direction: column; gap: 16px; }
#host-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.host-avatar { font-size: 1.8rem; flex-shrink: 0; }
.host-message {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  flex: 1;
}

#log-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-height: 340px;
  overflow-y: auto;
}
#log-box h3 { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
#log-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
#log-list li {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  display: flex;
  gap: 8px;
  align-items: center;
}
.log-round { color: var(--muted); font-size: 0.75rem; min-width: 32px; }
.log-player { font-weight: 600; min-width: 54px; color: var(--text); }
.log-guess { color: var(--golden); font-weight: 700; min-width: 32px; }
.log-result { color: var(--text-secondary); font-size: 0.8rem; flex: 1; }
.log-correct { color: var(--green); font-weight: 700; }

/* ── Action Area ── */
.action-area { display: flex; flex-direction: column; gap: 14px; }
.action-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; }
.action-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 10px; }
.hidden { display: none !important; }

/* ── thinking dots ── */
.thinking { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Game Over ── */
#winner-display { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
#secret-reveal { text-align: center; color: var(--text-secondary); margin-bottom: 12px; font-size: 0.85rem; }

/* ── scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── 移动端响应式 ── */
@media (max-width: 820px) {
  .game-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    max-width: 100%;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .info-card, .players-card { padding: 14px; }
  .main-area { order: 2; }
  .action-area { order: 3; }
}

@media (max-width: 480px) {
  .setup-card { padding: 28px 20px; }
  .setup-card h1 { font-size: 1.7rem; }
  .form-row { flex-direction: column; gap: 0; }
  .game-layout { padding: 10px; gap: 10px; }
  .sidebar { grid-template-columns: 1fr; gap: 10px; }
  .info-row .value.highlight { font-size: 1.3rem; }
  #host-box { padding: 14px 16px; }
  .host-message { font-size: 0.9rem; }
  #log-box { max-height: 200px; }
  .action-card { padding: 14px; }
  input[type="number"] { font-size: 16px; } /* prevent iOS zoom */
}
