/* Admin — JD JUSTICE DIVERS · UX-focused responsive layout */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  /* Light professional dashboard palette (redesign v41) */
  --bg: #eef2f7;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-mid: #cbd5e1;
  --border-strong: rgba(37, 99, 235, 0.35);
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.09);
  --accent-soft: #eff6ff;
  --accent2: #0f766e;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  /* พื้นหลังกล่องพรีวิวอาร์ตของเกม (สไปรท์เรืองแสง อ่านง่ายบนพื้นเข้ม) */
  --art-well: #0f172a;
  --font: 'Kanit', system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
  --header-blur: 16px;
  --space: clamp(0.75rem, 2vw, 1.5rem);
  --shell-max: 1180px;
  --transition: 0.18s ease;
  /* ความสูงจริงของแถบหัว — admin.js อัปเดตให้ (sidebar sticky จะได้ไม่มุดใต้หัว) */
  --admin-header-h: 76px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Skip link — accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space);
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus {
  top: var(--space);
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

.admin-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 110% 70% at 50% -25%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 50% at 100% 15%, rgba(14, 165, 233, 0.08), transparent),
    radial-gradient(ellipse 45% 45% at 0% 85%, rgba(99, 102, 241, 0.06), transparent),
    var(--bg);
  pointer-events: none;
  z-index: 0;
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space);
  padding-bottom: max(var(--space), env(safe-area-inset-bottom));
}

/* Center auth cards vertically */
.admin-shell:has(#panel-login:not([hidden])),
.admin-shell:has(#panel-setup:not([hidden])) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(100vh, 100dvh);
  padding-top: max(var(--space), env(safe-area-inset-top));
}

/* —— Header —— */
.admin-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: calc(-0.25 * var(--space)) 0 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(var(--header-blur));
  -webkit-backdrop-filter: blur(var(--header-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: max(0.5rem, env(safe-area-inset-top));
  z-index: 40;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.admin-brand-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb 45%, #38bdf8);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14), 0 6px 16px rgba(37, 99, 235, 0.24);
}

.admin-brand-text {
  min-width: 0;
}

.admin-title {
  margin: 0;
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.admin-tagline {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

/* แอตทริบิวต์ hidden ต้องชนะ display:flex — ไม่งั้นปุ่มออกจากระบบโผล่ตอนหน้า login */
.admin-top-actions[hidden] {
  display: none !important;
}

.admin-user {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  background: var(--accent-soft);
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  max-width: min(220px, 50vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  flex-shrink: 0;
}

/* —— Cards —— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 3vw, 1.65rem);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: rgba(37, 99, 235, 0.26);
}

.card--auth {
  max-width: 440px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-md);
  border-color: rgba(37, 99, 235, 0.16);
}

.card--password {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.05), transparent 48%), var(--card);
  border-color: rgba(37, 99, 235, 0.2);
}

.card h2,
.card-title-icon {
  margin: 0 0 0.65rem;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 600;
  color: var(--text);
}

.admin-subheading {
  margin: 1.5rem 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent);
}

.muted {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 0 0 1rem;
}

/* —— Forms —— */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
}

.form-grid label,
.form-inline label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
  gap: 0.85rem;
  align-items: end;
  max-width: none;
  margin-bottom: 1rem;
}

.form-inline .check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

input,
select,
textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-mid);
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(37, 99, 235, 0.38);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.password-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.password-input-wrap input {
  padding-right: 4.5rem;
}

.btn-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--accent);
  line-height: 1.2;
  transition: background var(--transition), color var(--transition);
}

.btn-password-toggle:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0;
  background: var(--surface-2);
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--accent2);
}

.form-oauth {
  max-width: none;
  gap: 1.35rem;
}

/* —— Buttons —— */
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--border-mid);
  background: #fff;
  color: var(--text);
  font-weight: 500;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.34);
  filter: brightness(1.05);
}

.btn-ghost {
  background: #fff;
  color: #334155;
  border-color: var(--border-mid);
}

.btn-ghost:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--accent-strong);
}

.btn-danger {
  color: var(--danger);
  background: #fff;
  border-color: rgba(220, 38, 38, 0.32);
  font-size: 0.78rem;
  padding: 0.38rem 0.65rem;
}

.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.55);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* —— Messages —— */
.msg {
  min-height: 1.35rem;
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  padding: 0.35rem 0;
}

.msg.error {
  color: var(--danger);
}

.msg.ok {
  color: var(--success);
}

/* —— App layout & tabs —— */
.admin-main-flow {
  display: block;
}

.admin-app {
  margin-top: 0.25rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.35rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.admin-tabs::-webkit-scrollbar {
  height: 6px;
}

.admin-tabs::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.tab {
  font: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.55rem 1rem;
  min-height: 3.1rem;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.tab-heading-row {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.4rem;
}

.tab-heading-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-top: 0.05rem;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.tab-heading-icon--wide {
  width: auto;
  max-width: 34px;
  height: 22px;
}

/* Minigame-3 Stack — สินทรัพย์แท่งแนวนอนยาว (object-fit contain ในกล่องนี้) */
.tab-heading-icon--stack-tab {
  width: auto;
  max-width: 52px;
  height: 20px;
}

.tab-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.2;
}

.tab-desc {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.88;
  line-height: 1.2;
  max-width: 140px;
}

.tab-desc--wide {
  max-width: 12.5rem;
}

.tab:hover {
  color: var(--text);
  background: #f1f5f9;
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab.is-active {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.tab.is-active .tab-label {
  color: var(--accent);
}

/* —— Tab group dividers (จัดหมวดเมนูให้สแกนง่าย) —— */
.admin-tab-sep {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.35rem 0.15rem 0;
  padding: 0 0.15rem;
  user-select: none;
}
.admin-tab-sep:first-child {
  margin-top: 0;
}
.admin-tab-sep span {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.admin-tab-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
@media (max-width: 899px) {
  /* มือถือ: แถบเลื่อนแนวนอน — ไม่ต้องแสดงหัวข้อกลุ่ม */
  .admin-tab-sep { display: none; }
}

/* —— ชุดคำถามพิเศษ (Special Quiz panel) —— */
.sq-title { margin: 0 0 0.35rem; }
.sq-step-no {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.sq-fieldset {
  margin: 0 0 1.1rem;
  padding: 0.95rem 1.1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.sq-fieldset > legend {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 0.45rem;
  color: var(--text);
}
.sq-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.sq-select { min-width: 200px; }
.sq-set-tag {
  margin-left: auto;
  align-self: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* —— เลือกการ์ดพิเศษ (card-1..7 จาก trycss/10-Game-1-result) —— */
.sq-card-picker-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.sq-card-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.65rem;
  flex: 1 1 420px;
  max-width: 720px;
}
.sq-card-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.35rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.sq-card-pick:hover {
  border-color: rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}
.sq-card-pick.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3), 0 6px 16px rgba(15, 23, 42, 0.1);
  background: var(--accent-dim);
}
.sq-card-pick img {
  width: 72px;
  height: auto;
  max-height: 96px;
  object-fit: contain;
  display: block;
  image-rendering: auto;
}
.sq-card-pick-cap {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sq-card-pick.is-selected .sq-card-pick-cap { color: var(--accent); }
.sq-card-preview {
  flex: 0 0 auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}
.sq-card-preview-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.sq-card-preview-img {
  width: 120px;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.sq-card-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-top: 0.25rem;
}
.sq-card-meta input,
.sq-card-meta select { width: 100%; }
.sq-count {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.3rem;
}

/* —— คำถามตัวเลือก A/B/C/D (Special Quiz MCQ rows) —— */
.sq-mcq-row {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.sq-mcq-q {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.sq-mcq-text { width: 100%; }
.sq-mcq-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}
.sq-mcq-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sq-mcq-letter {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}
.sq-mcq-choice-input { flex: 1 1 auto; min-width: 0; }
.sq-mcq-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.sq-mcq-ans {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.sq-mcq-correct { min-width: 5rem; }
@media (max-width: 620px) {
  .sq-mcq-choices { grid-template-columns: 1fr; }
}

.tab-panel[hidden] {
  display: none !important;
}

.tab-panel.card {
  margin-bottom: 1.25rem;
}

/* —— Tables —— */
.table-wrap {
  overflow: auto;
  /* จำกัดความสูง → หัวตาราง sticky ทำงานจริงเวลาตารางยาว */
  max-height: min(68vh, 680px);
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

.table-wrap::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #fff;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475569;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-mid);
}

/* แถบสลับสีอ่อน — สแกนตารางยาวได้ง่าย */
.data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.data-table tbody tr:nth-child(even):hover {
  background: rgba(37, 99, 235, 0.06);
}

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

code {
  font-size: 0.84em;
  font-family: ui-monospace, monospace;
  background: var(--surface-3);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.input-coins,
.input-score {
  width: 5.5rem;
  min-width: 0;
}

.btn-coins-save,
.btn-score-save {
  font-size: 0.74rem;
  padding: 0.32rem 0.55rem;
  margin-top: 0.3rem;
}

/* —— Map editor iframe —— */
.admin-editor-panel {
  max-width: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.admin-editor-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.admin-editor-panel-intro {
  flex: 1 1 240px;
  min-width: 0;
}

.admin-editor-panel-intro h2 {
  margin: 0 0 0.35rem;
}

.admin-editor-panel-intro .muted {
  margin-bottom: 0;
}

.btn-editor-fs {
  flex-shrink: 0;
  align-self: flex-start;
  font-weight: 600;
  border-color: rgba(37, 99, 235, 0.35);
}

.admin-editor-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  margin: 0 !important;
  border-radius: 0 !important;
  max-width: none !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  padding: clamp(0.5rem, 2vw, 1rem) !important;
  overflow: hidden;
  box-shadow: none;
}

.admin-editor-panel.is-fullscreen .admin-editor-iframe {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  border-radius: var(--radius);
}

.admin-editor-iframe {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: min(72vh, 800px);
  height: 72vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--art-well);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.06);
}

/* —— Quiz game settings —— */
.quiz-timing-fieldset {
  margin-bottom: 1.25rem;
}

.quiz-timing-grid {
  margin-top: 0.35rem;
}

.quiz-round-q-fieldset .quiz-round-q-label {
  max-width: 280px;
}

.quiz-admin-questions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.quiz-admin-q-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.quiz-admin-q-label,
.quiz-admin-ans-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  margin: 0;
}

.quiz-admin-q-text {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 0;
}

.quiz-admin-q-ans {
  font: inherit;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 9rem;
}

.quiz-admin-q-remove {
  align-self: end;
  white-space: nowrap;
}

.quiz-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

/* —— Quiz carry (หลายตัวเลือก) —— */
.quiz-carry-admin-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quiz-carry-admin-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.quiz-carry-admin-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem;
}

.quiz-carry-q-label {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  margin: 0;
}

.quiz-carry-q-text {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  width: 100%;
  min-width: 0;
}

.quiz-carry-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
  gap: 0.5rem 0.75rem;
}

.quiz-carry-slot-label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0;
}

.quiz-carry-slot-inp {
  font: inherit;
  padding: 0.38rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  width: 100%;
  min-width: 0;
}

.quiz-carry-slot-img {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.32rem 0.45rem;
  margin-top: 0.25rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
  min-width: 0;
}

.quiz-carry-correct-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.quiz-carry-correct-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  margin: 0;
}

.quiz-carry-correct-sel {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 12rem;
}

.quiz-carry-block-remove {
  flex-shrink: 0;
  align-self: flex-end;
}

/* —— Gauntlet: Editor-style shell (โทน editor.html + HUD พรมแดง) —— */
.gauntlet-timing-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 0.5rem 0.85rem 1rem;
  box-shadow: none;
}

