/* ===== BASE BODY ===== */
body {
  font-family: Arial, sans-serif;
  background-color: #0f172a;
  color: #e5e7eb;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== MAIN ===== */
main {
  flex: 1;
  padding: 20px;
}

h1 {
  text-align: center;
}

/* ===== CARD ===== */
.card {
  background-color: #020617;
  padding: 20px;
  border-radius: 8px;
  margin: 0 auto 20px;
  max-width: 400px;
}

/* ===== INPUTS / BUTTONS ===== */
input,
button {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 5px;
  border: none;
}

input {
  background-color: #020617;
  color: #e5e7eb;
  border: 1px solid #334155;
  width: 95%;
}

button {
  background-color: #38bdf8;
  color: #020617;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background-color: #0ea5e9;
}

/* ===== ROOM LIST ===== */
.room-list {
  max-width: 600px;
  margin: 0 auto;
}

.room-item {
  background-color: #020617;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.room-info {
  flex: 1;
}

.room-actions button {
  margin-left: 5px;
}

/* ===== FOOTER ===== */
.footer {
  background-color: #020617;
  padding: 10px 0;
  border-top: 1px solid #334155;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
}

.github-logo {
  width: 20px;
  height: 20px;
  filter: invert(1);
}

.github-link:hover {
  opacity: 0.8;
}

/* =========================
   LIGHT THEME OVERRIDES
   ========================= */
body.light {
  background-color: #f8fafc;
  color: #020617;
}

body.light .card,
body.light .room-item,
body.light input,
body.light .footer {
  background-color: #ffffff;
  color: #020617;
  border-color: #cbd5e1;
}

body.light input {
  border: 1px solid #94a3b8;
}

body.light button {
  background-color: #0ea5e9;
  color: #ffffff;
}

body.light button:hover {
  background-color: #0284c7;
}

body.light .github-logo {
  filter: invert(0);
}

/* =========================
   DARK THEME (explicit)
   ========================= */
body.dark {
  background-color: #0f172a;
  color: #e5e7eb;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #334155;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 20px;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

pre {
  background: #020617;
  padding: 10px;
  border-radius: 6px;
  max-height: 200px;
  overflow: auto;
  font-size: 13px;
}

#fileInput {
  padding: 5px;
  margin-right: 5px;
}

body.light pre {
  background-color: white;
  color: black;
  border: 1px solid #334155;
}

#joinBtn {
  margin: 10px auto;
  width: 25%;
  display: flex;
  justify-content: center;
}

.Right {
  margin-left: 15px;
  width: auto;
  color: green;
}
.Wrong {
  margin-left: 15px;
  width: auto;
  color: red;
}
.hidden {
  display: none;
}
#Hide {
  transform: scale(0.9);
}
#unhide {
  height: 100px;
}

#themeToggle,
#Information {
  width: auto;
  padding: 8px 12px;
}
.top-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.modal.hidden {
  display: none;
}
.modal-content {
  background: #ffffff;
  color: #020617;
  padding: 25px 35px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 24px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}
body.dark .modal-content {
  background: #020617;
  color: #e5e7eb;
}

body.light .modal-content {
  background: #ffffff;
  color: #020617;
}

.hidden {
  display: none;
}
#closeInfoModal {
  width: auto;
}
#back {
  text-decoration: none;
  color: black;
}
#backbtn {
  width: auto;
  padding: 8px 14px;
}

/* =========================
   TOP BAR BUTTONS
   ========================= */
#helperBtn {
  width: auto;
  padding: 6px 12px;
  color: black;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  text-decoration: none;
}
#helperBtn:hover {
  background-color: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
}
body.light #helperBtn {
  background-color: rgba(14, 165, 233, 0.08);
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.35);
}
body.light #helperBtn:hover {
  background-color: rgba(14, 165, 233, 0.16);
}

/* =========================
   QUIZ RUNNING BANNER
   ========================= */
#quizRunningBanner:not(.hidden) {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 14px;
  margin-bottom: 4px;
  border: 1px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  animation: bannerPulse 2.5s ease-in-out infinite;
}

.banner-dot {
  width: 9px;
  height: 9px;
  background: #ffffff;
  border-radius: 50%;
  flex-shrink: 0;
  animation: dotBlink 1.2s ease-in-out infinite;
}

.banner-question-counter {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 600;
  font-family: monospace;
}

@keyframes bannerPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
}

@keyframes dotBlink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.75);
  }
}

body.light #quizRunningBanner:not(.hidden) {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.25);
}

/* =========================
   RESTORE BUILDER BUTTON
   ========================= */
#restoreBuilderBtn:not(.hidden) {
  display: inline-block;
  width: auto;
  margin-top: 10px;
  padding: 7px 14px;
  background: transparent;
  border: 1.5px dashed #334155;
  color: #94a3b8;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}
