body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, #10214f 0%, #07132d 40%, #040b1d 100%);
  color: white;
}

.qd-hidden {
  display: none !important;
}

.qd-app {
  max-width: 1420px;
  margin: 0 auto;
  padding: 28px 30px 42px;
  box-sizing: border-box;
}

/* =========================
   LOBBY
========================= */

.qd-card {
  background: linear-gradient(180deg, rgba(8, 16, 36, 0.95) 0%, rgba(5, 10, 24, 0.98) 100%);
  border: 1px solid rgba(110, 145, 255, 0.18);
  padding: 28px;
  border-radius: 18px;
  max-width: 460px;
  margin: 0 auto 22px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

.qd-card h1,
.qd-card h2,
.qd-card h3 {
  margin-top: 0;
}

.qd-card h1 {
  font-size: 40px;
  font-weight: 900;
  margin-bottom: 18px;
}

.qd-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 7px;
  font-weight: 800;
  color: #d9e5ff;
}

.qd-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: white;
  box-sizing: border-box;
  font-size: 15px;
}

.qd-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.qd-actions button,
.qd-control-btn,
.qd-host-actions button,
.qd-lobby-btn,
.qd-board-switch-btn {
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.qd-actions button:hover,
.qd-control-btn:hover,
.qd-host-actions button:hover,
.qd-lobby-btn:hover,
.qd-board-switch-btn:hover {
  transform: translateY(-1px);
}

.qd-actions button {
  background: linear-gradient(180deg, #2d67ff 0%, #1d4ed8 100%);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.qd-error {
  color: #ff8181;
  margin-top: 10px;
  min-height: 20px;
  font-weight: 700;
}

#qdPlayerList {
  list-style: none;
  padding: 0;
  margin-top: 10px;
}

#qdPlayerList li {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* =========================
   GAME TOP BAR
========================= */

.qd-topbar {
  display: grid;
  grid-template-columns: 220px 1fr 720px;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.qd-host-badge {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-size: 18px;
  font-weight: 800;
  color: #d8e6ff;
  padding: 0 4px;
}

.qd-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.qd-title {
  text-align: center;
  font-size: 60px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff7e6;
  text-shadow:
    0 0 8px rgba(255,255,255,0.08),
    0 0 24px rgba(255, 208, 0, 0.06);
}

.qd-board-label {
  font-size: 18px;
  font-weight: 900;
  color: #8fd3ff;
}

.qd-topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.qd-volume-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(22, 33, 53, 0.98) 100%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}

.qd-volume-box label {
  font-size: 14px;
  font-weight: 800;
  color: #d8e6ff;
  white-space: nowrap;
}

#qdVolumeSlider {
  width: 110px;
}

#qdVolumeValue {
  font-size: 14px;
  font-weight: 800;
  min-width: 40px;
  text-align: right;
  color: #ffffff;
}

.qd-control-btn {
  background: linear-gradient(180deg, #1fd15f 0%, #13a548 100%);
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.28);
}

.qd-lobby-btn {
  background: linear-gradient(180deg, #5c6b86 0%, #39465d 100%);
  box-shadow: 0 8px 18px rgba(71, 85, 105, 0.26);
}

.qd-board-switch-btn {
  background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 8px 18px rgba(109, 40, 217, 0.28);
}

.qd-board-switch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qd-mode-badge {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.22);
}

.qd-turn-box {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(22, 33, 53, 0.98) 100%);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* =========================
   BOARD
========================= */

.qd-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.qd-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qd-category {
  min-height: 74px;
  background: linear-gradient(180deg, #cb114f 0%, #99113f 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  font-weight: 900;
  font-size: 17px;
  line-height: 1.2;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    0 0 18px rgba(203, 17, 79, 0.18);
}

.qd-category.editable {
  cursor: pointer;
}

.qd-category.editable:hover {
  transform: translateY(-1px);
}

.qd-value {
  background: linear-gradient(180deg, #234ea6 0%, #163d87 100%);
  border-radius: 14px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 16px rgba(37, 99, 235, 0.12);
}

.qd-value:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 20px rgba(37, 99, 235, 0.22);
}

.qd-value.disabled {
  cursor: default;
}

.qd-value.used {
  opacity: 0.28;
  filter: grayscale(0.15);
  text-decoration: line-through;
  box-shadow: none;
}

.qd-value.setup-empty {
  border: 2px solid rgba(239, 68, 68, 0.85);
}

.qd-value.setup-filled {
  border: 2px solid rgba(34, 197, 94, 0.85);
}

/* =========================
   PLAYER STRIP
========================= */

.qd-players-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.qd-player-card {
  background: linear-gradient(180deg, rgba(31, 42, 67, 0.96) 0%, rgba(26, 37, 58, 0.98) 100%);
  border-radius: 18px;
  padding: 18px 16px;
  text-align: center;
  border: 2px solid transparent;
  min-height: 92px;
  box-sizing: border-box;
  box-shadow: 0 8px 20px rgba(0,0,0,0.16);
}

.qd-player-card.active {
  border-color: #44c8ff;
  box-shadow:
    0 0 0 2px rgba(68,200,255,0.08),
    0 0 18px rgba(68,200,255,0.18);
}

.qd-player-name {
  font-weight: 900;
  font-size: 22px;
  margin-bottom: 8px;
}

.qd-player-score {
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
}

/* =========================
   OVERLAYS
========================= */

#questionOverlay,
#qdSetupOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  z-index: 999;
}

