/* Yearce Studio Design System — Precision Dark UI */

:root {
  color-scheme: only dark;
  --bg-canvas: #09090B;
  --bg-panel: #111114;
  --bg-panel-subtle: #0D0D10;
  --bg-control: #16161A;
  --bg-control-hover: #1C1C21;
  --bg-active: #222228;

  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(250, 250, 250, 0.38);
  --inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;

  --cta-bg: #FAFAFA;
  --cta-bg-hover: #E4E4E7;
  --cta-text: #09090B;

  --status-emerald: #10B981;
  --status-emerald-bg: rgba(16, 185, 129, 0.10);
  --status-emerald-border: rgba(16, 185, 129, 0.28);

  --status-danger: #EF4444;
  --status-danger-bg: rgba(239, 68, 68, 0.10);
  --status-danger-border: rgba(239, 68, 68, 0.28);

  --status-warn: #F59E0B;
  --status-warn-bg: rgba(245, 158, 11, 0.10);
  --status-warn-border: rgba(245, 158, 11, 0.28);

  --radius-sm: 6px;
  --radius-md: 8px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  accent-color: #FAFAFA;
  scrollbar-color: #27272A #09090B;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(250, 250, 250, 0.18);
  color: var(--text-primary);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Icons — uniform 1.75px stroke */
.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.icon-sm {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.icon-lg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

/* Brand Mark */
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--text-primary);
  color: var(--bg-canvas);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   MODE A: ACTIVATION GATE (Customer Entry)
   ========================================================================== */
.gate-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.gate-topbar {
  height: 56px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
}

.gate-topbar-inner {
  max-width: 940px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subtle-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  transition: color 140ms ease, background-color 140ms ease;
}

.subtle-ext-link:hover {
  color: var(--text-primary);
  background: var(--bg-control);
}

.gate-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.gate-split {
  width: 100%;
  max-width: 892px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--inset-highlight);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
}

.gate-left {
  padding: 36px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border-hairline);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.gate-headline {
  font-size: 24px;
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.gate-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.code-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.code-input-wrap .input {
  padding-right: 78px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  height: 40px;
}

.code-input-wrap .input::placeholder {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.paste-inline-btn {
  position: absolute;
  right: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.paste-inline-btn:hover {
  background: var(--bg-control-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Architectural Index (Right Column) */
.gate-right {
  background: var(--bg-panel-subtle);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.arch-index {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.arch-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-hairline);
  align-items: baseline;
}

.arch-item:last-child {
  border-bottom: 0;
}

.arch-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.arch-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.arch-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.arch-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.gate-footer {
  height: 48px;
  border-top: 1px solid var(--border-hairline);
}

.gate-footer-inner {
  max-width: 940px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODE B: ACTIVE STUDIO SHELL & ADMIN CONSOLE SHELL
   ========================================================================== */
.studio-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.studio-topbar {
  height: 52px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  position: sticky;
  top: 0;
  z-index: 30;
}

.studio-topbar-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 14px;
  user-select: none;
}

.breadcrumb-current {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.voucher-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--text-secondary);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--text-primary);
}

.meta-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--status-emerald);
}

.studio-main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ==========================================================================
   COMMON CONTROLS, BUTTONS, INPUTS, VALIDATION
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

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

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-lg {
  height: 40px;
  padding: 0 16px;
  font-size: 13.5px;
}

.btn-primary {
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--cta-bg-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-control-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-control);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: #FCA5A5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FEE2E2;
}

.input,
.select {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-control);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover:not(:disabled),
.select:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus {
  border-color: var(--border-focus);
  background: var(--bg-control-hover);
}

/* Modern Web Guidance: validate-input-after-interaction (:user-invalid + fallback) */
:is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--status-danger) !important;
  background-color: rgba(239, 68, 68, 0.06);
}

:is(:user-invalid, .user-invalid-fallback) ~ .field-error {
  display: flex;
}

.field-error {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: #FCA5A5;
}

.inline-feedback {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.4;
  border: 1px solid var(--border-hairline);
  background: var(--bg-control);
  color: var(--text-secondary);
}

.inline-feedback[data-tone="error"] {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: #FCA5A5;
}

