:root {
  --background: #131316;
  --surface: #1b1b1e;
  --surface-2: #1f1f22;
  --surface-3: #2a2a2d;
  --surface-4: #353438;
  --line: #454933;
  --line-soft: rgba(255, 255, 255, .08);
  --text: #e4e1e6;
  --muted: #c6c9ac;
  --dim: rgba(228, 225, 230, .62);
  --primary: #d2f000;
  --primary-dim: #b8d300;
  --on-primary: #191e00;
  --secondary: #7ef4ff;
  --danger: #ffb4ab;
  --radius: 8px;
  --shadow: 0 18px 52px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(210, 240, 0, .06), transparent 36rem),
    radial-gradient(circle, rgba(69, 73, 51, .9) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--background);
  font: 14px/1.45 Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
select, input[type="text"] {
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 14px 32px;
  background: rgba(19, 19, 22, .92);
  border-bottom: 2px solid var(--surface-4);
  box-shadow: 0 0 15px rgba(210, 240, 0, .16);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: max-content; }
.brand strong {
  font-family: "Bricolage Grotesque", Geist, sans-serif;
  font-size: 24px;
  font-weight: 800;
  font-style: italic;
  color: #fff;
}
.brand span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.topnav { display: flex; align-items: center; gap: 26px; }
.topnav button, .ghost-btn {
  color: var(--muted);
  background: transparent;
  border: 0;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .08em;
}
.topnav button.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}
.account-area { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.try-pill, .plan-pill, .account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(210, 240, 0, .25);
  color: var(--primary);
  background: rgba(210, 240, 0, .05);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.plan-pill {
  color: var(--text);
  background: var(--surface-4);
  border-color: var(--line-soft);
}
.account-pill {
  max-width: 190px;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(126,244,255,.35), rgba(210,240,0,.25)),
    var(--surface-4);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px 32px 36px;
}
.hero-stepper { padding: 10px 0 18px; }
.stepper-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.stepper-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.stepper-head span + span { color: var(--muted); }
.progress-track {
  height: 7px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}
#activeStepHint { margin: 12px 0 0; color: var(--muted); text-align: center; }
.step-tabs { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; padding-bottom: 2px; }
.step-tab {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(31,31,34,.82);
  color: var(--muted);
  font-weight: 700;
}
.step-tab.active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.step-panel { display: none; }
.step-panel.active { display: block; }
.panel-copy h1 {
  margin: 0;
  max-width: 780px;
  font: 800 48px/1.06 "Bricolage Grotesque", Geist, sans-serif;
  color: #fff;
}
.panel-copy p { max-width: 700px; margin: 12px 0 0; color: var(--muted); font-size: 18px; }
.panel-copy.compact h1 { font-size: 34px; }
.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.concept-grid, .reference-hero, .output-layout, .export-grid, .mark-grid, .below-grid {
  display: grid;
  gap: 16px;
}
.concept-grid { grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); align-items: end; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice-card {
  display: grid;
  gap: 12px;
  min-height: 180px;
  padding: 22px;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 12px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.choice-card input { display: none; }
.choice-card.selected, .choice-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 18px rgba(210,240,0,.16);
}
.choice-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 8px;
  font-weight: 900;
  font-size: 24px;
}
.choice-card strong { font: 700 24px/1.2 "Bricolage Grotesque", Geist, sans-serif; }
.choice-card span:last-child { color: var(--muted); }
.concept-workspace { display: grid; grid-template-columns: 360px 1fr; gap: 16px; margin-top: 24px; }

.workspace-card, .upload-panel, .chat-panel, .task-box, .save-panel {
  background: rgba(31,31,34,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.upload-panel, .chat-panel, .task-box, .save-panel { padding: 16px; }
.panel-title, .card-head {
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.card-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-3);
}
.card-head > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.muted { color: var(--dim); font-weight: 500; text-transform: none; letter-spacing: 0; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}
.view-icon {
  min-width: 28px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(126,244,255,.16);
  color: var(--secondary);
  font-size: 11px;
  text-align: center;
}

.upload-zone {
  min-height: 190px;
  margin-top: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.upload-zone input { width: 100%; color: var(--muted); }
.upload-mark {
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 6px;
  padding: 7px 10px;
  font-weight: 800;
}
.upload-zone small, .source-bar { color: var(--dim); }
.source-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; min-height: 58px; }
.source-bar .thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  background: var(--surface-4);
}
.source-bar .thumb.active { border-color: var(--primary); }

