:root {
  --primary: #6C63FF;
  --secondary: #EC4899;
  --bg: #0a0a15;
  --card: #12122a;
  --text: #ffffff;
  --text-muted: rgba(255,255,255,0.5);
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --font: 'Space Grotesk', Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ── Login & Event selection ── */
#login-screen, #event-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box, .event-select-box {
  text-align: center;
  max-width: 360px;
  width: 100%;
  padding: 0 20px;
}

.login-title {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1rem;
}

#login-screen input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 12px;
  text-align: center;
}

#login-screen button {
  width: 100%;
  margin-bottom: 8px;
}

#login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
}

#event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.event-card {
  background: var(--card);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.event-card:hover {
  border-color: var(--primary);
  background: rgba(108,99,255,0.08);
}

.event-card-name { font-size: 1.1rem; font-weight: 600; }
.event-card-date { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.event-card-badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 0.7rem; font-weight: 600; margin-left: 8px; }
.event-card-badge.active { background: rgba(46,204,113,0.2); color: var(--success); }
.event-card-badge.inactive { background: rgba(255,255,255,0.08); color: var(--text-muted); }

.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-logout:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

.btn-logout-small {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-logout-small:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.btn-danger-small { border-color: rgba(231,76,60,0.4); color: var(--danger); }
.btn-danger-small:hover { border-color: var(--danger); }

/* ── Header: fixed top bar ── */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

header h1 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.event-name-header {
  font-size: 1.1rem;
  color: #fff;
  font-weight: 700;
}

#status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.1rem;
}

#stats { color: var(--text-muted); }
#connected, #voted { color: var(--text); font-weight: bold; }

.badge {
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: bold;
}

.badge-waiting { background: var(--warning); color: #000; }
.badge-voting { background: var(--primary); }
.badge-generating { background: var(--secondary); }
.badge-listening { background: var(--success); color: #000; }
.badge-complete { background: var(--text-muted); }
.badge-disconnected { background: var(--danger); }

/* ── Controls top: vote phase buttons ── */

/* ── Controls bottom: session buttons ── */
#controls-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 10px 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  z-index: 99;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%;
}

#btn-cancel { margin-left: auto; }

#btn-advance { margin-left: auto; }

/* ── Buttons ── */
button {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: white;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

button:hover { opacity: 0.9; }
button:active { transform: scale(0.97); }

.btn-secondary {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
}

.btn-big {
  padding: 24px 48px;
  font-size: 1.5rem;
  border-radius: 16px;
  font-weight: 700;
}

.btn-group { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── New session zone (centered) ── */
#intro-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 170px);
}

#intro-zone.hidden { display: none !important; }

.intro-animateur {
  text-align: center;
  max-width: 800px;
  padding: 0 20px;
}

.intro-hint {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-style: italic;
}

.intro-animateur h2 {
  margin-bottom: 20px;
}

.intro-script {
  text-align: left;
  font-size: 1.35rem;
  line-height: 1.9;
  color: rgba(255,255,255,0.85);
  margin-bottom: 30px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 28px 32px;
  border: 1px solid rgba(255,255,255,0.08);
}

.intro-script p { margin-bottom: 8px; }
.intro-script strong { color: var(--primary); }

#new-session-zone, #launch-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  height: calc(100vh - 170px);
}

.launch-connected {
  font-size: 1.8rem;
  color: var(--text-muted);
}

.launch-connected span {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#new-session-zone.hidden, #launch-zone.hidden { display: none !important; }

/* ── Main content area ── */
#app {
  padding-top: 56px;
  padding-bottom: 56px;
  height: 100vh;
  overflow: hidden;
}

section {
  height: calc(100vh - 112px);
  padding: 10px 16px;
  overflow: hidden;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  text-align: center;
}

#vote-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── Step indicators ── */
#step-indicators {
  display: none;
}

.step-dot {
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  transition: all 0.3s;
}

.step-dot.active { background: var(--primary); color: white; }
.step-dot.done { background: var(--success); color: #000; }

/* ── Vote header ── */
.vote-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.timer {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Vote recap ── */
#vote-recap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-bottom: 8px;
}

#vote-recap:empty { display: none; }

.recap-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(108, 99, 255, 0.15);
  font-size: 0.85rem;
}

.recap-chip .recap-label { color: var(--text-muted); }
.recap-chip .recap-value { color: var(--primary); font-weight: 600; }

/* ── Animateur vote cards ── */
.anim-vote-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  flex: 1;
}

.anim-vote-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 10px;
  overflow: hidden;
  max-height: 30vh;
}

