:root {
  --bg-top: #f8fbff;
  --bg-bottom: #dce4f3;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(28, 39, 72, 0.12);
  --text-strong: #101827;
  --text: #334155;
  --text-soft: #7a879d;
  --accent: #5864ff;
  --accent-soft: rgba(88, 100, 255, 0.14);
  --cyan: #4eb8ff;
  --cyan-soft: rgba(78, 184, 255, 0.18);
  --shadow: 0 20px 60px rgba(19, 32, 68, 0.12);
  --shadow-soft: 0 10px 30px rgba(19, 32, 68, 0.08);
  --toolbar: rgba(29, 39, 63, 0.88);
  --grid: rgba(80, 95, 128, 0.1);
  --grid-strong: rgba(80, 95, 128, 0.16);
  --blob: rgba(109, 118, 255, 0.22);
  --blob-edge: rgba(109, 118, 255, 0.12);
  --surface-radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 34%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: rgba(88, 100, 255, 0.18);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(109, 118, 255, 0.08);
}

::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.22);
  border-radius: 999px;
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #4555ec, #7b87ff);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 12px 24px rgba(69, 85, 236, 0.24);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-kicker,
.section-kicker,
.status-kicker,
.empty-kicker,
.mono-label {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-kicker {
  margin: 0 0 4px;
  font-size: 10px;
  color: var(--text-soft);
}

.brand-lockup h1,
.panel-heading h2,
.empty-card h3 {
  margin: 0;
  color: var(--text-strong);
}

.brand-lockup h1 {
  font-size: 1.7rem;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-chip,
.header-toggle,
.soft-button,
.primary-button,
.format-button,
.viewer-toolbar button,
.close-panel {
  border: 0;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.header-chip,
.header-toggle {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 39, 0.08);
}

.header-chip:hover,
.header-toggle:hover,
.soft-button:hover,
.format-button:hover,
.viewer-toolbar button:hover,
.primary-button:hover,
.close-panel:hover {
  transform: translateY(-1px);
}

.header-toggle {
  display: none;
}

.workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 290px) minmax(0, 1fr) minmax(290px, 330px);
}

.side-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 28px 22px 22px;
  background: var(--panel);
  backdrop-filter: blur(22px);
}

.left-panel {
  border-right: 1px solid var(--panel-border);
}

.right-panel {
  border-left: 1px solid var(--panel-border);
}

.panel-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  padding-right: 4px;
}

.panel-ribbon {
  position: absolute;
  top: 34px;
  left: -18px;
  width: 38px;
  height: 118px;
  padding: 0;
  border: 1px solid rgba(16, 24, 39, 0.08);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  writing-mode: vertical-rl;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
}

.panel-ribbon.right {
  right: -18px;
  left: auto;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.close-panel {
  display: none;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 39, 0.08);
}

.section-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--text-soft);
}

.section-copy,
.helper-copy,
.note-card p,
.panel-footer-note span,
.slot-meta,
.slot-note,
#empty-copy {
  line-height: 1.55;
}

code {
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88em;
  color: var(--text-strong);
  background: rgba(88, 100, 255, 0.12);
}

.section-copy,
.helper-copy,
.note-card p,
#empty-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.97rem;
}

.slot-stack {
  display: grid;
  gap: 18px;
}

.upload-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
  border-radius: var(--surface-radius);
  border: 1.5px dashed rgba(16, 24, 39, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 249, 255, 0.82));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.upload-card:hover,
.upload-card.is-dragging {
  border-color: rgba(88, 100, 255, 0.52);
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(88, 100, 255, 0.12);
}

.upload-card.is-loaded {
  border-style: solid;
  border-color: rgba(88, 100, 255, 0.22);
}

.icon-wrap {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--accent);
  background: linear-gradient(180deg, #0f1834, #1f2748);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.icon-wrap.alt {
  color: var(--cyan);
}

.icon-wrap svg {
  width: 28px;
  height: 28px;
}

.slot-eyebrow {
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.slot-title {
  font-size: 1.35rem;
  color: var(--text-strong);
}

.slot-note {
  color: var(--text-strong);
  font-size: 0.94rem;
  font-weight: 500;
}

.slot-meta {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.soft-button,
.primary-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 18px;
}

.soft-button {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 39, 0.08);
}

.soft-button.accent,
.primary-button,
.format-button.is-active {
  color: white;
  background: linear-gradient(135deg, #4655f0, #6874ff);
  box-shadow: 0 18px 34px rgba(70, 85, 240, 0.22);
}

.panel-footer-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(16, 24, 39, 0.1);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.viewer-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(242, 246, 253, 0.96), rgba(233, 239, 249, 0.88));
}

.stage-grid,
.stage-wash,
.stage-blob,
.viewer-empty,
model-viewer {
  position: absolute;
}

.stage-grid,
.stage-wash,
.stage-blob,
.viewer-empty,
model-viewer {
  inset: 0;
}

.stage-grid {
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-position:
    0 0,
    0 0,
    0 0,
    0 0;
  background-size:
    100px 100px,
    100px 100px,
    50px 50px,
    50px 50px;
  opacity: 0.68;
  pointer-events: none;
}

.stage-wash {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.9), transparent 30%),
    radial-gradient(circle at bottom center, rgba(255, 255, 255, 0.26), transparent 34%);
  pointer-events: none;
}