.gauntlet-timing-fieldset > legend {
  padding: 0 0.45rem;
  color: var(--accent);
  font-weight: 600;
}

.gauntlet-editor-shell {
  margin-top: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
}

.gauntlet-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
}

.gauntlet-editor-toolbar-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}

.gauntlet-editor-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.gauntlet-editor-link {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f766e;
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.07);
  transition: background var(--transition), border-color var(--transition);
}

.gauntlet-editor-link:hover {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.5);
}

.gauntlet-editor-link-secondary {
  color: var(--accent-strong);
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.07);
}

.gauntlet-editor-link-secondary:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.48);
}

.gauntlet-editor-legend {
  margin: 0;
  padding: 0.55rem 0.85rem 0.65rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.gauntlet-editor-legend a {
  color: var(--accent);
}

.gauntlet-editor-panels {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (min-width: 960px) {
  .gauntlet-editor-panels {
    display: grid;
    grid-template-columns: 1fr 1.08fr;
    align-items: start;
    gap: 1rem;
  }
}

.gauntlet-editor-panel {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: none;
}

.gauntlet-editor-panel-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
}

/* พื้นที่ "เวที" ของเกม — จงใจคงโทนเข้ม (เหมือนกล่องพรีวิววิดีโอ)
   เพราะสไปรท์เลเซอร์/เลนเป็นภาพเรืองแสงบนฉากมืด */
.gauntlet-editor-panel--stage {
  background: linear-gradient(180deg, #1e293b 0%, #172033 45%, #2a1622 100%);
  border-color: rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.08),
    0 8px 22px rgba(15, 23, 42, 0.18);
}

.gauntlet-editor-panel--stage .gauntlet-editor-panel-title,
.gauntlet-editor-panel--stage .game-timing-visual-hint {
  color: #e2e8f0;
}

.gauntlet-editor-panel--stage .game-timing-visual-card,
.gauntlet-editor-panel--stage .game-timing-laser-slot {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
}

.gauntlet-editor-panel--stage .game-timing-laser-slot-label,
.gauntlet-editor-panel--stage .game-timing-laser-placeholder {
  color: #94a3b8;
}

.gauntlet-editor-shell .gauntlet-asset-library {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.gauntlet-editor-shell .gauntlet-asset-library-intro {
  margin-top: 0;
}

.gauntlet-editor-shell .gauntlet-asset-drop {
  border: 1px dashed var(--border-mid);
  background: #ffffff;
  min-height: 6rem;
  box-shadow: none;
}

.gauntlet-editor-shell .gauntlet-asset-drop:hover,
.gauntlet-editor-shell .gauntlet-asset-drop:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.gauntlet-editor-shell .gauntlet-asset-drop.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.gauntlet-editor-shell .gauntlet-asset-card {
  background: #ffffff;
  border-color: var(--border);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.gauntlet-editor-shell .gauntlet-asset-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.gauntlet-editor-panel--stage .game-timing-assigned-visuals {
  margin: 0;
  gap: 1rem;
}

.gauntlet-editor-panel--stage .game-timing-visual-block {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.gauntlet-editor-panel--stage .game-timing-visual-title {
  color: #e2e8f0;
  font-size: 0.95rem;
}

.gauntlet-editor-panel--stage .game-timing-visual-block--lanes .game-timing-visual-grid {
  padding: 0.5rem;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(190, 24, 93, 0.14) 0%, rgba(15, 23, 42, 0.5) 50%);
  border: 1px solid rgba(212, 175, 55, 0.22);
}

.gauntlet-editor-panel--stage .game-timing-visual-card {
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.4);
}

.gauntlet-editor-panel--stage .game-timing-laser-preview {
  border-color: rgba(239, 68, 68, 0.3);
}

.game-timing-laser-slot--beam .game-timing-laser-preview--beam {
  position: relative;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  min-height: clamp(200px, 34vh, 380px);
  max-height: 420px;
  width: 100%;
  max-width: 76px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  overflow: hidden;
}

.game-timing-laser-slot--beam .game-timing-laser-preview--beam::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 3%;
  bottom: 3%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(252, 165, 165, 0.15), rgba(239, 68, 68, 0.92), rgba(252, 165, 165, 0.15));
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
  pointer-events: none;
  opacity: 0.92;
  z-index: 1;
}

.game-timing-laser-slot--beam .game-timing-laser-preview--beam:has(.game-timing-laser-preview-img)::after {
  opacity: 0.38;
}

.game-timing-laser-slot--beam .game-timing-laser-preview--beam .game-timing-laser-preview-img {
  position: relative;
  z-index: 0;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  max-width: none;
  object-fit: fill;
  object-position: center top;
  border-radius: 2px;
}

.game-timing-laser-slot--beam .game-timing-laser-preview--beam .game-timing-laser-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5rem;
  padding: 0.35rem;
}

@media (min-width: 700px) {
  .gauntlet-editor-panel--stage .game-timing-laser-slots-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
  }

  .gauntlet-editor-panel--stage .game-timing-laser-slot {
    border-radius: 0;
    border: none;
    border-right: 1px solid rgba(239, 68, 68, 0.22);
    background: transparent;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .gauntlet-editor-panel--stage .game-timing-laser-slot:last-child {
    border-right: none;
  }

  .gauntlet-editor-panel--stage .game-timing-laser-slot--beam {
    border-left: 1px solid rgba(125, 207, 255, 0.15);
    border-right: 1px solid rgba(125, 207, 255, 0.15);
  }
}

.gauntlet-editor-laser-colors {
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.gauntlet-editor-laser-colors label {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.gauntlet-editor-laser-colors input[type='text'],
.gauntlet-editor-laser-colors input[type='number'] {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(148, 163, 184, 0.5);
  color: var(--text);
}

.game-timing-laser-color-label {
  display: block;
}

.game-timing-laser-color-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.28rem;
}

.game-timing-laser-swatch-stack {
  position: relative;
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
}

.game-timing-laser-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}