.anim-vote-card-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(108,99,255,0.3), rgba(108,99,255,0.1));
  transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 0;
  border-radius: 0 0 12px 12px;
}

.anim-vote-card-icon { font-size: 1.5rem; z-index: 1; }
.anim-vote-card-name { font-size: 0.95rem; font-weight: 600; color: #fff; z-index: 1; text-align: center; }
.anim-vote-card-pct {
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 1;
}

.anim-card-winner {
  border-color: var(--primary) !important;
  border-width: 3px !important;
  background: rgba(108,99,255,0.15) !important;
  box-shadow: 0 0 15px rgba(108,99,255,0.3);
}

.anim-card-winner .anim-vote-card-name {
  color: var(--primary) !important;
}

.anim-variant-pending {
  opacity: 0.3;
}

.anim-variant-ready {
  border-color: var(--primary);
  background: rgba(108,99,255,0.1);
}

.anim-variant-ready:hover {
  background: rgba(108,99,255,0.2);
}

.anim-vote-card.playing {
  border-color: var(--primary) !important;
  background: var(--primary) !important;
  color: white;
}

.anim-card-loser {
  opacity: 0.25;
  transform: scale(0.95);
}

.anim-card-action {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  border: 2px dashed rgba(108,99,255,0.4) !important;
  box-shadow: none !important;
}

.anim-card-action .btn-big {
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.anim-result-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.anim-result-cards .anim-result-action {
  display: flex;
  justify-content: center;
}

/* ── Animateur versus (language vote) ── */
#vote-bars {
  flex: 1;
  display: flex;
  align-items: stretch;
}

.anim-versus {
  display: flex;
  gap: 16px;
  width: 100%;
  flex: 1;
}

.anim-versus-zone {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
}

.anim-versus-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(108,99,255,0.3), rgba(108,99,255,0.15));
  transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 0;
  border-radius: 0 0 16px 16px;
}

.anim-versus-flag { font-size: 4rem; z-index: 1; }
.anim-versus-name { font-size: 1.3rem; font-weight: 700; z-index: 1; }
.anim-versus-pct {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 1;
}
.anim-versus-count { font-size: 1rem; color: var(--text-muted); z-index: 1; }

/* ── Animateur result split ── */
.anim-result-split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  flex: 1;
}

.anim-result-winner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.anim-result-flag {
  font-size: 5rem;
  animation: popIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
}

.anim-result-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.anim-result-pct {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.anim-result-losers {
  display: flex;
  align-items: center;
  gap: 20px;
}

.anim-result-loser {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
}

.anim-loser-flag { font-size: 2rem; }
.anim-loser-name { font-size: 0.9rem; color: var(--text-muted); }
.anim-loser-pct { font-size: 1.2rem; font-weight: 700; color: var(--text-muted); }

.anim-result-action {
  display: flex;
  align-items: center;
}

@keyframes popIn {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Animateur script ── */
.anim-script {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 24px 28px;
  font-size: 1.3rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.9);
  text-align: left;
  max-width: 700px;
  margin: 0 auto;
}

/* ── Script + cards layout ── */
.anim-script-cards {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  flex: 1;
}

.anim-script-text {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.85);
  text-align: center;
  line-height: 1.6;
}

/* ── Choice cards (themes etc) ── */
.anim-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.anim-choice-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
}

.anim-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anim-card-icon { font-size: 1.4rem; }
.anim-card-name { font-size: 1rem; font-weight: 600; color: var(--primary); }
.anim-card-desc { font-size: 1.15rem; color: rgba(255,255,255,0.85); line-height: 1.4; }

/* ── Presentation items (genre grid) ── */
.present-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  height: 100%;
}

.present-grid > .present-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.present-item {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.3s;
}

.present-item:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}

.present-item.playing {
  border-color: var(--primary);
  background: rgba(108,99,255,0.12);
  box-shadow: 0 0 15px rgba(108,99,255,0.2);
}

.present-item.no-sample { cursor: default; opacity: 0.5; }

.present-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.present-play {
  font-size: 1.4rem;
  color: var(--primary);
  min-width: 24px;
}

.present-name {
  font-size: 1.5rem;
  font-weight: 600;
}

.present-vibes {
  margin-top: 8px;
  margin-left: 32px;
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Vote bars ── */

.vote-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.vote-bar-label {
  min-width: 200px;
  text-align: right;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.vote-bar-track {
  flex: 1;
  height: 38px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}

.vote-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.vote-bar-count {
  min-width: 60px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#vote-winner {
  margin-top: 8px;
  padding: 8px;
  background: rgba(108, 99, 255, 0.15);
  border-radius: 6px;
  text-align: center;
  font-size: 0.95rem;
}

#vote-winner strong {
  color: var(--primary);
  font-size: 1.1rem;
}

/* ── Lyrics ── */
#lyrics-editor {
  display: flex;
  flex-direction: column;
}