.inline-feedback[data-tone="ok"] {
  background: var(--status-emerald-bg);
  border-color: var(--status-emerald-border);
  color: #6EE7B7;
}

.inline-feedback[data-tone="warn"] {
  background: var(--status-warn-bg);
  border-color: var(--status-warn-border);
  color: #FCD34D;
}

/* Panels & Sections */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--inset-highlight);
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Segmented Radio / Pill Controls */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-hairline);
}

.segmented-full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.seg-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn[aria-checked="true"],
.seg-btn.is-active {
  background: var(--bg-control-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Password / Stream key input with trailing button */
.input-action-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-action-wrap .input {
  padding-right: 74px;
}

.input-trailing-btn {
  position: absolute;
  right: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.input-trailing-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ==========================================================================
   WORKSPACE 1: STREAM (62% / 38%)
   ========================================================================== */
.grid-stream {
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
  gap: 16px;
  align-items: start;
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scene-tile {
  text-align: left;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-control);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.scene-tile:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-strong);
}

.scene-tile[aria-checked="true"] {
  border-color: var(--text-primary);
  background: var(--bg-control-hover);
}

.scene-preview {
  height: 52px;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  overflow: hidden;
  position: relative;
}

.scene-tile[aria-checked="true"] .scene-preview {
  color: var(--status-emerald);
  border-color: var(--status-emerald-border);
}

.scene-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.scene-caption {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Clean Dropzone */
.dropzone {
  position: relative;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-panel-subtle);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--text-secondary);
  background: var(--bg-control);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.dropzone-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.file-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
}

.file-readout-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-readout-size {
  color: var(--text-muted);
  flex-shrink: 0;
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

/* Telemetry Card */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border-hairline);
  background: var(--bg-control);
  color: var(--text-secondary);
}

.status-badge[data-state="live"] {
  background: var(--status-emerald-bg);
  border-color: var(--status-emerald-border);
  color: var(--status-emerald);
}

.status-badge[data-state="warn"] {
  background: var(--status-warn-bg);
  border-color: var(--status-warn-border);
  color: var(--status-warn);
}

.status-badge[data-state="danger"] {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status-badge[data-state="live"] .pulse-dot {
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.kv-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-hairline);
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12.5px;
}

.kv-row:last-child {
  border-bottom: 0;
}

.kv-key {
  color: var(--text-muted);
}

.kv-val {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.guide-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.guide-step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 1px;
}

/* ==========================================================================
   WORKSPACE 2: GAME (Command strip + 58% / 42%)
   ========================================================================== */
.command-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--inset-highlight);
  flex-wrap: wrap;
}

.command-strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.dim-tag {
  height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.readonly-url {
  flex: 1;
  min-width: 180px;
  height: 30px;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.grid-game {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  gap: 16px;
  align-items: start;
}

.checkerboard-stage {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background-color: #0B0B0E;
  background-image:
    linear-gradient(45deg, #101014 25%, transparent 25%),
    linear-gradient(-45deg, #101014 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #101014 75%),
    linear-gradient(-45deg, transparent 75%, #101014 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  min-height: 430px;
  overflow: hidden;
  position: relative;
}

.overlay-preview-iframe {
  width: 100%;
  height: 430px;
  border: 0;
  display: block;
  background: transparent;
}

.score-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  font-size: 13px;
}

.score-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.score-rank {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  width: 22px;
}

.score-author {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--status-emerald);
}

.sim-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 8px;
}

/* ==========================================================================
   WORKSPACE 3: STUDIO (Tabs + 55% / 45%)
   Modern Web Guidance: tabs (shape underline via border on ::after, single row)
   ========================================================================== */
.studio-tablist {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: 18px;
  scrollbar-width: none;
}

.studio-tab {
  position: relative;
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 120ms ease;
}

.studio-tab:hover {
  color: var(--text-primary);
}

.studio-tab[aria-selected="true"] {
  color: var(--text-primary);
}

.studio-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 2px solid var(--text-primary);
}

.tab-credit-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.grid-studio {
  display: grid;
  grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
  gap: 16px;
  align-items: start;
}

/* Toggle Switch Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.toggle-input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Color Swatches */
.swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 120ms ease, border-color 120ms ease;
}