#restoreBuilderBtn:not(.hidden):hover {
  border-color: #38bdf8;
  color: #38bdf8;
}
body.light #restoreBuilderBtn:not(.hidden) {
  border-color: #cbd5e1;
  color: #64748b;
}
body.light #restoreBuilderBtn:not(.hidden):hover {
  border-color: #0ea5e9;
  color: #0ea5e9;
}

/* =========================
   PLAYER REPORT STYLES
   ========================= */
#playerReportContainer {
  background-color: #020617;
  color: #e5e7eb;
  margin: 20px auto;
  padding: 20px;
  border-radius: 8px;
  max-width: 700px;
  border: 2px solid #38bdf8;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#playerReportContainer h2 {
  color: #38bdf8;
  text-align: center;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 24px;
}

#playerReportContainer h3 {
  text-align: center;
  color: #e5e7eb;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #334155;
}

.report-question {
  border: 1px solid #334155;
  padding: 15px;
  margin: 10px 0;
  border-radius: 6px;
  background-color: #0f172a;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.report-question:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.report-question p {
  margin: 8px 0;
  line-height: 1.5;
}

.report-question strong {
  color: #38bdf8;
}

.report-question-number {
  font-size: 14px;
  color: #94a3b8;
  font-weight: normal;
}

.report-correct {
  color: #22c55e !important;
  font-weight: bold;
  font-size: 16px;
}

.report-incorrect {
  color: #ef4444 !important;
  font-weight: bold;
  font-size: 16px;
}

.report-your-answer {
  color: #e5e7eb;
}

.report-correct-answer {
  color: #94a3b8;
  font-size: 14px;
}

#downloadPlayerReportBtn {
  margin-top: 20px;
  padding: 12px 24px;
  background-color: #38bdf8;
  color: #020617;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: auto;
}

#downloadPlayerReportBtn:hover {
  background-color: #0ea5e9;
  transform: scale(1.05);
}

#downloadPlayerReportBtn:active {
  transform: scale(0.98);
}

/* =========================
   LIGHT THEME - PLAYER REPORT
   ========================= */
body.light #playerReportContainer {
  background-color: #ffffff;
  color: #020617;
  border-color: #0ea5e9;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.light #playerReportContainer h2 {
  color: #0284c7;
}

body.light #playerReportContainer h3 {
  color: #020617;
  border-bottom-color: #cbd5e1;
}

body.light .report-question {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

body.light .report-question:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

body.light .report-question strong {
  color: #0284c7;
}

body.light .report-question-number {
  color: #64748b;
}

body.light .report-correct {
  color: #16a34a !important;
}

body.light .report-incorrect {
  color: #dc2626 !important;
}

body.light .report-your-answer {
  color: #020617;
}

body.light .report-correct-answer {
  color: #64748b;
}

body.light #downloadPlayerReportBtn {
  background-color: #0ea5e9;
  color: #ffffff;
}

body.light #downloadPlayerReportBtn:hover {
  background-color: #0284c7;
}

/* =========================
   PUBLIC ROOMS LIST
   ========================= */
.room-list {
  max-width: 100%;
  margin: 0;
}

.room-item {
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.room-item:hover {
  transform: translateY(-2px);
  border-color: #38bdf8;
}

.room-info {
  flex: 1;
  min-width: 200px;
}

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

.room-actions button {
  margin-top: 0;
}

body.light .room-item {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

body.light .room-item:hover {
  border-color: #0ea5e9;
}

/* Radio button styling */
input[type="radio"] {
  width: auto;
  cursor: pointer;
  accent-color: #38bdf8;
}

body.light input[type="radio"] {
  accent-color: #0ea5e9;
}

body.light #jsonTextarea {
  background-color: white;
  color: black;
}
#jsonTextarea {
  background-color: black;
  color: white;
}

/* ===== SHARE LINK BOX ===== */
.share-box {
  display: none;
  margin-top: 12px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  gap: 8px;
  flex-direction: column;
}
.share-box.visible {
  display: flex;
}
.share-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
  margin-bottom: 2px;
}
.share-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-url {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: monospace;
  font-size: 0.88rem;
  color: inherit;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.copy-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: transparent;
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  width: auto;
  margin-top: 0;
}
.copy-btn:hover {
  background: rgba(56, 189, 248, 0.1);
}
.copy-btn.copied {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
}

body.light .share-box {
  background: rgba(14, 165, 233, 0.05);
  border-color: rgba(14, 165, 233, 0.25);
}
body.light .share-label {
  color: #0284c7;
}
body.light .copy-btn {
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.4);
}
body.light .copy-btn:hover {
  background: rgba(14, 165, 233, 0.08);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden {
  display: none;
}

/* =========================
   PLAYER ITEM
   ========================= */
.player-item {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 15px;
}

canvas > #accuracyChart {
  color: white;
}

