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

:root {
  --ink: #102033;
  --muted: #5f6e7d;
  --navy: #0d1b2a;
  --steel: #2a4e6e;
  --teal: #1e5b63;
  --copper: #cc7a2b;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.97);
  --surface-soft: rgba(243, 247, 250, 0.9);
  --line: rgba(13, 27, 42, 0.08);
  --line-strong: rgba(13, 27, 42, 0.14);
  --shadow-lg: 0 22px 54px rgba(13, 27, 42, 0.16);
  --shadow-md: 0 14px 32px rgba(13, 27, 42, 0.12);
  --shadow-sm: 0 8px 18px rgba(13, 27, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(30, 91, 99, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(204, 122, 43, 0.12), transparent 24%),
    linear-gradient(160deg, #eef3f8 0%, #dae5ef 100%);
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.studio-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

#canvas-container {
  position: absolute;
  inset: 0;
}

#loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font-weight: 600;
}

.floating-actions {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 18;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.floating-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  color: var(--navy);
  font-weight: 600;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

.floating-link:hover,
.floating-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.floating-link.primary {
  border-color: transparent;
  background: linear-gradient(145deg, var(--copper), #df8f3f);
  color: #fff;
}

.studio-lang {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.studio-lang span,
.studio-kicker,
.pdf-kicker {
  margin: 0;
  color: var(--steel);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lang-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lang-pill {
  min-width: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 27, 42, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  transition: background-color 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.lang-pill:hover,
.lang-pill.is-active {
  background: var(--navy);
  color: #fff;
  transform: translateY(-1px);
}

.hud-card,
#ui-panel,
.material-dock {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.studio-left-rail {
  position: absolute;
  top: 108px;
  left: 24px;
  bottom: 24px;
  z-index: 12;
  width: min(640px, calc(100vw - 520px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.studio-intro {
  position: relative;
  width: auto;
  min-width: 0;
  max-height: min(46vh, 500px);
  overflow: auto;
  padding: 20px 22px;
  border-radius: 28px;
}

.studio-intro h1 {
  margin: 10px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: 0.98;
}

.studio-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.studio-summary-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(13, 27, 42, 0.08);
}

.studio-summary-head h2 {
  margin: 10px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.32rem;
  line-height: 1.12;
}

.studio-summary-copy {
  margin-top: 10px;
}

.studio-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.studio-answer-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--steel);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.intro-pill {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(13, 27, 42, 0.06);
  color: var(--navy);
  font-size: 0.9rem;
  line-height: 1.45;
}

#ui-panel {
  position: absolute;
  top: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 14;
  width: 400px;
  padding: 20px;
  overflow-y: auto;
  border-radius: 30px;
}

.control-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 22px;
  background: var(--surface-soft);
}

.control-section:first-child {
  margin-top: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.section-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.08rem;
}

.section-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.variant-grid,
.mode-row,
.zone-selector,
.view-grid,
.color-grid,
.selection-metrics {
  display: grid;
  gap: 10px;
}

.variant-grid,
.mode-row,
.view-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.view-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.view-grid-dual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.variant-btn,
.mode-btn,
.zone-tab,
.view-btn,
.utility-btn,
.filter-chip {
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}

.variant-btn,
.mode-btn,
.zone-tab,
.view-btn,
.utility-btn {
  padding: 12px 12px;
  font-weight: 600;
}

.variant-btn.active,
.mode-btn.active,
.zone-tab.active,
.view-btn.active,
.filter-chip.active {
  border-color: transparent;
  background: linear-gradient(145deg, var(--navy), var(--steel));
  box-shadow: var(--shadow-sm);
  color: #fff;
}

.variant-btn:hover,
.mode-btn:hover,
.zone-tab:hover,
.view-btn:hover,
.utility-btn:hover,
.filter-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.zone-selector {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.zone-tab {
  display: grid;
  gap: 4px;
  text-align: center;
}

.zone-tab strong {
  font-size: 0.96rem;
}

.zone-tab small {
  font-size: 0.72rem;
  opacity: 0.84;
}

.section-footnote {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.color-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.color-dot {
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(13, 27, 42, 0.12);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, outline-color 0.22s ease;
}

.color-dot:hover,
.color-dot.active {
  transform: translateY(-2px);
}

.color-dot.active {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.selection-section {
  background:
    linear-gradient(155deg, rgba(13, 27, 42, 0.96), rgba(34, 59, 91, 0.92)),
    var(--surface-soft);
  color: #fff;
}

.selection-section .section-head span {
  color: rgba(255, 255, 255, 0.72);
}

.selection-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.metric-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-card span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.selection-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mode-btn-wide {
  width: 100%;
}

.selection-section .mode-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.selection-section .mode-btn.active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.selection-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  line-height: 1.6;
}

.selection-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.selection-row,
.selection-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.selection-row strong,
.selection-empty {
  font-size: 0.92rem;
}

.selection-row span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.selection-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.utility-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.panel-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  margin-top: 16px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94) 26%);
}

.save-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--copper), #df8f3f);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(204, 122, 43, 0.3);
}

.detail-drawer {
  padding: 0;
  overflow: hidden;
}

.detail-drawer summary {
  list-style: none;
  cursor: pointer;
  padding: 18px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.detail-drawer summary::-webkit-details-marker {
  display: none;
}

.detail-drawer[open] summary {
  border-bottom: 1px solid rgba(13, 27, 42, 0.08);
}

.summary-list,
.studio-geo-copy,
.studio-geo-list,
.studio-faq-list {
  margin: 0;
}

.summary-list {
  padding: 16px 18px 18px 34px;
  color: var(--muted);
  line-height: 1.7;
}

.studio-geo-copy {
  padding: 16px 18px 0;
  color: var(--muted);
  line-height: 1.7;
}

.studio-geo-list,
.studio-faq-list {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.studio-answer-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.studio-answer-card strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.5;
}

.studio-answer-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.94rem;
}

.studio-answer-card-quick {
  background: rgba(255, 255, 255, 0.96);
}

.material-dock {
  position: relative;
  z-index: 12;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px 16px 12px;
  border-radius: 30px;
  overflow: hidden;
}

.dock-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.dock-head h2 {
  margin: 6px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.24rem;
}

.dock-copy {
  max-width: none;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.material-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-chip {
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 600;
}

.material-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 160px);
  gap: 14px;
  margin-top: 0;
  overflow-x: auto;
  padding-bottom: 6px;
  align-content: start;
}

.material-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.material-card:hover,
.material-card.active {
  transform: translateY(-2px);
  border-color: rgba(34, 78, 110, 0.24);
  box-shadow: var(--shadow-md);
}

.material-card.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(233, 240, 246, 0.98));
}

