/* ==========================================================================
   AI 3D Lab (lab.archconvertme.com) — Studio Dark-Mode 100vh
   Palette Obsidian Charcoal + Verde Smeraldo (coerente con archconvertme.com)
   ========================================================================== */

:root {
  --bg-app: #090B0E;
  --bg-panel: #111317;
  --bg-card: #171A20;
  --bg-card-hover: #1E222A;
  --bg-input: #0C0E12;
  --bg-stage: #07090C;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(16, 185, 129, 0.48);

  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;

  --accent-blue: #10B981;
  --accent-indigo: #059669;
  --accent-cyan: #34D399;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-grad: linear-gradient(135deg, #059669 0%, #10B981 100%);
  --accent-grad-hover: linear-gradient(135deg, #10B981 0%, #34D399 100%);

  --gold-light: #FDE68A;
  --gold-main: #FBBF24;
  --gold-dark: #B45309;
  --gold-bg: rgba(251, 191, 36, 0.1);
  --gold-border: rgba(251, 191, 36, 0.34);

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --warning: #F59E0B;
  --danger: #EF4444;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --topbar-h: 50px;
  --rail-w: 64px;
  --left-w: 326px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.62);
  --shadow-glow: 0 0 0 1px rgba(52, 211, 153, 0.32), 0 8px 22px rgba(16, 185, 129, 0.2);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Reset & regole base */
*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   MONETA TOKEN SVG INLINE & ICONE LINE-ART STUDIO
   ========================================================================== */
.ac-coin-icon {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.ac-coin-xs { width: 16px; height: 16px; }
.ac-coin-sm { width: 20px; height: 20px; }
.ac-coin-md { width: 22px; height: 22px; }
.ac-coin-lg { width: 42px; height: 42px; }
.ac-coin-xl { width: 64px; height: 64px; }

.ui-ic {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   STATI GLOBALI BODY (Incluso Marketplace Full-Screen senza pannello sinistro)
   ========================================================================== */
body[data-guest="false"] #guest-banner {
  display: none !important;
}

body[data-has-model="false"] #mesh-hud,
body[data-has-model="false"] .viewport-controls,
body[data-has-model="false"] #explode-floating-bar {
  display: none !important;
}

body[data-left-collapsed="true"] .panel-left,
body[data-left-collapsed="true"] .panel-resizer,
body[data-room="market"] .panel-left,
body[data-room="market"] .panel-resizer,
body[data-market-overlay="true"] .panel-left,
body[data-market-overlay="true"] .panel-resizer {
  display: none !important;
}

body[data-left-collapsed="true"] .lab-workspace,
body[data-room="market"] .lab-workspace,
body[data-market-overlay="true"] .lab-workspace {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

/* Quando sei sul Market Full-Screen nascondi HUD/Dock 3D e mostra solo la vista Market */
body[data-room="market"] #stage-empty-state,
body[data-market-overlay="true"] #stage-empty-state {
  display: flex !important;
}
body[data-room="market"] #mesh-hud,
body[data-room="market"] .viewport-bottom-dock,
body[data-market-overlay="true"] #mesh-hud,
body[data-market-overlay="true"] .viewport-bottom-dock {
  visibility: hidden;
  pointer-events: none;
}

/* ==========================================================================
   SHELL STUDIO 100vh
   ========================================================================== */
.lab-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-app);
}

/* ==========================================================================
   TOP BAR PULITA STILE STUDIO
   ========================================================================== */
.lab-topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.btn-sidebar-toggle {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.btn-sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.back-main-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.back-main-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

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

.lab-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.lab-brand-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
}
.lab-brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #F9FAFB;
}
.badge-beta {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.34);
  color: var(--accent-cyan);
}

.stage-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
}
.stage-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.stage-tab:hover {
  color: var(--text-primary);
}
.stage-tab.is-active {
  background: var(--bg-card-hover);
  color: #FFFFFF;
}

.lang-switcher {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
}
.lang-btn {
  padding: 3px 7px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: all 0.14s ease;
}
.lang-btn:hover {
  color: var(--text-primary);
}
.lang-btn.is-active {
  background: var(--bg-card-hover);
  color: #FFFFFF;
}

.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px 3px 5px;
  border-radius: var(--radius-pill);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-weight: 700;
  transition: transform 0.14s ease, background 0.14s ease;
}
.token-pill:hover {
  background: rgba(251, 191, 36, 0.18);
  transform: translateY(-1px);
}
.token-count {
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 14px;
  text-align: right;
}
.token-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--gold-main);
  color: #1F1302;
  font-weight: 900;
  font-size: 12.5px;
  line-height: 1;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.user-pill:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 800;
}

/* ==========================================================================
   WORKSPACE STUDIO (Rail Verticale + 1 Pannello + Viewport 3D / Market)
   ========================================================================== */
.lab-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail-w) var(--left-w) 4px minmax(0, 1fr);
  overflow: hidden;
}

