:root {
  color-scheme: only light;
  --bg: #0b1020;
  --surface: #141a2f;
  --accent: #f1b07a;
  --accent-dark: #c48754;
  --ink: #f8f4ea;
  --muted: #c8c1b2;
  --jeopardy-blue: #0a64b4;
  --panel-border: #0b0e17;
  font-family: "Futura PT", "Avenir Next", "Trebuchet MS", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #141b33 0%, #0b1020 60%, #070b16 100%);
  color: var(--ink);
  min-height: 100vh;
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #141b33 0%, #0b1020 60%, #070b16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-screen[hidden] {
  display: none;
}

.login-content {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.login-logo {
  max-width: 400px;
  width: 100%;
  height: auto;
  margin: 0 auto 8px;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(241, 176, 122, 0.3));
}

.login-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 40px;
  letter-spacing: 0.05em;
}

.login-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.login-button:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.login-button:active {
  transform: translateY(0);
}

.login-error {
  margin-top: 20px;
  padding: 12px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 4px;
  color: #ff6b6b;
  font-size: 0.9rem;
}

.app {
  width: min(92vw, 420px);
  margin: 24px auto;
  padding: 18px;
  display: grid;
  gap: 0;
  border: 2px solid #0b0e17;
  box-shadow: 0 20px 50px rgba(5, 8, 16, 0.45);
  background: #0c1224;
  position: relative;
}

.app.listening::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 16px;
  border: 3px solid rgba(241, 176, 122, 0.9);
  box-shadow:
    0 0 0 6px rgba(241, 176, 122, 0.15),
    0 0 25px rgba(241, 176, 122, 0.6),
    0 0 50px rgba(241, 176, 122, 0.35);
  animation: listening-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes listening-pulse {
  0% {
    opacity: 0.4;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.01);
  }
  100% {
    opacity: 0.4;
    transform: scale(0.98);
  }
}

.center-board {
  background: linear-gradient(180deg, #0c78cc 0%, #0a4f9a 100%);
  padding: 34px 20px 28px;
  text-align: center;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  border-top: 2px solid var(--panel-border);
  border-bottom: 2px solid var(--panel-border);
}

.center-board.result-mode .board-clue {
  display: none;
}

.center-board.result-mode .board-feedback {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.center-board.non-clue .board-value {
  display: none;
}

.board-text {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.board-clue-text {
  font-size: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  margin-top: 10px;
}

.board-value {
  font-size: 2.2rem;
  font-weight: 700;
}

.board-feedback {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(248, 244, 234, 0.7);
}

.result-stack {
  display: grid;
  gap: 6px;
}

.result-text {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.correct-answer {
  font-size: 1.35rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: pre-line;
}

.utterance {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(248, 244, 234, 0.6);
  min-height: 1rem;
}

.category-strip {
  padding: 10px 12px;
  border-bottom: 2px solid var(--panel-border);
  background: #10172c;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  text-align: center;
}

.category-block,
.value-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}

.category-label {
  font-size: 0.65rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(248, 244, 234, 0.6);
}

.category-banner,
.value-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 2px solid rgba(248, 244, 234, 0.2);
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(6, 10, 20, 0.5);
  min-height: 44px;
  height: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

.thinking {
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(248, 244, 234, 0.6);
  margin-top: 16px;
  position: relative;
}

.thinking::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid rgba(248, 244, 234, 0.6);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 2px solid var(--panel-border);
}

.score-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  padding: 12px;
  color: #fef6e4;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  border-right: 2px solid var(--panel-border);
}

.score-card:last-child {
  border-right: none;
}

.score-card .score {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 6px;
  line-height: 1;
  min-height: 2.6rem;
}

.score-reveal-line {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.score-reveal-line:first-child {
  font-size: 1.1rem;
}

.score-card.flash .score {
  color: transparent;
}

.score-card.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f8f4ea;
  text-shadow: 0 0 12px rgba(248, 244, 234, 0.6);
  pointer-events: none;
}

.score-card.flash[data-status="correct"]::after {
  content: "✓";
}

.score-card.flash[data-status="wrong"]::after {
  content: "✕";
}

.score-card.player {
  background: #125a7e;
}

.score-card.opponent:nth-of-type(2) {
  background: #8e2f1f;
}

.score-card.opponent:nth-of-type(3) {
  background: #1f5a33;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 2px solid var(--panel-border);
}

.game-logo {
  max-width: 350px;
  width: 100%;
  height: auto;
  margin: 4px auto 12px;
  display: block;
  filter: drop-shadow(0 0 20px rgba(241, 176, 122, 0.4)) drop-shadow(0 0 40px rgba(241, 176, 122, 0.2));
  transition: max-width 0.3s ease;
}

.game-logo.teen-mode {
  max-width: 300px;
}

.controls .button-row {
  display: flex;
  gap: 0;
  width: 100%;
}

button {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 16px 18px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--accent);
  color: #1a1404;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
}