.qd-popup {
  background: linear-gradient(180deg, #2f67c0 0%, #224f9e 100%);
  padding: 34px 36px;
  border-radius: 20px;
  max-width: 940px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 44px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}

.qd-setup-popup {
  max-width: 980px;
}

.qd-popup-meta {
  font-size: 30px;
  font-weight: 900;
  color: #78c8ff;
  margin-bottom: 18px;
}

.qd-popup-question {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.25;
  margin: 18px 0 22px;
}

.qd-answer-turn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 18, 34, 0.22);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,0.08);
}

.qd-buzz-row {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

#buzzBtn {
  min-width: 220px;
  min-height: 58px;
  padding: 14px 30px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff4c5e 0%, #e11d48 100%);
  color: white;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(225, 29, 72, 0.28);
}

#buzzBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qd-popup-answer {
  margin-top: 22px;
  font-size: 22px;
  font-weight: 800;
  color: #ffd166;
}

.qd-popup-media-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 22px;
}

.qd-popup-media {
  max-width: 100%;
  max-height: 420px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
}

/* =========================
   HOST CONTROL PANEL
========================= */

.qd-host-page.narrow {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

.qd-host-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.qd-host-title {
  font-size: 34px;
  font-weight: 900;
}

.qd-host-roominfo {
  color: #d8e6ff;
  font-weight: 800;
}

.qd-host-onlypanel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.qd-host-panel {
  background: linear-gradient(180deg, rgba(8, 16, 36, 0.96) 0%, rgba(5, 10, 24, 0.98) 100%);
  padding: 25px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 14px 34px rgba(0,0,0,0.24);
}

.qd-host-panel-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
}

.qd-host-question-meta {
  font-size: 20px;
  font-weight: 900;
  color: #77c4ff;
  margin-bottom: 12px;
}

.qd-host-question-player {
  font-size: 18px;
  font-weight: 800;
  margin-top: 16px;
}

.qd-host-readbox {
  width: 100%;
  min-height: 72px;
  box-sizing: border-box;
  background: #0f172a;
  color: white;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  line-height: 1.4;
  margin-top: 10px;
}

.qd-host-readbox.secondary {
  min-height: 58px;
}

.qd-host-label {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #d8e3ff;
  margin-bottom: 8px;
  margin-top: 12px;
}

.qd-host-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  box-sizing: border-box;
  background: #0f172a;
  color: white;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-family: Arial, sans-serif;
}

.qd-host-textarea.small {
  min-height: 90px;
}

.qd-host-select,
.qd-host-file {
  width: 100%;
  padding: 12px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #111827;
  color: white;
  font-size: 15px;
}

.qd-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  text-align: left;
}

.qd-setup-section {
  background: rgba(9, 18, 34, 0.18);
  padding: 12px;
  border-radius: 14px;
}

.qd-setup-preview {
  margin-top: 12px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 18, 34, 0.18);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: hidden;
}

.qd-setup-preview img {
  max-width: 100%;
  max-height: 240px;
  display: block;
}

.qd-host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.qd-host-actions .green {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
}

.qd-host-actions .red {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

.qd-host-actions .blue {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.qd-host-actions .gray {
  background: linear-gradient(180deg, #5c6b86 0%, #39465d 100%);
}

.qd-host-player-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qd-host-player-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr auto;
  gap: 12px;
  align-items: center;
}

.qd-host-player-name {
  font-size: 18px;
  font-weight: 800;
}

.qd-host-score-input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #111827;
  color: white;
  box-sizing: border-box;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1250px) {
  .qd-topbar {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .qd-topbar-right {
    justify-content: center;
  }

  .qd-host-badge {
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 1100px) {
  .qd-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .qd-setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .qd-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .qd-players-strip {
    grid-template-columns: 1fr;
  }

  .qd-title {
    font-size: 40px;
  }

  .qd-host-player-row {
    grid-template-columns: 1fr;
  }

  .qd-popup-question {
    font-size: 24px;
  }

  .qd-popup-meta {
    font-size: 24px;
  }

  .qd-volume-box {
    width: 100%;
    justify-content: center;
  }

  #buzzBtn {
    min-width: 180px;
  }
}