.material-preview {
  display: block;
  aspect-ratio: 1.55;
  border-radius: 16px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  background-color: #d9dee4;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.material-meta {
  display: grid;
  gap: 4px;
}

.material-meta strong {
  line-height: 1.35;
}

.material-meta small {
  color: var(--muted);
  line-height: 1.5;
}

#pdf-design-card {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #fff;
  padding: 36px;
}

.pdf-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 24px;
  font-family: "IBM Plex Sans", sans-serif;
}

.pdf-header,
.pdf-content {
  display: flex;
  gap: 24px;
}

.pdf-header {
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--navy);
}

.pdf-header h2 {
  margin: 8px 0 0;
  font-family: "Space Grotesk", sans-serif;
}

.pdf-badge {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(13, 27, 42, 0.06);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pdf-content {
  margin-top: 28px;
  align-items: flex-start;
}

.pdf-image-box {
  flex: 1.2;
  overflow: hidden;
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 20px;
  background: #f5f7fa;
}

.pdf-image-box img {
  width: 100%;
  min-height: 360px;
  object-fit: cover;
}

.pdf-specs {
  flex: 0.8;
}

.spec-item + .spec-item {
  margin-top: 16px;
}

.spec-label {
  display: block;
  color: var(--steel);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.spec-value {
  display: block;
  margin-top: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(13, 27, 42, 0.08);
  white-space: pre-wrap;
  font-weight: 600;
}

.pdf-footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1380px) {
  .studio-left-rail {
    width: min(560px, calc(100vw - 500px));
  }

  #ui-panel {
    width: 380px;
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    height: auto;
    min-height: 100vh;
    padding-top: 92px;
    overflow: visible;
  }

  #canvas-container {
    position: relative;
    height: 56vh;
  }

  .studio-left-rail,
  #ui-panel {
    position: relative;
    inset: auto;
    width: auto;
    right: auto;
    left: auto;
    top: auto;
    bottom: auto;
    margin: 16px;
  }

  .studio-left-rail {
    grid-template-rows: auto auto;
    gap: 16px;
  }

  .studio-intro,
  .material-dock {
    margin: 0;
  }

  .studio-intro {
    max-height: none;
    overflow: visible;
  }

  #ui-panel {
    padding: 16px;
    overflow: visible;
  }

  .panel-actions {
    position: static;
    background: none;
  }

  .floating-actions {
    top: 18px;
    left: 18px;
    right: 18px;
  }

  .dock-head {
    flex-direction: column;
  }

  .material-filters {
    justify-content: flex-start;
  }
}

@media (max-width: 780px) {
  .variant-grid,
  .mode-row,
  .view-grid,
  .selection-metrics,
  .selection-actions,
  .zone-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-summary-grid {
    grid-template-columns: 1fr;
  }

  .material-grid {
    grid-auto-columns: minmax(168px, 168px);
  }

  .color-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pdf-content {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .floating-actions {
    flex-direction: column;
  }

  .studio-lang {
    width: 100%;
  }

  .zone-selector,
  .color-grid,
  .selection-metrics,
  .selection-actions {
    grid-template-columns: 1fr 1fr;
  }

  .variant-grid,
  .mode-row,
  .view-grid {
    grid-template-columns: 1fr;
  }

  .material-grid {
    grid-auto-columns: minmax(150px, 150px);
  }
}