button#startButton {
  flex: 1.4;
}

button#repeatButton {
  flex: 0.8;
  background: #c7c9cc;
  color: #0b0e17;
  border-left: 2px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1.2rem;
}

button#infoButton {
  flex: 0 0 54px;
  max-width: 54px;
  padding-inline: 0;
  font-size: 1.2rem;
  background: transparent;
  color: var(--accent);
  border-left: 2px solid var(--panel-border);
}

button#infoButton:hover {
  background: rgba(248, 244, 234, 0.1);
}
button:active {
  transform: translateY(2px);
}

.debug-panel {
  padding: 12px 10px 0;
}

.debug-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  text-align: center;
}

.debug-row {
  display: flex;
  gap: 8px;
}

.debug-row input {
  flex: 1;
  border-radius: 8px;
  border: 1px solid rgba(248, 244, 234, 0.2);
  padding: 10px 12px;
  background: #0b0e17;
  color: var(--ink);
  font-size: 0.9rem;
}

.debug-row button {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 0.7rem;
}

.voice-panel {
  padding: 12px 10px 20px;
}

.voice-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.voice-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: #101528;
  border: 1px solid rgba(248, 244, 234, 0.08);
  color: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-option button {
  padding: 6px 10px;
  font-size: 0.65rem;
  background: var(--accent);
  color: #1a1404;
  border-radius: 999px;
}

@media (min-width: 768px) {
  .app {
    margin-top: 32px;
  }
}

@media (max-width: 480px) {
  .board-text {
    font-size: 2rem;
  }

  .board-value {
    font-size: 1.7rem;
  }
}