.color-swatch[aria-checked="true"] {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.hex-input {
  width: 112px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* ==========================================================================
   WORKSPACE 4: TRACK (Quick-Add + Telegram Bar + Linear Table + Timeline)
   ========================================================================== */
.quick-add-bar {
  padding: 14px 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px auto auto;
  gap: 8px;
  align-items: start;
}

.telegram-bar {
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.telegram-bar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.telegram-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cmd-copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-control);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.cmd-copy-pill:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-strong);
}

.telegram-cheatsheet {
  border-top: 1px solid var(--border-hairline);
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cheat-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cheat-cmd {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 11.5px;
}

.cheat-desc {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* ==========================================================================
   RESPONSIVE DATA TABLES (Modern Web Guidance: responsive-table)
   ========================================================================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(520px, 75vh);
  container-type: inline-size;
}

.table-wrapper:focus-visible {
  outline: 1px solid var(--border-focus);
  outline-offset: -1px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.data-table caption {
  text-align: left;
}

.data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.data-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11.5px;
  padding: 9px 14px;
  background: var(--bg-panel-subtle);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}

.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover th,
.data-table tbody tr:hover td {
  background: #141418;
}

.cell-product-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-product-link:hover {
  text-decoration: underline;
}

.price-drop-val {
  color: var(--status-emerald);
  font-weight: 600;
}

@container (width < 640px) {
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    margin: 10px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    background: var(--bg-panel-subtle);
    border-bottom: 1px solid var(--border-hairline);
  }

  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
  }

  .data-table td:nth-child(2)::before { content: var(--label-2) ": "; color: var(--text-muted); }
  .data-table td:nth-child(3)::before { content: var(--label-3) ": "; color: var(--text-muted); }
  .data-table td:nth-child(4)::before { content: var(--label-4) ": "; color: var(--text-muted); }
  .data-table td:nth-child(5)::before { content: var(--label-5) ": "; color: var(--text-muted); }
  .data-table td:nth-child(6)::before { content: var(--label-6) ": "; color: var(--text-muted); }
}

/* Timeline */
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12.5px;
  align-items: baseline;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.timeline-msg {
  color: var(--text-secondary);
}

.empty-state {
  padding: 28px 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   NATIVE MODAL DIALOG (Modern Web Guidance: dialog + light-dismiss-a-dialog)
   ========================================================================== */
dialog {
  margin: auto;
  width: min(440px, calc(100vw - 32px));
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65), var(--inset-highlight);
  padding: 0;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-inner {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* ==========================================================================
   ADMIN CONSOLE SPECIFIC LAYOUTS
   ========================================================================== */
.admin-auth-wrap {
  min-height: calc(100dvh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-auth-card {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--inset-highlight);
  margin-bottom: 18px;
  overflow: hidden;
}

.kpi-cell {
  padding: 16px 18px;
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-cell:last-child {
  border-right: 0;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.grid-admin-gen {
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}

.qty-row {
  display: grid;
  grid-template-columns: auto 100px;
  gap: 8px;
  align-items: center;
}

.form-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.output-pad {
  flex: 1;
  min-height: 220px;
  width: 100%;
  resize: vertical;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  outline: none;
}

.code-copy-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  margin: -3px -6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.code-copy-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-hairline);
}

/* Toast Notification (subtle bottom-right) */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 920px) {
  .gate-split,
  .grid-stream,
  .grid-game,
  .grid-studio,
  .grid-admin-gen {
    grid-template-columns: 1fr;
  }

  .gate-left {
    border-right: 0;
    border-bottom: 1px solid var(--border-hairline);
    padding: 28px 24px;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-cell:nth-child(2) {
    border-right: 0;
  }

  .kpi-cell:nth-child(1),
  .kpi-cell:nth-child(2) {
    border-bottom: 1px solid var(--border-hairline);
  }

  .quick-add-bar {
    grid-template-columns: 1fr;
  }

  .telegram-cheatsheet {
    grid-template-columns: 1fr;
  }
}

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

  .sim-row {
    grid-template-columns: 1fr;
  }

  .qty-row {
    grid-template-columns: 1fr;
  }
}
