@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@600;700&family=DM+Sans:wght@500;600;700&family=IBM+Plex+Mono:wght@500;700&display=swap');

:root {
  --bg-stage: #0b0d13;
  --bg-panel: #131722;
  --bg-elevated: #1b2131;
  --bg-interactive: #232b40;
  --border-subtle: #283149;
  --border-strong: #3a4666;

  --text-primary: #f4f6fb;
  --text-secondary: #b8c2dc;
  --text-muted: #8e9bbf;

  --face-accent: #06d6a0;
  --state-win: #10b981;
  --state-fault: #ef4444;
  --state-warn: #f59e0b;

  --font-display: 'Bricolage Grotesque', 'DM Sans', sans-serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --shadow-stage: none;
  --shadow-btn: 0 6px 14px -4px rgba(0, 0, 0, 0.45);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

::selection {
  background: var(--face-accent);
  color: #0b0d13;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-stage);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

html,
body {
  min-height: 100dvh;
  background-color: var(--bg-stage);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  caret-color: var(--face-accent);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
select {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  transition:
    transform 160ms var(--ease-out-expo),
    background-color 160ms var(--ease-out-expo),
    border-color 160ms var(--ease-out-expo);
}

button:hover:not(:disabled) {
  background: var(--bg-interactive);
  border-color: var(--border-strong);
}

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

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--face-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   APP SHELL & TOP STUDIO BAR
   ========================================================================== */
.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 16px 24px 22px;
  gap: 18px;
  max-width: 1760px;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 16px;
  box-shadow: var(--shadow-stage);
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cube-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--face-accent);
  color: #0b0d13;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.faces-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.face-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
}

.face-pill .face-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-interactive);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.face-pill.active {
  background: var(--bg-elevated);
  border-color: var(--face-accent);
  color: var(--text-primary);
}

.face-pill.active .face-num {
  background: var(--face-accent);
  color: #0b0d13;
}

.shake-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 700;
  background: #2b2112;
  border-color: #6b4c1b;
  color: #fbbf24;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-switch {
  display: inline-flex;
  background: var(--bg-stage);
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--bg-interactive);
  color: var(--text-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.icon-btn.active-state {
  border-color: var(--state-win);
  color: #6ee7b7;
}

/* ==========================================================================
   TV STUDIO LAYOUT (Asymmetric Stage + Score & QR Rail)
   ========================================================================== */
.tv-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: stretch;
}

.stage-surface {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 34px 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  box-shadow: var(--shadow-stage);
  position: relative;
  overflow: hidden;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stage-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stage-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 2.8vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.status-pill.ducking {
  background: #331c19;
  border-color: var(--state-fault);
  color: #fca5a5;
}

/* Contenu central par jeu */
.stage-focal {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.hero-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.3vw, 3.1rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.025em;
  max-width: 28ch;
  text-wrap: balance;
}

.choices-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice-token {
  padding: 14px 22px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-size: 1.2rem;
  font-weight: 700;
}

.choice-token.correct {
  background: #0f2e24;
  border-color: var(--state-win);
  color: #6ee7b7;
}

/* Blind Test Vinyl & Equalizer */
.blindtest-showcase {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.vinyl-disc {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--face-accent) 0 18%, #121621 19% 28%, #1e2538 29% 31%, #0d1018 32% 100%);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-btn);
}

.vinyl-disc.spinning {
  animation: spinDisc 5s linear infinite;
}

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

.track-meta-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track-Big {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.6vw, 3.3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.track-sub {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Murder Party Suspects Strip */
.suspects-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.suspect-tile {
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suspect-tile.interrogated {
  border-color: var(--face-accent);
  background: var(--bg-interactive);
}

.suspect-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.suspect-role {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.clues-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clue-item {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  font-size: 1.02rem;
  color: var(--text-secondary);
}

/* Taboo & Dungeon Special Stage */
.taboo-banner {
  padding: 28px 32px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.taboo-banner.fault {
  background: #2d1216;
  border-color: var(--state-fault);
}

.dungeon-hud {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

/* Bandeau Voix Maître du Jeu IA en bas de scène */
.stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
}

.host-speech-line {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.transcript-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ==========================================================================
   COLONNE DROITE TV : SCORES + CONTRÔLES STUDIO + QR CODE MANETTE
   ========================================================================== */
.studio-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rail-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-stage);
}

.panel-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.score-row.active-team {
  border-color: var(--face-accent);
}

.team-label {
  font-size: 1.05rem;
  font-weight: 700;
}

.team-points {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--face-accent);
}

.quick-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.studio-btn {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.studio-btn.primary {
  background: var(--face-accent);
  border-color: var(--face-accent);
  color: #0b0d13;
}

.studio-btn.primary:hover:not(:disabled) {
  background: #34f5c5;
  border-color: #34f5c5;
  color: #0b0d13;
}

.qr-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.qr-frame {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background: var(--bg-stage);
  border: 1px solid var(--border-strong);
  padding: 6px;
  flex-shrink: 0;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   VUE SMARTPHONE MAÎTRE DU JEU (/controller) — PUSH-TO-TALK & CARTE SECRÈTE
   ========================================================================== */
.controller-workspace {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.secret-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-stage);
}

.secret-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.secret-word {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--face-accent);
  letter-spacing: -0.02em;
}

.forbidden-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.forbidden-pill {
  padding: 8px 13px;
  border-radius: 10px;
  background: #2d1216;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  font-weight: 700;
  font-size: 0.92rem;
}

/* Bouton Géant Push-to-Talk */
.ptt-zone {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-stage);
}

.ptt-trigger {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 3px solid var(--face-accent);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-btn);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ptt-trigger.recording {
  background: var(--state-fault);
  border-color: #fecaca;
  color: #ffffff;
  transform: scale(1.04);
}

.voice-input-row {
  width: 100%;
  display: flex;
  gap: 8px;
}

.voice-text-input {
  flex: 1;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.voice-text-input::placeholder {
  color: var(--text-muted);
}

/* ==========================================================================
   TIROIR PARAMÈTRES (Mistral API + Home Assistant + WiiM Amp Pro)
   ========================================================================== */
.settings-drawer {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  box-shadow: var(--shadow-stage);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-input {
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .tv-workspace {
    grid-template-columns: 1fr;
  }
  .suspects-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px 12px 18px;
  }
  .stage-surface {
    padding: 20px;
  }
  .face-pill span.face-name {
    display: none;
  }
}
