/*
 * party-game-ai — 聚会游戏样式
 * ────────────────────────────────────────
 */

:root {
  --bg: #0a0a18;
  --surface: #141428;
  --card: #1c1c3a;
  --accent: #7c6af0;
  --accent2: #e94560;
  --gold: #f5a623;
  --green: #2ecc71;
  --text: #eaeaff;
  --muted: #7777aa;
  --border: rgba(124, 106, 240, 0.25);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── Screen & animations ── */
.hidden { display: none !important; }
.screen { display: none; min-height: 100vh; padding: 0 0 100px; animation: fadeUp 0.35s ease; }
.screen.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6a58e0; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-accent { background: var(--accent2); color: #fff; }
.btn-accent:hover { background: #d63850; }
.btn-block { width: 100%; }

/* ── Inputs ── */
input {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; width: 100%;
}
input:focus { border-color: var(--accent); }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-host { background: var(--gold); color: #000; }
.badge-ai { background: rgba(124, 106, 240, 0.3); color: var(--accent); }
.badge-you { background: var(--green); color: #000; }

/* ── Header ── */
.header { text-align: center; padding: 40px 20px 20px; }
.header h1 {
  font-size: 26px; font-weight: 800; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header p { font-size: 13px; color: var(--muted); }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 0 16px 12px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ── Room code display ── */
.room-code-display {
  font-size: 36px; font-weight: 900; letter-spacing: 8px; text-align: center;
  padding: 16px; background: rgba(124, 106, 240, 0.1);
  border: 2px dashed var(--accent); border-radius: var(--radius);
  margin: 12px 0; user-select: all;
}
.room-code-sub { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }

/* ── QR code ── */
.qr-wrap { text-align: center; margin: 16px 0; }
.qr-wrap img { border-radius: var(--radius-sm); }

/* ── Player list ── */
.player-list { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
}
.player-chip .avatar { font-size: 18px; }
.player-chip .name { font-weight: 600; }
.btn-remove {
  margin-left: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; padding: 0; line-height: 1;
}
.btn-remove:hover { background: var(--accent2); color: #fff; border-color: var(--accent2); }

/* ── Connection indicator ── */
.conn-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.conn-on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.conn-off { background: var(--accent2); }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; padding: 4px; margin: 0 16px 12px; background: var(--surface); border-radius: var(--radius-sm); }
.tab {
  flex: 1; padding: 8px 12px; border: none; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 8px; transition: all 0.2s; font-family: inherit;
}
.tab.active { background: var(--card); color: var(--text); }

/* ── Game grid ── */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.game-option {
  padding: 12px 8px; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.2s;
}
.game-option:hover { border-color: var(--accent); }
.game-option.selected { border-color: var(--accent); background: rgba(124, 106, 240, 0.15); }
.game-option .emoji { font-size: 24px; display: block; margin-bottom: 4px; }

/* ── Chat ── */
.chat-area { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chat-msg { font-size: 12px; line-height: 1.5; }
.chat-sender { color: var(--accent); font-weight: 600; }
.chat-text { color: var(--text); }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }

/* ── Game area ── */
.game-container { padding: 12px; max-width: 520px; margin: 0 auto; }
.game-title { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 12px; color: var(--text); }
.game-status { text-align: center; padding: 24px; color: var(--muted); font-size: 14px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--text); padding: 10px 20px;
  border-radius: var(--radius-sm); font-size: 13px; z-index: 9999;
  border: 1px solid var(--border); animation: fadeUp 0.3s ease;
  pointer-events: none; white-space: nowrap;
}

/* ── Responsive ── */
@media (min-width: 600px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .card { max-width: 520px; margin-left: auto; margin-right: auto; }
}
