:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: rgba(12, 13, 17, 0.7);
  --line: rgba(255, 255, 255, 0.16);
  --text: rgba(255, 255, 255, 0.9);
  --muted: rgba(255, 255, 255, 0.62);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: #050608;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

#ambientBg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#ambientBg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.15);
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: none;
}

canvas {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 26px 80px rgba(0, 0, 0, 0.52);
}

/* ---- four unobtrusive corner elements; canvas stays maximized and uncovered ---- */

.title-badge {
  position: fixed;
  top: clamp(16px, 3vw, 32px);
  left: clamp(16px, 3vw, 32px);
  z-index: 2;
}

h1 {
  margin: 0;
  pointer-events: none;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.65);
}

.back-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text);
}

.swatches {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.swatch {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--sw) 0%, transparent 75%);
  box-shadow: 0 0 7px 0 var(--sw);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch:hover {
  transform: scale(1.18);
}

.swatch.active {
  box-shadow: 0 0 10px 1px var(--sw), 0 0 0 2px rgba(255, 255, 255, 0.85);
  transform: scale(1.18);
}

.camera-slot {
  position: fixed;
  top: clamp(16px, 3vw, 32px);
  right: clamp(16px, 3vw, 32px);
  z-index: 2;
  width: min(170px, 20vw);
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #050608;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
}

.camera-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  z-index: 1;
}

.camera-toggle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  min-height: 24px;
  padding: 5px 0;
  border: none;
  border-radius: 0;
  background: rgba(5, 6, 8, 0.78);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.camera-toggle:hover {
  background: rgba(5, 6, 8, 0.92);
}

.camera-toggle.active {
  background: rgba(255, 255, 255, 0.16);
}

.hud {
  position: fixed;
  left: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 2;
  width: min(190px, 40vw);
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.hud-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

button {
  min-height: 28px;
  padding: 0 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.hud-row button {
  border: 1px solid var(--line);
}

button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

button:active {
  transform: translateY(1px);
}

.scale-note {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 2;
  max-width: min(230px, 42vw);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  text-align: right;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
}

.scale-note strong {
  display: block;
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

@media (max-width: 680px) {
  .hud {
    width: calc(50vw - 24px);
    padding: 10px 12px;
  }

  .scale-note {
    max-width: calc(50vw - 24px);
    padding: 8px 10px;
    font-size: 9.5px;
  }

  .camera-slot {
    width: 96px;
  }

  h1 {
    font-size: 18px;
  }

  .hud-row {
    gap: 8px;
  }

  p {
    font-size: 10px;
  }
}
