:root {
  --bg: #0b0f1a;
  --bg-2: #121a2b;
  --card: #161f33;
  --card-2: #1d2942;
  --line: #263352;
  --text: #e8edf7;
  --muted: #93a1c0;
  --accent: #6d8cff;
  --accent-2: #22d3ee;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(109, 140, 255, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 10%, rgba(34, 211, 238, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

#app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  line-height: 1.25;
}

h1 {
  font-size: 30px;
  letter-spacing: 0.5px;
}

a {
  color: var(--accent-2);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.center {
  text-align: center;
}

.hero {
  padding: 28px 4px 8px;
  text-align: center;
}

.hero .tag {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.hero p {
  color: var(--muted);
  margin: 6px 0 0;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 24px;
  }
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 18px;
}

.card h3 {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 6px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: #0e1626;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 140, 255, 0.18);
}

textarea {
  resize: vertical;
  min-height: 72px;
}

button {
  font-family: inherit;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.12);
  border-color: var(--accent);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #8aa2ff);
  border-color: transparent;
  color: #0b0f1a;
  font-weight: 700;
}

button.ghost {
  background: transparent;
}

button.danger {
  background: transparent;
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--bad);
}

button.tiny {
  padding: 5px 10px;
  font-size: 13px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row.tight {
  gap: 6px;
}

.row.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e1626;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.pill.on {
  background: rgba(109, 140, 255, 0.18);
  border-color: var(--accent);
  color: var(--text);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}

.badge.ai {
  color: var(--accent-2);
  border-color: rgba(34, 211, 238, 0.5);
}

.badge.host {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.5);
}

.badge.me {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.5);
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 4px;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-2);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1626;
  font-size: 14px;
}

.player .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  flex: none;
}

.player.off .dot {
  background: #64748b;
}

.player.dead {
  opacity: 0.5;
  text-decoration: line-through;
}

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

.phase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  color: var(--warn);
}

.timer.low {
  color: var(--bad);
}

.word-box {
  text-align: center;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  background: rgba(109, 140, 255, 0.08);
}

.word-box .word {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-top: 6px;
}

.word-box.whiteboard {
  border-color: var(--warn);
  background: rgba(251, 191, 36, 0.08);
}

.desc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desc {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e1626;
  font-size: 15px;
}

.desc .who {
  color: var(--muted);
  font-size: 13px;
  margin-right: 8px;
}

.desc.pending {
  color: var(--muted);
  font-style: italic;
}

.desc.turn {
  border-color: var(--accent);
  background: rgba(109, 140, 255, 0.12);
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.vote-btn {
  text-align: left;
}

.vote-btn.chosen {
  border-color: var(--bad);
  background: rgba(248, 113, 113, 0.12);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.chat .msg {
  font-size: 14px;
}

.chat .msg .who {
  color: var(--accent-2);
  margin-right: 6px;
}

.result {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #0e1626;
}

.result.win {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.08);
}

.result.lose {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.07);
}

table.roster {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.roster th,
table.roster td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

table.roster th {
  color: var(--muted);
  font-weight: 600;
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #1b2540;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 90vw;
  font-size: 14px;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #0e1626;
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}