.studio-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 5px;
  background: #0C0E12;
  border-right: 1px solid var(--border-subtle);
  z-index: 25;
}
.rail-btn {
  width: 54px;
  padding: 5px 2px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: color 0.15s ease;
}
.rail-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.16s ease;
}
.rail-icon .ui-ic {
  width: 19px;
  height: 19px;
}
.rail-btn:hover {
  color: var(--text-primary);
}
.rail-btn:hover .rail-icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.rail-btn.is-active {
  color: var(--text-primary);
}
.rail-btn.is-active .rail-icon {
  background: var(--accent-soft);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.28);
}
.rail-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.15;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.room-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.panel-resizer {
  width: 4px;
  cursor: col-resize;
  background: var(--border-subtle);
  transition: background 0.15s ease;
  z-index: 15;
}
.panel-resizer:hover,
.panel-resizer.is-dragging {
  background: var(--accent-blue);
}

.panel-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* ==========================================================================
   PANNELLO SINISTRO: CREAZIONE & PROGETTI
   ========================================================================== */
.input-mode-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.segmented-tabs-2 {
  grid-template-columns: repeat(2, 1fr);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 5px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.seg-btn .ui-ic {
  width: 13px;
  height: 13px;
}
.seg-btn:hover {
  color: var(--text-primary);
}
.seg-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.32);
}

.projects-tab-badge {
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 10px;
  color: inherit;
}
.projects-demo-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.block-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.muted-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Dropzone Immagine / 3D */
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent-blue);
  background: rgba(16, 185, 129, 0.05);
}
.dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dropzone-cloud-icon {
  width: 34px;
  height: 34px;
  color: var(--text-muted);
  margin-bottom: 2px;
  transition: color 0.18s ease, transform 0.18s ease;
}
.dropzone:hover .dropzone-cloud-icon,
.dropzone.is-dragover .dropzone-cloud-icon {
  color: var(--accent-cyan);
  transform: translateY(-2px);
}
.dropzone-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.dropzone-sub {
  color: var(--text-secondary);
  font-size: 11px;
}
.btn-browse-file {
  margin-top: 5px;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-browse-file:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
}
.dropzone-preview-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 124px;
}
.dropzone-preview-wrap img {
  max-width: 100%;
  max-height: 120px;
  border-radius: var(--radius-xs);
  object-fit: contain;
}
.btn-icon-mini {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(9, 11, 14, 0.88);
  color: #FFFFFF;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-mini:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.dropzone-3d-loaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.dropzone-3d-file-info {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  text-align: left;
}
.dropzone-3d-badge {
  flex-shrink: 0;
  padding: 4px 7px;
  border-radius: var(--radius-xs);
  background: var(--accent-grad);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
}
.dropzone-3d-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dropzone-3d-meta strong {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropzone-3d-meta small {
  font-size: 11px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.helper-note {
  margin: 0;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #A7F3D0;
  font-size: 11px;
}
.helper-note-info {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

/* Textarea Prompt & Chip Rapidi */
.prompt-textarea {
  width: 100%;
  resize: vertical;
  min-height: 68px;
  max-height: 150px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.prompt-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}
.prompt-textarea::placeholder {
  color: var(--text-muted);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip-btn {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.14s ease;
}
.chip-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--border-accent);
  background: var(--accent-soft);
}

/* Switch 4 Viste Ortogonali */
.switch-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.switch-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.switch-desc {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: var(--text-muted);
}

.toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: #2A2F3A;
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.18s ease;
}
.toggle-switch:checked {
  background: var(--accent-blue);
}
.toggle-switch:checked::after {
  transform: translateX(16px);
}

/* Selettore Modelli AI (Griglia compatta 2x2) */
.model-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.model-card {
  display: block;
  position: relative;
  padding: 8px 9px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}
.model-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.model-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.model-card.is-selected,
.model-card:has(input:checked) {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.62);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.2);
}
.model-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.model-card-head strong {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.model-card-sub {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.25;
}

.token-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.free-badge {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--success-bg);
  border: 1px solid rgba(52, 211, 153, 0.34);
  color: var(--accent-cyan);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* Pulsanti Azione Generazione (sticky in fondo al pannello Crea) */
.action-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 2px;
}
#room-create .action-stack {
  position: sticky;
  bottom: -12px;
  margin: auto -13px -12px;
  padding: 12px 13px 13px;
  background: linear-gradient(180deg, rgba(17, 19, 23, 0) 0%, #111317 20%);
  border-top: 1px solid var(--border-subtle);
  z-index: 5;
}
.btn-secondary-action,
.btn-primary-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  transition: all 0.16s ease;
}
.btn-secondary-action {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary-action:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}
.btn-primary-action {
  background: var(--accent-grad);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #FFFFFF;
  box-shadow: var(--shadow-glow);
}
.btn-primary-action:hover:not(:disabled) {
  background: var(--accent-grad-hover);
  transform: translateY(-1px);
}
.btn-primary-action:disabled,
.btn-secondary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-primary-action.is-danger {
  background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}
