/* ============================================================
 *  CODE2VIDEO — tech-noir UI
 *  palette: deep navy + cyan / magenta accents
 * ============================================================ */

:root {
  --bg: #05070d;
  --bg-2: #0a0f1c;
  --panel: rgba(10, 16, 28, 0.72);
  --panel-border: rgba(0, 240, 255, 0.18);
  --panel-border-hot: rgba(0, 240, 255, 0.55);
  --text: #d9f4ff;
  --text-dim: #6b8aa3;
  --accent: #00f0ff;            /* cyan */
  --accent-2: #ff3df0;           /* magenta */
  --accent-3: #76ff9c;           /* green */
  --danger: #ff5577;
  --warn: #ffc857;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: 'Orbitron', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at top, rgba(0, 240, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(255, 61, 240, 0.06), transparent 60%),
    var(--bg);
}

/* --------- background decor ------------------------------ */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}
.glow-1 { background: var(--accent); top: -200px; left: -150px; }
.glow-2 { background: var(--accent-2); bottom: -240px; right: -180px; opacity: 0.16; }

/* --------- top bar --------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  background: rgba(5, 7, 13, 0.78);
}
.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  color: var(--accent);
  font-size: 24px;
  text-shadow: 0 0 14px var(--accent);
  letter-spacing: -2px;
  line-height: 1;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 18px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.45);
}
.brand-name .accent { color: var(--accent); }
.brand-sub {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 2px;
  font-family: var(--mono);
}

/* --------- language toggle ------------------------------- */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}
.lang-btn {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 6px 14px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all .15s;
  font-weight: 600;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--accent);
  color: #001218;
  text-shadow: none;
}

@media (max-width: 900px) {
  .topbar-inner { grid-template-columns: auto auto; row-gap: 12px; }
  .sysinfo { grid-column: 1 / -1; order: 3; }
  .lang-toggle { justify-self: end; }
}

/* --------- sysinfo widget in topbar ---------------------- */
.sysinfo {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.sys-cell {
  width: 96px;
  padding: 6px 10px 7px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.04);
  position: relative;
  overflow: hidden;
}
.sys-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
  font-family: var(--display);
  font-weight: 600;
}
.sys-value {
  font-family: var(--display);
  font-weight: 700;
  color: var(--accent);
  font-size: 18px;
  line-height: 1.15;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.45);
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 2px;
}
.sys-value .sys-unit {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  text-shadow: none;
  letter-spacing: 1px;
}
.sys-sub {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.5px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sys-bar {
  margin-top: 5px;
  height: 3px;
  background: rgba(0, 240, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.sys-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s;
}
.sys-cell.hot .sys-value { color: var(--warn); text-shadow: 0 0 6px var(--warn); }
.sys-cell.hot .sys-bar span { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.accent-text { color: var(--accent); }

/* --------- container & panels ---------------------------- */
.container {
  position: relative;
  z-index: 5;
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 22px 26px;
  backdrop-filter: blur(12px);
  box-shadow:
    inset 0 0 1px rgba(0, 240, 255, 0.18),
    0 18px 60px rgba(0, 0, 0, 0.45);
}
.panel::before {
  /* corner ticks */
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 10px;
  pointer-events: none;
  background:
    linear-gradient(135deg, var(--accent) 0 12px, transparent 12px) top left / 14px 14px no-repeat,
    linear-gradient(225deg, var(--accent) 0 12px, transparent 12px) top right / 14px 14px no-repeat,
    linear-gradient(45deg,  var(--accent) 0 12px, transparent 12px) bottom left / 14px 14px no-repeat,
    linear-gradient(-45deg, var(--accent) 0 12px, transparent 12px) bottom right / 14px 14px no-repeat;
  opacity: 0.4;
  mix-blend-mode: screen;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-id {
  font-family: var(--display);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.06);
  line-height: 1;
  flex-shrink: 0;
}
.panel-header h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  white-space: nowrap;
}
.panel-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--panel-border), transparent);
}

