:root {
  --bg-deep: #070b14;
  --bg-panel: #0f172a;
  --bg-card: #131e35;
  --bg-hover: #1b2a47;
  --border: rgba(148, 163, 184, 0.16);
  --border-accent: rgba(56, 189, 248, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #0ea5e9;
  --accent-bright: #38bdf8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --radius-lg: 16px;
  --radius-md: 11px;
}

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

body, html {
  height: 100%;
  background: radial-gradient(circle at top right, #0f1c36 0%, var(--bg-deep) 60%);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.brand-cube {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #04101d;
  font-size: 14px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 10px 0 26px;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(7, 11, 20, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s;
}

.field input:focus, .field select:focus {
  border-color: var(--accent-bright);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--border);
  color: #e2e8f0;
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.btn-block {
  width: 100%;
}

.error-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fecdd3;
  font-size: 13px;
}

/* Main Studio Shell */
.studio-shell {
  display: grid;
  grid-template-rows: 62px 1fr;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(10, 16, 30, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 10px;
}

.project-pill select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.studio-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 62px);
  overflow: hidden;
}

/* Left Sidebar: Upload + Job Queue */
.sidebar {
  background: rgba(11, 18, 33, 0.94);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px;
  gap: 18px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropzone {
  border: 1.5px dashed rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.05);
  border-radius: 13px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover, .dropzone.dragover {
  background: rgba(14, 165, 233, 0.12);
  border-color: var(--accent-bright);
}

.dropzone h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

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

.job-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.job-item {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.16s;
}

.job-item:hover {
  background: var(--bg-hover);
}

.job-item.active {
  border-color: var(--accent-bright);
  background: rgba(14, 165, 233, 0.12);
}

.job-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.job-item-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-completed { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge-processing, .badge-queued { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.badge-ready { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-failed { background: rgba(244, 63, 94, 0.2); color: #fb7185; }

.job-item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.mini-progress {
  height: 4px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.mini-progress > div {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  transition: width 0.3s ease;
}

/* Right Workspace: 3D Tour Showcase + Pipeline Telemetry + Downloads + Sharing */
.workspace {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 24px;
  gap: 18px;
}

.empty-state {
  margin: auto;
  text-align: center;
  max-width: 460px;
  color: var(--text-muted);
}

.empty-state h2 {
  color: var(--text-main);
  font-size: 20px;
  margin-bottom: 8px;
}

/* Stage Progress Banner */
.pipeline-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.stage-pills {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.stage-pill {
  font-size: 10.5px;
  text-align: center;
  padding: 5px 4px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
}

.stage-pill.done {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.stage-pill.active {
  background: rgba(14, 165, 233, 0.24);
  border-color: var(--accent-bright);
  color: #fff;
}

/* Interactive 3D Showcase Frame */
.showcase-card {
  position: relative;
  height: 540px;
  min-height: 460px;
  background: #050811;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#three-container {
  width: 100%;
  height: 100%;
}

.viewer-hud-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.viewer-hud-top > * {
  pointer-events: auto;
}

.hud-glass {
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 12.5px;
}

.viewer-hud-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 10;
}

.mode-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s;
}

.mode-btn:hover {
  color: #fff;
  background: rgba(56, 189, 248, 0.14);
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.sweep-strip {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 5px;
  z-index: 10;
}

.sweep-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.sweep-dot.active {
  background: var(--accent-bright);
  color: #04101d;
  border-color: #fff;
}

/* Metrics & Downloads Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.metric-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 15px;
}

.metric-tile .k {
  font-size: 11.5px;
  color: var(--text-muted);
}

.metric-tile .v {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  color: #f1f5f9;
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 11px;
}

.dl-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dl-info h4 {
  font-size: 13px;
  font-weight: 600;
}

.dl-info p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.warning-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.warning-item {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.11);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fde68a;
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
  font-size: 12.5px;
}

/* Keyboard Accessibility Focus Rings */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* Responsive Tablet & Mobile Layouts */
@media (max-width: 1024px) {
  .studio-main {
    grid-template-columns: 300px 1fr;
  }
  .stage-pills {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 768px) {
  .studio-shell {
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .topbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .studio-main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }
  .workspace {
    padding: 14px;
  }
  .showcase-card {
    height: 400px;
    min-height: 340px;
  }
  .viewer-hud-bottom {
    width: calc(100% - 24px);
    justify-content: center;
    flex-wrap: wrap;
    border-radius: 16px;
    bottom: 10px;
  }
  .sweep-strip {
    bottom: 64px;
  }
  .stage-pills {
    grid-template-columns: repeat(2, 1fr);
  }
}