.game-timing-laser-color-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
}

.game-timing-laser-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.game-timing-laser-color-picker::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

.game-timing-laser-swatch.is-empty {
  background-color: transparent !important;
  background-image:
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%, transparent 75%, #cbd5e1 75%, #cbd5e1),
    linear-gradient(45deg, #cbd5e1 25%, #f8fafc 25%, #f8fafc 75%, #cbd5e1 75%, #cbd5e1);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.game-timing-laser-color-wrap input[type='text'] {
  flex: 1;
  min-width: 0;
}

/* —— Gauntlet asset library (game timing) —— */
.gauntlet-asset-library {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.gauntlet-asset-library-intro {
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.gauntlet-asset-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.gauntlet-asset-drop:hover,
.gauntlet-asset-drop:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.06);
}

.gauntlet-asset-drop.is-dragover {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.1);
}

.gauntlet-asset-drop-text {
  font-size: 0.92rem;
  font-weight: 500;
}

.gauntlet-asset-upload-msg {
  margin: 0.4rem 0 0;
  min-height: 1.25em;
}

.gauntlet-asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.gauntlet-asset-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.gauntlet-asset-card-preview {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: contain;
  background: repeating-conic-gradient(#eef2f7 0% 25%, #dbe3ec 0% 50%) 50% / 12px 12px;
  border-radius: 6px;
}

.gauntlet-asset-card-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gauntlet-asset-card-label-wrap label {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin: 0;
}

.gauntlet-asset-card-label-wrap input {
  font: inherit;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.gauntlet-asset-card-url {
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--muted, #64748b);
  margin: 0;
}

.gauntlet-asset-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.gauntlet-asset-card-actions .btn {
  font-size: 0.78rem;
  padding: 0.28rem 0.45rem;
}

/* —— Game timing: lane / laser visual assignment (no visible URL paths) —— */
.game-timing-assigned-visuals {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.game-timing-visual-block {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.game-timing-visual-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.game-timing-visual-hint {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  line-height: 1.4;
}

.game-timing-visual-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
}

.game-timing-visual-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 118px;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.game-timing-visual-card-img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: repeating-conic-gradient(#182236 0% 25%, #223049 0% 50%) 50% / 10px 10px;
  border-radius: 6px;
}

.game-timing-visual-card-img.is-broken {
  opacity: 0.35;
}

.game-timing-visual-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
}

.game-timing-visual-card-actions .btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.35rem;
  min-width: 0;
}

.game-timing-laser-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}

.game-timing-laser-slot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.game-timing-laser-slot-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #64748b);
}

.game-timing-laser-preview {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: repeating-conic-gradient(#182236 0% 25%, #223049 0% 50%) 50% / 10px 10px;
  border: 1px dashed var(--border);
}

.game-timing-laser-placeholder {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  text-align: center;
  padding: 0.5rem;
  line-height: 1.35;
}

.game-timing-laser-preview-img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
}

.game-timing-laser-preview-img.is-broken {
  opacity: 0.35;
}

.game-timing-laser-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.game-timing-laser-colors-row {
  margin-top: 0;
}

@media (max-width: 720px) {
  .quiz-admin-q-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .quiz-admin-q-remove {
    align-self: stretch;
  }
}

/* —— Responsive —— */
@media (max-width: 640px) {
  :root {
    --shell-max: 100%;
  }

  .admin-header-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .admin-brand {
    justify-content: flex-start;
  }

  .admin-top-actions {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-user {
    max-width: none;
    text-align: center;
  }

  .btn-logout {
    width: 100%;
  }

  .tab {
    min-width: 118px;
  }

  .admin-editor-iframe {
    min-height: min(62vh, 680px);
    height: 62vh;
    border-radius: var(--radius);
  }

  .admin-editor-panel.is-fullscreen .admin-editor-iframe {
    height: auto !important;
  }

  .form-grid {
    max-width: none;
  }
}

@media (min-width: 900px) {
  .admin-tabs {
    flex-wrap: wrap;
    overflow: visible;
  }

  .tab {
    flex: 1 1 0;
    min-width: 140px;
    max-width: 220px;
    align-items: center;
    text-align: center;
  }

  .tab-desc {
    max-width: none;
  }
}

@media (min-width: 1100px) {
  :root {
    --shell-max: 1320px;
  }
}

@media (min-width: 1500px) {
  :root {
    --shell-max: 1440px;
  }
}

/* —— Quiz carry: map panel theme (color + alpha) —— */
.quiz-carry-theme-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.25rem;
}
.quiz-carry-theme-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10rem) 1fr;
  gap: 0.65rem 1rem;
  align-items: center;
}
.quiz-carry-theme-row--narrow {
  grid-template-columns: 1fr;
  max-width: 12rem;
}
.quiz-carry-theme-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.quiz-carry-color-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}
.quiz-carry-color-controls input[type='color'] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.quiz-carry-alpha-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
  min-width: min(100%, 220px);
}
.quiz-carry-alpha-label input[type='range'] {
  flex: 1;
  min-width: 120px;
  max-width: 280px;
  accent-color: var(--accent);
}
.quiz-carry-alpha-out {
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  font-size: 0.8rem;
  color: var(--text);
}
.quiz-carry-theme-code {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  max-width: 100%;
  flex-basis: 100%;
}

/* —— Quiz Battle admin (โดม + ป๊อปอัป cyber) —— */
.tab-panel-quiz-battle {
  --qb-cyan: #00f2ff;
  --qb-cyan-dim: rgba(0, 242, 255, 0.45);
  --qb-magenta: #ff2ee5;
  --qb-magenta-dim: rgba(255, 46, 229, 0.5);
  --qb-green: #40ff70;
  --qb-red: #ff3355;
  --qb-gold: #ffc14d;
  --qb-bg-modal: rgba(12, 18, 32, 0.92);
}

.qb-admin-layout {
  display: grid;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

@media (min-width: 960px) {
  .qb-admin-layout {
    grid-template-columns: 1fr min(420px, 38vw);
    align-items: start;
  }
}

.qb-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.qb-battle-filter-cat {
  max-width: 100%;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.qb-battle-admin-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.qb-battle-block {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
/* ตัวกรองหมวด: ซ่อนแถวที่ไม่ตรงหมวด (display:flex ด้านบนทับ [hidden] ของ UA ต้อง override) */
.qb-battle-block[hidden] {
  display: none !important;
}

.qb-battle-block-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  justify-content: space-between;
}

.qb-battle-cat-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.86rem;
  margin: 0;
  flex: 1 1 12rem;
}

.qb-battle-cat {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.qb-battle-q-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  margin: 0;
}

.qb-battle-q-text {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.qb-battle-abc-grid {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .qb-battle-abc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.qb-battle-opt-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  margin: 0;
}

.qb-battle-opt-label input {
  font: inherit;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.qb-battle-correct-fs {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}

.qb-battle-correct-fs legend {
  padding: 0 0.35rem;
  font-size: 0.82rem;
}

.qb-battle-correct-rg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.qb-battle-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.qb-preview-col {
  position: sticky;
  top: calc(var(--admin-header-h) + 0.75rem);
}

.qb-preview-heading {
  margin-bottom: 0.35rem;
}

.qb-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.qb-preview-toolbar-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.qb-preview-mode-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.qb-preview-mode-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}

/* พรีวิวหน้าจอเกม Quiz Battle — จงใจคงโทน cyber เข้ม เพราะเป็นภาพจำลองจอเกมจริง */
.qb-preview-stage {
  /* ตัวแปรเฉพาะกล่องนี้: กลับไปใช้โทนสว่างบนพื้นเข้ม */
  --muted: #94a3b8;
  --text: #e2e8f0;
  color: #e2e8f0;
  position: relative;
  min-height: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(165deg, #070b14 0%, #0e1528 45%, #0a0e18 100%);
  border: 1px solid rgba(0, 242, 255, 0.22);
  box-shadow:
    inset 0 0 80px rgba(0, 80, 120, 0.15),
    0 0 24px rgba(255, 46, 229, 0.08);
}

.qb-preview-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 242, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
}

@media (min-width: 400px) {
  .qb-preview-hud {
    font-size: 0.68rem;
    padding: 0.5rem 0.65rem;
  }
}

.qb-hud-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.qb-hud-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--qb-cyan-dim);
  border-radius: 4px;
  font-size: 0.75rem;
  box-shadow: 0 0 8px var(--qb-cyan-dim);
}

.qb-hud-cat {
  color: #e8f4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
  text-transform: none;
  font-size: 0.65rem;
  letter-spacing: 0;
}

