:root {
  --bg: #0a0b14;
  --panel: rgba(28, 24, 48, 0.55);
  --panel-border: #322c52;
  --text: #f2f3f7;
  --muted: #9aa0b4;
  --accent: #e6394a;
  --accent-dark: #c0283a;
  --success: #38c172;
  --danger: #ff5a5f;
  --gold: #ffd76a;
  --blue: #5a96ff;
  --purple: #b088ff;
  --font-display: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 18% 0%, rgba(90, 60, 200, 0.45), transparent 60%),
    radial-gradient(ellipse 60% 45% at 88% 10%, rgba(200, 60, 140, 0.30), transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 105%, rgba(40, 90, 200, 0.35), transparent 60%),
    linear-gradient(180deg, #0d0c1a 0%, #150f28 45%, #0a0b14 100%);
  background-attachment: fixed;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  gap: 20px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 0.01em;
  margin: 0;
  text-align: center;
  text-transform: uppercase;
}

.title-name {
  background: linear-gradient(180deg, #ffb3ba, var(--accent) 45%, #a01e2b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  text-align: center;
  margin-top: -12px;
}

.points-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(120, 80, 210, 0.22);
  border: 1px solid rgba(170, 130, 255, 0.4);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 800;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-top: -6px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.card.accent-blue {
  border-color: rgba(90, 150, 255, 0.45);
  box-shadow: 0 0 28px rgba(90, 150, 255, 0.08);
}

.card.accent-purple {
  border-color: rgba(176, 136, 255, 0.45);
  box-shadow: 0 0 28px rgba(176, 136, 255, 0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: #0e1019;
  color: var(--text);
  font-size: 1rem;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
}

button {
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:disabled {
  background: #5a3336;
  color: #9aa0b4;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
}

button.danger {
  background: var(--danger);
  color: white;
}

button.success {
  background: var(--success);
  color: white;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.1em;
}

.room-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.5rem;
  letter-spacing: 0.15em;
  text-align: center;
}

.row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row-left span:not(.avatar) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(14, 16, 25, 0.7);
  border-radius: 10px;
  padding: 8px 12px;
  gap: 10px;
}

.badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.connected {
  background: rgba(56, 193, 114, 0.2);
  color: var(--success);
}

.badge.disconnected {
  background: rgba(255, 90, 95, 0.2);
  color: var(--danger);
}

.score-pill {
  font-family: var(--font-display);
  font-weight: 800;
  border-radius: 12px;
  padding: 4px 12px;
  text-align: center;
  line-height: 1.15;
  min-width: 48px;
  flex-shrink: 0;
}

.score-pill .pts-label {
  display: block;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.score-pill.positive {
  background: rgba(46, 204, 113, 0.18);
  color: #43e97b;
  border: 1px solid rgba(67, 233, 123, 0.5);
}

.score-pill.zero {
  background: rgba(220, 53, 69, 0.18);
  color: #ff6b7d;
  border: 1px solid rgba(255, 107, 125, 0.4);
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-list li {
  display: flex;
  justify-content: space-between;
  background: rgba(14, 16, 25, 0.7);
  border-radius: 10px;
  padding: 8px 12px;
}

.rank-list li:first-child {
  border: 1px solid var(--accent);
}

.logo-frame {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  color: #8890a0;
  font-size: 0.9rem;
  text-align: center;
}

.logo-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.answer-banner {
  text-align: center;
  font-size: 1.3rem;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gold);
  min-height: 1.4em;
}

.buzz-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(80vw, 280px);
  height: min(80vw, 280px);
}

.buzz-button {
  position: relative;
  width: min(70vw, 260px);
  height: min(70vw, 260px);
  border-radius: 50%;
  border: 6px solid #1a0d10;
  background: radial-gradient(circle at 34% 26%, #ff9297 0%, #ff4d54 38%, #d81f28 72%, #900d14 100%);
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow:
    inset 0 8px 14px rgba(255, 255, 255, 0.35),
    inset 0 -20px 32px rgba(0, 0, 0, 0.35),
    0 14px 30px rgba(216, 31, 40, 0.4),
    0 0 60px rgba(216, 31, 40, 0.25);
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
  touch-action: manipulation;
  user-select: none;
}

.buzz-button:active:not(:disabled) {
  transform: scale(0.97);
}

.buzz-button:disabled {
  background: radial-gradient(circle at 34% 26%, #4a4f66 0%, #363b52 45%, #21232f 100%);
  color: var(--muted);
  box-shadow:
    inset 0 6px 12px rgba(255, 255, 255, 0.08),
    inset 0 -18px 30px rgba(0, 0, 0, 0.4);
  border-color: #14151d;
  text-shadow: none;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.dot.offline {
  background: var(--danger);
}

.result-banner {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 1.4em;
}

.tabs {
  display: flex;
  width: 100%;
  max-width: 420px;
  gap: 8px;
}

.tabs button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
}

.tabs button.active {
  background: var(--panel);
  color: var(--text);
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.row > * {
  flex: 1;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  color: var(--text);
}