.btn-primary-action.is-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
}
.btn-cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(9, 11, 14, 0.42);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--gold-light);
}

/* ==========================================================================
   STAGE CENTRALE (Barra Schede + Viewport 2D/3D + Market Full-Screen)
   ========================================================================== */
.stage-center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-stage);
  overflow: hidden;
}

.project-tabs-bar {
  height: 35px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 10px 0;
  background: #0C0E12;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
}
.project-tabs-bar:has(#project-tabs-list:empty) {
  display: none;
}
.project-tabs-list {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}
.project-tab {
  position: relative;
  max-width: 190px;
  min-width: 96px;
  height: 30px;
  padding: 0 8px 0 10px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.project-tab:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}
.project-tab.is-active {
  background: var(--bg-stage);
  border-color: var(--border-subtle);
  color: #FFFFFF;
  box-shadow: inset 0 2px 0 var(--accent-blue);
}
.project-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.project-tab.is-active .project-tab-dot {
  background: var(--accent-cyan);
}
.project-tab-dot.is-busy {
  background: var(--warning);
  animation: tabPulse 1s ease-in-out infinite;
}
.project-tab-dot.is-ready {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.75);
}
@keyframes tabPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.75); }
}
.project-tab-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-tab-close {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.project-tab-close:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #FCA5A5;
}
.project-tab-add {
  width: 25px;
  height: 25px;
  margin-bottom: 3px;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}
.project-tab-add:hover:not(:disabled) {
  color: #FFFFFF;
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}
.project-tab-add:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.project-tabs-counter {
  margin-left: auto;
  margin-bottom: 6px;
  padding-left: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-bridge-print {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52, 211, 153, 0.34);
  background: var(--accent-soft);
  color: var(--accent-cyan);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-bridge-print .ui-ic {
  width: 12px;
  height: 12px;
}
.btn-bridge-print:hover {
  background: rgba(16, 185, 129, 0.24);
  color: #FFFFFF;
}

.download-dropdown-wrap {
  position: relative;
}
.btn-download-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(52, 211, 153, 0.42);
  background: var(--accent-grad);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-download-trigger:hover {
  background: var(--accent-grad-hover);
}
body[data-has-model="false"] .btn-download-trigger {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-muted);
  box-shadow: none;
}
body[data-has-model="false"] .btn-download-trigger:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.download-menu-panel {
  position: fixed;
  top: 96px;
  left: 16px;
  width: min(304px, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  z-index: 120;
}
.download-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.download-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 10px 0;
}
.download-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-card);
  text-align: left;
  transition: all 0.14s ease;
}
.download-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
}
.download-item strong {
  font-size: 12.5px;
  color: var(--text-primary);
}
.download-item span {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   VIEWPORT WRAP (2D Checkpoint & 3D Canvas Neutro)
   ========================================================================== */
.stage-viewport-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(16, 185, 129, 0.07) 0%, rgba(7, 9, 12, 0) 60%),
    var(--bg-stage);
}

.stage-view-2d {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.checkpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
}
.checkpoint-header h2 {
  margin: 0;
  font-size: 15px;
}
.checkpoint-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.checkpoint-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-secondary-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-secondary-inline:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}
.btn-approve-inline {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(52, 211, 153, 0.48);
  background: var(--accent-grad);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
}
.btn-approve-inline:hover {
  background: var(--accent-grad-hover);
}

.checkpoint-compare {
  flex: 1;
  min-height: 260px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
}
.compare-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-cyan);
  font-weight: 700;
}
.compare-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.compare-card figcaption {
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 11, 14, 0.55);
}
.compare-canvas-slot {
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.compare-canvas-slot img,
.compare-canvas-slot canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}
.empty-slot-msg {
  max-width: 260px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.stage-view-3d {
  position: relative;
  width: 100%;
  height: 100%;
}
#lab-3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* Canvas vuoto stile Studio 3D con micro-griglia a puntini */
.stage-empty-state {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 24px 48px;
  background-color: var(--bg-stage);
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
}
.empty-stage-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.02) 48%, rgba(0, 0, 0, 0) 72%);
  filter: blur(28px);
  pointer-events: none;
}

/* Stato fuori dal Market -> Canvas 3D silenzioso e centrato */
body:not([data-room="market"]):not([data-market-overlay="true"]) .stage-empty-state {
  justify-content: center;
}
body:not([data-room="market"]):not([data-market-overlay="true"]) #market-explorer-section {
  display: none;
}

