/* Layout ------------------------------- */

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

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.studio-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.app-shell {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
}

.brand-title-link {
  transition: opacity 0.2s ease;
}

.brand-title-link:hover {
  opacity: 0.9;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.screen.active {
  display: flex;
  animation: fadeSlideIn 0.28s ease-out;
}

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

.hidden {
  display: none !important;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}

.lobby-card,
.podium-card {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.game-settings-bar {
  display: block;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  margin-bottom: 1.25rem;
}

.setting-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.segmented-control {
  display: flex;
  flex-grow: 1;
  align-items: center;
  border-radius: 12px;
  gap: 0.2rem;
  overflow: hidden;
}

.segment-btn {
  min-width: 2.6rem;
  padding: 0.45rem 0.8rem;
  flex-grow: 1;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-row {
  display: grid;
  grid-template-columns: 42px minmax(170px, 1fr) minmax(220px, 1.4fr) 42px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.player-row.is-ghost {
  border-style: dashed;
  opacity: 0.78;
}

.player-row.is-ghost .player-theme-select {
  visibility: hidden;
  pointer-events: none;
}

.player-row.is-ghost:focus-within {
  opacity: 1;
}

.player-index {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.tv-input,
.tv-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  outline: none;
}

.tv-select.compact {
  width: auto;
}

.btn-remove-row {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.error-banner {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--status-danger);
}

.lobby-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

button {
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

.btn-primary {
  padding: 0.85rem 1.6rem;
  border-radius: 14px;
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-large {
  padding: 1rem 2rem;
}

.btn-secondary {
  padding: 0.85rem 1.4rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

.btn-icon {
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.btn-success {
  padding: 0.85rem 1.4rem;
  border-radius: 12px;
}

.btn-danger {
  padding: 0.85rem 1.4rem;
  border-radius: 12px;
}

.game-layout {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.progress-card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.scoreboard-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.game-center-column {
  display: flex;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.stage-card {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .game-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
  }
  .game-sidebar {
    position: sticky;
    top: 1.25rem;
  }
  .scoreboard-strip {
    grid-template-columns: 1fr;
  }
}

.score-tile {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.score-player-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-announcement {
  padding: 1.15rem 1rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.question-header {
  display: flex;
  justify-content: center;
  margin-bottom: -0.75rem;
}

.question-box {
  border-radius: 16px;
  border: 1px solid var(--border-glow);
  overflow: hidden;
}

.question-theme-bar {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
  align-items: center;
}

.question-body {
  padding: 1.5rem;
}

.phase-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.mode-btn {
  padding: 1.25rem 1rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.mode-btn:hover {
  transform: translateY(-3px);
}

.mode-cash {
  background: var(--mode-cash-bg);
}

.mode-carre {
  background: var(--mode-carre-bg);
}

.mode-duo {
  background: var(--mode-duo-bg);
}

.flashcard-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.answer-reveal-box {
  width: 100%;
  padding: 1.4rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.reveal-explanation {
  max-width: 640px;
}

.self-eval-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}

.choice-btn {
  padding: 1.15rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.choice-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.feedback-banner {
  padding: 1.25rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feedback-banner.success {
  border: 1px solid var(--status-success);
}

.feedback-banner.error {
  border: 1px solid var(--status-danger);
}

.next-action {
  display: flex;
  justify-content: center;
}

.podium-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.winner-spotlight {
  padding: 1.75rem;
  border-radius: 18px;
}

.final-standings {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.standing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

.podium-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

@media (max-width: 720px) {
  .player-row {
    grid-template-columns: 36px 1fr 36px;
  }
  .player-row .tv-select {
    grid-column: 1 / -1;
  }
  .mode-grid,
  .choices-grid {
    grid-template-columns: 1fr;
  }
}