.qb-hud-center,
.qb-hud-right {
  text-align: center;
  color: var(--qb-cyan);
  text-shadow: 0 0 10px var(--qb-cyan-dim);
}

.qb-hud-right {
  text-align: right;
}

.qb-preview-floor {
  position: relative;
  height: 200px;
  background-image:
    linear-gradient(rgba(0, 242, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 242, 255, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
}

.qb-path {
  position: absolute;
  left: 50%;
  top: 12%;
  bottom: 8%;
  width: 44px;
  transform: translateX(-50%);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(180, 80, 255, 0.35), rgba(80, 40, 160, 0.5));
  border: 2px solid rgba(0, 242, 255, 0.55);
  box-shadow:
    0 0 16px rgba(255, 46, 229, 0.35),
    inset 0 0 20px rgba(0, 242, 255, 0.12);
}

.qb-dome-scene {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -42%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.qb-dome-float {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2px;
}

.qb-dome-qbadge {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  border: 2px solid var(--qb-cyan);
  border-radius: 4px;
  background: rgba(0, 30, 45, 0.85);
  box-shadow: 0 0 14px var(--qb-cyan-dim), 0 0 4px var(--qb-magenta-dim);
}

.qb-dome-chevron {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--qb-gold);
  filter: drop-shadow(0 0 4px rgba(255, 193, 77, 0.8));
  margin-top: 2px;
}

.qb-dome-glass {
  position: relative;
  width: 72px;
  height: 110px;
  border-radius: 36px 36px 10px 10px;
  background: linear-gradient(
    90deg,
    rgba(0, 242, 255, 0.08) 0%,
    rgba(0, 242, 255, 0.22) 45%,
    rgba(0, 242, 255, 0.1) 100%
  );
  border: 2px solid rgba(0, 242, 255, 0.65);
  box-shadow:
    0 0 20px rgba(0, 242, 255, 0.35),
    inset 0 0 30px rgba(0, 180, 220, 0.12);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  overflow: hidden;
}

.qb-dome-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.07) 2px,
    rgba(0, 0, 0, 0.07) 3px
  );
  pointer-events: none;
  opacity: 0.5;
}

.qb-dome-pedestal {
  width: 48px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #4a5568 0%, #1f2937 70%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.qb-dome-lock {
  font-size: 1.15rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 193, 77, 0.6));
}

.qb-modal-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  pointer-events: none;
}

.qb-modal-layer--summary .qb-cyber-modal--question {
  display: none;
}

.qb-cyber-modal {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 1.35rem 1rem 1rem;
  background: var(--qb-bg-modal);
  border-radius: 14px;
  border: 2px solid var(--qb-cyan);
  box-shadow:
    0 0 0 1px rgba(255, 46, 229, 0.4),
    0 0 28px rgba(0, 242, 255, 0.25),
    0 0 60px rgba(255, 46, 229, 0.12);
  pointer-events: none;
}

.qb-cyber-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid var(--qb-magenta);
  box-shadow: 0 0 10px var(--qb-magenta-dim);
  pointer-events: none;
}

.qb-cyber-bracket--tl {
  top: 6px;
  left: 6px;
  border-right: none;
  border-bottom: none;
  border-radius: 4px 0 0 0;
}

.qb-cyber-bracket--tr {
  top: 6px;
  right: 6px;
  border-left: none;
  border-bottom: none;
  border-radius: 0 4px 0 0;
}

.qb-cyber-bracket--bl {
  bottom: 6px;
  left: 6px;
  border-right: none;
  border-top: none;
  border-radius: 0 0 0 4px;
}

.qb-cyber-bracket--br {
  bottom: 6px;
  right: 6px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 4px 0;
}

.qb-cyber-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--qb-cyan);
  border-radius: 4px;
  background: rgba(0, 20, 35, 0.9);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: default;
}

.qb-cyber-title-tab {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(8, 14, 28, 0.95);
  border: 2px solid var(--qb-cyan);
  border-radius: 4px;
  box-shadow: 0 0 12px var(--qb-cyan-dim);
  white-space: nowrap;
}

.qb-cyber-qtext {
  margin: 0.85rem 0 0.75rem;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f0f6ff;
  font-weight: 500;
}

.qb-cyber-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qb-cyber-choice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--qb-cyan-dim);
  background: rgba(0, 25, 40, 0.55);
  font-size: 0.78rem;
  line-height: 1.35;
  color: #e8f0ff;
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.08);
}

.qb-cyber-choice-label {
  font-weight: 700;
  color: var(--qb-cyan);
}

.qb-cyber-choice-txt {
  text-align: left;
  min-width: 0;
  word-break: break-word;
}

.qb-cyber-choice-mark {
  font-size: 1rem;
  font-weight: 800;
  min-width: 1.25rem;
  text-align: center;
}

.qb-cyber-choice--correct {
  border-color: var(--qb-green);
  background: rgba(20, 60, 35, 0.65);
  box-shadow: 0 0 14px rgba(64, 255, 112, 0.35);
}

.qb-cyber-choice--correct .qb-cyber-choice-label {
  color: var(--qb-green);
}

.qb-cyber-choice--wrong {
  border-color: var(--qb-red);
  background: rgba(70, 20, 30, 0.65);
  box-shadow: 0 0 14px rgba(255, 51, 85, 0.35);
}

.qb-cyber-choice--wrong .qb-cyber-choice-label {
  color: var(--qb-red);
}

.qb-cyber-choice--wrong .qb-cyber-choice-mark {
  color: var(--qb-red);
}

.qb-cyber-choice--neutral {
  opacity: 0.75;
}

.qb-cyber-modal--summary {
  max-width: 360px;
  padding-top: 1.5rem;
}

.qb-summary-header {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--qb-cyan-dim);
  border-radius: 6px;
  background: rgba(0, 40, 55, 0.4);
}

.qb-summary-msg {
  text-align: center;
  font-size: 0.82rem;
  color: #dbe7ff;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.qb-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.qb-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.25rem;
  border: 1px solid var(--qb-cyan-dim);
  border-radius: 8px;
  background: rgba(0, 20, 35, 0.5);
  font-size: 0.65rem;
}

.qb-summary-card-icon {
  font-size: 0.9rem;
  opacity: 0.9;
}

.qb-summary-card-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qb-summary-card-val {
  font-size: 1.05rem;
  font-weight: 700;
}

.qb-summary-card-val--green {
  color: var(--qb-green);
  text-shadow: 0 0 10px rgba(64, 255, 112, 0.4);
}

.qb-summary-card-val--cyan {
  color: var(--qb-cyan);
  text-shadow: 0 0 10px var(--qb-cyan-dim);
}

.qb-summary-card-val--gold {
  color: var(--qb-gold);
  text-shadow: 0 0 10px rgba(255, 193, 77, 0.35);
}

.qb-summary-footer-btn {
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--qb-cyan-dim);
  font-size: 0.82rem;
  color: #eef6ff;
  background: rgba(0, 35, 50, 0.5);
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.12);
}

/* quiz_carry — ป้ายต่อช่อง: โหมด neon ไม่ใช้สีขอบ fixed */
.quiz-carry-plaque-slots-root .quiz-carry-theme-grid.quiz-carry-plaque-grid--neon [data-quiz-carry-plaque-color-row='fixed'] {
  opacity: 0.48;
}

.quiz-carry-plaque-slots-root .quiz-carry-plaque-neon-hint {
  color: var(--muted);
}

.quiz-carry-plaque-slots-root .quiz-carry-plaque-image-row {
  grid-template-columns: 1fr;
  max-width: none;
}

.quiz-carry-plaque-slots-root .quiz-carry-plaque-image-row .admin-inp-text {
  width: 100%;
  max-width: none;
  min-width: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.quiz-carry-plaque-slots-root .quiz-carry-plaque-preview-err {
  color: var(--danger);
}

.quiz-carry-plaque-slots-root .quiz-carry-plaque-preview-img {
  vertical-align: top;
  box-sizing: border-box;
}

/* quiz_carry — ปรับขนาดป้ายบนแมป (ทั่วทั้งแมป) */
.quiz-carry-plaque-map-scale-panel {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: none;
}
.quiz-carry-plaque-map-scale-panel__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}
.quiz-carry-plaque-map-scale-panel__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
}
.quiz-carry-plaque-map-scale-range-wrap {
  flex: 1 1 220px;
  min-width: 180px;
}
.quiz-carry-plaque-map-scale-range-wrap input[type='range'] {
  width: 100%;
  margin-top: 0.35rem;
}
.quiz-carry-plaque-map-scale-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.quiz-carry-plaque-map-scale-out {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  padding-bottom: 0.2rem;
}