.stage-blob {
  top: 20%;
  left: 50%;
  width: min(44vw, 520px);
  height: min(44vw, 520px);
  translate: -50% 0;
  border-radius: 46% 54% 52% 48% / 45% 44% 56% 55%;
  background:
    radial-gradient(circle at 40% 35%, var(--blob), transparent 68%),
    radial-gradient(circle at 60% 60%, var(--blob-edge), transparent 80%);
  filter: blur(4px);
  opacity: 0.9;
  pointer-events: none;
  animation: blob-drift 14s ease-in-out infinite alternate;
}

@keyframes blob-drift {
  from {
    transform: rotate(0deg) scale(0.96);
  }
  to {
    transform: rotate(16deg) scale(1.04);
  }
}

.viewer-stage[data-lighting="legacy"] {
  --blob: rgba(120, 152, 255, 0.24);
  --blob-edge: rgba(80, 106, 255, 0.14);
}

.viewer-stage[data-lighting="daylight"] {
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.98), rgba(227, 237, 255, 0.9));
  --blob: rgba(76, 201, 255, 0.2);
  --blob-edge: rgba(86, 129, 255, 0.16);
}

.viewer-stage[data-lighting="night"] {
  background: linear-gradient(180deg, #d7dfed, #c7d2e8);
  --blob: rgba(100, 113, 255, 0.26);
  --blob-edge: rgba(33, 41, 89, 0.16);
}

model-viewer {
  z-index: 2;
  width: 100%;
  height: 100%;
  background: transparent;
  --progress-mask: rgba(255, 255, 255, 0.65);
  --progress-bar-color: var(--accent);
}



.viewer-empty {
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 32px;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.viewer-stage.is-loaded .viewer-empty {
  opacity: 0;
  visibility: hidden;
}

.empty-card {
  max-width: 420px;
  padding: 28px;
  text-align: center;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.empty-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--accent);
}

.empty-card h3 {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--toolbar);
  flex-shrink: 0;
}

.viewer-toolbar button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
}

.viewer-toolbar button:hover,
.viewer-toolbar button.is-active {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.viewer-toolbar svg {
  width: 21px;
  height: 21px;
}

.settings-body {
  overflow-y: auto;
  padding-right: 4px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.label-row label,
.toggle-row strong {
  color: var(--text-soft);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.format-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.format-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 39, 0.08);
}

.format-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid rgba(16, 24, 39, 0.08);
  border-bottom: 1px solid rgba(16, 24, 39, 0.08);
}

.toggle-row span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-row strong {
  margin: 0;
  color: var(--text-strong);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
}

.toggle-row small {
  color: var(--text-soft);
}

.toggle-row input[type="checkbox"] {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  appearance: none;
  background: rgba(148, 163, 184, 0.34);
  position: relative;
  transition: background 160ms ease;
}

.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  transition: transform 160ms ease;
}

.toggle-row input[type="checkbox"]:checked {
  background: rgba(88, 100, 255, 0.38);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(22px);
}

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

select {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(16, 24, 39, 0.08);
  border-radius: 16px;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.note-card {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(88, 100, 255, 0.1), rgba(255, 255, 255, 0.8));
  box-shadow: var(--shadow-soft);
}

.note-title {
  margin-bottom: 8px;
  color: var(--text-strong);
  font-weight: 700;
}

.qr-panel {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(88, 100, 255, 0.08), rgba(255, 255, 255, 0.8));
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.qr-panel .section-kicker {
  margin: 0;
}

.qr-label {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.qr-wrap {
  padding: 10px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.qr-wrap img {
  display: block;
  width: 192px;
  height: 192px;
  border-radius: 8px;
}

.qr-link-row {
  display: flex;
  width: 100%;
  gap: 8px;
}

.qr-url-input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  height: 44px;
  border: 1px solid rgba(16, 24, 39, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-expire-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
}

.qr-status {
  margin: 0;
  min-height: 1.25rem;
  color: #8b1e3f;
  font-size: 0.82rem;
  line-height: 1.4;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 18;
  border: 0;
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(4px);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(240px, 270px) minmax(0, 1fr) minmax(280px, 310px);
  }
}

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

  .header-toggle,
  .close-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .workspace {
    display: block;
    min-height: calc(100vh - 78px);
  }

  .panel-ribbon {
    display: none;
  }

  .side-panel {
    position: fixed;
    top: 78px;
    bottom: 0;
    width: min(88vw, 340px);
    z-index: 20;
    transition: transform 200ms ease;
    box-shadow: var(--shadow);
  }

  .left-panel {
    left: 0;
    transform: translateX(-105%);
  }

  .right-panel {
    right: 0;
    transform: translateX(105%);
  }

  .side-panel.is-open {
    transform: translateX(0);
  }

  .viewer-column {
    min-height: calc(100vh - 78px);
  }
}

@media (max-width: 720px) {
  .app-header {
    padding: 14px 16px;
  }

  .brand-lockup h1 {
    font-size: 1.45rem;
  }

  .brand-kicker {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .header-chip,
  .header-toggle {
    min-height: 40px;
    padding: 0 14px;
  }

  .empty-card {
    padding: 24px;
  }
}