/* =========================
   OWNER PANEL
   ========================= */
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.owner-panel {
  display: flex;
  height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 24px;
  color: var(--accent-color);
}

.sidebar-header p {
  margin: 5px 0 0;
  font-size: 12px;
  opacity: 0.7;
}

.nav-menu {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item.active {
  background: var(--accent-color);
  color: white;
  border-left: 4px solid var(--accent-dark);
}

.nav-icon {
  font-size: 18px;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-header {
  margin-bottom: 30px;
}

.section-header h1 {
  margin: 0 0 10px;
  font-size: 32px;
}

.section-header p {
  margin: 0;
  opacity: 0.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 25px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: 1px;
}

.stat-card .value {
  font-size: 36px;
  font-weight: bold;
  color: var(--accent-color);
  margin: 10px 0;
}

.stat-card .trend {
  font-size: 12px;
  opacity: 0.7;
}

.data-table {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-hover);
  padding: 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

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

.data-table tr:hover {
  background: var(--bg-hover);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}
.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: #27ae60;
  color: white;
}
.btn-success:hover {
  background: #229954;
}

.btn-warning {
  background: #f39c12;
  color: white;
}
.btn-warning:hover {
  background: #e67e22;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--border-color);
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.logs-terminal {
  background: #1a1a1a;
  color: #00ff00;
  padding: 20px;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.log-entry {
  margin: 5px 0;
  font-size: 13px;
}
.log-entry.error {
  color: #ff4444;
}
.log-entry.warning {
  color: #ffaa00;
}
.log-entry.success {
  color: #00ff00;
}
.log-entry.info {
  color: #4da6ff;
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-online {
  background: #27ae60;
}
.status-offline {
  background: #e74c3c;
}
.status-idle {
  background: #f39c12;
}

.modal-content {
  background: var(--bg-secondary);
  padding: 30px;
  border-radius: 10px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
}

.close-modal {
  font-size: 24px;
  cursor: pointer;
  opacity: 0.7;
}
.close-modal:hover {
  opacity: 1;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-hover: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --accent-color: #007bff;
  --accent-dark: #0056b3;
}

body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-hover: #404040;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #404040;
  --accent-color: #3498db;
  --accent-dark: #2980b9;
}

.auth-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: var(--bg-primary);
}

.auth-box {
  background: var(--bg-secondary);
  padding: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  width: 400px;
  text-align: center;
}

.auth-box h1 {
  margin: 0 0 30px;
  color: var(--accent-color);
}

.error-message {
  color: #e74c3c;
  margin-top: 10px;
  font-size: 14px;
}

/* =========================
   HELPER PAGE
   ========================= */
.helper-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.helper-page h2 {
  text-align: left;
  font-size: 1.5rem;
  margin: 0 0 4px;
  color: #38bdf8;
}

.helper-page .helper-subtitle {
  color: #94a3b8;
  font-size: 0.88rem;
  margin-bottom: 28px;
}

body.light .helper-page h2 {
  color: #0284c7;
}
body.light .helper-page .helper-subtitle {
  color: #64748b;
}

/* Helper grid layout */
.helper-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 720px) {
  .helper-grid {
    grid-template-columns: 1fr;
  }
}

/* Helper cards reuse .card but with tweaks */
.helper-card {
  background-color: #020617;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
}

body.light .helper-card {
  background-color: #ffffff;
  border-color: #cbd5e1;
}

.helper-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #1e293b;
  background-color: #0a0f1e;
}

body.light .helper-card-header {
  background-color: #f1f5f9;
  border-bottom-color: #e2e8f0;
}

.helper-card-header h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  margin: 0;
}

body.light .helper-card-header h3 {
  color: #64748b;
}

.helper-card-icon {
  font-size: 1rem;
  line-height: 1;
}

.helper-card-body {
  padding: 16px;
}

/* Helper form fields */
.helper-field {
  margin-bottom: 14px;
}

.helper-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 5px;
}

body.light .helper-field label {
  color: #475569;
}

.helper-field input {
  width: 100%;
  background-color: #0f172a;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: monospace;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.helper-field input:focus {
  outline: none;
  border-color: #38bdf8;
}

body.light .helper-field input {
  background-color: #f8fafc;
  color: #020617;
  border-color: #cbd5e1;
}

body.light .helper-field input:focus {
  border-color: #0ea5e9;
}

.helper-field textarea {
  width: 100%;
  background-color: #0f172a;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 9px 12px;
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.helper-field textarea:focus {
  outline: none;
  border-color: #38bdf8;
}

body.light .helper-field textarea {
  background-color: #f8fafc;
  color: #020617;
  border-color: #cbd5e1;
}

body.light .helper-field textarea:focus {
  border-color: #0ea5e9;
}

.helper-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* JSON status badge */
.helper-json-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  min-height: 22px;
  font-size: 0.75rem;
}