.panel-desc { color: var(--text-dim); font-size: 12px; margin: 4px 0 16px; letter-spacing: 1px; }

/* --------- input panel ----------------------------------- */
.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}

#topic-input {
  flex: 1 1 320px;
  min-width: 220px;
}

.workers-input {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  min-width: 92px;
}
.workers-input .wk-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
  font-family: var(--display);
}
.workers-input input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  outline: none;
  text-align: left;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
  padding: 0;
}

.primary-btn { flex: 0 0 auto; min-width: 160px; }

#topic-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  padding: 16px 20px;
  border-radius: 6px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  letter-spacing: 0.5px;
}
#topic-input::placeholder { color: var(--text-dim); }
#topic-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(0, 240, 255, 0.25);
}

.primary-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--accent);
  color: #001218;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 3px;
  padding: 0 28px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  min-width: 200px;
  transition: transform .15s;
}
.primary-btn .btn-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), #80fcff);
  z-index: -1;
  transition: opacity .2s;
}
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:hover .btn-bg { opacity: 0.85; }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled {
  border-color: var(--text-dim);
  color: var(--text-dim);
  cursor: not-allowed;
  transform: none;
}
.primary-btn:disabled .btn-bg {
  background: rgba(107, 138, 163, 0.18);
}
.btn-text { display: inline-flex; gap: 8px; align-items: center; }
.btn-arrow { transition: transform .2s; }
.primary-btn:hover .btn-arrow { transform: translateX(3px); }

.quick-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.suggest-label { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }
.suggest-chip {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all .15s;
}
.suggest-chip:hover {
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent);
}

