:root {
  --bg: #0b0a12;
  --panel: #141222;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1ff;
  --muted: #a39bb8;
  --accent: #a78bfa;
  --accent-2: #38bdf8;
  --hot: #fb7185;
  --warm: #fbbf24;
  --ok: #4ade80;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 400px at 15% 0%, rgba(167, 139, 250, 0.22), transparent 55%),
    radial-gradient(700px 360px at 90% 10%, rgba(56, 189, 248, 0.12), transparent 50%);
  pointer-events: none;
}

.app {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  position: relative;
}

.panel {
  background: rgba(20, 18, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem 1.3rem 1.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.hidden { display: none !important; }

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
}
h1 {
  margin: 0.4rem 0 0.55rem;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  line-height: 1.1;
}
.lead { margin: 0 0 1.1rem; color: var(--muted); line-height: 1.55; }

.field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
}
input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0d0b16;
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  outline: none;
}
input:focus {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}
input.code {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
  text-align: center;
}

.row { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.row.join { display: grid; grid-template-columns: 1fr auto; }
.divider {
  text-align: center;
  color: var(--muted);
  margin: 1rem 0 0.85rem;
  font-size: 0.85rem;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: #2a2540;
  color: var(--text);
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #120f1c;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.btn.tiny { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn.full { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: 0.55; cursor: wait; }

.error { color: #fda4af; margin: 0.6rem 0 0; font-size: 0.92rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.35rem 0 0; }

.game-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.code-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.code-line strong {
  font-size: 1.5rem;
  letter-spacing: 0.16em;
}
.right-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.pill {
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(167, 139, 250, 0.15);
  color: #ddd6fe;
}
.pill.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.live-dot::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: live-pulse 1.2s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.board li.guess-new {
  animation: guess-flash 0.9s ease;
  border-color: rgba(56, 189, 248, 0.55);
}
.board li.guess-win {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.1);
}
@keyframes guess-flash {
  0% { background: rgba(56, 189, 248, 0.28); transform: scale(1.01); }
  100% { background: rgba(0, 0, 0, 0.18); transform: scale(1); }
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: #100e1b;
  margin-bottom: 0.9rem;
}
.label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 800;
}
.secret {
  margin-top: 0.35rem;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  font-variant-ligatures: none;
}

.hints-box {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.08);
}