/* Stato dentro il Market -> Nascondi Hero vuoto 3D e lascia spazio al Marketplace Full-Screen */
body[data-room="market"] .empty-stage-card,
body[data-market-overlay="true"] .empty-stage-card,
body[data-has-model="true"] .empty-stage-card {
  display: none;
}
body[data-room="market"] .empty-stage-glow,
body[data-market-overlay="true"] .empty-stage-glow {
  display: none;
}
body[data-has-model="false"] .market-back-3d-btn {
  display: none;
}

.empty-stage-card {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: min(490px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 20px;
}
.empty-logo-ring {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--accent-cyan);
  box-shadow: 0 0 34px rgba(16, 185, 129, 0.14);
}
.empty-cube-icon {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-stage-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #F9FAFB;
}
.empty-stage-accent {
  color: var(--accent-cyan);
}
.empty-stage-subtitle {
  margin: 0;
  max-width: 410px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.empty-stage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.empty-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(23, 26, 32, 0.88);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.16s ease;
}
.empty-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* HUD & Guest Pill */
.mesh-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 23, 0.84);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-primary);
  pointer-events: none;
}
.hud-sep {
  color: var(--text-muted);
}
#hud-polycount,
#hud-dimensions {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.guest-floating-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 23, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--gold-border);
  font-size: 11.5px;
  color: var(--text-primary);
}
.guest-claim-btn {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--gold-main);
  color: #1F1302;
  font-size: 11.5px;
  font-weight: 800;
}
.guest-claim-btn:hover {
  background: var(--gold-light);
}

/* Overlay Avanzamento Generazione AI */
.generation-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 12, 0.8);
  backdrop-filter: blur(6px);
  z-index: 30;
}
.generation-card {
  width: min(390px, 90%);
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.gen-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--accent-cyan);
  animation: labSpin 0.85s linear infinite;
}
@keyframes labSpin {
  to { transform: rotate(360deg); }
}
.generation-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.generation-card p {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.gen-progress-track {
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  overflow: hidden;
  margin-bottom: 12px;
}
.gen-progress-bar {
  height: 100%;
  background: var(--accent-grad);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}
.gen-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.gen-step.is-active {
  color: var(--accent-cyan);
  font-weight: 700;
}
.gen-step.is-done {
  color: var(--success);
}

/* Controlli Viewport in basso */
.viewport-bottom-dock {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  pointer-events: none;
  z-index: 20;
}

.explode-floating-bar {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 23, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}
.explode-floating-bar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.explode-floating-bar input[type="range"] {
  width: 150px;
  accent-color: var(--accent-blue);
}
#explode-value-label {
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 34px;
  text-align: right;
  color: var(--accent-cyan);
}

.viewport-controls {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 5px;
  border-radius: 16px;
  background: rgba(17, 19, 23, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

.vp-lighting-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}
.vp-btn-lighting-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  padding: 4px 9px;
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}
.vp-light-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}
.vp-light-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.vp-btn-lighting-caret {
  padding: 5px 8px 5px 6px;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  font-size: 11px;
}
.lighting-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 146px;
  padding: 5px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 80;
}
.lighting-opt {
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.lighting-opt:hover {
  background: var(--bg-card-hover);
  color: #FFFFFF;
}
.lighting-opt.is-active {
  background: var(--accent-soft);
  color: var(--accent-cyan);
}
.vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.vp-btn .ui-ic {
  width: 14px;
  height: 14px;
}
.vp-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
.vp-btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(52, 211, 153, 0.42);
  color: var(--accent-cyan);
}

/* ==========================================================================
   STANZA PROGETTI, TOOL CARDS & CONTROLLI FORM
   ========================================================================== */
.assets-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.assets-demo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.demo-chip {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  transition: all 0.14s ease;
}
.demo-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}
.demo-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

.btn-save-local {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: var(--success-bg);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s ease;
}
.btn-save-local:hover {
  background: rgba(16, 185, 129, 0.24);
}
.history-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dock-empty-msg {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
.history-card {
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.history-card:hover {
  border-color: var(--accent-blue);
}
.history-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}
.history-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-rename-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.history-rename-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
}
.history-card-meta {
  font-size: 10.5px;
  color: var(--text-secondary);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tool-card-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.tool-desc {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.input-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.input-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.input-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.input-stack label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.clamp-input,
.lab-select,
.lab-text-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.14s ease;
}
.input-inline-row .clamp-input {
  width: 88px;
  text-align: right;
  font-family: var(--font-mono);
}
.clamp-input {
  font-family: var(--font-mono);
}
.clamp-input:focus,
.lab-select:focus,
.lab-text-input:focus {
  border-color: var(--accent-blue);
}

.btn-tool-ai,
.btn-tool-local {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.btn-tool-ai {
  background: var(--accent-soft);
  border: 1px solid rgba(52, 211, 153, 0.42);
  color: var(--accent-cyan);
}
.btn-tool-ai:hover {
  background: var(--accent-grad);
  color: #FFFFFF;
}
.btn-tool-local {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn-tool-local:hover {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

.anim-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.anim-btn,
.lod-btn {
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}
.anim-btn:hover,
.lod-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.anim-btn.is-active,
.lod-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

.lod-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-row input {
  accent-color: var(--accent-blue);
}

/* ==========================================================================
   MARKETPLACE FULL-SCREEN GOOGLE-STYLE, VETRINA & AREA CREATOR
   ========================================================================== */
.market-fullscreen-shell {
  position: relative;
  z-index: 2;
  width: min(1240px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Top bar del Market (Switch Esplora / Area Creator + Pubblica) */
.market-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0 2px;
}
.market-topbar-left,
.market-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.market-back-3d-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-accent);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.market-back-3d-btn:hover {
  background: rgba(16, 185, 129, 0.22);
  color: #FFFFFF;
}

.market-view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 23, 0.9);
  border: 1px solid var(--border-subtle);
}
.market-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.market-view-tab:hover {
  color: var(--text-primary);
}
.market-view-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.34);
}
.market-tab-count {
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.market-publish-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52, 211, 153, 0.48);
  background: var(--accent-grad);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
  transition: all 0.16s ease;
}
.market-publish-pill:hover {
  background: var(--accent-grad-hover);
  transform: translateY(-1px);
}