/* --------- progress panel -------------------------------- */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 8px 0 22px;
}
.stage {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 14px 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.stage .stage-icon {
  font-size: 22px;
  color: var(--text-dim);
  font-family: var(--display);
  transition: all .25s;
}
.stage .stage-label {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.stage.active {
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.35);
}
.stage.active .stage-icon { color: var(--accent); animation: pulse 1.4s infinite; }
.stage.active .stage-label { color: var(--accent); }
.stage.done {
  border-color: var(--accent-3);
  background: rgba(118, 255, 156, 0.08);
}
.stage.done .stage-icon { color: var(--accent-3); }
.stage.done .stage-label { color: var(--accent-3); }
.stage.err {
  border-color: var(--danger);
  background: rgba(255, 85, 119, 0.1);
}
.stage.err .stage-icon { color: var(--danger); }
.stage.err .stage-label { color: var(--danger); }

.progress-bar-wrap { margin-top: 8px; }
.progress-track {
  position: relative;
  height: 10px;
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid var(--panel-border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--accent);
  transition: width .35s ease-out;
}
.progress-shine {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -55deg,
    rgba(255, 255, 255, 0.12) 0 6px,
    transparent 6px 14px
  );
  mix-blend-mode: overlay;
  animation: stripes 1.2s linear infinite;
  pointer-events: none;
}
@keyframes stripes {
  from { transform: translateX(0); }
  to   { transform: translateX(28px); }
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.progress-meta #progress-text { color: var(--accent); font-weight: 700; }

.task-id { color: var(--text-dim); font-size: 11px; letter-spacing: 1px; }

/* --------- split view (tasks + terminal) ----------------- */
.split-view {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
}
@media (max-width: 980px) {
  .split-view { grid-template-columns: 1fr; }
  .stage-grid { grid-template-columns: repeat(3, 1fr); }
  .sysinfo { display: none; }
}

/* --------- tasks list ------------------------------------ */
.tasks-list {
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.tasks-list::-webkit-scrollbar { width: 6px; }
.tasks-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.tasks-empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
}
.tasks-empty .dim { font-size: 10px; opacity: 0.6; margin-top: 4px; }

.task-card {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.task-card:hover {
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.06);
}
.task-card.selected {
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}
.task-card .tc-topic {
  font-size: 12px;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  margin-bottom: 6px;
  /* clamp 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card .tc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.tc-step-badge {
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 1.5px;
  background: rgba(0, 240, 255, 0.08);
}
.tc-step-badge.done { color: var(--accent-3); border-color: var(--accent-3); background: rgba(118, 255, 156, 0.1); }
.tc-step-badge.err  { color: var(--danger); border-color: var(--danger); background: rgba(255, 85, 119, 0.1); }
.tc-step-badge.busy { animation: pulse 1.4s infinite; }

.task-card .tc-bar {
  margin-top: 6px;
  height: 3px;
  background: rgba(0, 240, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.task-card .tc-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s;
  width: 0%;
}

/* --------- terminal -------------------------------------- */
.terminal {
  background: #02060e;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 14px 18px;
  height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.terminal::-webkit-scrollbar { width: 8px; }
.terminal::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.term-line { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.term-line .term-prompt { color: var(--accent); margin-right: 6px; }
.term-line-dim { color: var(--text-dim); }
.term-line-ok  { color: var(--accent-3); }
.term-line-err { color: var(--danger); }
.term-line-warn { color: var(--warn); }
.term-line-step { color: var(--accent-2); font-weight: 700; }
.term-line .ts { color: var(--text-dim); margin-right: 6px; }

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all .15s;
}
.ghost-btn:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
.ghost-btn.small { font-size: 9px; padding: 3px 8px; letter-spacing: 1.5px; }

/* --------- video panel ----------------------------------- */
.video-frame {
  position: relative;
  background: #02060e;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.video-frame::before, .video-frame::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border: 1px solid var(--accent);
}
.video-frame::before {
  top: 8px; left: 8px;
  border-right: 0; border-bottom: 0;
}
.video-frame::after {
  bottom: 8px; right: 8px;
  border-left: 0; border-top: 0;
}

.video-placeholder { text-align: center; color: var(--text-dim); }
.video-placeholder .ph-icon {
  font-size: 60px;
  color: rgba(0, 240, 255, 0.25);
  animation: rotate 12s linear infinite;
}
.video-placeholder .ph-text {
  margin-top: 12px;
  letter-spacing: 4px;
  font-family: var(--display);
  font-size: 14px;
}
.video-placeholder .ph-sub { font-size: 11px; opacity: 0.6; margin-top: 4px; }

#video-el {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: black;
}

.video-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* --------- footer ---------------------------------------- */
.footbar {
  border-top: 1px solid var(--panel-border);
  padding: 16px 36px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  position: relative;
  z-index: 5;
}

/* --------- mode tabs ------------------------------------- */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.mode-tab {
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--mono);
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  min-height: 70px;
}
.mode-tab:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}
.mode-tab.active {
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.1);
  color: var(--text);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}
.mode-tab .mode-tab-id {
  grid-row: 1 / 3;
  grid-column: 1;
  align-self: center;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-family: var(--display);
  font-weight: 800;
  color: var(--accent);
  font-size: 11px;
  background: rgba(0, 240, 255, 0.08);
}
.mode-tab.active .mode-tab-id { text-shadow: 0 0 8px var(--accent); box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
.mode-tab .mode-tab-name {
  grid-row: 1; grid-column: 2;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2.5px;
  line-height: 1.2;
}
.mode-tab .mode-tab-desc {
  grid-row: 2; grid-column: 2;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  line-height: 1.4;
}
@media (max-width: 980px) {
  .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .mode-tabs { grid-template-columns: 1fr; }
}

.mode-body { margin-top: 16px; }

.narration-toolbar {
  margin-bottom: 12px;
  gap: 10px;
}
.narration-toolbar .form-hint {
  margin-top: 0;
  margin-left: auto;
  flex: 0 1 auto;
  white-space: nowrap;
}

/* --------- form bits ------------------------------------- */
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.form-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  font-family: var(--display);
}
.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.5px;
  line-height: 1.5;
}
.form-hint.dim { opacity: 0.7; }

.big-area {
  width: 100%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 6px;
  outline: none;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.big-area:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(0, 240, 255, 0.2);
}
.big-area.mono { font-family: var(--mono); }
.big-area::placeholder { color: var(--text-dim); white-space: pre; }

