* {
  box-sizing: border-box;
}

:root {
  --bg: #130f24;
  --bg2: #21183d;
  --card: rgba(255,255,255,.09);
  --card2: rgba(255,255,255,.14);
  --text: #fff;
  --muted: rgba(255,255,255,.72);
  --soft: rgba(255,255,255,.16);
  --accent: #ffcf5a;
  --accent2: #ff6b9d;
  --danger: #ff6b6b;
  --ok: #77e2a7;
  --shadow: 0 24px 80px rgba(0,0,0,.35);
  --radius: 24px;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,107,157,.35), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(255,207,90,.25), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg2));
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
  transform: none;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--soft);
  background: rgba(255,255,255,.10);
  color: var(--text);
  outline: none;
}

select option {
  color: #21183d;
}

input::placeholder {
  color: rgba(255,255,255,.45);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,207,90,.18);
}

label {
  display: block;
  margin: 18px 0 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1f1634;
}

main {
  flex: 1;
  display: grid;
  align-items: center;
}

.view {
  display: none;
  width: 100%;
  animation: appear .22s ease;
}

.view.active {
  display: block;
}

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

.hero {
  width: min(760px, 100%);
  margin: 40px auto 24px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 86px);
  line-height: .95;
  letter-spacing: -0.06em;
}

h2 {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: -.03em;
}

.hero-text {
  width: min(620px, 100%);
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 30px;
}

.primary, .secondary, .ghost {
  min-height: 48px;
  padding: 13px 20px;
  border-radius: 999px;
  font-weight: 900;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #ff9c54);
  color: #21183d;
  box-shadow: 0 16px 32px rgba(255, 207, 90, .18);
}

.secondary {
  background: rgba(255,255,255,.14);
  color: var(--text);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--soft);
}

.full {
  width: 100%;
  margin-top: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.join-card {
  width: min(420px, 100%);
  margin: 28px auto 0;
  padding: 24px;
  text-align: left;
}

.narrow {
  width: min(480px, 100%);
  margin: 32px auto;
  padding: 28px;
}

.howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px auto;
  width: min(760px, 100%);
}

.mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--soft);
}

.mini-card strong {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255,255,255,.14);
}

.room-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
  margin: 20px 0 40px;
}

.room-info, .game-card {
  padding: 24px;
}

.room-code {
  font-size: 44px;
  letter-spacing: .15em;
  font-weight: 1000;
  line-height: 1;
  margin-bottom: 18px;
}

hr {
  border: 0;
  border-top: 1px solid var(--soft);
  margin: 24px 0;
}

.players-list {
  display: grid;
  gap: 10px;
}

.player-pill {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.10);
}

.player-pill.inactive {
  opacity: .45;
}

.badge {
  color: #21183d;
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.badge-muted {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.12);
}

.game-card {
  min-height: 480px;
  display: grid;
  align-content: center;
}

.game-card h1 {
  font-size: clamp(34px, 6vw, 66px);
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.vote-btn {
  min-height: 82px;
  padding: 16px;
  border-radius: 20px;
  color: var(--text);
  background: rgba(255,255,255,.12);
  border: 1px solid var(--soft);
  text-align: left;
  font-weight: 900;
}

.vote-btn.selected {
  background: rgba(255,207,90,.22);
  border-color: var(--accent);
}

.results-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 24px;
}

.result-row {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.10);
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-weight: 900;
}

.bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.final-winner {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,207,90,.45);
  background: rgba(255,207,90,.14);
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.small {
  font-size: 13px;
}

.footer {
  padding: 24px 0;
  color: rgba(255,255,255,.55);
  text-align: center;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 999px;
  color: #21183d;
  background: var(--accent);
  font-weight: 900;
  box-shadow: var(--shadow);
  z-index: 10;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    padding: 18px 0;
  }

  .hero {
    margin-top: 24px;
  }

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

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

  .room-info {
    order: 2;
  }

  .game-card {
    order: 1;
    min-height: auto;
  }
}
