:root {
  color-scheme: dark;
  --studio-0: #07080b;
  --studio-1: #10131a;
  --studio-2: #1a1f2a;
  --panel: #ffffff;
  --panel-soft: #f4f5f8;
  --panel-softer: #fafbfc;
  --text: #15161b;
  --muted: #747b88;
  --line: #e6e9ef;
  --dark: #111217;
  --violet: #6540ff;
  --violet-soft: #f0edff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--studio-0);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.configurator-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 680px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--studio-2), var(--studio-0) 68%);
}

.stage {
  position: absolute;
  inset: 72px 0 0;
  z-index: 0;
  min-width: 0;
}

#stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  outline: none;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 24px;
  height: 72px;
  padding: 0 26px;
  border-bottom: 1px solid #bfc5cd;
  background: linear-gradient(180deg, #d8dce1 0%, #c6cbd2 100%);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--dark);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px 7px;
  border: 2px solid #fff;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

.brand-mark::after {
  inset: 6px 10px auto;
  width: 8px;
  height: 5px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.nav-links a {
  color: #46505f;
  font-size: 15px;
  font-weight: 760;
  text-decoration: none;
  letter-spacing: 0;
}

.nav-links a:hover {
  color: var(--text);
}

.top-action {
  min-height: 40px;
  padding: 0 22px;
  border: 1px solid rgba(101, 64, 255, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #111217 0 56%, #6540ff 56% 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 820;
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(17, 18, 23, 0.2),
    0 0 0 3px rgba(101, 64, 255, 0.1);
}

.top-action:hover,
.primary-upload:hover,
.apply-button:hover,
.action-grid button:hover,
.export-card > button:hover {
  filter: brightness(0.94);
}

.fullscreen-fab {
  position: fixed;
  top: 90px;
  left: calc(344px + 18px);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(7, 8, 11, 0.72);
  cursor: pointer;
  backdrop-filter: blur(18px);
}

.fullscreen-fab span,
.fullscreen-fab span::before,
.fullscreen-fab span::after {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
}

.fullscreen-fab span {
  border-right: 0;
  border-bottom: 0;
}

.fullscreen-fab span::before,
.fullscreen-fab span::after {
  content: none;
}

.status-pill {
  position: fixed;
  left: calc(344px + 18px);
  bottom: 22px;
  z-index: 5;
  max-width: min(520px, calc(100% - 782px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(7, 8, 11, 0.68);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  backdrop-filter: blur(18px);
}

.control-dock {
  position: fixed;
  top: 90px;
  bottom: 18px;
  z-index: 8;
  width: 308px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.product-dock {
  left: 18px;
}

.artwork-dock {
  top: auto;
  right: 18px;
  width: 366px;
  max-height: calc(100vh - 108px);
  height: auto;
}

.artwork-dock .dock-scroll {
  height: auto;
  max-height: calc(100vh - 108px);
}

.dock-scroll {
  height: 100%;
  padding: 14px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.panel-kicker {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.artwork-workspace {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-top: 8px;
}

.artwork-side-tabs {
  display: grid;
  gap: 7px;
}

.artwork-tab {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 50px;
  padding: 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #4b5565;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 19, 26, 0.035);
}

.artwork-tab:hover {
  border-color: rgba(101, 64, 255, 0.28);
}

.artwork-tab.is-active {
  border-color: rgba(101, 64, 255, 0.42);
  background: var(--violet-soft);
  color: var(--text);
  box-shadow:
    inset 3px 0 0 var(--violet),
    0 10px 24px rgba(101, 64, 255, 0.1);
}

.artwork-tab .summary-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.artwork-tab span:not(.summary-icon) {
  min-width: 0;
  font-size: 11px;
  font-weight: 820;
  line-height: 1.12;
}

.artwork-detail-pane {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.artwork-upload-panels {
  min-width: 0;
}

.artwork-card {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fff, #fbfcfe);
  box-shadow: 0 10px 24px rgba(16, 19, 26, 0.045);
}

.artwork-card.is-active {
  border-color: rgba(101, 64, 255, 0.36);
  box-shadow:
    0 0 0 3px rgba(101, 64, 255, 0.08),
    0 12px 28px rgba(16, 19, 26, 0.06);
}

.artwork-upload-panels .artwork-card {
  display: none;
  min-height: 136px;
  margin-top: 0;
  padding: 12px;
}

.artwork-upload-panels .artwork-card.is-active {
  display: block;
}

.artwork-card-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.artwork-upload-panels .artwork-card-head {
  display: block;
}

.artwork-card-head .summary-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.artwork-card-head span:not(.summary-icon) {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.2;
}

.artwork-card-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.primary-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.primary-upload {
  background: var(--dark);
  color: #fff;
}

.artwork-card .primary-upload {
  margin-top: 10px;
}

.slot-reset {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: #263143;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.slot-reset:hover {
  filter: brightness(0.97);
}

.editor-mount:empty {
  display: none;
}

.shared-artwork-editor {
  display: grid;
  gap: 10px;
}

.upload-icon,
.summary-icon,
.mobile-icon {
  position: relative;
  display: inline-block;
  flex: none;
}

.upload-icon {
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
}

.upload-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 4px;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.upload-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 1.5px;
  height: 7px;
  background: currentColor;
}

.accordion {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.accordion summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 0 15px;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
  list-style: none;
  cursor: pointer;
}

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

.summary-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.color-icon::before,
.model-icon::before,
.area-icon::before,
.background-icon::before,
.upload-tile-icon::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #141318;
}

.model-icon::before {
  inset: 8px 9px 10px;
  border-radius: 4px 4px 8px 8px;
  background: #141318;
}

.model-icon::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 7px;
  width: 10px;
  height: 7px;
  border: 2px solid #141318;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.upload-tile-icon::before {
  border-radius: 4px;
  background: linear-gradient(135deg, #141318 42%, #6540ff 42%);
}

.background-icon::before {
  border-radius: 5px;
  background: linear-gradient(135deg, #111319 0 50%, #6540ff 50% 100%);
}

.area-icon::before {
  inset: 9px;
  border: 2px dashed #141318;
  border-radius: 5px;
  background: transparent;
}

.area-icon::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 15px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow:
    8px 0 0 var(--violet),
    8px 8px 0 var(--violet),
    0 8px 0 var(--violet);
}

.chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid #8a909b;
  border-bottom: 2px solid #8a909b;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.accordion[open] .chevron {
  transform: rotate(225deg);
}

.accordion-body {
  display: grid;
  gap: 14px;
  padding: 0 15px 16px;
  border-top: 1px solid var(--line);
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding-top: 14px;
}

.swatch,
.color-picker {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border: 1px solid #dce0e8;
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}

.swatch.is-active {
  outline: 3px solid rgba(101, 64, 255, 0.24);
  border-color: var(--violet);
}

.color-picker {
  background:
    conic-gradient(from 90deg, #f43, #fc3, #2c6, #37f, #83f, #f43);
  overflow: hidden;
}

.color-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.background-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
}

.background-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.background-field input {
  width: 48px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.export-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.export-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field.compact {
  padding-top: 2px;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-softer);
  color: var(--text);
  appearance: none;
}

.model-field {
  padding-top: 14px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--violet);
}

.tool-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.area-status {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.35;
}

.print-area-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.print-area-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.print-area-tabs button.is-active {
  background: var(--dark);
  color: #fff;
}

.secondary-wide {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 760;
  cursor: pointer;
}

.is-marking-print-area #stage-canvas {
  cursor: crosshair;
}

.apply-button,
.action-grid button,
.export-card > button,
.placement-switch button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 760;
  cursor: pointer;
}

.apply-button,
.action-grid button:first-child,
.export-card > button {
  background: var(--dark);
  color: #fff;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.placement-switch {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.placement-switch button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
}

.placement-switch button.is-active {
  background: var(--dark);
  color: #fff;
}

.action-grid button:last-child {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(0, 0, 0, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.045) 75%),
    #fff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  overflow: hidden;
}

.artwork-detail-pane .preview-wrap {
  margin-top: 0;
}

.artwork-detail-pane .action-grid {
  gap: 8px;
}

.artwork-detail-pane .action-grid button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 12px;
}

#design-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#design-canvas:active {
  cursor: grabbing;
}