/* Space shooter admin — per-slot ship image URLs */
.space-shooter-ship-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
.space-shooter-ship-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.space-shooter-ship-slot {
  flex: 0 0 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: center;
}
.space-shooter-ship-url-label {
  flex: 1 1 220px;
  min-width: 160px;
  margin: 0;
}
.space-shooter-ship-url-label input[type='text'] {
  width: 100%;
  max-width: 560px;
  margin-top: 0.2rem;
}
.space-shooter-ship-prev {
  flex: 0 0 48px;
  object-fit: contain;
  background: var(--art-well);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.space-shooter-damage-prev {
  flex: 0 0 56px;
}
.space-shooter-damage-file {
  max-width: 200px;
  font-size: 0.78rem;
}
.space-shooter-ship-slot--ast {
  flex: 0 0 2.25rem;
  font-size: 0.82rem;
}

/* Stack minigame (Tower block) — คอลัมน์ปกติ/ใหญ่เท่ากัน + พรีวิวสัดส่วนตามรูปอ้างอิง (ปกติ 314×103 · ใหญ่ 382×72) */
.space-shooter-ship-row.stack-block-visual-row {
  display: grid;
  grid-template-columns:
    1.75rem
    minmax(0, 1fr)
    min(42vw, 168px)
    auto
    minmax(0, 1fr)
    min(48vw, 200px)
    auto;
  align-items: start;
  gap: 0.45rem 0.55rem;
}
.stack-block-visual-row .space-shooter-ship-url-label {
  flex: unset;
  min-width: 0;
  max-width: 100%;
}
.stack-block-visual-row .space-shooter-ship-url-label input[type='text'] {
  max-width: 100%;
}
.stack-block-visual-row .space-shooter-ship-prev.stack-block-prev {
  flex: unset;
  width: 100%;
  height: auto;
  display: block;
  box-sizing: border-box;
}
.stack-block-visual-row .space-shooter-ship-prev.stack-block-prev--normal {
  aspect-ratio: 314 / 103;
  max-width: 168px;
}
.stack-block-visual-row .space-shooter-ship-prev.stack-block-prev--heavy {
  aspect-ratio: 382 / 72;
  max-width: 200px;
}

/* ===== Evidence Cards admin panel ===== */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.cm-pick {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cm-pick-label {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--text-strong);
}
.cm-pick-prev {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: var(--art-well);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.cm-pick select { width: 100%; }
.cm-section-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.ev-suspect-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  background: var(--surface-2);
}
.ev-suspect-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.ev-suspect-head .ev-suspect-no {
  font-weight: 900;
  font-size: 15px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 4px 12px;
}
.ev-suspect-head label {
  flex: 1 1 240px;
}
.ev-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .ev-cards-grid { grid-template-columns: 1fr; }
}
.ev-card-edit {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ev-card-edit .ev-card-edit-rar {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.ev-card-edit.rar-common .ev-card-edit-rar { color: #64748b; }
.ev-card-edit.rar-rare .ev-card-edit-rar { color: #0284c7; }
.ev-card-edit.rar-legendary .ev-card-edit-rar { color: #b45309; }
.ev-card-edit input,
.ev-card-edit textarea,
.ev-card-edit select {
  width: 100%;
  box-sizing: border-box;
}
.ev-card-edit textarea { min-height: 60px; resize: vertical; }
.ev-card-edit-imgwrap {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ev-card-edit-thumb {
  width: 72px;
  height: 102px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--art-well);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.ev-card-edit-imgcol {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ev-img-picker {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ev-img-picker[hidden] { display: none; }
.ev-img-picker-shell {
  width: min(900px, 94vw);
  max-height: 86vh;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ev-img-picker-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ev-img-picker-head strong { font-size: 16px; color: var(--text-strong); }
.ev-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 4px;
}
.ev-img-grid button {
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--art-well);
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.ev-img-grid button:hover { border-color: var(--accent); transform: translateY(-2px); }
.ev-img-grid button.is-current { border-color: var(--success); }
.ev-img-grid img { width: 100%; height: auto; display: block; border-radius: 4px; }
.ev-img-grid .ev-img-name { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; }

/* Evidence pool count badges (รูปอย่างเดียว) */
.ev-pool-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ev-pool-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: #0f172a; border: 1px solid rgba(15, 23, 42, 0.08); }
.ev-pool-pill.rar-common { background: #e2e8f0; }
.ev-pool-pill.rar-rare { background: #bae6fd; }
.ev-pool-pill.rar-legendary { background: #fde68a; }

/* ============================================================
   Admin redesign (v38) — Sidebar layout + ระบบ CPU/RAM
   ============================================================ */

/* App shell ภายใน: [ sidebar | content ] */
#panel-app {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
/* สำคัญ: id selector มี specificity สูงกว่า [hidden] ของเบราว์เซอร์ → ต้องบังคับซ่อนเมื่อยังไม่ login */
#panel-app[hidden] {
  display: none !important;
}

/* ---- Sidebar (เดิมเป็นแถบแท็บแนวนอน) ---- */
#panel-app .admin-tabs {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.16rem;
  margin: 0;
  padding: 0.55rem 0.5rem 0.7rem;
  overflow-x: visible;
  overflow-y: auto;
  max-height: calc(100vh - var(--admin-header-h) - 2rem);
  position: sticky;
  top: calc(var(--admin-header-h) + 1rem);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scroll-snap-type: none;
}
#panel-app .admin-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
#panel-app .admin-tabs::-webkit-scrollbar-track { background: transparent; }
#panel-app .admin-tabs::-webkit-scrollbar { width: 7px; height: 7px; }

/* ช่องค้นหาเมนู (sticky บนสุดของ sidebar) */
.admin-nav-search {
  position: sticky; top: 0; z-index: 3;
  padding: 0.1rem 0.2rem 0.5rem;
  background: linear-gradient(180deg, #ffffff 72%, rgba(255,255,255,0));
}
.admin-nav-search input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 0.84rem;
  padding: 0.5rem 0.7rem; border-radius: 9px;
  border: 1px solid var(--border-mid); background: var(--surface-3); color: var(--text);
}
.admin-nav-search input::placeholder { color: var(--muted); }
.admin-nav-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.admin-nav-empty { padding: 0.5rem 0.55rem; color: var(--muted); font-size: 0.8rem; }

/* แท็บ → แถวเต็มความกว้างแนวตั้ง */
#panel-app .admin-tabs .tab {
  width: 100%;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.45rem;
  padding: 0.48rem 0.7rem;
  border-radius: 9px;
  scroll-snap-align: none;
}
#panel-app .admin-tabs .tab .tab-desc { display: none; }
#panel-app .admin-tabs .tab .tab-label { font-size: 0.85rem; line-height: 1.25; }
#panel-app .admin-tabs .tab .tab-heading-row { align-items: center; }
#panel-app .admin-tabs .tab.is-active {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: inset 3px 0 0 var(--accent);
}
#panel-app .admin-tabs .tab.is-active .tab-label { color: var(--accent-strong); }

/* หัวข้อกลุ่ม (separator) — กดยุบ/ขยายได้ */
#panel-app .admin-tabs .admin-tab-sep {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.55rem 0 0.1rem;
  padding: 0.32rem 0.45rem;
  cursor: pointer;
  border-radius: 7px;
  user-select: none;
}
#panel-app .admin-tabs .admin-tab-sep:hover { background: var(--surface-3); }
#panel-app .admin-tabs .admin-tab-sep span { font-size: 0.63rem; }
#panel-app .admin-tabs .admin-tab-sep::after { display: none; }
#panel-app .admin-tabs .admin-tab-sep::before {
  content: '▾'; order: 2; margin-left: auto;
  font-size: 0.58rem; color: var(--muted); transition: transform 0.15s;
}
#panel-app .admin-tabs .admin-tab-sep.is-collapsed::before { transform: rotate(-90deg); }
#panel-app .admin-tabs .tab.is-group-hidden,
#panel-app .admin-tabs .tab.is-search-hidden { display: none; }

/* เนื้อหา */
.admin-content { min-width: 0; }
.admin-content > .tab-panel { margin-top: 0; }

.admin-sidebar-backdrop { display: none; }

/* ---- แถบสถานะ CPU/RAM (บน header) ---- */
.admin-sys-stats {
  display: flex; align-items: center; gap: 0.85rem; margin-left: auto;
  padding: 0.38rem 0.75rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.admin-sys-stats[hidden] { display: none; }
.sysstat { display: flex; flex-direction: column; gap: 0.2rem; min-width: 92px; }
.sysstat--up { min-width: auto; gap: 0.12rem; align-items: flex-start; }
.sysstat-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.sysstat-label { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.09em; color: var(--muted); }
.sysstat-val { font-size: 0.82rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sysstat-bar { height: 5px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.sysstat-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width 0.45s ease, background 0.3s; }
.sysstat-bar i.is-warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.sysstat-bar i.is-crit { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ปุ่มแฮมเบอร์เกอร์ (มือถือ) */
.admin-sidebar-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 44px; height: 44px; padding: 0 10px; margin-right: 0.5rem;
  border: 1px solid var(--border-mid); border-radius: 10px; background: #ffffff; cursor: pointer;
}
.admin-sidebar-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); }

/* ---- Responsive: มือถือ/แท็บเล็ต → sidebar เป็น off-canvas ---- */
@media (max-width: 980px) {
  #panel-app { grid-template-columns: 1fr; }
  #panel-app .admin-tabs {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 220;
    width: 272px; max-height: 100vh; border-radius: 0;
    transform: translateX(-102%); transition: transform 0.22s ease;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  }
  .admin-shell.sidebar-open #panel-app .admin-tabs { transform: translateX(0); }
  .admin-shell.sidebar-open .admin-sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, 0.45);
  }
  .admin-sidebar-toggle:not([hidden]) { display: inline-flex; }
  .admin-sys-stats { gap: 0.5rem; padding: 0.3rem 0.55rem; }
  .admin-sys-stats .sysstat { min-width: 64px; }
  .admin-sys-stats .sysstat--up,
  .admin-sys-stats .sysstat--node { display: none; }
}
@media (max-width: 680px) {
  .admin-sys-stats .sysstat--disk { display: none; }
}
@media (max-width: 560px) {
  .admin-sys-stats .sysstat--ram { display: none; }
  .admin-brand-text .admin-tagline { display: none; }
}

/* ============================================================
   Light theme polish (v41) — ผิวสัมผัสสุดท้ายของ dashboard สว่าง
   ============================================================ */

/* หัวเรื่องแผง: มีเส้นแบ่งบาง ๆ ให้แต่ละการ์ดอ่านเป็นบล็อกเดียวกัน */
.admin-content > .tab-panel > h2:first-child,
.admin-content > .tab-panel > .card-title-icon:first-child {
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
  font-size: clamp(1.05rem, 2.5vw, 1.22rem);
  color: var(--text-strong);
}

/* ข้อความสถานะ: อ่านออกชัดบนพื้นขาว */
.msg.ok,
.msg.error {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-weight: 500;
}
.msg.ok { background: #ecfdf5; border: 1px solid #a7f3d0; }
.msg.error { background: #fef2f2; border: 1px solid #fecaca; }
.msg:empty { display: none; }

/* Sidebar: โฟกัส/ตัวอักษรกลุ่ม */
#panel-app .admin-tabs .admin-tab-sep span { color: #94a3b8; letter-spacing: 0.1em; }
#panel-app .admin-tabs .admin-tab-sep:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#panel-app .admin-tabs .tab { color: #475569; }
#panel-app .admin-tabs .tab:hover { background: var(--surface-3); color: var(--text-strong); }
.admin-nav-empty {
  margin: 0.35rem 0.2rem;
  border: 1px dashed var(--border-mid);
  border-radius: 9px;
  text-align: center;
  background: var(--surface-2);
}

/* แถบหัว: ปุ่มลัด/ป้ายผู้ใช้ในหัวข้อ ให้แน่นและอ่านง่าย */
.admin-top-actions .btn {
  padding: 0.42rem 0.75rem;
  font-size: 0.82rem;
}

/* scrollbar ทั้งหน้าให้เข้าธีมสว่าง */
html {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
body::-webkit-scrollbar { width: 11px; height: 11px; }
body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
body::-webkit-scrollbar-track { background: transparent; }

/* กล่องอัปโหลด/ลากวางทั่วไป */
.gauntlet-asset-drop { color: var(--muted); }

/* จอเตี้ย/มือถือ: ตารางไม่ต้องล็อกความสูงจนอึดอัด */
@media (max-width: 640px) {
  .table-wrap { max-height: none; }
}

/* เคารพ prefers-reduced-motion กับสไลด์ sidebar ด้วย */
@media (prefers-reduced-motion: reduce) {
  #panel-app .admin-tabs { transition: none !important; }
}

/* แถบหัว: เมื่อปุ่มลัดตกลงบรรทัดที่สอง ให้ชิดขวาตรงกับแถบสถานะระบบ */
@media (min-width: 641px) {
  .admin-top-actions {
    margin-left: auto;
  }
}

/* ===== Log การใช้งาน (บัญชีผู้ใช้ sub-tab) — การ์ดสถิติ 5 ใบ ===== */
.log-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem;
}
.log-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.log-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.log-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-strong);
}
.log-stat-sub {
  font-size: 0.72rem;
  color: var(--muted);
  min-height: 1em;
}
.log-stat-sub.is-warn {
  color: var(--warn);
}

/* แถวเหตุการณ์ที่นับเป็นการเข้าใช้งาน — ป้ายเล็กต่อท้าย */
.log-visit-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  vertical-align: middle;
}

/* ป้ายชื่อ event ในตาราง log */
.log-event-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ===== ตรวจห้อง (room-check) ===== */
.room-check-type-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
}
.room-check-history-action {
  font-weight: 600;
}
.room-check-history-action.is-reject { color: var(--danger); }
.room-check-history-action.is-dismiss { color: var(--muted); }
.room-check-empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 1.1rem 0.5rem;
}