.lyrics-columns {
  display: flex;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.lyrics-col-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.lyrics-tab {
  padding: 42px 10px !important;
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: var(--text-muted) !important;
  white-space: nowrap;
}

.lyrics-tab.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

#lyrics-textarea {
  flex: 2;
  min-width: 0;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 10px;
  font-size: 1.2rem;
  font-family: monospace;
  line-height: 1.6;
  resize: none;
}

.lyrics-col-action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.lyrics-vote-btn {
  border-radius: 10px;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
}

#lyrics-status {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 4px;
}

/* ── Generation ── */
.loader-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.loader {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#generation-status { color: var(--text-muted); font-size: 0.85rem; }

/* ── Variants ── */
#variant-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.variant-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.variant-card:hover { background: rgba(255,255,255,0.08); }
.variant-debug { font-size: 0.65rem; color: var(--text-muted); margin-top: 6px; line-height: 1.4; word-break: break-all; opacity: 0.6; }
.variant-card.playing { border-color: var(--primary); }
.variant-card.winner { border-color: var(--success); }
.variant-card h3 { margin-bottom: 4px; font-size: 1.1rem; }

.variant-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.variant-card .error-msg {
  color: var(--danger);
  font-size: 0.8rem;
}

#variant-player { width: 100%; margin-bottom: 8px; }


/* ── Final ── */
#final-player { width: 100%; margin-bottom: 8px; }
#final-recap { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; }

/* ── History ── */
#history-panel {
  position: fixed;
  top: 56px;
  right: 0;
  width: 360px;
  max-height: calc(100vh - 48px);
  background: rgba(10,10,21,0.95);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 98;
  overflow-y: auto;
  padding: 16px;
}

#history-panel h2 { font-size: 1.1rem; margin-bottom: 12px; text-align: left; }

.session-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
}

.badge-small {
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
}

.badge-waiting { background: rgba(243,156,18,0.2); color: var(--warning); }
.badge-voting { background: rgba(108,99,255,0.2); color: var(--primary); }
.badge-generating { background: rgba(236,72,153,0.2); color: var(--secondary); }
.badge-complete { background: rgba(255,255,255,0.08); color: var(--text-muted); }

.muted { color: var(--text-muted); font-size: 0.8rem; }

/* ── Big open vote button ── */
#btn-open-vote-big {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Test buttons ── */
.test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
}

.btn-test {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-test:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── Test styles ── */
#test-styles-panel { overflow-y: auto; }
#test-styles-list { display: flex; flex-wrap: wrap; gap: 12px; }

.tsi-btn {
  width: 200px;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.tsi-genre { font-size: 1.4rem; font-weight: 700; }
.tsi-vibe { font-size: 1.1rem; opacity: 0.7; }
.tsi-btn.tsi-pending { opacity: 0.3; cursor: wait; }
.tsi-btn.tsi-ready { background: rgba(108,99,255,0.15); border-color: var(--primary); color: #fff; }
.tsi-btn.tsi-ready:hover { background: rgba(108,99,255,0.3); }
.tsi-btn.tsi-error { opacity: 0.3; cursor: not-allowed; border-color: #e74c3c; }
.tsi-btn.playing { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 12px rgba(108,99,255,0.5); }

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-box {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
}

.modal-box h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.modal-box p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-delete {
  background: none;
  border: 1px solid rgba(231,76,60,0.4);
  color: var(--danger);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  margin-left: auto;
}

.btn-delete:hover { background: rgba(231,76,60,0.15); }

/* ── Debug ── */
#debug-inline {
  border: 1px solid rgba(243, 156, 18, 0.3);
  background: rgba(243, 156, 18, 0.05);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  max-height: 30vh;
  overflow-y: auto;
}

#debug-panel { border: 1px solid rgba(243, 156, 18, 0.3); background: rgba(243, 156, 18, 0.05); }
#debug-panel h2 { color: #f39c12; }

.debug-entry { border-bottom: 1px solid rgba(255,255,255,0.06); padding: 6px 0; }
.debug-header { font-weight: 600; color: #f39c12; font-size: 0.8rem; margin-bottom: 3px; }

.debug-prompt {
  background: rgba(0,0,0,0.3);
  color: #ccc;
  padding: 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 3px;
}

.debug-meta { font-size: 0.65rem; color: var(--text-muted); }