.hint-line {
  margin: 0.2rem 0;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.hint-next {
  margin: 0.35rem 0 0;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.guess-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.cols {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1rem;
  margin-top: 1.1rem;
}
.cols h3 { margin: 0 0 0.35rem; font-size: 1rem; }

.board, .players {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: 340px;
  overflow: auto;
}
.board li, .players li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.18);
}
.board li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: center;
}
.rank {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.85rem;
  background: #221e35;
}
.rank.hot { background: rgba(74, 222, 128, 0.22); color: #bbf7d0; }
.rank.warm { background: rgba(251, 191, 36, 0.2); color: #fde68a; }
.rank.cold { background: rgba(251, 113, 133, 0.22); color: #fecdd3; }
.guess-main { min-width: 0; }
.guess-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.word { font-weight: 800; }
.who { color: var(--muted); font-size: 0.8rem; }
.vibe {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  font-weight: 800;
}
.vibe.hot { color: #4ade80; }
.vibe.warm { color: #fbbf24; }
.vibe.cold { color: #fb7185; }
.score { font-weight: 900; color: var(--accent); }
.score.hot { color: #4ade80; }
.score.warm { color: #fbbf24; }
.score.cold { color: #fb7185; }

.bar-track {
  margin-top: 0.45rem;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
  background: linear-gradient(90deg, #fb7185, #fbbf24, #4ade80);
}
.bar-fill.cold {
  background: linear-gradient(90deg, #7f1d1d, #fb7185);
}
.bar-fill.warm {
  background: linear-gradient(90deg, #fb7185, #fbbf24);
}
.bar-fill.hot {
  background: linear-gradient(90deg, #fbbf24, #4ade80);
}
.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.win {
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.12), transparent);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  margin-bottom: 0.9rem;
  text-align: center;
}
.win h2 { margin: 0; color: var(--ok); }
.win p { margin: 0.35rem 0 0.75rem; color: var(--muted); }

.lobby-banner {
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.12), transparent);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  margin-bottom: 0.9rem;
  text-align: center;
}
.lobby-banner h2 { margin: 0 0 0.35rem; color: #ddd6fe; }
.lobby-banner p { margin: 0.25rem 0; color: var(--muted); }
.lobby-players {
  list-style: none;
  margin: 0.75rem auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  max-width: 100%;
}
.lobby-players li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  font-weight: 700;
  font-size: 0.9rem;
}
.lobby-players li.you {
  border-color: rgba(167, 139, 250, 0.55);
  color: #ddd6fe;
}
.lobby-players li.host::after {
  content: " · host";
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.spin-banner {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.1), transparent);
  border-radius: 16px;
  padding: 0.95rem 1rem 1.1rem;
  margin-bottom: 0.9rem;
  text-align: center;
  overflow: hidden;
}
.spin-banner .label {
  margin-bottom: 0.65rem;
  color: var(--accent-2);
}

.wheel-wrap {
  position: relative;
  height: 72px;
  margin: 0.25rem 0 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0a0812;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.wheel-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  z-index: 2;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.7);
}
.wheel-pointer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--accent);
}
.wheel-track {
  display: flex;
  height: 100%;
  align-items: stretch;
  will-change: transform;
  transition: none;
}
.wheel-track.spinning {
  transition: transform 3.1s cubic-bezier(0.12, 0.75, 0.12, 1);
}
.wheel-seg {
  flex: 0 0 120px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 0.4rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wheel-seg:nth-child(odd) { background: rgba(167, 139, 250, 0.12); }
.wheel-seg:nth-child(even) { background: rgba(56, 189, 248, 0.1); }
.wheel-seg.winner {
  background: rgba(74, 222, 128, 0.22);
  color: #bbf7d0;
  box-shadow: inset 0 0 0 2px rgba(74, 222, 128, 0.45);
}

.spin-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.spin-results li {
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.spin-results li.filled {
  background: rgba(74, 222, 128, 0.15);
  color: #bbf7d0;
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.spin-results li.auto {
  background: rgba(251, 191, 36, 0.15);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.turn-banner {
  margin-top: 0.65rem;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
}
.turn-banner.yours {
  background: rgba(74, 222, 128, 0.14);
  border-color: rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
  animation: turn-pulse 1.4s ease-in-out infinite;
}
.turn-banner.wait {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

.players li.turn-now {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.1);
}

.vote-banner {
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.1), transparent);
  border-radius: 16px;
  padding: 0.95rem 1rem 1.1rem;
  margin-bottom: 0.9rem;
}
.vote-banner .label {
  color: #fde68a;
  margin-bottom: 0.35rem;
}
.vote-lead {
  margin: 0 0 0.75rem;
  font-weight: 700;
  color: var(--text);
}
.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
}
.vote-opt {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s, background 0.15s;
}
.vote-opt:hover {
  border-color: rgba(251, 191, 36, 0.55);
}
.vote-opt.selected {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.12);
}
.vote-opt .vote-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.vote-opt.selected .vote-count { color: #86efac; }

.category-badge {
  margin-top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-weight: 800;
  font-size: 0.9rem;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(56, 189, 248, 0.2));
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #e9e5ff;
  letter-spacing: 0.02em;
}
.category-badge::before {
  content: "Category";
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 800;
}

.hint-category {
  font-size: 1.05rem !important;
  color: #c4b5fd !important;
}

.admin-panel {
  border: 1px dashed rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.08);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
}
.admin-panel .label { color: #fda4af; margin-bottom: 0.4rem; }
.admin-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.live-dot { cursor: default; user-select: none; }

@media (max-width: 700px) {
  .cols { grid-template-columns: 1fr; }
  .row.join, .guess-form { grid-template-columns: 1fr; }
  .wheel-seg { flex-basis: 100px; font-size: 0.85rem; }
  .vote-grid { grid-template-columns: 1fr 1fr; }
}