.market-view-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero Google-Style centrato con decorazione SVG leggera */
.market-google-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 36px 20px 30px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(17, 19, 23, 0.88) 0%, rgba(12, 14, 18, 0.72) 100%);
  border: 1px solid var(--border-subtle);
  overflow: visible;
}
.market-hero-decor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.9;
}

.market-hero-brand {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 620px;
}
.market-hero-logo-wrap {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(52, 211, 153, 0.22), rgba(16, 185, 129, 0.06));
  border: 1px solid rgba(52, 211, 153, 0.34);
  box-shadow: 0 0 42px rgba(16, 185, 129, 0.16);
}
.market-hero-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.market-hero-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #F9FAFB;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.market-hero-accent {
  background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.market-hero-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Barra di Ricerca Centrale Stile Google + Popover #Tag + Tendina Filtri */
.market-google-search-wrap {
  position: relative;
  z-index: 30;
  width: min(740px, 100%);
}
.market-search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 8px 6px 18px;
  border-radius: var(--radius-pill);
  background: #0C0E12;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.market-search-pill:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15), 0 12px 32px rgba(0, 0, 0, 0.5);
}
.market-search-icon {
  display: inline-flex;
  color: var(--accent-cyan);
}
.market-search-icon .ui-ic {
  width: 18px;
  height: 18px;
}
.market-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.market-search-input::placeholder {
  color: var(--text-muted);
}
.market-search-clear {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.market-search-clear:hover {
  background: rgba(239, 68, 68, 0.24);
  color: #FFFFFF;
}
.market-filters-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.market-filters-btn:hover,
.market-filters-btn[aria-expanded="true"] {
  border-color: var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-cyan);
}
.market-filters-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-blue);
  color: #04130D;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Popover Autocomplete #Tag */
.market-tag-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 14px;
  right: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #13161C;
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-md);
  text-align: left;
  z-index: 50;
}
.market-suggest-head {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.market-tag-suggest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.market-suggest-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.14s ease;
}
.market-suggest-item:hover,
.market-suggest-item.is-active {
  border-color: var(--accent-blue);
  background: var(--accent-soft);
  color: var(--accent-cyan);
}
.market-suggest-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Tendina Filtri a comparsa */
.market-filters-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(490px, 100%);
  padding: 16px;
  border-radius: 16px;
  background: #13161C;
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.72);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 48;
}
.market-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.market-filters-head strong {
  font-size: 13px;
  color: #F9FAFB;
}
.market-link-reset {
  border: 0;
  background: transparent;
  color: var(--accent-cyan);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0;
}
.market-link-reset:hover {
  text-decoration: underline;
}
.market-filters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.market-filter-pills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.market-filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}
.market-filter-check:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.market-filter-check:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}
.market-filter-check input {
  accent-color: var(--accent-blue);
}

/* Chip Tag Rapidi sotto la barra Google */
.market-quick-tags {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}
.market-quick-tag {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(23, 26, 32, 0.75);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.14s ease;
}
.market-quick-tag:hover {
  border-color: var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* Fascia In Evidenza (Boost) */
.market-boost-strip {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.07) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.market-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.market-strip-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-light);
  letter-spacing: 0.01em;
}

/* Toolbar Ordinamento + Freccia Crescente/Decrescente */
.market-sort-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(17, 19, 23, 0.85);
  border: 1px solid var(--border-subtle);
}
.market-sort-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.market-section-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #F9FAFB;
}
.market-count-pill {
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.market-sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.market-sort-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.market-sort-select {
  width: auto;
  min-width: 190px;
  padding: 6px 10px;
}
.market-sort-dir-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.14s ease;
}
.market-sort-dir-btn:hover {
  border-color: var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-cyan);
}

