/* ==========================================================================
   Kinox 3D/4D World Generation Engine - Pro Studio Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #07090e;
  --bg-panel: #0d1117;
  --bg-card: #141923;
  --bg-card-hover: #1c2331;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #58a6ff;
  
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #6e7681;

  --accent-cyan: #58a6ff;
  --accent-blue: #1f6feb;
  --accent-purple: #8957e5;
  --accent-emerald: #2ea043;
  --accent-rose: #f85149;
  --accent-amber: #d29922;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Standardized Design Tokens & Sizing */
  --btn-xs-h: 26px;
  --btn-sm-h: 32px;
  --btn-md-h: 38px;
  --btn-lg-h: 46px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --sidebar-width: 350px;
  --topbar-height: 52px;

  /* shadcn/ui Design Tokens (Slate/Dark Scheme) */
  --background: 222 47% 7%;
  --foreground: 210 40% 98%;
  --card: 222 47% 9%;
  --card-foreground: 210 40% 98%;
  --popover: 222 47% 9%;
  --popover-foreground: 210 40% 98%;
  --primary: 217 91% 60%;
  --primary-foreground: 222 47% 11%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --accent: 217 33% 17%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 63% 31%;
  --destructive-foreground: 210 40% 98%;
  --border: 217 33% 17%;
  --input: 217 33% 17%;
  --ring: 224 76% 48%;
  --radius: 0.5rem;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Component display rules (e.g. .tool-btn { display: inline-flex }) must not override the hidden attribute. */
[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   Top Studio Application Bar (Header)
   ========================================================================== */
.studio-topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

/* Left: Brand */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  transition: opacity 0.2s ease;
}

.topbar-brand:hover {
  opacity: 0.9;
}

.brand-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.35);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-main);
}

.brand-accent {
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid rgba(88, 166, 255, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Center: 3D Camera Controls */
.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  /* An overflow that is left anyway goes to the scrollable end instead of cutting off the first tools. */
  justify-content: safe center;
  /* Shrinks and scrolls on narrow screens instead of pushing the account button off the bar. */
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar-center::-webkit-scrollbar {
  display: none;
}

.topbar-left,
.topbar-right {
  flex-shrink: 0;
}

.camera-control-group {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px 4px;
  gap: 3px;
}

.tool-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.tool-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.tool-btn.active {
  background: var(--accent-cyan);
  color: #07090e;
  font-weight: 700;
  box-shadow: 0 1px 6px rgba(88, 166, 255, 0.35);
}

.tool-btn-icon {
  padding: 0 8px;
  font-size: 13px;
}

.tool-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
  margin: 0 3px;
}

/* A tool shows its label, or only its icon while the labels do not fit the bar (fitTopbarTools in app.js):
   is-compact keeps the navigation modes named, is-icons leaves every tool to its icon and title. */
.tool-icon {
  display: none;
  font-size: 13px;
  line-height: 1;
}

.topbar-center.is-compact .tool-btn:not(.tool-btn-mode),
.topbar-center.is-icons .tool-btn {
  padding: 0 8px;
}

.topbar-center.is-compact .tool-btn:not(.tool-btn-mode) .tool-icon,
.topbar-center.is-icons .tool-icon {
  display: inline;
}

.topbar-center.is-compact .tool-btn:not(.tool-btn-mode) .tool-label,
.topbar-center.is-icons .tool-label {
  display: none;
}

/* Right: Actions, Language, Profile */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-topbar {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  outline: none;
}

.btn-topbar-batch {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.38);
  color: #d8b4fe;
}

.btn-topbar-batch:hover {
  background: rgba(139, 92, 246, 0.26);
  border-color: #c084fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.btn-topbar-status {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-topbar-status:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(88, 166, 255, 0.4);
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
}

.topbar-link {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.topbar-link:hover {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-color);
}

.lang-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lang-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.lang-btn.active {
  background: var(--accent-cyan);
  color: #07090e;
  font-weight: 700;
}

.btn-auth-profile {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth-profile:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
}

