/* =============================================================
   host.css — Host Interface
   DeGrid · Third Degree Entertainment
   ============================================================= */

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

/* Ensure [hidden] always wins over any display: flex/grid rules in this file */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #e2e8f0;
  background: #0c0c14;
}

/* =============================================================
   Header
   ============================================================= */

#host-header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 16px;
  background: #13131f;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  z-index: 10;
}

#storage-warning {
  position: fixed;
  z-index: 1000;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #451a03;
  color: #fef3c7;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.9rem;
}

#storage-warning[hidden] { display: none; }

#dismiss-storage-warning {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid rgba(254, 243, 199, 0.45);
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.host-confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: #181824;
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

.host-confirm-dialog::backdrop { background: rgba(0,0,0,0.72); }
.host-confirm-dialog h2 { margin-bottom: 10px; font-size: 1.05rem; }
.host-confirm-dialog p { color: #cbd5e1; line-height: 1.5; }
.host-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

#app-brand {
  flex-shrink: 0;
}

#app-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f97316;
}

/* Tab bar */
#tab-bar {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab-btn {
  padding: 6px 18px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.tab-btn.active {
  background: rgba(249,115,22,0.18);
  color: #f97316;
}

/* Display controls */
#display-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#display-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #374151;
  flex-shrink: 0;
}

.indicator--connected .indicator-dot  { background: #22c55e; }
.indicator--connected #indicator-label { color: #86efac; }
.indicator--off .indicator-dot        { background: #374151; }
.indicator--warning .indicator-dot    { background: #f59e0b; }
.indicator--warning #indicator-label  { color: #fcd34d; }

/* =============================================================
   Main layout
   ============================================================= */

#host-main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* =============================================================
   Play tab
   ============================================================= */

#play-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: #13131f;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

#play-live-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.play-live-btn {
  font-size: 0.75rem;
  padding: 5px 12px;
}

#blur-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

#blur-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #f97316;
  cursor: pointer;
}

#play-area {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
  background: var(--primary);
}

/* Grid area */
#host-grid-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
}

#host-tv-grid {
  display: grid;
  flex-shrink: 0;
  background: var(--primary);
  /* grid-template-columns / grid-template-rows / gap set by JS fitGrid() */
}

#host-tv-grid .tv-cell {
  /* Grid slots are already sized to the correct ratio by fitGrid().
     Unsetting aspect-ratio lets cells fill their slot completely. */
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
}

/* Host question cells show text, not blur lines */
#host-tv-grid .tv-cell--question {
  cursor: pointer;
}

#host-tv-grid .tv-cell--question:hover {
  transform: scale(1.04) translateY(-3px);
  transition: transform 150ms ease;
  z-index: 2;
}

#host-tv-grid .tv-cell--answered {
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 150ms;
}

#host-tv-grid .tv-cell--answered:hover {
  opacity: 1;
}

/* Host cell question text */
.host-cell-text {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: clamp(0.45rem, 1.4cqi, 0.85rem);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
  hyphens: auto;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 4px;
}

/* Blur My View — blurs cell question text on host only */
#host-tv-grid.blur-my-view .host-cell-text {
  filter: blur(5px);
  user-select: none;
}

/* Timer controls in active panel */
#timer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}

.timer-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.timer-toggle-label input[type="checkbox"] {
  accent-color: #f97316;
  cursor: pointer;
}

.timer-seconds-input {
  width: 56px;
  padding: 4px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  text-align: center;
}

.timer-seconds-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

.timer-unit {
  font-size: 0.72rem;
  color: #475569;
}

.timer-countdown {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: #86efac;
  min-width: 2ch;
  text-align: center;
}

.timer-countdown--urgent {
  color: #f87171;
}

/* Active cell highlight */
#host-tv-grid .tv-cell--active .tv-screen {
  outline: 3px solid #f97316;
  outline-offset: -3px;
}

/* Active Question Panel */
#active-panel {
  width: 340px;
  flex-shrink: 0;
  background: #13131f;
  border-left: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}


#panel-inner {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

#panel-category {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f97316;
}

.panel-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 6px;
}

#panel-question-wrap,
#panel-answer-wrap {
  display: flex;
  flex-direction: column;
}

#panel-question,
#panel-answer {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
  color: #f1f5f9;
}

#panel-answer {
  color: #fbbf24;
  font-size: 1.05rem;
}

#panel-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.panel-btn {
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, opacity 150ms;
  text-align: center;
}

.panel-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
}

.panel-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.panel-btn--done {
  background: rgba(249,115,22,0.2);
  border-color: rgba(249,115,22,0.4);
  color: #fdba74;
}

.panel-btn--done:hover:not(:disabled) {
  background: rgba(249,115,22,0.35);
}

.panel-btn--done:disabled {
  opacity: 0.3;
}

#img-reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.img-fullscreen-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.img-fullscreen-label input[type="checkbox"] {
  accent-color: #0ea5e9;
  cursor: pointer;
}

.panel-btn--image {
  flex: 1;
  background: rgba(14,165,233,0.15);
  border-color: rgba(14,165,233,0.4);
  color: #7dd3fc;
}