.market-fallback-banner {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FDE68A;
  font-size: 12px;
  font-weight: 600;
}

/* Griglia & Card Vetrina Marketplace */
.market-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: 16px;
}
.market-cards-grid.is-boost-row {
  grid-template-columns: repeat(auto-fill, minmax(242px, 1fr));
}

.market-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.market-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48);
}
.market-card.is-boosted {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.16);
}

.market-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0B0D10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.market-card-thumb img,
.market-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.market-card-placeholder {
  color: var(--text-muted);
  opacity: 0.55;
}
.market-card-placeholder .ui-ic {
  width: 36px;
  height: 36px;
}

.market-card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}
.market-card-bottom-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.mkt-media-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(9, 11, 14, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #E5E7EB;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mkt-preview-pill {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.9);
  color: #03150E;
  font-size: 10px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.market-card:hover .mkt-preview-pill {
  opacity: 1;
  transform: translateY(0);
}

.mkt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.mkt-badge .ui-ic {
  width: 11px;
  height: 11px;
}
.mkt-badge-boost {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: var(--gold-light);
}
.mkt-badge-price {
  margin-left: auto;
  background: rgba(9, 11, 14, 0.88);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-family: var(--font-mono);
}
.mkt-badge-owned {
  margin-left: auto;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(52, 211, 153, 0.48);
  color: #6EE7B7;
}

.market-card-body {
  padding: 12px 13px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.market-card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #F9FAFB;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-card-desc {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}
.market-card-stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.market-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.market-card-stat .ui-ic {
  width: 12px;
  height: 12px;
}
.market-card-stat.is-star {
  color: var(--gold-main);
}
.market-card-stat.is-star .ui-ic {
  fill: currentColor;
}
.market-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.market-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.mkt-tag {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}
.mkt-tag.is-feature {
  background: var(--accent-soft);
  color: var(--accent-cyan);
}

.market-card-actions {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mkt-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.mkt-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.mkt-btn-primary {
  background: var(--accent-grad);
  color: #FFFFFF;
}
.mkt-btn-primary:hover:not(:disabled) {
  background: var(--accent-grad-hover);
}
.mkt-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.mkt-btn-secondary:hover {
  border-color: var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-cyan);
}
.mkt-btn-icon {
  flex: 0 0 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mkt-btn-icon:hover {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.16);
  color: var(--gold-light);
}

.market-empty-catalog {
  grid-column: 1 / -1;
  padding: 34px 20px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: rgba(17, 19, 23, 0.7);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.market-empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.market-empty-desc {
  margin: 0 0 4px;
  max-width: 520px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Area Creator Full-Screen */
.creator-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.creator-hub-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
}
.creator-hub-card h3 {
  margin: 0;
  font-size: 15px;
  color: #F9FAFB;
}
.creator-bucket-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  overflow: hidden;
}
.creator-bucket-bar {
  height: 100%;
  background: linear-gradient(90deg, #FBBF24 0%, #10B981 100%);
  transition: width 0.25s ease;
}
.creator-payout-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.creator-publish-card .market-confirm-btn {
  align-self: flex-start;
  margin-top: auto;
}
.creator-listings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.creator-my-listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.creator-listing-row {
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.creator-listing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.creator-listing-top strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.creator-listing-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--gold-light);
  flex-shrink: 0;
}
.creator-listing-sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.creator-listing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.creator-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  transition: all 0.14s ease;
}
.creator-mini-btn:hover {
  color: #FFFFFF;
  border-color: var(--accent-blue);
}
.creator-mini-btn.is-boost {
  border-color: var(--gold-border);
  color: var(--gold-light);
}
.creator-mini-btn.is-danger:hover {
  border-color: var(--danger);
  color: #FCA5A5;
}

/* ==========================================================================
   MODALI (OAuth, Wallet, Scorciatoie, Pubblica, Boost, Preview 3D, Dialogo)
   ========================================================================== */
.lab-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 9, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
#modal-app-dialog {
  z-index: 130;
}
.lab-modal-card {
  position: relative;
  width: min(440px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}
.lab-modal-card.modal-wide {
  width: min(720px, 100%);
}
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  z-index: 5;
}
.modal-close-btn:hover {
  color: #FFFFFF;
  border-color: var(--border-strong);
}
.modal-coin-hero {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.lab-modal-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  text-align: center;
}
.modal-wide h2,
.modal-market-preview-card h2,
.modal-app-dialog-card h2 {
  text-align: left;
}
.modal-subtitle {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
}
.modal-wide .modal-subtitle {
  text-align: left;
  margin-bottom: 0;
}
.modal-footnote {
  margin: 16px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.modal-legal-links {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--text-secondary);
  text-align: center;
}
.modal-legal-links a {
  color: var(--accent-cyan);
}
.modal-legal-links a:hover {
  text-decoration: underline;
}