.avatar-emoji { font-size: 14px; }
.user-name-text { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Narrower screens drop secondary top bar labels. These come after the component rules above, which would
   otherwise win the cascade (.topbar-link sets its own display). */
@media (max-width: 1440px) {
  .brand-badge,
  .btn-topbar-batch [data-i18n="batchDemoBtn"] {
    display: none;
  }
}

@media (max-width: 1280px) {
  .topbar-link,
  .topbar-divider,
  .user-name-text {
    display: none;
  }
}

/* Status Pulse Dot */
.status-pulse-dot {
  width: 7px;
  height: 7px;
  background: #3fb950;
  border-radius: 50%;
  box-shadow: 0 0 6px #3fb950;
  animation: pulseDot 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* ==========================================================================
   Studio Body & Layout (Sidebar + Viewport)
   ========================================================================== */
.studio-body {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   Sidebar (Control Panel - 350px Streamlined)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: linear-gradient(180deg, #0e1219 0%, #080a0f 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  gap: 12px;
  z-index: 20;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

/* Panel Sections */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.panel-section:focus-within {
  border-color: rgba(88, 166, 255, 0.35);
  background: rgba(255, 255, 255, 0.025);
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.btn-icon-link {
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-color);
}

/* ==========================================================================
   Standardized Form Controls (Inputs, Selects, Buttons)
   ========================================================================== */
.form-input,
.form-select,
input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  height: var(--btn-md-h);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238b949e%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 9px auto;
  padding-right: 28px;
}

.model-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 2px;
}

.model-availability { color: var(--accent-amber); }
.model-input-hint { color: var(--accent-cyan); }
.model-timing { font-variant-numeric: tabular-nums; }
.model-prompt { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.model-advanced { margin-top: 8px; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 6px 10px; }
.model-advanced[hidden] { display: none; }
.model-advanced summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.model-advanced[open] summary { margin-bottom: 8px; }
.model-advanced-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.model-param { display: flex; flex-direction: column; gap: 4px; }

/* Step Flow & Labels */
.step-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--accent-cyan);
  color: #07090e;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 50%;
  flex-shrink: 0;
}

.provision-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 4px;
}

.provision-container .step-number {
  background: var(--accent-amber);
}

.provision-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.provision-actions-stack .btn {
  width: 100%;
  justify-content: center;
  padding: 0 14px;
}

.provision-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.provision-actions .btn {
  min-width: 0;
  padding: 0 14px;
  font-size: 12px;
  justify-content: center;
}

.connection-flow-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.connection-group {
  display: flex;
  gap: 6px;
  width: 100%;
}