.panel-btn--image:hover:not(:disabled) {
  background: rgba(14,165,233,0.28);
  border-color: rgba(14,165,233,0.6);
}

#audio-reveal-row,
#audio-answer-reveal-row {
  display: flex;
  align-items: center;
}

.panel-btn--audio {
  flex: 1;
  background: rgba(168,85,247,0.15);
  border-color: rgba(168,85,247,0.4);
  color: #d8b4fe;
}

.panel-btn--audio:hover:not(:disabled) {
  background: rgba(168,85,247,0.28);
  border-color: rgba(168,85,247,0.6);
}

.panel-btn--cancel {
  background: transparent;
  border-color: rgba(255,255,255,0.07);
  color: #475569;
}

.panel-btn--cancel:hover {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
}

/* =============================================================
   Shared host button
   ============================================================= */

.host-btn {
  padding: 7px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  background: rgba(255,255,255,0.06);
  color: #cbd5e1;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
  white-space: nowrap;
}

.host-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
}

.host-btn--ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.08);
  color: #64748b;
}

.host-btn--danger {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

.host-btn--danger:hover {
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.5);
}

/* =============================================================
   Questions tab
   ============================================================= */

#tab-questions {
  overflow: hidden;
  background: #0c0c14 !important;
  color: #e2e8f0 !important;
}

#q-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: #13131f;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.q-toolbar-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.q-toolbar-group + .q-toolbar-group {
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.1);
}

#drive-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #0f0f1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.drive-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.drive-sync-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
}

.drive-sync-label input[type="checkbox"] {
  accent-color: #f97316;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

#drive-url-input {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-family: 'Inter', monospace;
  font-size: 0.78rem;
}

#drive-url-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

#drive-sheet-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#drive-sheet-input {
  width: 160px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
}

#drive-sheet-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

#drive-status {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}

/* Category editors */
#category-editors {
  display: flex;
  gap: 24px;
  padding: 10px 16px;
  background: #0f0f1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.cat-editor-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-editor-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.cat-input-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-name-input {
  padding: 4px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  width: 110px;
}

.cat-name-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

/* Questions table */
#questions-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

#questions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#questions-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: #0c0c14;
  z-index: 1;
}

#questions-table th:nth-child(1),
#questions-table td:nth-child(1),
#questions-table th:nth-child(2),
#questions-table td:nth-child(2) {
  width: 120px;
  color: #94a3b8;
}

#questions-table th:nth-child(3),
#questions-table td:nth-child(3),
#questions-table th:nth-child(4),
#questions-table td:nth-child(4) {
  width: auto;
}

#questions-table th:nth-child(5),
#questions-table td:nth-child(5) {
  width: 200px;
}

.q-img-input {
  min-height: unset;
  height: 36px;
  font-family: monospace;
  font-size: 0.75rem;
}

.audio-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.q-audio-url-input {
  min-height: unset;
  height: 30px;
  font-family: monospace;
  font-size: 0.75rem;
  width: 100%;
}

.audio-upload-btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  height: 28px;
}

.audio-filename {
  font-size: 0.75rem;
  font-family: monospace;
  color: #a78bfa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.audio-clear-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  align-self: flex-start;
}

#questions-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

#questions-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

#questions-table td {
  padding: 6px 8px;
  vertical-align: top;
}

.q-cell-label {
  color: #64748b;
  font-size: 0.78rem;
  padding: 8px 12px;
}

.q-input {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  border-radius: 5px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: none;
  min-height: 52px;
  transition: border-color 150ms, background 150ms;
}

.q-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.4);
  background: rgba(255,255,255,0.06);
}

/* =============================================================
   Settings tab — always fixed dark scheme, never affected by color pickers
   ============================================================= */

#tab-settings {
  overflow-y: auto;
  background: #0c0c14 !important;
  color: #e2e8f0 !important;
}

#settings-form {
  max-width: 560px;
  padding: 24px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.setting-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.setting-label {
  width: 120px;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8;
  padding-top: 4px;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-control input[type="color"] {
  width: 48px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: rgba(255,255,255,0.05);
}

.color-hex {
  font-family: monospace;
  font-size: 0.85rem;
  color: #94a3b8;
  width: 82px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 4px;
  outline: none;
  cursor: text;
  transition: border-color 150ms, background 150ms, color 150ms;
}

.color-hex:hover {
  border-color: rgba(255,255,255,0.12);
}

.color-hex:focus {
  border-color: rgba(249,115,22,0.5);
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
}

.logo-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#logo-preview {
  max-height: 48px;
  max-width: 120px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}

.setting-input {
  flex: 1;
  padding: 8px 12px;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

.setting-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

/* Selects need solid background — transparency renders as white in native dropdowns */
select.setting-input,
.panel-quad-type-sel,
.panel-type-select {
  background: #1a1a2e;
  color: #e2e8f0;
}

select.setting-input option,
.panel-quad-type-sel option,
.panel-type-select option {
  background: #1a1a2e;
  color: #e2e8f0;
}

.grid-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.size-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #94a3b8;
}

.size-input {
  width: 56px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  text-align: center;
}

.size-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

