/* ==========================================================================
   3D Design Studio — app-shell layout
   ========================================================================== */

body.studio-page { overflow: hidden; }
body.studio-page .site-footer { display: none; }

.studio {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}

/* ============================ top bar ============================ */
.studio-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 62px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}

.sb-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.sb-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.sb-id {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.sb-groups {
  display: flex;
  gap: 4px;
  justify-content: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.sb-groups::-webkit-scrollbar { display: none; }

.gtab {
  flex: 0 0 auto;
  background: none;
  border: 0;
  padding: 8px 12px 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
  transition: color .18s ease;
  white-space: nowrap;
}
.gtab:hover { color: var(--ink); }
.gtab.is-active { color: var(--ink); font-weight: 600; }
.gtab.is-done { color: var(--sage-deep); }

.gtab i {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
  position: relative;
}
.gtab i::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: var(--sage);
  border-radius: 2px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.gtab.is-active i::after { background: var(--accent); }

.sb-right { display: flex; align-items: center; gap: 10px; }

.sb-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  padding-right: 12px;
  margin-right: 2px;
  border-right: 1px solid var(--line);
}
.sb-price-label {
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.sb-price strong {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sb-price strong.flash { animation: priceFlash .5s ease; }
@keyframes priceFlash {
  0% { color: var(--accent); transform: scale(1.06); }
  100% { color: var(--ink); transform: scale(1); }
}

.btn-sm { padding: 9px 15px; font-size: 0.82rem; }

/* ============================ body ============================ */
.studio-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: 0;
}

/* ---------- 3D stage ---------- */
.stage {
  position: relative;
  min-width: 0;
  background:
    radial-gradient(120% 90% at 50% 12%, #F6F3EC 0%, #E6E1D6 58%, #D8D2C4 100%);
  overflow: hidden;
}
.stage-canvas { position: absolute; inset: 0; }
.stage-canvas canvas { display: block; width: 100% !important; height: 100% !important; }

.stage-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--surface);
  z-index: 3;
  transition: opacity .4s ease, visibility .4s;
}
.stage-loading.is-hidden { opacity: 0; visibility: hidden; }
.stage-loading p { color: var(--ink-muted); font-size: 0.9rem; margin: 0; }
.spinner {
  width: 34px; height: 34px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* view toggle */
.stage-views {
  position: absolute;
  top: 18px; left: 18px;
  display: flex;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  z-index: 2;
}
.vbtn {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.vbtn.is-active { background: var(--ink); color: #fff; font-weight: 600; }

/* hint chips */
.stage-hint {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 32px);
}
.stage-hint span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.stage-hint svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* spec readout bottom-left */
.stage-spec {
  position: absolute;
  top: 18px; right: 18px;
  z-index: 2;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 7px 12px;
  pointer-events: none;
}

/* hotspot pins */
.pins { position: absolute; inset: 0; z-index: 2; }
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(16,32,42,.14);
  transition: padding .22s ease, box-shadow .22s ease;
  font: inherit;
}
.pin::before {
  content: '';
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(196,99,58,.5);
  animation: pulse 2.4s ease-out infinite;
  flex: 0 0 auto;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(196,99,58,.45); }
  70% { box-shadow: 0 0 0 11px rgba(196,99,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(196,99,58,0); }
}
.pin b {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  transition: max-width .26s ease, margin .26s ease;
}
.pin:hover { padding: 5px 13px 5px 5px; box-shadow: 0 5px 20px rgba(16,32,42,.2); }
.pin:hover b { max-width: 110px; margin-left: 7px; }
.pins[aria-hidden="true"] .pin { display: none; }

/* ---------- option panel ---------- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--white);
  border-left: 1px solid var(--line);
}
.panel-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 24px 20px;
}

.panel-head { margin-bottom: 20px; }
.panel-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
.panel-count {
  flex: 0 0 auto;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.panel-desc {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-muted);
}
.panel-progress {
  margin-top: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
}
.panel-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* option cards */
.panel-options { display: flex; flex-direction: column; gap: 9px; }

.opt {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--r-md, 12px);
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.opt:hover { border-color: var(--sage); background: var(--surface); }
.opt.is-active {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.opt-sw {
  width: 54px; height: 54px;
  border-radius: 9px;
  border: 1px solid rgba(16,32,42,.13);
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.opt-sw.split::after {
  content: '';
  position: absolute;
  inset: 50% 0 0 0;
  background: var(--sw2);
}
.opt-sw.icon {
  display: grid;
  place-content: center;
  background: var(--surface-2);
  color: var(--ink-soft);
}
.opt-sw.icon svg { width: 24px; height: 24px; }

.opt-txt { min-width: 0; }
.opt-name {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.3;
}
.opt-note {
  display: block;
  margin-top: 3px;
  font-size: 0.775rem;
  line-height: 1.45;
  color: var(--ink-muted);
}
.opt-brand {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sage-deep);
}

.opt-price {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}
.opt-price.zero { color: var(--sage-deep); background: rgba(125,145,130,.14); }
.opt-price.up { color: var(--accent-deep); background: rgba(196,99,58,.11); }
.opt-price.quote { color: var(--ink-muted); background: var(--surface-2); font-weight: 500; }

/* form fields (quote steps) */
.panel-form { display: flex; flex-direction: column; gap: 15px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.fld label span { color: var(--accent); }
.fld input, .fld select, .fld textarea {
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  width: 100%;
  transition: border-color .18s ease;
}
.fld input:focus, .fld select:focus, .fld textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.fld textarea { resize: vertical; min-height: 84px; }
.fld.err input, .fld.err select { border-color: var(--accent); }
.fld .msg { font-size: 0.75rem; color: var(--accent-deep); display: none; }
.fld.err .msg { display: block; }

.form-note {
  font-size: 0.775rem;
  line-height: 1.55;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
}

/* panel footer */
.panel-foot {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--white);
}
.foot-price {
  text-align: center;
  line-height: 1.15;
  display: none;
}
.foot-price span {
  display: block;
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.foot-price strong {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.panel-foot .btn-ghost:disabled { opacity: .35; cursor: not-allowed; }
.panel-foot .btn { justify-content: center; }
.panel-foot .btn svg { width: 16px; height: 16px; }

/* ============================ welcome ============================ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(16,32,42,.55);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.overlay.is-gone,
.overlay[hidden] { display: none; }
.overlay-scroll { overflow-y: auto; align-items: start; }

.wcard {
  width: min(880px, 100%);
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
  box-shadow: 0 24px 70px rgba(16,32,42,.3);
}
.wcard-media { position: relative; background: var(--surface-2); }
.wcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wcard-body { padding: 34px 34px 26px; display: flex; flex-direction: column; }
.wcard-body h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin: 10px 0 12px;
}
.wcard-body .w-a { font-size: 0.96rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 10px; }
.wcard-body .w-b { font-size: 0.87rem; line-height: 1.6; color: var(--ink-muted); margin: 0; }
.wcard-foot {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wdots { display: flex; gap: 6px; }
.wdots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: all .2s ease;
}
.wdots i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.wbtns { display: flex; gap: 8px; align-items: center; }

/* ============================ proposal ============================ */
.proposal-shell { width: min(860px, 100%); padding: 24px 0 60px; }
.proposal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.proposal-actions > div { display: flex; gap: 8px; }

.proposal {
  background: var(--white);
  border-radius: 14px;
  padding: 46px 50px 50px;
  box-shadow: 0 20px 60px rgba(16,32,42,.28);
  color: var(--ink);
}
.p-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.p-top h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.p-top p { margin: 0; font-size: 0.83rem; color: var(--ink-muted); line-height: 1.5; }
.p-meta { text-align: right; font-size: 0.8rem; color: var(--ink-muted); line-height: 1.6; white-space: nowrap; }
.p-meta strong { color: var(--ink); }

.p-shot {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.p-shot img { width: 100%; display: block; }

.p-h {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 28px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
}
.p-tbl { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.p-tbl td { padding: 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.p-tbl td:first-child { color: var(--ink-muted); width: 38%; padding-right: 16px; }
.p-tbl td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-soft); }
.p-tbl td.val { text-align: left; font-weight: 500; color: var(--ink); }
.p-tbl tr.total td {
  border-bottom: 0;
  border-top: 2px solid var(--ink);
  padding-top: 13px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ink);
}
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.p-fine {
  margin-top: 26px;
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 16px 18px;
}
.p-fine strong { color: var(--ink-soft); }
.p-fine ul { margin: 6px 0 0; padding-left: 18px; }
.p-fine li { margin-bottom: 3px; }

/* toast */
.toast {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  padding: 12px 20px;
  border-radius: 999px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  box-shadow: 0 8px 26px rgba(16,32,42,.3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================ print ============================ */
@media print {
  body.studio-page { overflow: visible; }
  .site-header, .studio-bar, .studio-body, .no-print, .toast, .overlay::before { display: none !important; }
  .studio { position: static; inset: auto; display: block; }
  .overlay {
    position: static;
    background: none;
    backdrop-filter: none;
    padding: 0;
    display: block;
  }
  .proposal-shell { width: 100%; padding: 0; }
  .proposal { box-shadow: none; border-radius: 0; padding: 0; }
  .p-shot { break-inside: avoid; }
  .p-h { break-after: avoid; }
}

/* ============================ responsive ============================ */
@media (max-width: 1180px) {
  .studio-body { grid-template-columns: minmax(0, 1fr) 370px; }
  .sb-price { display: none; }
}

@media (max-width: 900px) {
  .studio-bar { grid-template-columns: 1fr auto; height: auto; padding: 10px 14px; gap: 10px 12px; }
  .sb-groups { grid-column: 1 / -1; order: 3; justify-content: flex-start; }
  .sb-right .btn-outline { display: none; }
  .sb-price { display: flex; border-right: 0; padding-right: 0; }
  .sb-title { font-size: 0.92rem; }

  .studio-body { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 42vh) minmax(0, 1fr); }
  .stage { border-bottom: 1px solid var(--line); }
  .panel { border-left: 0; }
  .panel-scroll { padding: 20px 16px 16px; }
  .stage-hint span:not(:first-child) { display: none; }
  .stage-spec { display: none; }
  .stage-views { top: 12px; left: 12px; }
  .panel-title { font-size: 1.14rem; }

  .panel-foot { grid-template-columns: auto auto 1fr; padding: 11px 14px; gap: 10px; }
  .foot-price { display: block; text-align: right; margin-left: auto; order: 3; }
  .panel-foot #btnNext { order: 4; }
  .panel-foot #btnBack { order: 1; }

  .wcard { grid-template-columns: 1fr; max-height: calc(100vh - 120px); overflow-y: auto; }
  .wcard-media { height: 170px; }
  .wcard-body { padding: 24px 22px 20px; }
  .wcard-body h2 { font-size: 1.3rem; }

  .proposal { padding: 26px 22px 30px; }
  .p-top { flex-direction: column; gap: 12px; }
  .p-meta { text-align: left; }
  .p-grid { grid-template-columns: 1fr; gap: 0; }
  .proposal-actions { flex-direction: column; align-items: stretch; }
  .proposal-actions > div { justify-content: stretch; }
  .proposal-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 560px) {
  /* the footer already carries the running price, so the bar only needs
     the title and the primary action */
  .studio-bar { gap: 8px 10px; padding: 9px 13px; }
  .sb-price { display: none; }
  .sb-id { display: none; }
  .sb-left { min-width: 0; overflow: hidden; }
  .sb-title { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }
  .sb-right .btn { font-size: 0.82rem; padding: 9px 14px; white-space: nowrap; }
  .sb-groups { gap: 14px; overflow-x: auto; scrollbar-width: none; }
  .sb-groups::-webkit-scrollbar { display: none; }
  .sb-groups b { font-size: 0.8rem; }

  .panel-foot { grid-template-columns: auto 1fr auto; }
  .foot-price strong { font-size: 0.92rem; }
  .pin { padding: 4px; }
  .pin::before { width: 8px; height: 8px; }
  .opt { grid-template-columns: 44px 1fr auto; gap: 11px; padding: 10px 11px; }
  .opt-sw { width: 44px; height: 44px; }
  .opt-name { font-size: 0.87rem; }
  .opt-note { font-size: 0.74rem; }
}