/* Pause Overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 16, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.pause-overlay[hidden] {
  display: none;
}

.pause-content {
  text-align: center;
  padding: 40px;
  max-width: 500px;
  animation: pause-fade-in 0.3s ease-out;
}
.info-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 16, 32, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.info-overlay[hidden] {
  display: none;
}

.info-content {
  width: min(92vw, 420px);
  max-height: 80vh;
  background: #0c1224;
  border-radius: 16px;
  border: 1px solid rgba(248, 244, 234, 0.2);
  box-shadow: 0 18px 40px rgba(5, 8, 16, 0.7);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pause-fade-in 0.25s ease-out;
}

.info-tabs {
  display: flex;
  gap: 8px;
}

.info-tab {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(248, 244, 234, 0.24);
  background: transparent;
  color: var(--muted);
}

.info-tab.active {
  background: var(--accent);
  color: #1a1404;
  box-shadow: 0 3px 10px rgba(241, 176, 122, 0.5);
}

.info-panels {
  flex: 1;
  overflow-y: auto;
  padding: 8px 2px 4px;
}

.info-panel {
  display: none;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}

.info-panel.active {
  display: block;
}

.info-panel h2 {
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px 0;
  color: var(--accent);
}

.info-panel p {
  margin: 0 0 10px 0;
}

.info-close-button {
  align-self: center;
  margin-top: 4px;
  padding: 10px 26px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(248, 244, 234, 0.5);
  background: transparent;
  color: var(--ink);
}

.info-close-button:hover {
  background: rgba(248, 244, 234, 0.1);
}

@keyframes pause-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pause-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 30px 0;
  text-shadow: 0 2px 10px rgba(241, 176, 122, 0.5);
}

.pause-resume-button {
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #1a1404;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(241, 176, 122, 0.4);
}

.pause-resume-button:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(241, 176, 122, 0.6);
}

.pause-resume-button:active {
  transform: translateY(0);
}

.settings-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid rgba(248, 244, 234, 0.2);
}

.settings-header {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin: 0 0 24px 0;
  text-transform: uppercase;
}

.user-account-section {
  margin-top: 30px;
}

.user-info {
  background: rgba(11, 16, 32, 0.6);
  border: 1px solid rgba(248, 244, 234, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.user-email {
  font-size: 0.9rem;
  color: var(--muted);
}

.logout-button {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(248, 244, 234, 0.1);
  border: 1px solid rgba(248, 244, 234, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-button:hover {
  background: rgba(248, 244, 234, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.stats-message {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  margin: 40px 0;
}

.stats-section {
  margin-bottom: 32px;
}

.stats-section h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.stat-value {
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
}

/* Collapsible Stats Sections */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapsible-header:hover {
  color: var(--accent-dark);
}

.collapsible-header .arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  display: inline-block;
  width: 16px;
}

.collapsible-content {
  margin-top: 16px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Round Toggle */
.round-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(11, 16, 32, 0.6);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid rgba(248, 244, 234, 0.2);
}

.round-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.round-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.round-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.round-btn:hover:not(:disabled):not(.active) {
  background: rgba(248, 244, 234, 0.1);
}

/* Round Chart */
.round-chart {
  display: none;
}

.round-chart.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Value Bars */
.value-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.value-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.value-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.bar-container {
  display: flex;
  height: 32px;
  background: rgba(11, 16, 32, 0.6);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(248, 244, 234, 0.1);
}

.bar-segment {
  transition: width 0.3s ease;
}

.bar-correct {
  background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
}

.bar-incorrect {
  background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
}

.bar-stats {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  padding: 0 4px;
}

.bar-stats span {
  flex: 1;
}

.correct-count {
  color: #4ade80;
  text-align: left;
  font-weight: 600;
}

.accuracy-pct {
  color: var(--ink);
  text-align: center;
  font-weight: 600;
}

.incorrect-count {
  color: #f87171;
  text-align: right;
  font-weight: 600;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.setting-label {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-align: left;
}

.toggle-switch {
  display: flex;
  gap: 0;
  background: rgba(11, 16, 32, 0.6);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid rgba(248, 244, 234, 0.2);
}

.toggle-option {
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  min-width: 50px;
}

.toggle-option:hover {
  color: var(--text-primary);
  background: rgba(248, 244, 234, 0.05);
}

.toggle-option.active {
  background: var(--accent);
  color: #1a1404;
  box-shadow: 0 2px 8px rgba(241, 176, 122, 0.4);
}

.toggle-option:active {
  transform: scale(0.95);
}

.settings-note {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 16px 20px 8px;
  font-style: italic;
  border-top: 1px solid rgba(248, 244, 234, 0.1);
  margin-top: 12px;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 200px;
}

.setting-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(11, 16, 32, 0.6);
  border-radius: 4px;
  outline: none;
  border: 1px solid rgba(248, 244, 234, 0.2);
}

.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(241, 176, 122, 0.4);
  transition: all 0.2s ease;
  margin-top: -6px;
}

.setting-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(241, 176, 122, 0.6);
}

.setting-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(241, 176, 122, 0.4);
  transition: all 0.2s ease;
}

.setting-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(241, 176, 122, 0.6);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 10px;
}