/* =========================================================================
   [2026-08-06] v43 — relayout Quiz Battle / ชุดคำถามพิเศษ + โมดัลนำเข้า Excel
   ========================================================================= */

/* ---------- Quiz Battle: แถบเครื่องมือด้านบน + ตัวแบ่งหน้า ---------- */
.qb-admin-toolbar {
  position: sticky;
  top: calc(var(--admin-header-h) + 0.5rem);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

/* จอเตี้ย: แถบ ~200px ที่ปักหมุดไว้จะกินพื้นที่แก้ไขจนอึดอัด — ปล่อยให้เลื่อนตามปกติ */
@media (max-height: 820px) {
  .qb-admin-toolbar { position: static; }
}

.qb-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.qb-toolbar-row--filter {
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.qb-toolbar-row--filter .qb-filter-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.qb-toolbar-row--filter .qb-battle-filter-cat {
  flex: 1 1 14rem;
  min-width: 0;
  max-width: 28rem;
  min-height: 44px;
}

.qb-count-badge {
  margin-left: auto;
  align-self: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

.qb-admin-toolbar .msg:empty {
  display: none;
}

.qb-admin-hint {
  margin: 0 0 0.6rem;
  font-size: 0.86rem;
}

/* อยู่ในแถบ sticky — ชิดขอบ ไม่ต้องมีระยะห่างล่าง */
.qb-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

/* พื้นที่แตะ 44px ตามมาตรฐานของโปรเจกต์ — ปุ่มลูกศรเล็กแต่ยังกดง่ายบนมือถือ */
.qb-pager .btn-sm {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 0.55rem;
  font-size: 1.15rem;
  line-height: 1;
}

.qb-pager[hidden] { display: none; }

.qb-pager-info {
  flex: 1 1 9rem;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.qb-pager-size {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.qb-pager-size select {
  font: inherit;
  min-height: 44px;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

/* แถวคำถามที่ถูกซ่อนโดยตัวแบ่งหน้า — ใช้คลาสแยกจาก [hidden] ของตัวกรอง */
.qb-battle-block.is-paged-out {
  display: none !important;
}

/* ---------- ชุดคำถามพิเศษ: step wizard ---------- */
.sq-wizard {
  margin-top: 0.4rem;
}

.sq-wizard-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.sq-wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.sq-wizard-step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 190px;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.sq-wizard-step:hover {
  border-color: var(--border-mid);
  background: var(--card-hover);
}

.sq-wizard-step.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-strong);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.sq-wizard-step.is-active .sq-step-no {
  background: var(--accent);
  color: #fff;
}

.sq-wizard-step .sq-step-txt {
  min-width: 0;
}

.sq-step-panel {
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.sq-step-panel[hidden] { display: none; }

.sq-step-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-strong);
}

.sq-step-hint {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
}

.sq-step-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.sq-actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.sq-actionbar .msg {
  margin: 0;
  flex: 1 1 100%;
}

.sq-actionbar .msg:empty { display: none; }

.sq-wizard .sq-set-tag { margin-left: auto; }

/* ---------- โมดัลกลาง (นำเข้าข้อมูล) ---------- */
.adm-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 3vw, 2rem);
}

.adm-modal[hidden] { display: none; }

.adm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.adm-modal-box {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(90vh, 90dvh);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.adm-modal-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.adm-modal-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-strong);
  flex: 1 1 auto;
}

.adm-modal-x {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.adm-modal-x:hover {
  background: var(--card-hover);
  color: var(--danger);
}

.adm-modal-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.adm-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---------- เนื้อในโมดัลนำเข้า ---------- */
.imp-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 0.85rem;
}

.imp-template-row .muted { flex: 1 1 16rem; min-width: 0; }

.imp-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .imp-grid { grid-template-columns: 1fr 1fr; }
  .imp-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.imp-grid .admin-field,
.imp-file-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  margin: 0;
  min-width: 0;
}