.connection-group input[type="text"] {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.connection-group .btn {
  flex-shrink: 0;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
  flex-shrink: 0;
}

.status-indicator.connected .dot {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.status-indicator.disconnected .dot {
  background-color: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
}

/* ==========================================================================
   Button Hierarchy & System (.btn, .btn-xs, .btn-sm, .btn-md, .btn-lg)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

/* Sizing Standards */
.btn-xs {
  height: var(--btn-xs-h);
  padding: 0 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.btn-sm {
  height: var(--btn-sm-h);
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-md,
.btn:not(.btn-xs):not(.btn-sm):not(.btn-lg) {
  height: var(--btn-md-h);
  padding: 0 16px;
  font-size: 12.5px;
  border-radius: var(--radius-md);
}

.btn-lg {
  height: var(--btn-lg-h);
  padding: 0 20px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Variants */
.btn-primary {
  background: linear-gradient(135deg, #1f6feb 0%, #0099ff 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px rgba(31, 111, 235, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(31, 111, 235, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-hover);
}

.btn-warning {
  background: linear-gradient(135deg, #d29922, #bb8009);
  color: #07090e;
  font-weight: 700;
}

.btn-warning:hover {
  filter: brightness(1.1);
}

.btn-danger {
  background: linear-gradient(135deg, #da3633, #b62324);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(1.15);
}

.btn:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  filter: grayscale(80%) !important;
  pointer-events: none;
  transform: none !important;
}

.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Input Image & Benchmark Presets Grid
   ========================================================================= */
.preset-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.preset-card {
  aspect-ratio: 1;
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.preset-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
  display: block;
}

.preset-card span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 700;
  padding: 8px 2px 2px 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(88, 166, 255, 0.4);
}

.preset-card:hover img {
  transform: scale(1.08);
}

.preset-card.active {
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.4);
}

.upload-area {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-area:hover {
  border-color: var(--accent-cyan);
  background: rgba(88, 166, 255, 0.04);
}

.upload-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.selected-info {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-info strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Cache Options */
.cache-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.cache-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.cache-toggle input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.cache-toggle:hover {
  color: var(--text-main);
}

.infer-stage-banner {
  margin-top: 8px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.2s ease-in-out;
}

.stage-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(88, 166, 255, 0.3);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.stage-info {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.stage-text {
  color: var(--text-main);
  font-weight: 500;
}

.stage-timer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Metrics panel */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.metric-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.metric-label {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Viewport Area (Studio 3D Canvas & Overlays)
   ========================================================================== */
.viewport-container {
  flex: 1;
  position: relative;
  background-color: #06080c;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* clip, unlike hidden, cannot be scrolled by focus or scrollIntoView, which pulled the collapsed album into view */
  overflow: clip;
}

.canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Empty State in 3D Viewport */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 440px;
  background: rgba(14, 18, 25, 0.65);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.empty-icon-glow {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 166, 255, 0.2) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  font-size: 32px;
}

.empty-state h3 {
  font-size: 17px;
  color: var(--text-main);
  font-weight: 700;
}

.empty-state p {
  font-size: 12.5px;
  line-height: 1.5;
}

.shortcut-tips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin-top: 4px;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
}

.spinner-large {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(88, 166, 255, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

.loading-overlay p {
  font-size: 13.5px;
  color: var(--text-main);
  font-weight: 600;
}

/* Viewport HUD */
.viewport-hud {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

.hud-item strong {
  color: var(--accent-cyan);
}

.hud-divider {
  color: var(--border-color);
}

/* Walk Mode Hint Overlay */
.walk-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-main);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}

/* Gamification Toast (Lucky Boost) */
.lucky-boost-toast {
  position: fixed;
  top: 68px;
  right: 20px;
  z-index: 1500;
  background: linear-gradient(135deg, rgba(26, 32, 44, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid #e3b341;
  box-shadow: 0 10px 30px rgba(227, 179, 65, 0.25), 0 0 20px rgba(88, 166, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  max-width: 380px;
  backdrop-filter: blur(16px);
  animation: slideInToast 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInToast {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.lucky-boost-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lucky-boost-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.lucky-boost-text h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 700;
  color: #e3b341;
}

.lucky-boost-text p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-main);
}

.btn-close-toast {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  margin-left: 6px;
}
.btn-close-toast:hover { color: var(--text-main); }

/* ==========================================================================
   Drawers (Status Drawer & Batch Album)
   ========================================================================== */
.status-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: rgba(13, 17, 23, 0.96);
  border-left: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
}

.status-drawer.collapsed {
  transform: translateX(100%);
  box-shadow: none;
  pointer-events: none;
}

.status-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-icon { font-size: 16px; }

.drawer-title-group h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
}

.drawer-tab-btn {
  flex: 1;
  padding: 9px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.drawer-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.drawer-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(88, 166, 255, 0.06);
}

.status-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Queue Monitor */
.queue-monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.monitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.monitor-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.monitor-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.monitor-val.highlight {
  color: var(--accent-cyan);
}

.active-job-card {
  background: rgba(88, 166, 255, 0.05);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.active-job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(88, 166, 255, 0.15);
}

.active-job-tag {
  font-size: 9.5px;
  font-weight: 700;
  background: var(--accent-cyan);
  color: #0d1117;
  padding: 2px 6px;
  border-radius: 4px;
}

.active-job-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.job-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  margin-bottom: 3px;
}

.job-detail-label { color: var(--text-muted); }
.job-detail-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-main); }

.boost-badge {
  background: rgba(227, 179, 65, 0.15);
  border: 1px solid #e3b341;
  color: #e3b341;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-card:hover {
  border-color: rgba(88, 166, 255, 0.4);
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-model-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.history-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.terminal-badge {
  font-size: 9.5px;
  font-weight: 700;
  color: #3fb950;
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid rgba(63, 185, 80, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.terminal-container {
  background: #06090f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #79c0ff;
  height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

.empty-history {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

/* Batch Gallery Drawer (Bottom Slide-up Album) */
.batch-gallery-drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 380px;
  background: rgba(10, 14, 22, 0.96);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
}

.batch-gallery-drawer.collapsed {
  transform: translateY(100%);
  pointer-events: none;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.gallery-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-icon { font-size: 16px; }
.gallery-title-group h3 { font-size: 13.5px; font-weight: 600; }

.gallery-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: rgba(22, 27, 34, 0.6);
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
}

.keyboard-hints {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.key-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
}

.album-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.album-index {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

.gallery-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.batch-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.bento-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.bento-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.bento-tile.active-world {
  border: 2px solid #58a6ff;
  box-shadow: 0 0 16px rgba(88, 166, 255, 0.5);
}

.bento-thumb-wrapper {
  width: 100%;
  height: 75px;
  background: #000;
  position: relative;
  overflow: hidden;
}

.bento-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.bento-tile-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  text-transform: uppercase;
}

.bento-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bento-model-name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bento-status-chip {
  font-size: 9.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.bento-status-chip.ready { color: #3fb950; font-weight: 600; }
.bento-status-chip.running { color: #e3b341; font-weight: 600; }

/* ==========================================================================
   Modals (Batch Demo, Auth, Server, Provision, Error)
   ========================================================================== */
.modal-backdrop,
.error-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1400; /* above the batch album (1200) and the compare view (1300) */
}

.modal-dialog,
.error-dialog {
  background: #11151e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.error-dialog {
  border-color: var(--accent-rose);
  max-width: 620px;
}

.modal-header,
.error-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.error-header {
  background: rgba(248, 81, 73, 0.08);
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.error-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-rose);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body,
.error-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

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

.form-group-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
}

/* Count Pills */
.batch-count-pills {
  display: flex;
  gap: 6px;
}

.count-pill {
  flex: 1;
  height: 34px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.count-pill:hover {
  border-color: var(--accent-cyan);
  background: rgba(88, 166, 255, 0.05);
}

.count-pill.active {
  background: var(--accent-cyan);
  color: #0a0d14;
  border-color: var(--accent-cyan);
  box-shadow: 0 1px 8px rgba(88, 166, 255, 0.3);
}

.batch-modal-actions {
  margin-top: 6px;
}

/* Auth Modal Tabs & Elements */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.auth-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.guest-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.guest-avatar-large {
  font-size: 40px;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.auth-actions-row .btn {
  flex: 1;
}

.btn-google { gap: 8px; }
.google-logo { width: 16px; height: 16px; flex-shrink: 0; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 11px; color: var(--text-muted); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-color); }

.auth-status-msg {
  font-size: 11.5px;
  margin-top: 4px;
  min-height: 16px;
}

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

.auth-footer-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Server Profiles Modal */
.server-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.server-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.server-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.server-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.server-item-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

/* Provision Modal Elements */
.pat-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.pat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.pat-input-wrapper {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pat-input-wrapper input {
  flex: 1;
}

.code-block {
  background: #080a0f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--accent-cyan);
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
  max-height: 140px;
  overflow-y: auto;
}

.provision-connect-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.section-title-sm {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

/* Error Modal Trace */
.err-msg {
  font-size: 13.5px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.4;
}

.err-meta {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.trace-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.err-trace {
  background: #080a0f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: #ff7b72;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

/* ==========================================================================
   Desktop Screen Resolution Guard (<1024px width or <600px height)
   Kinox 3D Studio requires desktop display space. Mobile/tablets are blocked.
   ========================================================================== */
.resolution-guard-overlay {
  display: none;
}

@media (max-width: 1023px), (max-height: 599px) {
  .resolution-guard-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 9, 14, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 24px;
  }
}

.resolution-guard-card {
  max-width: 480px;
  width: 100%;
  background: #0d1117;
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(88, 166, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: guardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes guardFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.guard-icon-container {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.guard-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.guard-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.guard-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
  margin-bottom: 6px;
}

.guard-metric-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guard-metric-item .metric-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.guard-metric-item .metric-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.guard-metric-item .metric-value.current {
  color: #ff7b72;
}

.guard-metric-item .metric-value.required {
  color: #3fb950;
}

.guard-actions {
  width: 100%;
  margin-top: 8px;
}

.guard-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.guard-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.4);
  color: var(--accent-cyan);
}


/* Upload drag & drop and preview */
.upload-area.drag-over { border-color: var(--accent-cyan); background: rgba(88, 166, 255, 0.08); }
.upload-drop-hint { display: none; font-weight: 600; color: var(--accent-cyan); }
.upload-area.drag-over .upload-drop-hint { display: inline; }
.upload-preview { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: var(--radius-md); margin-top: 10px; }
.upload-preview[hidden] { display: none; }
.video-dialog { max-width: min(960px, calc(100vw - 32px)); width: 100%; }
.asset-video { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius-md); }
.batch-heavy-note { margin: 0 0 10px; font-size: 11.5px; color: var(--accent-amber); }
.batch-heavy-note[hidden] { display: none; }
.data-consent { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 6px; }
.data-consent[hidden] { display: none; }
.data-consent-toggle { align-items: flex-start; font-size: 12px; color: var(--text-main); }
.data-consent-toggle input[type="checkbox"] { margin-top: 1px; flex-shrink: 0; }
.data-consent .config-hint-text { margin: 0; line-height: 1.45; }
.tool-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Cloud job queue panel */
.queue-panel { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.queue-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.pairing-code-input { text-transform: uppercase; letter-spacing: 0.12em; }
.pairing-status.success { color: var(--accent-emerald); }
.pairing-status.error { color: var(--accent-rose); }

/* Invite-only beta: the notice without an invite, a member's daily usage and the admins' invite list */
.beta-notice { padding: 8px 10px; font-size: 12px; line-height: 1.45; color: #e3b341; background: rgba(210, 153, 34, 0.1); border: 1px solid rgba(210, 153, 34, 0.4); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.beta-usage { font-variant-numeric: tabular-nums; }
.beta-usage.is-full { color: var(--accent-amber); }
.beta-invites { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; }
.beta-invites .config-hint-text { margin: 0; line-height: 1.45; }
.beta-invites .auth-status-msg { margin-top: 0; }
.beta-invites .auth-status-msg.success { color: var(--accent-emerald); }
.beta-invites-header { display: flex; align-items: center; gap: 8px; }
.beta-invite-count { margin-left: auto; min-width: 22px; padding: 1px 7px; text-align: center; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--accent-cyan); background: rgba(88, 166, 255, 0.12); border: 1px solid rgba(88, 166, 255, 0.25); border-radius: var(--radius-full); }
.beta-invite-count:empty { display: none; }
.beta-invite-form { display: flex; flex-wrap: wrap; gap: 6px; }
.beta-invite-form .form-input { flex: 1 1 160px; min-width: 0; }
.beta-invite-form .btn { flex: 0 0 auto; }
.beta-invite-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.beta-invite-list:empty { display: none; }
.beta-invite { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.beta-invite-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.beta-invite-email { font-size: 12.5px; font-weight: 600; color: var(--text-main); overflow-wrap: anywhere; }
.beta-invite-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.beta-invite-note { font-size: 11px; color: var(--text-dim); overflow-wrap: anywhere; }
.beta-invite-pill { padding: 2px 6px; font-size: 9.5px; font-weight: 700; color: var(--text-muted); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-color); border-radius: 4px; }
.beta-invite-pill.is-signed-up { color: #3fb950; border-color: rgba(63, 185, 80, 0.35); }
.beta-invite-remove { flex-shrink: 0; color: #ff7b72; }
.beta-invite-empty { padding: 10px 8px; font-size: 11px; text-align: center; color: var(--text-dim); border: 1px dashed var(--border-color); border-radius: var(--radius-sm); }

/* Queue job progress, cancel and completion states */
.job-stage-val { font-family: var(--font-sans); font-weight: 500; text-align: right; }
.job-progress { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.job-progress-track { flex: 1; height: 6px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.job-progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); transition: width 0.4s ease; }
.job-progress-text { min-width: 36px; text-align: right; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--accent-cyan); }
.job-cancel-btn { width: 100%; }
.infer-stage-banner.is-done { background: rgba(46, 160, 67, 0.1); border-color: rgba(46, 160, 67, 0.4); }
.infer-stage-banner.is-cancelled { background: rgba(210, 153, 34, 0.1); border-color: rgba(210, 153, 34, 0.4); }
.infer-stage-banner.is-done .stage-spinner,
.infer-stage-banner.is-cancelled .stage-spinner { display: none; }
.infer-stage-banner.is-done .stage-timer { color: #3fb950; }
.infer-stage-banner.is-cancelled .stage-timer { color: var(--accent-amber); }
.auth-status-msg.error { color: var(--accent-rose); }

/* Batch tiles in queue mode */
.bento-status-chip.failed { color: #ff7b72; font-weight: 600; }
.bento-status-chip.cancelled { color: var(--accent-amber); font-weight: 600; }
.bento-progress { height: 3px; margin-top: 3px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bento-progress-bar { width: 0; height: 100%; background: var(--accent-cyan); transition: width 0.4s ease; }

/* Job history cards */
.btn-outline { background: transparent; border: 1px solid rgba(88, 166, 255, 0.4); color: var(--accent-cyan); }
.btn-outline:hover { background: rgba(88, 166, 255, 0.1); border-color: var(--accent-cyan); }
.history-card-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-meta-group { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.history-time-badge { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.history-pill { font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: var(--text-muted); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-color); }
.history-pill.cached, .history-pill.completed { color: #3fb950; border-color: rgba(63, 185, 80, 0.35); }
.history-pill.gpu, .history-pill.running { color: var(--accent-cyan); border-color: rgba(88, 166, 255, 0.35); }
.history-pill.failed { color: #ff7b72; border-color: rgba(248, 81, 73, 0.4); }
.history-pill.cancelled { color: var(--accent-amber); border-color: rgba(210, 153, 34, 0.4); }
.history-error { font-size: 11px; color: #ff7b72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Benchmark report, per-model summary and compare selection */
.benchmark-panel { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.benchmark-actions { display: flex; align-items: center; gap: 6px; }
.benchmark-label { font-size: 11px; color: var(--text-muted); }
.benchmark-compare-btn { margin-left: auto; }
.benchmark-summary { font-size: 11px; color: var(--text-muted); }
.benchmark-summary:empty { display: none; }
.benchmark-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 10.5px; }
.benchmark-table caption { text-align: left; font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.benchmark-table th, .benchmark-table td { padding: 3px 4px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border-color); }
.benchmark-table th { font-family: var(--font-sans); font-weight: 600; color: var(--text-dim); }
.benchmark-table td { color: var(--text-main); }
.benchmark-table th:first-child, .benchmark-table td:first-child { text-align: left; }
.benchmark-table td:first-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; color: var(--accent-cyan); }
.history-title-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.history-compare-check { width: 14px; height: 14px; margin: 0; accent-color: var(--accent-cyan); cursor: pointer; }
.history-compare-check:disabled { cursor: not-allowed; opacity: 0.4; }

/* Compare view: one canvas, CSS lays out the cells it draws into */
.compare-overlay { position: fixed; inset: 0; z-index: 1300; display: flex; flex-direction: column; background: var(--bg-dark); }
.compare-header { display: flex; align-items: center; gap: 14px; height: var(--topbar-height); min-height: var(--topbar-height); padding: 0 16px; background: var(--bg-panel); border-bottom: 1px solid var(--border-color); }
.compare-header h3 { font-size: 13.5px; font-weight: 700; color: var(--text-main); white-space: nowrap; }
.compare-hint { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-stage { position: relative; flex: 1; min-height: 0; }
.compare-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.compare-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 6px; padding: 6px; pointer-events: none; }
.compare-cell { position: relative; border: 1px solid var(--border-color); }
.compare-cell-label { position: absolute; top: 10px; left: 10px; max-width: calc(100% - 20px); display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(13, 17, 23, 0.82); border: 1px solid var(--border-color); backdrop-filter: blur(10px); }
.compare-cell-model { font-size: 12px; font-weight: 700; color: var(--accent-cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-cell-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-cell-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
.compare-cell-status.is-error { color: #ff7b72; }

/* Camera path panel: keyframes, presets, playback and video export */
.camera-path-panel { display: block; }
.camera-path-summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; user-select: none; }
.camera-path-summary::-webkit-details-marker { display: none; }
.camera-path-summary::after { content: "▸"; font-size: 11px; color: var(--text-muted); transition: transform 0.2s ease; }
.camera-path-panel[open] > .camera-path-summary::after { transform: rotate(90deg); }
.camera-path-summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 4px; border-radius: var(--radius-sm); }
.camera-path-count { margin-left: auto; min-width: 22px; text-align: center; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--accent-cyan); background: rgba(88, 166, 255, 0.12); border: 1px solid rgba(88, 166, 255, 0.25); border-radius: var(--radius-full); padding: 1px 7px; }
.camera-path-body { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.camera-path-row { display: flex; align-items: center; gap: 6px; }
.camera-path-row .preset-label { margin: 0; flex: 0 0 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-path-row.is-stacked { flex-direction: column; align-items: stretch; gap: 4px; }
.camera-path-row.is-stacked .preset-label { flex: none; }
.camera-pills { display: flex; flex: 1; min-width: 0; gap: 4px; }
.camera-pills .btn { flex: 1 1 auto; min-width: 0; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
.camera-pill.active { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #07090e; font-weight: 700; }
.camera-keyframe-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 172px; overflow-y: auto; }
.camera-keyframe { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.camera-keyframe-goto { flex: 1; min-width: 0; height: 26px; padding: 0; text-align: left; background: transparent; border: none; color: var(--text-main); font-family: var(--font-sans); font-size: 11.5px; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-keyframe-goto:hover { color: var(--accent-cyan); }
.camera-keyframe .btn-icon-link { width: 26px; height: 26px; padding: 0; }
.camera-keyframe button:disabled { opacity: 0.3; cursor: not-allowed; }
.camera-keyframe-empty { padding: 10px 8px; font-size: 11px; line-height: 1.45; text-align: center; color: var(--text-dim); border: 1px dashed var(--border-color); border-radius: var(--radius-sm); }
.camera-path-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.camera-playback { display: flex; align-items: center; gap: 6px; }
.camera-play-btn { min-width: 84px; }
.camera-scrubber { flex: 1; min-width: 0; accent-color: var(--accent-cyan); cursor: pointer; }
.camera-scrubber:disabled { cursor: not-allowed; opacity: 0.45; }
.camera-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.camera-export { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.camera-audio-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.camera-audio-name { flex: 1; min-width: 0; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-record-progress { display: flex; align-items: center; gap: 8px; }
.camera-record-progress .job-progress-bar { transition: none; }
.camera-video-info { font-size: 11px; color: var(--text-dim); }
.camera-record-status { font-size: 11px; }
.camera-record-status:empty { display: none; }
.camera-record-status.success, .share-status.success { color: var(--accent-emerald); }
.camera-record-status.error, .share-status.error { color: var(--accent-rose); }
.canvas-container.is-recording canvas { object-fit: contain; background: #000; }
.record-badge { position: absolute; top: 14px; left: 14px; z-index: 12; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-full); background: rgba(13, 17, 23, 0.85); border: 1px solid rgba(248, 81, 73, 0.5); color: var(--text-main); font-family: var(--font-mono); font-size: 11px; font-weight: 700; pointer-events: none; }
.record-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-rose); box-shadow: 0 0 8px var(--accent-rose); animation: pulseDot 1.2s infinite ease-in-out; }

/* Share link modal */
.share-status { min-height: 18px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions .btn { text-decoration: none; }
.share-revoke-btn { margin-left: auto; color: #ff7b72; }

/* Resolution guard: open the current result in the mobile viewer */
.guard-actions { display: flex; flex-direction: column; gap: 10px; }
.guard-btn-primary { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; padding: 0 20px; border-radius: var(--radius-md); background: linear-gradient(135deg, #1f6feb 0%, #0099ff 100%); border: 1px solid rgba(255, 255, 255, 0.15); color: #ffffff; text-decoration: none; font-size: 13.5px; font-weight: 700; box-shadow: 0 2px 10px rgba(31, 111, 235, 0.35); }
.guard-btn-primary:hover { filter: brightness(1.1); }
.guard-btn-primary[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

/* Guided tour (tours/studio.js): the Tour button in the top bar is as tall as the account and status buttons. */
.studio-tour-button {
  height: 32px;
}