/* segmented control */
.seg-control {
  display: inline-flex;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
}
.seg-btn {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-dim);
  border: none;
  border-right: 1px solid var(--panel-border);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .15s;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--text); background: rgba(0, 240, 255, 0.05); }
.seg-btn.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

/* switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input { display: none; }
.switch .slider {
  position: relative;
  width: 38px;
  height: 20px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  transition: all .2s;
}
.switch .slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all .2s;
}
.switch input:checked + .slider {
  background: rgba(0, 240, 255, 0.3);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
}
.switch input:checked + .slider::after {
  background: var(--accent);
  left: 20px;
  box-shadow: 0 0 8px var(--accent);
}
.switch .switch-label {
  font-family: var(--display);
  letter-spacing: 3px;
  font-size: 11px;
  color: var(--text);
}

.preview-row {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--panel-border);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.025);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.preview-row .form-hint { margin: 0; flex: 1 1 240px; }

/* voice row — same shell as preview-row but with extra controls */
.voice-row {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--panel-border);
  border-radius: 6px;
  background: rgba(255, 160, 0, 0.03);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.voice-row .form-hint { margin: 0; flex: 1 1 240px; }
.voice-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.voice-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.voice-pick .vp-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.voice-pick select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  min-width: 240px;
  max-width: 320px;
}
.voice-pick select optgroup {
  color: var(--accent, #00f0ff);
  background: rgba(0, 0, 0, 0.9);
  font-style: normal;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.voice-pick select option {
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  padding: 2px 6px;
}
.voice-pick input[type="range"] {
  width: 110px;
  accent-color: #ffb547;
}
.voice-pick .vp-value {
  font-size: 11px;
  color: var(--muted);
  min-width: 42px;
  text-align: right;
}
.voice-engine {
  font-size: 11px;
}

/* code mode files list */
.code-files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.code-file-item {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px;
}
.code-file-item .cf-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.code-file-item input.cf-name {
  flex: 1;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.code-file-item textarea.cf-code {
  width: 100%;
  background: #02060e;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
}
.code-file-item .cf-del {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 3px 8px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}

/* --------- preview modal --------------------------------- */
/* 关键：[hidden] 必须显式覆盖，否则 display:flex 会让 hidden 失效 */
[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 6, 16, 0.85);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1200px, 95vw);
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--panel-border-hot);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.4);
  display: flex;
  flex-direction: column;
}
.modal-panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 10px;
  pointer-events: none;
  background:
    linear-gradient(135deg, var(--accent) 0 14px, transparent 14px) top left / 16px 16px no-repeat,
    linear-gradient(225deg, var(--accent) 0 14px, transparent 14px) top right / 16px 16px no-repeat,
    linear-gradient(45deg,  var(--accent) 0 14px, transparent 14px) bottom left / 16px 16px no-repeat,
    linear-gradient(-45deg, var(--accent) 0 14px, transparent 14px) bottom right / 16px 16px no-repeat;
  opacity: 0.7;
}
.modal-header {
  padding: 18px 22px 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.modal-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 3px;
}
.modal-tag {
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 4px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}
.icon-btn {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.icon-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 85, 119, 0.1);
}
.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 22px;
  overflow-y: auto;
}
.modal-col-label {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}
.modal-footer {
  padding: 12px 22px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--panel-border);
}
.modal-footer .form-hint { margin-right: auto; margin-top: 0; }

@media (max-width: 760px) {
  .modal-body { grid-template-columns: 1fr; }
}

