@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --ink: #0d1117;
  --ink-raised: #151b23;
  --paper: #f0eee8;
  --paper-deep: #dcdad2;
  --muted: #8c949e;
  --muted-dark: #626a73;
  --line: rgba(13, 17, 23, .15);
  --line-dark: rgba(240, 238, 232, .16);
  --blue: #8fc5ff;
  --orange: #ff7b4d;
  --green: #a8e5be;
  --display: 'Space Grotesk', 'Avenir Next', 'Segoe UI', sans-serif;
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--display); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.site-shell { min-height: 100vh; overflow: hidden; }
.topbar { height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; gap: 28px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 24px; height: 24px; object-fit: contain; }
.brand-name { font-weight: 700; letter-spacing: -.04em; }
.brand-divider { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
.brand-product, .route-label, .tiny-label, .panel-state, .canvas-meta, .eyebrow, .status-chip, .scene-hint, .section-index, .site-footer { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.brand-product { color: var(--muted-dark); white-space: nowrap; }
.topnav { display: flex; gap: 28px; margin-left: auto; }
.topnav-link { color: var(--muted-dark); font-size: 13px; }
.topnav-link:hover, .topnav-link.is-active { color: var(--ink); }
.topnav-link.is-active { font-weight: 600; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-dark); white-space: nowrap; }
.status-dot, .live-marker { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px rgba(168, 229, 190, .22); }
.language-toggle { border: 1px solid var(--line); background: transparent; color: var(--muted-dark); min-width: 36px; height: 28px; padding: 0 8px; font: 10px var(--mono); cursor: pointer; }
.language-toggle:hover { color: var(--ink); border-color: var(--ink); }

.workspace { padding: 70px 4vw 0; }
.intro-row { max-width: 1240px; margin: 0 auto 58px; display: flex; justify-content: space-between; align-items: flex-end; gap: 44px; }
.eyebrow { color: var(--orange); margin: 0 0 15px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(48px, 6.5vw, 92px); line-height: .92; letter-spacing: -.07em; font-weight: 600; margin-bottom: 0; }
h1 em, h2 em { font-style: normal; color: var(--muted-dark); }
.intro-note { max-width: 270px; padding-bottom: 2px; }
.intro-note p { color: var(--muted-dark); font-size: 14px; line-height: 1.55; margin-bottom: 17px; }
.route-label { color: var(--muted-dark); }

.studio-grid { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); min-height: 680px; }
.panel-dark { background: var(--ink); color: var(--paper); }
.canvas-panel { min-width: 0; display: flex; flex-direction: column; }
.canvas-header, .canvas-footer { min-height: 55px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-family: var(--mono); font-size: 10px; letter-spacing: .07em; }
.canvas-header { border-bottom: 1px solid var(--line-dark); color: #b9c0c8; }
.canvas-header > div:first-child { display: flex; align-items: center; gap: 10px; }
.canvas-meta { display: flex; align-items: center; gap: 11px; color: #68737e; }
.meta-separator { width: 20px; height: 1px; background: var(--line-dark); }
.scene-mount { position: relative; min-height: 520px; flex: 1; overflow: hidden; background: #111820; cursor: grab; }
.scene-mount:active { cursor: grabbing; }
.scene-mount canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-grid { position: absolute; inset: 0; pointer-events: none; opacity: .34; background-image: linear-gradient(rgba(143, 197, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 197, 255, .08) 1px, transparent 1px); background-size: 58px 58px; mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 75%, transparent 100%); }
.scene-coordinate { position: absolute; right: 25px; top: 22px; color: #56616b; font: 10px var(--mono); display: flex; align-items: center; gap: 7px; pointer-events: none; }
.scene-coordinate i { width: 38px; height: 1px; background: #56616b; display: block; }
.reference-card { position: absolute; z-index: 2; top: 20px; left: 24px; width: 148px; padding: 9px; background: rgba(13, 17, 23, .92); border: 1px solid rgba(240, 238, 232, .2); box-shadow: 0 12px 30px rgba(0, 0, 0, .22); pointer-events: none; }
.reference-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #b9c0c8; font: 9px var(--mono); letter-spacing: .07em; text-transform: uppercase; margin-bottom: 8px; }
.reference-card-header span:last-child { color: var(--green); font-size: 8px; }
.reference-card img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fffefa; }
.scene-hint { position: absolute; bottom: 20px; left: 24px; color: #62707d; pointer-events: none; }
.scene-hint span { color: var(--orange); padding: 0 7px; }
.scene-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--paper); font-size: 14px; }
.canvas-footer { border-top: 1px solid var(--line-dark); color: #b9c0c8; }
.model-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tiny-label { color: #68737e; font-size: 9px; }
.model-id strong { font: 11px var(--mono); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-controls { display: flex; gap: 8px; }
.mode-button { border: 1px solid var(--line-dark); background: transparent; color: #7b8690; padding: 8px 10px; font: 10px var(--mono); cursor: pointer; }
.mode-button:hover, .mode-button.is-selected { color: var(--paper); border-color: var(--blue); }

.control-panel { background: #fffefa; border: 1px solid var(--line); border-left: 0; padding: 27px 28px; display: flex; flex-direction: column; }
.panel-heading, .mini-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading > div, .mini-heading { display: flex; align-items: center; gap: 12px; }
.section-index { color: var(--orange); }
h2 { font-size: 18px; letter-spacing: -.04em; margin: 0; font-weight: 600; }
.panel-state { color: #4c795d; }
.panel-copy { color: var(--muted-dark); font-size: 13px; line-height: 1.55; margin: 22px 0; max-width: 295px; }
.dropzone { border: 1px dashed #adb1ae; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--orange); background: #fff6f1; }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-icon { color: var(--orange); font-size: 27px; line-height: 1; margin-bottom: 11px; }
.dropzone strong { font-size: 14px; margin-bottom: 8px; }
.dropzone span:last-child { color: var(--muted-dark); font: 10px var(--mono); line-height: 1.5; }
.upload-preview { display: grid; grid-template-columns: 54px minmax(0, 1fr) 28px; gap: 12px; align-items: center; margin-top: 14px; padding: 10px; background: #f3f1eb; }
.upload-preview img { width: 54px; height: 54px; object-fit: cover; border: 1px solid var(--line); }
.upload-preview div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-preview strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview span:last-child { color: var(--muted-dark); font: 10px var(--mono); }
.icon-button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted-dark); font-size: 22px; cursor: pointer; }
.primary-button { border: 0; background: var(--ink); color: var(--paper); min-height: 47px; padding: 0 16px; margin-top: 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 13px; }
.primary-button:hover:not(:disabled) { background: #252d36; }
.primary-button:disabled { opacity: .38; cursor: not-allowed; }
.form-message { min-height: 18px; color: var(--muted-dark); font: 10px var(--mono); margin: 10px 0 0; }
.form-message.is-error { color: #b4492d; }
.form-message.is-success { color: #477355; }
.rule { height: 1px; background: var(--line); margin: auto 0 25px; }
.mini-heading { justify-content: flex-start; }
.run-output { margin-top: 18px; min-height: 142px; background: #f3f1eb; padding: 17px; }
.run-output.is-empty { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.empty-symbol { color: var(--orange); font-size: 26px; margin-bottom: 10px; }
.run-output p { font-size: 13px; margin-bottom: 5px; }
.run-output > span { color: var(--muted-dark); font: 10px var(--mono); line-height: 1.4; }
.run-result { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.result-status { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); font: 10px var(--mono); }
.result-status strong { color: #477355; font-weight: 500; }
.result-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.result-item span { color: var(--muted-dark); font: 9px var(--mono); text-transform: uppercase; }
.result-item strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.result-note { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted-dark); font-size: 11px; line-height: 1.45; }

.pipeline-section { max-width: 1240px; margin: 120px auto 0; padding-bottom: 116px; }
.section-topline { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }
.pipeline-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10vw; padding-top: 52px; }
.pipeline-copy h2 { font-size: clamp(34px, 4vw, 56px); line-height: .95; letter-spacing: -.07em; margin-bottom: 22px; }
.pipeline-copy p { max-width: 330px; color: var(--muted-dark); font-size: 13px; line-height: 1.6; }
.pipeline-steps { display: grid; grid-template-columns: repeat(5, 1fr); align-self: start; border-top: 1px solid var(--line); }
.pipeline-step { position: relative; min-height: 145px; padding: 17px 12px 10px 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.pipeline-step:not(:first-child) { padding-left: 13px; }
.pipeline-step:last-child { border-right: 0; }
.pipeline-step span { color: var(--muted-dark); font: 10px var(--mono); }
.pipeline-step strong { font-size: 14px; font-weight: 500; }
.pipeline-step small { color: var(--muted-dark); font: 10px var(--mono); line-height: 1.4; }
.pipeline-step.is-current:before { content: ''; position: absolute; top: -4px; left: 0; right: 0; height: 7px; background: var(--orange); }
.site-footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; padding: 21px 4vw; color: var(--muted-dark); }

@media (max-width: 900px) {
  .topbar { padding: 0 20px; }
  .brand-product, .topnav { display: none; }
  .status-chip { margin-left: auto; }
  .workspace { padding: 50px 20px 0; }
  .intro-row { display: block; margin-bottom: 38px; }
  .intro-note { margin-top: 25px; }
  .studio-grid { display: block; }
  .scene-mount { min-height: 440px; }
  .reference-card { width: 116px; left: 16px; top: 16px; }
  .control-panel { border-left: 1px solid var(--line); border-top: 0; padding: 24px 22px; }
  .pipeline-section { margin-top: 80px; padding-bottom: 70px; }
  .pipeline-layout { display: block; padding-top: 35px; }
  .pipeline-copy { margin-bottom: 40px; }
  .pipeline-steps { overflow-x: auto; grid-template-columns: repeat(5, minmax(120px, 1fr)); }
  .site-footer { padding: 18px 20px; gap: 14px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