.oauth-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-oauth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.btn-oauth:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}
.btn-oauth-google {
  background: #F9FAFB;
  color: #0F172A;
}
.btn-oauth-github {
  background: #1F242C;
  color: #F9FAFB;
}

.wallet-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.pack-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.pack-card.is-featured {
  border-color: var(--gold-border);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.08) 0%, var(--bg-card) 100%);
}
.pack-tier {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-light);
}
.pack-tokens {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
}
.pack-price {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.pack-unit-price {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}
.pack-perk {
  margin: 2px 0 8px;
  font-size: 11px;
  color: #6EE7B7;
}
.btn-pack-buy {
  margin-top: auto;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--accent-grad);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 12px;
}
.btn-pack-buy:hover {
  background: var(--accent-grad-hover);
}

.wallet-summary-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.wallet-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}
.wallet-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.wallet-stat strong {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
#wallet-modal-balance {
  color: var(--gold-light);
}
.wallet-breakdown-meta {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.wallet-ledger-section {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}
.wallet-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.wallet-ledger-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.wallet-ledger-filters {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
}
.ledger-filter-btn {
  padding: 3px 9px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.14s ease;
}
.ledger-filter-btn:hover {
  color: var(--text-primary);
}
.ledger-filter-btn.is-active {
  background: var(--bg-card-hover);
  color: #FFFFFF;
}

.wallet-ledger-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wallet-ledger-empty {
  padding: 14px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.ledger-row-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.ledger-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}
.ledger-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ledger-reason {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ledger-date {
  font-size: 10.5px;
  color: var(--text-muted);
}
.ledger-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.ledger-delta {
  font-size: 12.5px;
  font-weight: 700;
}
.ledger-delta.is-in { color: #34D399; }
.ledger-delta.is-out { color: #F87171; }
.ledger-delta.is-neutral { color: var(--accent-cyan); }
.ledger-balance-after {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Modale Scorciatoie */
.modal-shortcuts-card {
  width: min(560px, 100%);
}
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}
.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-app);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* Modale Pubblica (Vetrina Media / AI) & Boost */
.market-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.market-publish-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  align-items: start;
}
.market-publish-preview-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.market-cover-preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  background: #050709;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}
.market-cover-preview-stage img,
.market-cover-preview-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.market-cover-preview-stage .mkt-media-type-badge {
  position: absolute;
  top: 6px;
  left: 6px;
}
.market-cover-modes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cover-mode-opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
.cover-mode-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cover-mode-opt:hover {
  border-color: var(--border-strong);
}
.cover-mode-opt.is-selected,
.cover-mode-opt:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}
.market-cover-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.market-publish-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.market-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.market-confirm-btn {
  width: auto;
  gap: 10px;
  padding: 9px 16px;
}

.market-boost-status-pill {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   MODALE 7: SCHEDA MODELLO MARKET CON PREVIEW 3D RUOTABILE & STELLE
   ========================================================================== */
.modal-market-preview-card {
  width: min(980px, 100%);
  padding: 20px;
}
.market-preview-grid {
  display: grid;
  grid-template-columns: 1.28fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.market-preview-stage-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.market-preview-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.market-preview-mode-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
}
.market-pv-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
}
.market-pv-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-cyan);
}
.market-preview-3d-tools {
  display: inline-flex;
  gap: 4px;
}
.market-pv-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}
.market-pv-tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.market-pv-tool-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

.market-preview-viewport {
  position: relative;
  width: 100%;
  min-height: 390px;
  flex: 1;
  border-radius: 14px;
  background-color: #07090C;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
#market-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#market-preview-canvas:active {
  cursor: grabbing;
}
.market-preview-media-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06080B;
}
.market-preview-media-wrap img,
.market-preview-media-wrap video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.market-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 12, 0.72);
  z-index: 4;
}
.market-preview-drag-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 23, 0.84);
  border: 1px solid var(--border-subtle);
  font-size: 10.5px;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
}

.market-preview-info-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding-top: 6px;
}
.market-preview-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.market-preview-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #F9FAFB;
  line-height: 1.25;
}
.market-preview-author {
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.market-preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.market-pv-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}
.market-pv-stat small {
  color: var(--text-muted);
  font-size: 10.5px;
}
.market-pv-stat.is-rating {
  color: var(--gold-main);
}
.market-pv-stat.is-rating .ui-ic {
  fill: currentColor;
}

/* Widget Stelle 1–5 cliccabili */
.market-rating-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.market-rating-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.market-stars-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.market-star-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4B5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, color 0.12s ease;
}
.market-star-btn .ui-ic {
  width: 17px;
  height: 17px;
}
.market-star-btn:hover {
  transform: scale(1.14);
}
.market-star-btn.is-filled,
.market-star-btn.is-hover {
  color: var(--gold-main);
}
.market-star-btn.is-filled .ui-ic,
.market-star-btn.is-hover .ui-ic {
  fill: currentColor;
}