/* --------- face video uploader / compose modes ----------- */
.face-row {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed rgba(0, 240, 255, 0.22);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.face-row-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.face-row-head .form-label {
  color: var(--accent);
}
.face-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.face-status {
  font-size: 12px;
  letter-spacing: 0.5px;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.face-status.ok {
  color: var(--accent-3);
}
.face-status.err {
  color: var(--danger);
}
.face-upload-btn {
  cursor: pointer;
}
.face-clear {
  color: var(--text-dim);
}

.face-modes-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  font-family: var(--display);
  margin-bottom: 8px;
}
.face-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 760px) {
  .face-mode-grid { grid-template-columns: 1fr; }
}
.face-mode-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(10, 16, 28, 0.5);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.face-mode-chip:hover {
  border-color: var(--panel-border-hot);
  background: rgba(0, 240, 255, 0.06);
  transform: translateY(-1px);
}
.face-mode-chip.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(255, 61, 240, 0.08));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 0 18px rgba(0, 240, 255, 0.25);
}
.face-mode-chip .fm-id {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 1px;
}
.face-mode-chip .fm-name {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 13px;
}
.face-mode-chip .fm-desc {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.4;
}

/* group label between PRO modes and v1 modes */
.face-mode-group-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  font-family: var(--display);
  margin: 14px 0 6px;
  text-transform: uppercase;
}
.face-mode-group-label:first-child { margin-top: 0; }

/* PRO chips get a subtle accent ring even when inactive */
.face-mode-chip.face-mode-pro {
  border-color: rgba(255, 61, 240, 0.28);
  background: rgba(255, 61, 240, 0.04);
}
.face-mode-chip.face-mode-pro:hover {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, rgba(255, 61, 240, 0.10), rgba(0, 240, 255, 0.04));
}
.face-mode-chip.face-mode-pro.active {
  background: linear-gradient(135deg, rgba(255, 61, 240, 0.22), rgba(0, 240, 255, 0.08));
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2) inset, 0 0 18px rgba(255, 61, 240, 0.3);
}
.face-mode-chip.face-mode-pro .fm-id {
  color: var(--accent-2);
}

/* face ratio slider row */
.face-ratio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding: 10px 14px;
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 4px;
}
.face-ratio-row .form-label {
  color: var(--accent);
  margin: 0;
}
.face-ratio-row input[type="range"] {
  flex: 1 1 220px;
  min-width: 200px;
  accent-color: var(--accent-2);
}
.face-ratio-row .face-ratio-val {
  min-width: 52px;
  text-align: right;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.face-ratio-row .form-hint { margin: 0; flex: 0 1 auto; }

/* ---- face_position toggle (vstack_pro only) -------------- */
.face-position-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0 4px;
  padding: 10px 14px;
  background: rgba(191, 90, 242, 0.04);
  border: 1px solid rgba(191, 90, 242, 0.20);
  border-radius: 4px;
}
.face-position-row .form-label {
  color: #d59cff;
  margin: 0;
}
.face-position-group {
  display: flex;
  gap: 6px;
  flex: 0 1 auto;
}
.face-pos-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(213, 156, 255, 0.35);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.face-pos-chip:hover {
  border-color: rgba(213, 156, 255, 0.6);
  background: rgba(213, 156, 255, 0.06);
}
.face-pos-chip.active {
  background: rgba(213, 156, 255, 0.15);
  border-color: #d59cff;
  color: #f0d8ff;
  box-shadow: 0 0 0 1px rgba(213, 156, 255, 0.4) inset;
}
.face-pos-chip .fp-icon {
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}
.face-position-row .form-hint { margin: 0; flex: 1 1 100%; }

/* --------- recompose panel ------------------------------------ */
.recompose-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(213, 156, 255, 0.25);
  background: rgba(191, 90, 242, 0.03);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recompose-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(213, 156, 255, 0.20);
}
.recompose-face-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.recompose-face-row .form-label { margin: 0; }
.recompose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.recompose-actions .mono { font-size: 11px; }

/* ============================================================
   BILLING / PRICING UI
   ============================================================ */
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  margin-right: 10px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
}
.topbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}
.topbar-btn-icon { font-size: 13px; line-height: 1; }

.tc-bill-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px; height: 24px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--accent);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  opacity: 0.65;
  transition: all .15s;
}
.tc-bill-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.18);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}
.task-card { position: relative; }