.imp-grid select,
.imp-file-field input[type="file"] {
  font: inherit;
  font-weight: 400;
  min-height: 44px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 0;
  max-width: 100%;
}

.imp-preview:empty { display: none; }

.imp-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.7rem 0.85rem;
  font-size: 0.84rem;
}

.imp-preview-head {
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
}

.imp-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.imp-preview-table th,
.imp-preview-table td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.imp-preview-table th {
  background: var(--surface-3);
  font-weight: 600;
  white-space: nowrap;
}

.imp-preview-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.imp-errors {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  color: var(--danger);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.imp-errors li { list-style: disc; }

/* =========================================================================
   [2026-08-08] v44 — Foundation ที่ใช้ร่วมกันทุกแผง
   (คลาสชุดนี้ถูกใช้ซ้ำในงานรอบถัดไป — อย่าเปลี่ยนชื่อ)
   ========================================================================= */

/* ปุ่มขนาดกะทัดรัด — ใช้ในตาราง/แถบเครื่องมือ */
.btn-sm {
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  border-radius: 9px;
  line-height: 1.25;
}

/* กลุ่มปุ่มในช่องตาราง */
.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* แถบเครื่องมือหัวการ์ด */
.panel-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.panel-toolbar-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

/* กล่องหัวข้อย่อยภายในแผง */
.panel-section {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.panel-section > h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.7rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.35;
}
.panel-section-desc {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}
.panel-section-desc:last-child { margin-bottom: 0; }
.panel-section-desc code {
  font-size: 0.78rem;
  padding: 0.05rem 0.3rem;
  border-radius: 5px;
  background: var(--surface-3);
}
/* ป้ายนับจำนวนบนหัวข้อย่อย */
.panel-section-count {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* กริดฟิลด์ยืดหยุ่น + ฟิลด์ (ป้ายอยู่บน อินพุตอยู่ล่าง) */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
}
.field-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}
.field > input,
.field > select,
.field > textarea {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text);
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
}
.field > input[type='range'] { min-height: 0; padding: 0; border: 0; background: none; }
.field > input[type='color'] { padding: 0.15rem; min-height: 40px; }
.field > input:focus,
.field > select:focus,
.field > textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.field-hint {
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
}

/* แถบปุ่มบันทึกที่ปักอยู่ก้นแผง (แผงยาว ๆ จะได้ไม่ต้องเลื่อนหาปุ่ม) */
.panel-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1.1rem 0 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-width: 0;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(var(--header-blur));
  -webkit-backdrop-filter: blur(var(--header-blur));
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.07);
}
.panel-sticky-actions .msg { margin: 0; }
.panel-sticky-actions-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

/* =========================================================================
   [2026-08-08] v44 — จัดหน้าแผงมินิเกมใหม่ (Minigame-1..7)
   ========================================================================= */

/* แถวรูป/URL ในกล่อง .panel-section — ให้หายใจได้เท่าเดิมแต่ไม่มีกรอบซ้อนกรอบ */
.panel-section > .space-shooter-ship-grid { margin-top: 0.25rem; }
.panel-section > .field-grid + .panel-section-desc { margin-top: 0.75rem; }

/* หัวเรื่องแผง + คำอธิบายใต้หัวเรื่อง */
.panel-intro {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}
.panel-intro code {
  font-size: 0.78rem;
  padding: 0.05rem 0.3rem;
  border-radius: 5px;
  background: var(--surface-3);
}

/* กล่องเตือนสีเหลือง (ใช้ในแผงหยิบมาวาง) */
.panel-note-warn {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: #fffbeb;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
}

/* =========================================================================
   [2026-08-08] v44 — Quiz Battle: ค้นหา · เรียงลำดับ · เลขลำดับรายข้อ
   ========================================================================= */