.drag-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 9px;
  border: 1px solid rgba(21, 22, 27, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: rgba(21, 22, 27, 0.72);
  font-size: 10px;
  font-weight: 760;
  pointer-events: none;
}

.export-card {
  display: grid;
  gap: 16px;
  margin-top: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.export-head {
  display: grid;
  gap: 10px;
}

.mobile-toolbar {
  display: none;
}

@media (max-width: 980px) {
  body {
    overflow: hidden;
  }

  .configurator-shell {
    min-height: 100vh;
  }

  .stage {
    inset: 72px 0 0;
  }

  .topbar {
    grid-template-columns: auto auto;
    justify-content: space-between;
    height: 64px;
    padding: 0 16px;
  }

  .top-action {
    width: auto;
    justify-self: end;
  }

  .nav-links {
    display: none;
  }

  .control-dock {
    top: auto;
    bottom: 76px;
    width: auto;
    max-height: 52vh;
    border-radius: 14px;
  }

  .product-dock {
    left: 10px;
    right: calc(50% + 5px);
  }

  .artwork-dock {
    left: calc(50% + 5px);
    right: 10px;
    width: auto;
  }

  .status-pill {
    left: 18px;
    bottom: calc(76px + min(52vh, 430px) + 14px);
    max-width: calc(100% - 36px);
  }

  .fullscreen-fab {
    top: 82px;
    left: 18px;
  }

  .mobile-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: 66px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  }

  .mobile-toolbar button {
    display: grid;
    place-items: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 11px;
    font-weight: 760;
  }

  .mobile-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--panel-soft);
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 58px;
  }

  .top-action {
    min-height: 34px;
    padding: 0 12px;
  }

  .control-dock {
    left: 10px;
    right: 10px;
    max-height: 38vh;
  }

  .product-dock {
    bottom: calc(76px + 38vh + 8px);
    max-height: 22vh;
  }

  .artwork-dock {
    bottom: 76px;
  }
}