.market-preview-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 92px;
  overflow-y: auto;
}
.market-preview-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
.market-preview-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}
.market-pv-foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}
.market-pv-foot-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.market-pv-foot-btn.is-boost {
  color: var(--gold-light);
  border-color: var(--gold-border);
  background: var(--gold-bg);
}

/* ==========================================================================
   MODALE 8: POP-UP DIALOGO CUSTOM (Conferma & Input — Zero confirm/prompt)
   ========================================================================== */
.modal-app-dialog-card {
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.app-dialog-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 28px;
}
.app-dialog-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  color: var(--accent-cyan);
}
.app-dialog-icon.is-gold {
  background: var(--gold-bg);
  border-color: var(--gold-border);
  color: var(--gold-light);
}
.app-dialog-icon.is-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}
.app-dialog-head h2 {
  margin: 0;
  font-size: 16px;
}
.app-dialog-message {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.app-dialog-cost-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-size: 12.5px;
  font-weight: 700;
}
.app-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.app-dialog-confirm-btn {
  width: auto;
  padding: 8px 16px;
}

/* ==========================================================================
   STATUS BAR FISSA IN FONDO & TOAST
   ========================================================================== */
.lab-statusbar {
  flex: 0 0 28px;
  min-height: 28px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #090B0E;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  z-index: 30;
}
.lab-statusbar-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lab-statusbar a {
  color: var(--text-secondary);
  transition: color 0.14s ease;
}
.lab-statusbar a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.lab-toast-container {
  position: fixed;
  bottom: 36px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 150;
  pointer-events: none;
}
.lab-toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent-blue);
  color: var(--text-primary);
  font-size: 12.5px;
  box-shadow: var(--shadow-md);
  animation: toastSlideIn 0.2s ease;
}
.lab-toast.is-success { border-left-color: var(--success); }
.lab-toast.is-warn    { border-left-color: var(--warning); }
.lab-toast.is-error   { border-left-color: var(--danger); }

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

/* ==========================================================================
   RESPONSIVE (Laptop compatti, Tablet & Smartphone)
   ========================================================================== */
@media (max-width: 1200px) {
  :root {
    --left-w: 296px;
  }
  .lab-topbar {
    height: auto;
    flex-wrap: wrap;
    row-gap: 7px;
    padding: 7px 12px;
  }
  .topbar-left {
    order: 1;
  }
  .topbar-right {
    order: 2;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .stage-tabs {
    order: 3;
    flex: 1 0 100%;
    justify-content: center;
  }
}

@media (max-width: 960px) {
  html, body {
    overflow: auto;
  }
  .lab-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }
  .panel-resizer {
    display: none !important;
  }
  .lab-workspace,
  body[data-left-collapsed="true"] .lab-workspace,
  body[data-room="market"] .lab-workspace,
  body[data-market-overlay="true"] .lab-workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .stage-center {
    order: 1;
  }
  .studio-rail {
    order: 2;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px;
    border-right: 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
  }
  .rail-btn {
    flex: 1;
    width: auto;
    padding: 6px 4px;
  }
  .panel-left {
    order: 3;
    border-right: 0;
  }
  #room-create .action-stack {
    position: static;
    margin: 4px 0 0;
    padding: 8px 0 0;
    background: transparent;
  }
  .stage-viewport-wrap {
    min-height: 520px;
  }
  .viewport-bottom-dock {
    bottom: 8px;
    gap: 6px;
  }
  .viewport-controls {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: var(--radius-lg);
    padding: 6px;
  }
  .explode-floating-bar {
    width: auto;
    justify-content: center;
  }
  .explode-floating-bar input[type="range"] {
    width: 110px;
  }
  .mesh-hud {
    max-width: calc(100% - 24px);
    flex-wrap: wrap;
  }
  .guest-floating-pill {
    top: 52px;
    right: 12px;
    left: 12px;
    justify-content: space-between;
  }
  .pack-grid,
  .wallet-summary-strip,
  .creator-hub-grid,
  .market-preview-grid {
    grid-template-columns: 1fr;
  }
  .market-preview-viewport {
    min-height: 290px;
  }
  .checkpoint-compare {
    grid-template-columns: 1fr;
  }
  .compare-arrow {
    transform: rotate(90deg);
  }
  .lab-statusbar {
    flex: 0 0 auto;
    padding: 6px 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .stage-empty-state {
    padding: 14px 14px 36px;
  }
  .market-google-hero {
    padding: 24px 14px 20px;
  }
  .market-publish-layout,
  .market-filters-grid,
  .market-filter-pills-grid {
    grid-template-columns: 1fr;
  }
  .market-search-pill {
    padding-left: 12px;
  }
}

@media (max-width: 600px) {
  .shortcuts-grid,
  .model-cards {
    grid-template-columns: 1fr;
  }
}