.qb-toolbar-row--search {
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}
.qb-search-field {
  flex: 1 1 16rem;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.qb-search-field input {
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.4rem 2.4rem 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
}
.qb-search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.qb-search-clear {
  position: absolute;
  right: 0.3rem;
  min-width: 32px;
  min-height: 32px;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.qb-search-clear:hover { background: var(--surface-3); color: var(--text); }

.qb-sort-field {
  flex: 0 1 15rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.qb-sort-field select {
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
}
.qb-sort-note {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}

/* เลขลำดับข้อ — อัปเดตทุกครั้งหลังกรอง/ค้นหา/เรียง */
.qb-battle-num {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qb-battle-block-head { align-items: center; }
.qb-battle-abc-grid { gap: 0.45rem; }
@media (min-width: 640px) {
  .qb-battle-abc-grid { gap: 0.45rem 0.6rem; }
}

/* กันปุ่มกากบาทซ้ำของเบราว์เซอร์ (type="search") — ใช้ปุ่มของเราเอง */
.qb-search-field input::-webkit-search-cancel-button,
.qb-search-field input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* แถบเครื่องมือย่อยใน Quiz Battle: อยู่ในการ์ด sticky อีกที — ลดระยะขอบไม่ให้ซ้อนหนา */
.qb-toolbar-row.panel-toolbar { padding: 0.55rem 0.7rem; }
.qb-modes-actions.panel-toolbar { margin-top: 0.25rem; }

/* ฟิลด์เดี่ยวในกริดไม่ควรยืดเต็มความกว้างการ์ด — อ่านง่ายกว่าเมื่อจำกัดความกว้าง */
.field-grid > .field { max-width: 26rem; }
.field-grid--wide > .field { max-width: 34rem; }

/* =========================================================================
   [2026-08-08] Wave B — ชุดคำถามพิเศษ · การ์ดหลักฐาน · รูปคดี · จบคดี
   ========================================================================= */

/* —— ป้ายระดับการ์ด (rarity) ที่ใช้ร่วมกันในแผงชุดคำถามพิเศษ —— */
.sq-rarity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.sq-rarity-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.1);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sq-rarity-pill.rarity-common { background: #e2e8f0; }
.sq-rarity-pill.rarity-rare { background: #bae6fd; }
.sq-rarity-pill.rarity-legendary { background: #fde68a; }

/* —— รูปการ์ดในตัวเลือก: ต้องเห็นชัดเมื่อรูปหาย (เคสเดิม path ผิดทั้งระบบ) —— */
.sq-card-pick-shot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-height: 96px;
  border-radius: 8px;
  background: var(--art-well, #f1f5f9);
}
.sq-card-pick-shot.is-missing {
  border: 1px dashed #f87171;
  background: #fef2f2;
}
.sq-card-pick-shot.is-missing img { display: none; }
.sq-card-pick-shot.is-missing::after {
  content: attr(data-missing);
  font-size: 0.62rem;
  font-weight: 700;
  color: #b91c1c;
  text-align: center;
  line-height: 1.3;
  padding: 0 0.2rem;
}
.sq-card-preview.is-missing .sq-card-preview-img { display: none; }
.sq-card-preview.is-missing::after {
  content: 'ไม่พบรูปการ์ด';
  display: block;
  padding: 2.2rem 0.6rem;
  border: 1px dashed #f87171;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 700;
}

/* —— แถบรูปตัวอย่างจากพูล (แผงการ์ดหลักฐาน) —— */
.adm-thumb-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.adm-thumb {
  margin: 0;
  width: 74px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.adm-thumb img {
  width: 74px;
  height: 100px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--art-well, #f1f5f9);
  display: block;
}
.adm-thumb figcaption {
  font-size: 0.6rem;
  line-height: 1.25;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adm-thumb.is-missing img { display: none; }
.adm-thumb.is-missing::before {
  content: 'ไม่พบรูป';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 100px;
  border: 1px dashed #f87171;
  border-radius: 7px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.62rem;
  font-weight: 700;
}
.adm-thumb-empty,
.adm-thumb-more {
  align-self: center;
  font-size: 0.76rem;
  color: var(--muted);
}

/* —— ตัวเลือกรูปคดี: พรีวิวสด + สถานะไม่พบรูป/ยังไม่ตั้ง —— */
.cm-pick-shot {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--art-well, #f1f5f9);
  overflow: hidden;
}
.cm-pick-shot .cm-pick-prev {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}
.cm-pick.is-missing .cm-pick-shot,
.cm-pick.is-unset .cm-pick-shot {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cm-pick.is-missing .cm-pick-prev,
.cm-pick.is-unset .cm-pick-prev { display: none; }
.cm-pick.is-missing .cm-pick-shot {
  border: 1px dashed #f87171;
  background: #fef2f2;
}
.cm-pick.is-missing .cm-pick-shot::after {
  content: 'ไม่พบรูป — ไฟล์นี้หายจากเซิร์ฟเวอร์';
  font-size: 0.76rem;
  font-weight: 700;
  color: #b91c1c;
  text-align: center;
  padding: 0 0.6rem;
}
.cm-pick.is-unset .cm-pick-shot {
  border: 1px dashed var(--border-mid, #cbd5e1);
}
.cm-pick.is-unset .cm-pick-shot::after {
  content: 'ยังไม่ตั้งรูป';
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.cm-pick-hint {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}
/* .cm-grid อยู่ในกล่อง .panel-section แล้ว — ไม่ต้องเว้นบนซ้ำ */
.panel-section > .cm-grid { margin-top: 0.25rem; }

/* —— ชื่อผู้ต้องสงสัยบนหัวข้อกล่อง (แผงการ์ดหลักฐาน) —— */
.panel-section.ev-suspect-block {
  border: 1px solid var(--border);
  padding: 0.9rem 1rem 1rem;
  background: var(--card);
}
.ev-suspect-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.panel-section > .ev-pool-counts { margin-top: 0.75rem; }

/* =========================================================================
   [2026-08-08] Wave B — Sidebar: หัวข้อกลุ่มต้องดู "กดได้" ชัดเจน
   ========================================================================= */
#panel-app .admin-tabs .admin-tab-sep {
  transition: background 0.15s;
}
#panel-app .admin-tabs .admin-tab-sep:hover {
  background: var(--surface-3);
}
#panel-app .admin-tabs .admin-tab-sep:hover span { color: var(--text-strong); }
#panel-app .admin-tabs .admin-tab-sep::before {
  content: '▾';
  order: 2;
  margin-left: auto;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--text);
  transition: transform 0.18s ease, color 0.15s;
}
#panel-app .admin-tabs .admin-tab-sep:hover::before { color: var(--accent); }
#panel-app .admin-tabs .admin-tab-sep.is-collapsed::before { transform: rotate(-90deg); }

/* ข้อความสถานะที่วางในแถบเครื่องมือ — ไม่ต้องมี margin ของ <p> */
.panel-toolbar > .msg { margin: 0; }

/* =========================================================================
   [2026-08-08] v46 — Wave C: บัญชี/กระดานผู้นำ · Achievements · แอดมิน ·
   ตรวจห้อง · Test Mode · เสียง
   ========================================================================= */

/* ป้ายติ๊กแบบแถวเดียว (label + checkbox) — เดิมมีสไตล์เฉพาะใน .form-inline เท่านั้น */
.check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check > input[type='checkbox'] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ---- ช่องตัวเลข + ปุ่มบันทึกในตาราง (COINS / คะแนน / ความคืบหน้า) ---- */
.td-coins {
  white-space: nowrap;
}
.td-coins > .input-coins,
.td-coins > .input-score,
.td-coins > input[type='number'] {
  display: inline-block;
  vertical-align: middle;
  width: 5.5rem;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.88rem;
}
/* ปุ่มบันทึกรายแถว — อยู่ข้างช่องกรอก ไม่ตกบรรทัดจนแถวสูงเกินจำเป็น */
.btn-coins-save,
.btn-score-save {
  margin-left: 0.4rem;
  vertical-align: middle;
}
.achv-progress-target {
  margin-left: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  vertical-align: middle;
}

/* ---- Achievements: แคตตาล็อก ---- */
.achv-catalog-table td { vertical-align: middle; }
.achv-catalog-table input[type='text'],
.achv-catalog-table select {
  padding: 0.4rem 0.5rem;
  font-size: 0.88rem;
}
.achv-td-enabled { text-align: center; }
.achv-td-enabled input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- แอดมิน: สิทธิ์รายหมวด จัดกลุ่มตามเมนูซ้าย ---- */
.admin-perm-picker { max-width: 20rem; flex: 1 1 16rem; }
.admin-perm-tabs { margin: 0.75rem 0 0; }
/* กล่องกลุ่มซ้อนในกล่องแผงอยู่แล้ว — ใช้พื้นรองเพื่อไม่ให้เป็นขาวบนขาว */
.admin-perm-group {
  background: var(--surface-2);
  box-shadow: none;
  margin-bottom: 0.75rem;
}
.admin-perm-group:last-child { margin-bottom: 0; }
.admin-perm-group-all {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.admin-perm-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.35rem 0.9rem;
}
.admin-perm-item {
  min-height: 32px;
  font-size: 0.84rem;
}
.admin-perm-save-row { margin-top: 0.85rem; }

/* ---- ตรวจห้อง: กล่องห้องว่างแบบพับได้ ---- */
#room-check-empty-section[hidden] { display: none; }
.panel-section-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
  min-height: 32px;
}
.panel-section-summary::-webkit-details-marker { display: none; }
/* ลูกศรพับ/กาง — หมุนเมื่อกล่องเปิด */
.panel-section-summary::before {
  content: '▸';
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}
details[open] > .panel-section-summary::before { transform: rotate(90deg); }
details[open] > .panel-section-summary { margin-bottom: 0.7rem; }
.panel-section-summary-title { min-width: 0; }
.panel-section-summary .panel-section-count { margin-left: auto; }

/* ---- Test Mode ---- */
.test-mode-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
}
.test-mode-switch > input[type='checkbox'] { width: 22px; height: 22px; }
.test-mode-switch > strong { font-size: 1rem; color: var(--text-strong); }
.test-mode-shortcut-head {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-strong);
}
.test-mode-shortcut-list {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.75;
  font-size: 0.85rem;
  color: var(--text);
}
.test-mode-shortcut-list > li + li { margin-top: 0.4rem; }
.test-room-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.special-card-map-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 42rem;
}

/* ---- เสียง: สไลเดอร์พร้อมตัวเลข % ---- */
.sound-slider-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 500;
}
.sound-slider-val {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.sound-slider-field > input[type='range'] {
  width: 100%;
  min-height: 24px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Banner ข่าวสาร (Main-Lobby) — อัปโหลด/เปิด-ปิด/เรียงลำดับ  [2026-08-10] ---- */
.banner-upload-form {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) minmax(12rem, 2fr) auto;
  gap: 0.75rem;
  align-items: end;
}
.banner-upload-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .banner-upload-form { grid-template-columns: 1fr; }
}
.banner-upload-preview {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 30rem;
}
/* display:flex ด้านบนชนะกฎ [hidden]{display:none} ของ UA (author > UA) — ต้องประกาศเอง
   ไม่งั้นกล่องพรีวิวโผล่ค้างทั้งที่ยังไม่ได้เลือกไฟล์ */
.banner-upload-preview[hidden] {
  display: none;
}
.banner-upload-preview-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.banner-upload-preview > img,
.banner-default-preview > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--art-well);
}
.banner-default-preview { max-width: 30rem; }

.banner-count-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
}

.banner-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.banner-row {
  display: grid;
  /* thumb | ชื่อ+วันที่ | สวิตช์ | ปุ่ม — คอลัมน์กลางยืดได้อย่างเดียว ที่เหลือกว้างตามเนื้อหา */
  grid-template-columns: 8.5rem minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.banner-row.is-on {
  border-left-color: var(--success);
  background: var(--card);
}
.banner-row-thumb {
  aspect-ratio: 457 / 150;
  border-radius: 8px;
  overflow: hidden;
  background: var(--art-well);
  border: 1px solid var(--border);
}
.banner-row-thumb > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.banner-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.banner-row-name {
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  font: 600 0.92rem var(--font);
}
.banner-row-meta {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.banner-row-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.banner-row-switch > input[type='checkbox'] { width: 20px; height: 20px; }
.banner-row-switch > strong { font-size: 0.88rem; color: var(--text-strong); }
.banner-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 720px) {
  .banner-row {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    grid-template-areas: 'thumb main' 'switch actions';
  }
  .banner-row-thumb { grid-area: thumb; }
  .banner-row-main { grid-area: main; }
  .banner-row-switch { grid-area: switch; }
  .banner-row-actions { grid-area: actions; }
}
.banner-empty {
  margin: 0.6rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-3);
}

/* [2026-09-09] แถบค้นหาผู้ใช้ในรายชื่อบัญชี
   ระบบจริงมีเกือบสองพันบัญชี ช่องนี้คือทางเดียวที่จะหาคนเจอ
   ใช้ .panel-toolbar เป็นฐาน แค่บังคับให้ label + ช่อง + ปุ่มล้าง อยู่บรรทัดเดียว
   (input ในหน้านี้ default width:100% ถ้าไม่คุมไว้จะดันปุ่มตกบรรทัด) */
.accounts-search-bar {
  margin: 0 0 0.7rem;
}
.accounts-search-bar > label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}
.accounts-search-bar > input[type="search"] {
  flex: 1 1 18rem;
  width: auto;
  max-width: 30rem;
  margin: 0;
}