.helper-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.helper-badge-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}
.helper-badge-err {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.helper-badge-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.helper-q-count {
  color: #64748b;
  font-size: 0.75rem;
}

/* Generate button */
.helper-generate-btn {
  width: 100%;
  margin-top: 4px;
  padding: 11px;
  background-color: #38bdf8;
  color: #020617;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background-color 0.15s,
    transform 0.1s;
}

.helper-generate-btn:hover {
  background-color: #0ea5e9;
  transform: translateY(-1px);
}

body.light .helper-generate-btn {
  background-color: #0ea5e9;
  color: #ffffff;
}

body.light .helper-generate-btn:hover {
  background-color: #0284c7;
}

/* Sample JSON block */
.helper-sample-toggle {
  cursor: pointer;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
  margin-top: 14px;
  display: block;
}

.helper-sample-toggle:hover {
  color: #38bdf8;
}
body.light .helper-sample-toggle:hover {
  color: #0ea5e9;
}

.helper-sample-block {
  margin-top: 10px;
  background: #0a0f1e;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.73rem;
  color: #94a3b8;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

body.light .helper-sample-block {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.helper-sample-block .sk {
  color: #93c5fd;
}
.helper-sample-block .sv {
  color: #86efac;
}

.helper-load-sample-btn {
  margin-top: 8px;
  width: auto;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.helper-load-sample-btn:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}
body.light .helper-load-sample-btn {
  border-color: #cbd5e1;
  color: #64748b;
}
body.light .helper-load-sample-btn:hover {
  border-color: #0ea5e9;
  color: #0ea5e9;
}

/* Output URL box */
.helper-output-box {
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 13px;
  font-family: monospace;
  font-size: 0.78rem;
  color: #38bdf8;
  word-break: break-all;
  line-height: 1.6;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.helper-output-box.empty {
  color: #475569;
  font-style: italic;
}

body.light .helper-output-box {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #0284c7;
}
body.light .helper-output-box.empty {
  color: #94a3b8;
}

.helper-output-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.helper-output-row .helper-output-box {
  flex: 1;
}

.helper-copy-btn {
  flex-shrink: 0;
  align-self: stretch;
  width: auto;
  padding: 0 14px;
  margin-top: 0;
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.helper-copy-btn:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}
.helper-copy-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
body.light .helper-copy-btn {
  border-color: #cbd5e1;
  color: #64748b;
}
body.light .helper-copy-btn:hover {
  border-color: #0ea5e9;
  color: #0ea5e9;
}

/* Open in Admin button */
.helper-open-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}
.helper-open-btn:hover {
  background: rgba(34, 197, 94, 0.2);
}
.helper-open-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
body.light .helper-open-btn {
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.3);
}
body.light .helper-open-btn:hover {
  background: rgba(22, 163, 74, 0.16);
}

/* URL breakdown table */
.helper-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

.helper-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #1e293b;
  font-size: 0.78rem;
}

.helper-breakdown-row:last-child {
  border-bottom: none;
}

.helper-breakdown-key {
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.helper-breakdown-val {
  font-family: monospace;
  color: #38bdf8;
  text-align: right;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.light .helper-breakdown-row {
  border-bottom-color: #e2e8f0;
}
body.light .helper-breakdown-key {
  color: #475569;
}
body.light .helper-breakdown-val {
  color: #0284c7;
}

/* Quiz preview section (full width) */
.helper-preview {
  display: none;
  grid-column: 1 / -1;
}

.helper-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.helper-q-card {
  background-color: #0a0f1e;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.15s;
}

.helper-q-card:hover {
  border-color: #38bdf8;
}
body.light .helper-q-card {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}
body.light .helper-q-card:hover {
  border-color: #0ea5e9;
}

.helper-q-number {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  font-family: monospace;
}

.helper-q-text {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
  padding-right: 40px;
  line-height: 1.4;
  color: #e5e7eb;
}

body.light .helper-q-text {
  color: #0f172a;
}

.helper-q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.helper-q-option {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
}

body.light .helper-q-option {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

.helper-q-option.correct {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
}

.helper-q-option.correct::before {
  content: "✓ ";
  font-weight: 700;
}

body.light .helper-q-option.correct {
  border-color: rgba(22, 163, 74, 0.5);
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
}

/* Helper toast */
#helperToast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #22c55e;
  color: #020617;
  padding: 9px 20px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.83rem;
  opacity: 0;
  transition:
    opacity 0.22s,
    transform 0.22s;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}
#helperToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#empty {
  height: 36vh;
}