.size-x {
  color: #475569;
  font-size: 1rem;
}

.size-note {
  font-size: 0.72rem;
  color: #475569;
  width: 100%;
}

.settings-section--danger .settings-section-title {
  color: #ef4444;
  border-bottom-color: rgba(239,68,68,0.2);
}

.panel-config { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.panel-quad-row { align-items: flex-start; }

.panel-quad-row--disabled {
  opacity: 0.35;
  pointer-events: none;
}

.panel-quad-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.panel-quad-type-sel {
  width: 180px;
  height: 36px;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 8px;
}

.panel-quad-type-sel:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

/* keep old .panel-type-select for any remaining uses */
.panel-type-select {
  width: 140px;
  height: 36px;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
}

.panel-type-select:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

.panel-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-text-input {
  min-height: 80px;
  resize: vertical;
  white-space: pre-wrap;
}

.panel-text-toolbar {
  display: flex;
  gap: 4px;
}

.panel-fmt-btn {
  padding: 3px 10px;
  font-size: 0.75rem;
  font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.15s;
}

.panel-fmt-btn:hover {
  background: rgba(255,255,255,0.15);
}

.panel-fmt-btn--active {
  background: rgba(249,115,22,0.3);
  border-color: #f97316;
  color: #fdba74;
}

.setting-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.5;
}

.panel-estimate-note {
  font-size: 0.78rem;
  color: #f97316;
  background: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.5;
  margin-top: 4px;
}

/* Smaller number inputs used in scoring settings */
.setting-input--sm {
  width: 80px;
}

.setting-note {
  font-size: 0.8rem;
  color: #64748b;
  align-self: center;
}

/* Toggle label (checkbox + text inline) */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #e2e8f0;
}

/* =============================================================
   Live Tab
   ============================================================= */

#tab-live {
  overflow-y: auto;
  padding: 20px;
}

#live-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 800px;
}

.live-section {
  background: #13131f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 18px 20px;
}

.live-section-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  gap: 12px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #e2e8f0;
}

/* Room code display */
.room-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.room-code-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.room-code-value {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: 0.2em;
  color: #f97316;
}

.room-mode-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.room-mode-badge--buzzer     { background: rgba(124,58,237,0.25); color: #a78bfa; }
.room-mode-badge--allanswer  { background: rgba(20,184,166,0.20); color: #5eead4; }

/* QR code */
#live-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.live-qr-container {
  width: 256px;
  height: 256px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

.live-qr-container canvas,
.live-qr-container img {
  display: block;
  width: 256px !important;
  height: 256px !important;
}

.live-join-url {
  font-size: 0.75rem;
  color: #64748b;
  word-break: break-all;
  max-width: 400px;
}

.live-room-session-warning {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(234,179,8,0.4);
  border-radius: 8px;
  background: rgba(234,179,8,0.1);
  color: #fde68a;
  font-size: 0.82rem;
  line-height: 1.4;
}

.host-room-resume {
  max-width: 480px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.host-room-resume-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

#host-room-resume-code {
  width: 9rem;
  text-transform: uppercase;
}

#host-room-resume-help {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.live-link-copy-status {
  min-height: 1.2em;
  font-size: 0.78rem;
  color: #86efac;
}

.live-player-count {
  font-size: 0.88rem;
  color: #94a3b8;
  margin-bottom: 14px;
}

.live-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-room-reconnect-error {
  color: #fca5a5;
  max-width: 520px;
  margin: 0 0 10px;
  line-height: 1.45;
}

/* Live leaderboard table */
.live-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.live-lb-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.live-lb-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #e2e8f0;
  vertical-align: middle;
}

.live-lb-table tr:last-child td { border-bottom: none; }

.lb-score-cell {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #f97316 !important;
}

.lb-adj-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lb-adj-btn {
  padding: 3px 9px;
  border: none;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.lb-adj-btn--plus  { background: rgba(34,197,94,0.2);  color: #86efac; }
.lb-adj-btn--minus { background: rgba(239,68,68,0.2);  color: #fca5a5; }

.lb-set-input {
  width: 54px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #e2e8f0;
  font-size: 0.8rem;
  padding: 3px 6px;
  font-family: 'Inter', sans-serif;
}

.lb-set-input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
}

/* =============================================================
   Buzz Feed (in active question panel)
   ============================================================= */

.buzz-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.buzz-feed-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 0.8rem;
}

.buzz-feed-item.buzz--correct  { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.25); }
.buzz-feed-item.buzz--incorrect { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); }

.buzz-rank {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  color: #64748b;
  font-size: 0.72rem;
  width: 20px;
  flex-shrink: 0;
}

.buzz-name {
  flex: 1;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buzz-answer {
  flex: 2;
  color: #94a3b8;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buzz-action {
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

.buzz-action--award { background: rgba(34,197,94,0.2);  color: #86efac; }
.buzz-action--wrong { background: rgba(239,68,68,0.18); color: #fca5a5; }

.buzz-status-badge {
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Primary button variant for host */
.host-btn--primary {
  background: #f97316;
  color: #fff;
  border-color: transparent;
}

.host-btn--primary:hover {
  background: #ea6d10;
}