.billing-panel { width: min(1100px, 96vw); }
.pricing-panel { width: min(900px, 95vw); }

.billing-body,
.pricing-body {
  display: block;
  padding: 16px 22px;
  overflow-y: auto;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.bill-card {
  padding: 12px 14px;
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}
.bill-card-label {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.bill-card-value {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}
.bill-card-sub {
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.billing-section { margin-bottom: 22px; }
.bill-section-head {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
  text-transform: uppercase;
}
.bill-section-sub {
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
  text-transform: none;
  text-shadow: none;
}

.bill-table-wrap {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: auto;
  max-height: 320px;
}
.bill-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono, monospace);
  font-size: 12px;
}
.bill-table th,
.bill-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
  white-space: nowrap;
}
.bill-table th {
  background: rgba(0, 240, 255, 0.05);
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
.bill-table td.num,
.bill-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bill-table tr:hover td { background: rgba(0, 240, 255, 0.04); }
.bill-table tr:last-child td { border-bottom: none; }

.bill-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  background: rgba(0, 240, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 12px 14px;
}
.bill-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono, monospace);
  font-size: 12px;
}
.bill-kv-label { color: var(--text-dim); font-size: 11px; }
.bill-kv-value { color: var(--text); font-weight: 600; }
.bill-kv-value.accent { color: var(--accent); }

/* ----- pricing modal ----- */
.pricing-section { margin-bottom: 20px; }
.pricing-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.pricing-row .form-label {
  min-width: 140px;
  margin: 0;
  font-size: 12px;
  color: var(--text);
}
.pricing-input {
  flex: 0 0 140px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
}
.pricing-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}
.pricing-table input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 3px;
  text-align: left;
}
.pricing-table input.num { text-align: right; font-variant-numeric: tabular-nums; }
.pricing-table input:hover { border-color: var(--panel-border); }
.pricing-table input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.05);
}
.pricing-table .row-del-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  width: 24px; height: 24px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.pricing-table .row-del-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.pricing-table tr.fallback td { background: rgba(0, 240, 255, 0.06); }
.pricing-table tr.fallback .row-del-btn { visibility: hidden; }
.pricing-notice {
  background: rgba(255, 195, 0, 0.06);
  border: 1px solid rgba(255, 195, 0, 0.3);
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text);
}

/* override grid layout for billing/pricing modals */
#billing-modal .modal-body,
#pricing-modal .modal-body {
  grid-template-columns: 1fr;
}

@media (max-width: 760px) {
  .billing-summary { grid-template-columns: 1fr; }
  .bill-kv-grid { grid-template-columns: 1fr; }
}

/* --------- animations ------------------------------------ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ============================================================
 *  AUTH / USER BAR / REDEEM / ADMIN
 * ============================================================ */
#app-root.blurred { filter: blur(3px); pointer-events: none; }

.user-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px;
}
.user-bar .ub-credits-label { font-size: 10px; color: var(--text-dim); letter-spacing: .5px; margin-right: 2px; }
.user-bar .ub-credits { color: var(--accent-3); font-weight: 700; }
.user-bar .ub-tier {
  font-size: 11px; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--panel-border); border-radius: 4px; padding: 1px 6px;
}
.user-bar .ub-name { font-size: 12px; color: var(--text-dim); }
.topbar-btn.ghost { opacity: 0.7; }

