
:root {
  color-scheme: dark;
  --bg-a: #10131a;
  --bg-b: #242936;
  --glass: rgba(14, 17, 23, 0.62);
  --line: rgba(255,255,255,0.12);
  --text: #f4f5f7;
  --muted: #aeb4c0;
}

* { box-sizing: border-box; }

html, body, #app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 40%, rgba(125, 145, 175, .22), transparent 42%),
    linear-gradient(145deg, var(--bg-b), var(--bg-a));
  color: var(--text);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#viewer {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.overlay {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.top {
  top: max(20px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: clamp(9px, 1.5vw, 12px);
  letter-spacing: .12em;
  white-space: nowrap;
}

h1 {
  margin: 0;
  font-size: clamp(18px, 5vw, 46px);
  line-height: .95;
  letter-spacing: -.04em;
  font-weight: 700;
  white-space: nowrap;
}

button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--text);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

button:active { transform: scale(.97); }

.bottom {
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.bottom p { margin: 0; }
.bottom span { opacity: .45; }

.loading, .error {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10,12,16,.82);
  color: var(--muted);
  font-size: 13px;
}

.error {
  max-width: min(420px, calc(100vw - 40px));
  color: #ffd6d6;
}

/* ── Scene switcher ── */

.scenes {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.scene-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text);
  transition: transform .15s, border-color .15s;
}

.scene-btn:hover { transform: scale(1.1); }

.scene-btn.active {
  border-color: #5090d0;
  background: rgba(40, 60, 100, 0.5);
  transform: scale(1.15);
}

/* ── Toast notification ── */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #5090d0;
  color: #fff;
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: none;
  animation: toastIn .3s ease, toastOut .3s ease 1.7s forwards;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

@media (max-width: 620px) {
  .top { top: max(10px, env(safe-area-inset-top)); gap: 8px; flex-wrap: nowrap; }
  .eyebrow { font-size: 8px; letter-spacing: .08em; }
  h1 { font-size: clamp(16px, 5.5vw, 24px); }
  nav { flex-shrink: 0; display: flex; gap: 5px; }
  button { padding: 7px 10px; font-size: 11px; white-space: nowrap; }
  .bottom { font-size: 11px; bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (max-width: 400px) {
  h1 { font-size: 15px; }
  button { padding: 6px 8px; font-size: 10px; }
  .top { gap: 4px; }
  nav { gap: 3px; }
  .eyebrow { font-size: 7px; }
}

/* ── Design Placer Modal — mobile‑first ── */

.modal-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #1a1d23;
  overflow: hidden;
}

/* ── Top bar ── */

.dp-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.dp-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e3e8;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #aaa;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* ── Canvas area ── */

.dp-canvas-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(80, 100, 130, .10), transparent 40%),
    linear-gradient(150deg, #1a1d24, #111318);
  overflow: hidden;
  min-height: 0;
}

#dpCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: grab;
}

#dpCanvas:active {
  cursor: grabbing;
}

.dp-drop-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-align: center;
  color: #6a7080;
  z-index: 2;
}

.dp-drop-hint.hidden {
  display: none;
}

.dp-hint-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.dp-drop-hint p {
  font-size: 13px;
  margin: 0;
}

.dp-zoom-badge {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #8890a0;
  background: rgba(0, 0, 0, .55);
  padding: 3px 9px;
  border-radius: 12px;
  z-index: 2;
}

/* ── Controls footer ── */

.dp-controls {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #1a1d23;
}

.dp-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dp-btn {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  background: #252830;
  color: #c8ccd4;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  flex: 1;
  transition: background .12s;
}

.dp-btn:hover {
  background: #30343c;
}

.dp-btn.active {
  border-color: #5090d0;
  background: #243040;
  color: #80b8f0;
}

.dp-btn.dp-import {
  background: #2a3038;
}

.dp-btn.dp-primary {
  background: #5090d0;
  border-color: #5090d0;
  color: #fff;
  flex: 2;
  font-weight: 600;
}

.dp-btn.dp-primary:hover {
  background: #5c98d8;
}

.dp-btn:disabled {
  opacity: .35;
  pointer-events: none;
}

/* ── Name / Price fields (inline, no captions) ── */

.dp-fields {
  gap: 8px;
}

.dp-field-inline {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  background: #1e2127;
  color: #e0e3e8;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.dp-field-inline:focus {
  border-color: #5090d0;
}

.dp-field-inline::placeholder {
  color: #505560;
}

/* ── Apply button (compact) ── */

.dp-btn.dp-apply {
  flex: 1.2;
  font-size: 12px;
  padding: 7px 10px;
  background: #5090d0;
  border-color: #5090d0;
  color: #fff;
}

.scene-btn.permalink-btn {
  margin-top: 12px;
  border-style: dashed;
  font-size: 14px;
}

/* ── Info line ── */

.dp-info {
  font-size: 11px;
  color: #6a7080;
  flex: 1;
}

.dp-actions {
  gap: 10px;
}

.dp-audio-name {
  font-size: 11px;
  color: #8890a0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  line-height: 2.2;
}

/* ── Desktop (wider than 600px) ── */

@media (min-width: 600px) {
  .modal-panel {
    width: min(420px, 96vw);
    height: min(720px, 94vh);
    height: min(720px, 94dvh);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }
}