.chat-log { display: grid; gap: 12px; margin-top: 12px; max-height: 320px; overflow: auto; }
.chat-msg, .concept-card-mini {
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.chat-msg.user {
  justify-self: end;
  max-width: 74%;
  color: var(--on-primary);
  background: var(--primary);
}
.concept-card-mini { display: grid; gap: 4px; border-color: rgba(126,244,255,.4); }
.concept-card-mini strong { color: var(--secondary); }
.chat-input {
  margin-top: 14px;
  padding: 13px 14px;
  color: var(--dim);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.reference-hero {
  grid-template-columns: minmax(0, 460px) 1fr;
  align-items: stretch;
  min-height: 620px;
}
.reference-stage {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(210,240,0,.06), transparent 45%),
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.reference-stage.slim { min-height: 470px; }
.stage-badge {
  position: absolute;
  left: 18px;
  top: 18px;
  padding: 8px 11px;
  color: var(--primary);
  border: 1px solid rgba(210,240,0,.3);
  border-radius: 999px;
  background: rgba(19,19,22,.65);
  font-weight: 800;
}
.iso-figure {
  position: relative;
  width: 270px;
  height: 420px;
  transform: rotate(-8deg) skewY(3deg);
  filter: drop-shadow(0 24px 35px rgba(0,0,0,.45));
}
.iso-figure.small { transform: scale(.82) rotate(-8deg) skewY(3deg); }
.block-head, .block-body, .block-arm, .block-leg {
  position: absolute;
  border: 2px solid rgba(210,240,0,.55);
  background: linear-gradient(145deg, rgba(126,244,255,.18), rgba(210,240,0,.12));
}
.block-head { left: 92px; top: 0; width: 88px; height: 88px; }
.block-body { left: 62px; top: 104px; width: 148px; height: 156px; box-shadow: inset 0 0 60px rgba(210,240,0,.12); }
.block-arm { top: 104px; width: 54px; height: 156px; }
.block-arm.left { left: 0; }
.block-arm.right { right: 0; }
.block-leg { top: 278px; width: 68px; height: 138px; }
.block-leg.left { left: 62px; }
.block-leg.right { right: 62px; }

.output-layout { grid-template-columns: minmax(340px, 1fr) minmax(360px, 560px); align-items: stretch; }
.output-cards { display: grid; gap: 14px; }
.output-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 8px;
}
.output-card strong { font: 700 28px/1.1 "Bricolage Grotesque", Geist, sans-serif; }
.output-card span { color: var(--muted); }
.output-card.active, .output-card:hover {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}
.output-card.active span, .output-card:hover span { color: rgba(25,30,0,.75); }

.mark-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) minmax(250px, 2fr); align-items: stretch; }
.marking-card, .preview-card, .task-panel { min-height: 660px; }
.marking-card { position: relative; }
.source-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.source-toolbar label, .controls-box label, .project-open {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.canvas-wrap {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background:
    radial-gradient(circle, rgba(69, 73, 51, .8) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--background);
}
.marking-card .canvas-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 150px;
  height: 320px;
  transform: translate(-50%, -50%) rotate(-7deg);
  background:
    linear-gradient(rgba(126,244,255,.34), rgba(126,244,255,.22)) 50px 0 / 50px 50px no-repeat,
    linear-gradient(rgba(210,240,0,.28), rgba(126,244,255,.16)) 32px 72px / 86px 112px no-repeat,
    linear-gradient(rgba(210,240,0,.18), rgba(126,244,255,.12)) 0 72px / 28px 112px no-repeat,
    linear-gradient(rgba(210,240,0,.18), rgba(126,244,255,.12)) 122px 72px / 28px 112px no-repeat,
    linear-gradient(rgba(126,244,255,.18), rgba(210,240,0,.12)) 36px 204px / 34px 100px no-repeat,
    linear-gradient(rgba(126,244,255,.18), rgba(210,240,0,.12)) 80px 204px / 34px 100px no-repeat;
  opacity: .38;
  filter: drop-shadow(0 18px 26px rgba(0,0,0,.35));
  pointer-events: none;
}
canvas { max-width: 100%; border-radius: 6px; }
canvas#src { cursor: crosshair; }
.floating-tools {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  color: var(--text);
  background: rgba(19,19,22,.74);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}