.auth-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(3, 5, 10, 0.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  width: 380px; max-width: 92vw;
  background: var(--panel); border: 1px solid var(--panel-border-hot);
  border-radius: 12px; padding: 32px 28px;
  box-shadow: 0 0 60px rgba(0, 240, 255, 0.15);
}
.auth-brand {
  font-family: var(--display); font-size: 26px; font-weight: 800;
  text-align: center; letter-spacing: 2px;
}
.auth-brand .accent { color: var(--accent-2); }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 11px; margin: 6px 0 20px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; padding: 8px; background: transparent; cursor: pointer;
  border: 1px solid var(--panel-border); color: var(--text-dim);
  border-radius: 6px; font-family: var(--mono); font-size: 13px;
}
.auth-tab.active { border-color: var(--accent); color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  width: 100%; padding: 11px 12px; background: var(--bg-2);
  border: 1px solid var(--panel-border); border-radius: 6px;
  color: var(--text); font-family: var(--mono); font-size: 13px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-error {
  color: var(--danger); font-size: 12px; padding: 6px 8px;
  border: 1px solid var(--danger); border-radius: 6px; background: rgba(255,85,119,0.08);
}
.auth-note { text-align: center; color: var(--text-dim); font-size: 11px; margin-top: 16px; }

/* modal-card — shared base for redeem/admin modals */
.modal-card {
  position: relative;
  z-index: 1;
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--panel-border-hot);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card .modal-header {
  padding: 18px 22px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
}
.modal-card .modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  flex: 1;
}
.modal-card .modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-card .modal-close:hover { color: var(--text-bright); }
.modal-card .modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

/* redeem */
.modal-card.sm { width: 460px; }
.redeem-balance { margin-bottom: 12px; color: var(--text-dim); }
.redeem-balance b { color: var(--accent-3); font-size: 18px; }
.redeem-input {
  width: 100%; padding: 11px 12px; background: var(--bg-2);
  border: 1px solid var(--panel-border); border-radius: 6px;
  color: var(--text); font-family: var(--mono); margin-bottom: 10px; letter-spacing: 1px;
}
.redeem-input:focus { outline: none; border-color: var(--accent); }
.redeem-msg { min-height: 20px; font-size: 13px; margin-bottom: 10px; }
.redeem-msg .ok { color: var(--accent-3); }
.redeem-msg .err { color: var(--danger); }
.redeem-h4 { margin: 18px 0 8px; font-size: 13px; color: var(--text-dim); }
.redeem-ledger { max-height: 220px; overflow: auto; }
.ledger-row {
  display: grid; grid-template-columns: 1fr 60px 80px 1.4fr; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 12px;
}
.ledger-delta.pos { color: var(--accent-3); }
.ledger-delta.neg { color: var(--danger); }
.ledger-type { color: var(--accent); }

/* admin */
.modal-card.lg { width: 900px; max-width: 95vw; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--panel-border); }
.admin-tab {
  padding: 8px 14px; background: transparent; cursor: pointer; border: none;
  color: var(--text-dim); font-family: var(--mono); border-bottom: 2px solid transparent;
}
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-stats { margin-bottom: 12px; color: var(--accent); font-size: 12px; }
.admin-table-wrap { max-height: 420px; overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td {
  padding: 7px 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.admin-table th { color: var(--text-dim); font-weight: 500; position: sticky; top: 0; background: var(--bg-2); }
.admin-table select, .admin-table input {
  background: var(--bg-2); border: 1px solid var(--panel-border); color: var(--text);
  border-radius: 4px; padding: 3px 5px; font-family: var(--mono); font-size: 12px;
}
.row-btn {
  background: transparent; border: 1px solid var(--panel-border); color: var(--accent);
  border-radius: 4px; padding: 3px 8px; cursor: pointer; font-family: var(--mono); font-size: 11px;
  margin-left: 4px;
}
.row-btn:hover { border-color: var(--accent); background: rgba(0,240,255,0.08); }
.adm-actions { white-space: nowrap; }
.admin-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-codes-out {
  width: 100%; height: 110px; background: var(--bg-2); color: var(--accent-3);
  border: 1px solid var(--panel-border); border-radius: 6px; font-family: var(--mono);
  font-size: 12px; padding: 8px; margin-bottom: 12px; resize: vertical;
}
.admin-cfg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.admin-cfg-row label { width: 180px; color: var(--text-dim); font-size: 13px; }
.admin-cfg-row input {
  background: var(--bg-2); border: 1px solid var(--panel-border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-family: var(--mono); width: 140px;
}
.admin-cfg-msg { margin-left: 12px; color: var(--accent-3); font-size: 12px; }
.ok { color: var(--accent-3); }
