  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #111;
    color: #fff;
    min-height: 100vh;
    -webkit-user-select: none;
    user-select: none;
  }

  /* ── HEADER ── */
  .top-bar {
    background: #1a1a1a;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #FFD700;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .top-bar h1 { font-size: 1rem; color: #FFD700; }
  .top-bar .status { font-size: 0.75rem; color: #888; }
  .connection-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
  }
  .connection-dot.on { background: #4CAF50; }
  .connection-dot.off { background: #F44336; }

  /* ── SCORES ── */
  .scores {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #1a1a1a;
    overflow-x: auto;
  }
  .score-card {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 8px 4px;
    border-radius: 10px;
    background: #222;
    border: 2px solid #333;
  }
  .score-card .sname {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .score-card .sval {
    font-size: 1.3rem;
    font-weight: 900;
    color: #FFD700;
    cursor: pointer;
    user-select: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
  }
  .score-card .sval:hover { background: rgba(255, 215, 0, 0.15); }
  .score-card .sconn {
    font-size: 0.6rem;
    margin-top: 2px;
  }
  .score-card.buzzed { border-color: #FFD700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

  /* ── MINI BOARD ── */
  .mini-board {
    padding: 10px;
  }
  .mini-board h2 {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .mini-cats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    margin-bottom: 4px;
  }
  .mini-cat {
    background: #1a1a5c;
    border-radius: 4px;
    padding: 4px 2px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #FFD700;
    line-height: 1.2;
  }
  .mini-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 3px;
  }
  .mini-cell {
    background: #1e1e6a;
    border: 2px solid #3333aa;
    border-radius: 6px;
    padding: 12px 4px;
    text-align: center;
    font-size: 1rem;
    font-weight: 900;
    color: #FFD700;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .mini-cell:active { transform: scale(0.95); }
  .mini-cell.answered {
    background: #111;
    border-color: #1a1a1a;
    color: #444;
    pointer-events: none;
  }
  .mini-cell.active {
    background: #FFD700;
    color: #000;
    border-color: #FFD700;
  }
  /* Highlights the Daily Double cell on the host control */
  .mini-cell.is-dd {
    background: linear-gradient(135deg, #6a3a00 0%, #1e1e6a 100%);
    border-color: #FF9800;
    color: #FF9800;
    font-size: 0.85rem;
  }
  .mini-cell.is-dd.active {
    background: #FF9800;
    color: #060638;
    border-color: #FF9800;
  }

  /* ── QUESTION PANEL ── */
  .question-panel {
    display: none;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
  }
  .question-panel.visible { display: flex; }

  .qp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .qp-category {
    font-size: 0.8rem;
    color: #FFD700;
    font-weight: 600;
  }
  .qp-value {
    font-size: 1.2rem;
    font-weight: 900;
    color: #FFD700;
  }

  .qp-question {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #333;
  }

  .qp-answer {
    background: #1a3a1a;
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #2a5a2a;
  }
  .qp-answer-label {
    font-size: 0.7rem;
    color: #4CAF50;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
  }
  .qp-answer-text {
    font-size: 1rem;
    font-weight: 700;
    color: #4CAF50;
    line-height: 1.4;
  }
  .qp-explain {
    font-size: 0.8rem;
    color: #777;
    margin-top: 8px;
    line-height: 1.4;
  }

  .qp-buzzed {
    display: none;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
  }
  .qp-buzzed.visible { display: block; }

  .qp-attempted {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
  }

  /* ── BUTTONS ── */
  .btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .btn {
    flex: 1;
    min-width: 100px;
    padding: 14px 12px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .btn:active { transform: scale(0.95); }
  .btn:disabled { opacity: 0.3; pointer-events: none; }

  .btn-buzzer { background: #4CAF50; color: #fff; }
  .btn-correct { background: #4CAF50; color: #fff; }
  .btn-incorrect { background: #F44336; color: #fff; }
  .btn-reveal { background: #FF9800; color: #fff; }
  .btn-back { background: #555; color: #fff; }
  .btn-start { background: #FFD700; color: #000; font-size: 1.2rem; padding: 18px; }
  .btn-reset { background: #333; color: #F44336; border: 1px solid #F44336; }

  /* ── LOBBY ── */
  .lobby-panel {
    display: none;
    padding: 20px;
    flex-direction: column;
    gap: 16px;
    align-items: center;
  }
  .lobby-panel.visible { display: flex; }
  .lobby-panel h2 { color: #FFD700; font-size: 1.4rem; }

  .team-edit {
    width: 100%;
    max-width: 350px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 10px;
  }
  .team-edit .dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .team-edit input {
    flex: 1;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1rem;
  }
  .team-edit .conn-status {
    font-size: 0.7rem;
    color: #888;
    min-width: 60px;
    text-align: right;
  }
  .team-edit .conn-status.on { color: #4CAF50; }

  /* ── FOOTER ── */
  .footer-actions {
    padding: 16px;
    display: flex;
    gap: 8px;
  }

  /* ── PHASE LABEL ── */
  .phase-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  /* ── TIMER SETTINGS ── */
  .timer-settings {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
  }
  .timer-settings label {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
  }
  .timer-settings select {
    background: #222;
    border: 1px solid #444;
    color: #FFD700;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
  }
  .timer-bar {
    display: none;
    padding: 8px 16px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    border-radius: 8px;
    margin: 0 16px;
  }
  .timer-bar.visible { display: block; }
  .timer-bar.normal { background: #1a3a1a; color: #4CAF50; }
  .timer-bar.warning { background: #3a3a1a; color: #FF9800; }
  .timer-bar.critical { background: #3a1a1a; color: #F44336; }

  .phase-board { background: #1a1a5c; color: #88f; }
  .phase-question { background: #5c3a00; color: #FFD700; }
  .phase-buzzing { background: #1a5c1a; color: #4CAF50; }
  .phase-buzzed { background: #5c1a1a; color: #F44336; }
  .phase-reveal { background: #5c3a1a; color: #FF9800; }
  .phase-dd-team, .phase-dd-wager, .phase-dd-question {
    background: #5c1a5c; color: #ff8df5;
  }
  .phase-final-wager, .phase-final-question, .phase-final-judge {
    background: #1a5c5c; color: #8ff5f5;
  }

  /* ── DAILY DOUBLE ── */
  .dd-banner {
    display: none;
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FF9800 100%);
    color: #060638;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 3px;
    border-radius: 12px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  }
  .dd-banner.visible { display: block; }

  .dd-team-pick { display: none; flex-direction: column; gap: 10px; }
  .dd-team-pick.visible { display: flex; }
  .dd-team-pick .dd-label {
    font-size: 0.9rem;
    color: #FFD700;
    text-align: center;
  }
  .btn-dd-team {
    flex: 1;
    padding: 14px 8px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    text-transform: uppercase;
  }

  .dd-wait {
    display: none;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    background: #1a1a3a;
    border: 1px solid #333366;
    color: #8ff5f5;
    font-size: 0.95rem;
    font-weight: 600;
  }
  .dd-wait.visible { display: block; }

  /* ── FINAL JEOPARDY ── */
  .final-panel {
    display: none;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
  }
  .final-panel.visible { display: flex; }

  .fj-wagers {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .fj-wager-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
    font-size: 0.85rem;
  }
  .fj-wager-row .who { font-weight: 700; }
  .fj-wager-row .amt { color: #FFD700; font-weight: 900; }
  .fj-wager-row .pending { color: #888; font-style: italic; }

  .fj-judge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .fj-judge-row {
    padding: 10px;
    background: #1a1a1a;
    border-radius: 10px;
    border: 1px solid #333;
  }
  .fj-judge-row .who-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
  }
  .fj-judge-row .who-line .who { font-weight: 700; }
  .fj-judge-row .who-line .amt { color: #FFD700; font-weight: 900; }
  .fj-judge-row .judged-tag {
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
  }
  .fj-judge-row .judged-tag.correct { background: #1a3a1a; color: #4CAF50; }
  .fj-judge-row .judged-tag.wrong { background: #3a1a1a; color: #F44336; }

  .game-settings {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 350px;
  }
  .game-settings select {
    width: 100%;
    background: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 9px;
    font: inherit;
  }
  .game-settings input[type="range"] { width: 100%; accent-color: #FFD700; }
  .game-settings output { display: block; color: #ccc; font-size: .9rem; }
  #game-settings-feedback { color: #ffb4aa; }
  .qp-question, .qp-answer-text { white-space: pre-line; }
  #host-access, #room-links, #host-feedback { padding: 12px 16px; }
  #room-links a, #host-access a { color: #FFD700; margin-right: 12px; }
  #room-links { background: var(--room-color, #222); }
  #room-links strong { display: inline-block; margin-right: 12px; }
  .scores { background: var(--room-color, #222); flex-wrap: wrap; max-height: 32vh; overflow: auto; }
  .score-card .kick { margin-top: 6px; padding: 3px 8px; color: #ffd3d3; background: #371a1a; border: 1px solid #a75858; border-radius: 6px; cursor: pointer; }
  #host-feedback { color: #ffcaab; }
  #room-actions[hidden] { display: none; }


  .scores { justify-content: flex-start; }
  #room-roster { padding: 12px 16px; }
  #room-roster summary { cursor: pointer; color: #ffd700; }
  #roster-list { display: grid; gap: .5rem; margin-top: .65rem; }
  #roster-list section { background: #222; padding: .65rem; border-radius: .5rem; }
  #roster-list h3 { margin-bottom: .4rem; overflow-wrap: anywhere; }
  #roster-list ul { margin: 0; padding: 0; list-style: none; }
  #roster-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .25rem; overflow-wrap: anywhere; }
  #roster-list button { padding: .25rem .5rem; color: #ffd3d3; background: #371a1a; border: 1px solid #a75858; border-radius: 6px; cursor: pointer; }
  #saved-host-rooms { margin-top: .65rem; display: flex; flex-wrap: wrap; gap: .4rem; }
  #host-access-status { margin-top: .5rem; }
  #dd-start-wager[hidden] { display: none; }
  .btn[disabled] { opacity: .5; cursor: default; }

[hidden] { display: none !important; }
.fj-wagers, .fj-judge-list { overflow-wrap: anywhere; }

.top-bar { flex-wrap: wrap; gap: .35rem .75rem; }
.guide-link, #room-links a { text-underline-offset: .18em; }
.guide-link { color: #ffdf64; }
#room-links:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; }
#room-links a { margin-right: 0; }
#copy-player-link { min-height: 2.75rem; padding: .4rem .7rem; border: 1px solid #ffdf64; border-radius: .45rem; background: #181a29; color: #ffdf64; font: inherit; cursor: pointer; }
#copy-player-status:empty { display: none; }
#start-game-status { max-width: 30ch; text-align: center; color: #d5d8ea; }