.floating-tools button, .small-btn {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-3);
}
.floating-tools span { min-width: 44px; text-align: center; color: var(--muted); font-size: 12px; }
.view3d {
  position: relative;
  overflow: hidden;
  height: calc(100% - 48px);
  min-height: 612px;
  background:
    radial-gradient(circle at 50% 18%, rgba(126,244,255,.12), transparent 30rem),
    var(--surface);
  cursor: grab;
}
.view3d::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190px;
  height: 360px;
  transform: translate(-50%, -50%) rotate(-5deg);
  background:
    linear-gradient(var(--secondary), var(--secondary)) 66px 0 / 58px 58px no-repeat,
    linear-gradient(145deg, rgba(210,240,0,.42), rgba(126,244,255,.24)) 42px 80px / 106px 128px no-repeat,
    linear-gradient(145deg, rgba(126,244,255,.28), rgba(210,240,0,.2)) 0 82px / 36px 126px no-repeat,
    linear-gradient(145deg, rgba(126,244,255,.28), rgba(210,240,0,.2)) 154px 82px / 36px 126px no-repeat,
    linear-gradient(145deg, rgba(210,240,0,.28), rgba(126,244,255,.18)) 46px 228px / 44px 118px no-repeat,
    linear-gradient(145deg, rgba(210,240,0,.28), rgba(126,244,255,.18)) 100px 228px / 44px 118px no-repeat;
  filter: drop-shadow(0 24px 38px rgba(0,0,0,.45)) drop-shadow(0 0 24px rgba(210,240,0,.14));
  opacity: .72;
  pointer-events: none;
}
.view3d:active { cursor: grabbing; }
.view3d canvas { position: relative; z-index: 1; display: block; }
.task-panel { display: grid; grid-template-rows: 1fr auto; gap: 16px; }
.task-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.task-title span {
  color: var(--primary);
  background: rgba(210,240,0,.14);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}
.guided-tasks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.guided-tasks li {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}
.guided-tasks li.active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 800;
}
.controls-box { display: grid; gap: 10px; }
.checkline input { accent-color: var(--primary); }
.primary-btn, .secondary-btn, .danger-btn {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  color: var(--on-primary);
  background: var(--primary);
  font-weight: 800;
}
.secondary-btn {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line);
}
.danger-btn {
  color: var(--danger);
  background: rgba(255, 180, 171, .08);
  border-color: rgba(255, 180, 171, .3);
}
.wide { width: 100%; }

.export-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(300px, .8fr); align-items: start; }
.template-wrap { min-height: 500px; }
.save-panel { display: grid; gap: 12px; }
.project-open { flex-direction: column; align-items: stretch; }

.below-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.2fr) minmax(320px, 1.2fr);
  margin-top: 16px;
}
#layerList, #jobList { list-style: none; margin: 0; padding: 8px; max-height: 260px; overflow: auto; }
#layerList li, #jobList li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--muted);
}
#layerList li:hover, #jobList li:nth-child(odd) { background: var(--surface); }
#layerList li.active { outline: 1px solid var(--primary); }
#layerList .tag, #jobList .tag { color: var(--dim); font-size: 12px; }
#layerList .del {
  border: 0;
  color: var(--danger);
  background: transparent;
}
.plan-list, .plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; }
.plan {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.plan b { color: var(--primary); }
.plan span { color: var(--muted); font-size: 12px; }
.plan button { justify-self: start; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  color: var(--text);
  background: var(--surface-4);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#toast.show { opacity: 1; }

@media (max-width: 1180px) {
  .topnav { display: none; }
  .concept-grid, .concept-workspace, .reference-hero, .output-layout, .export-grid, .mark-grid, .below-grid {
    grid-template-columns: 1fr;
  }
  .marking-card, .preview-card, .task-panel { min-height: auto; }
  .view3d { min-height: 420px; }
}

@media (max-width: 760px) {
  .topbar, .studio-shell { padding-left: 16px; padding-right: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .account-area { justify-content: flex-start; }
  .panel-copy h1 { font-size: 34px; }
  .choice-grid { grid-template-columns: 1fr; }
  .step-tab { min-width: 104px; }
  .source-toolbar { align-items: stretch; flex-direction: column; }
  .source-toolbar label { justify-content: space-between; }
}
