:root {
  --bg: #f4edec;          /* soft cream canvas */
  --surface: #ffffff;     /* card / surface */
  --accent: #f3d29b;      /* single dominant accent (warm gold) */
  --secondary: #3898ec;   /* complementary highlight / links */
  --text: #000000;
  --muted: #666666;
  --border: #e6e6ea;

  --font: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* tinted elevation (chromatic, per brand) */
  --shadow-soft: rgba(121, 121, 121, 0.10) 0px 1px 20px 0px;
  --shadow-deep: rgba(0, 0, 0, 0.12) 0px 5px 25px 0px;
  --shadow-accent: rgba(243, 210, 155, 0.55) 0px 8px 24px -6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 960px;
  padding: clamp(36px, 7vw, 90px) clamp(18px, 4vw, 36px) clamp(80px, 14vw, 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 45px;
}

/* ---- masthead ---- */
.masthead { text-align: center; }
.title {
  font-family: var(--font);
  font-size: clamp(34px, 9vw, 68px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.tagline {
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(16px, 2.4vw, 18px);
  font-weight: 500;
  max-width: 40ch;
  margin-inline: auto;
  line-height: 1.4;
}
.credits {
  margin-top: 9px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 500;
}
.credits a {
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.25s;
}
.credits a:hover { opacity: 0.7; }

/* ---- global volume bar ---- */
.master {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 18px 27px;
  box-shadow: var(--shadow-soft);
}
.master-icon { font-size: 18px; line-height: 1; }
.master-vol {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: 50px;
  background: var(--bg);
  outline: none;
  cursor: pointer;
}
.master-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-deep);
  transition: transform 0.2s var(--ease);
}
.master-vol::-webkit-slider-thumb:active { transform: scale(1.12); }
.master-vol::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
}

/* ---- scene presets ---- */
.presets {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.presets-label {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.preset-btns {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.preset {
  position: relative;
  overflow: hidden;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  padding: 12px 20px;
  border: none;
  border-radius: 14px;
  background-color: #333;
  background-size: cover;
  background-position: center;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
/* darkening overlay so the white label stays readable */
.preset::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  transition: background 0.25s var(--ease);
}
.preset:hover { transform: translateY(-2px); box-shadow: var(--shadow-deep); }
.preset:hover::before { background: rgba(0, 0, 0, 0.3); }
.preset.flash { box-shadow: var(--shadow-accent); }
.preset.flash::before { background: rgba(249, 66, 0, 0.5); }
/* random has no photo — give it a warm gradient + lighter overlay */
.preset.is-random { background-image: linear-gradient(135deg, var(--accent), #e4a89b); }
.preset.is-random::before { background: rgba(0, 0, 0, 0.15); }
.preset.is-random:hover::before { background: rgba(0, 0, 0, 0.05); }
.preset-label {
  position: relative;
  z-index: 1;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ---- layers ---- */
.layers {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: clamp(48px, 9vw, 96px);
}

.layer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background 0.35s var(--ease), box-shadow 0.4s var(--ease), transform 0.25s var(--ease), border-color 0.35s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.layer:hover { transform: translateY(-2px); box-shadow: var(--shadow-deep); }
.layer.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.layer.disabled { display: none; }

.layer-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.layer-icon {
  font-size: 22px;
  line-height: 1;
  filter: grayscale(0.3) opacity(0.85);
  transition: filter 0.35s var(--ease), transform 0.35s var(--ease);
}
.layer.active .layer-icon { filter: none; transform: scale(1.1); }
.layer-label {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text);
}

/* per-layer loading spinner (shown while the file decodes) */
.layer-spinner {
  margin-left: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--secondary);
  animation: spin 0.7s linear infinite;
  display: none;
}
.layer.active .layer-spinner { border-color: rgba(0, 0, 0, 0.2); border-top-color: var(--text); }
.layer.loading .layer-spinner { display: block; }
.layer.loading .layer-dot { display: none; }
.layer.loading { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

.layer-dot {
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.35s, box-shadow 0.35s;
}
.layer.active .layer-dot {
  background: var(--text);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.12);
}

/* volume slider */
.layer-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 50px;
  background: var(--bg);
  outline: none;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.35s;
}
.layer.active .layer-vol { opacity: 1; background: rgba(0, 0, 0, 0.12); }
.layer-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease);
}
.layer.active .layer-vol::-webkit-slider-thumb { background: var(--text); border-color: var(--accent); }
.layer-vol::-webkit-slider-thumb:active { transform: scale(1.15); }
.layer-vol::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.layer.active .layer-vol::-moz-range-thumb { background: var(--text); border-color: var(--accent); }

/* ---- footer ---- */
.footer {
  margin-top: auto;
  padding-top: 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.footer a {
  color: var(--secondary);
  text-decoration: none;
  transition: opacity 0.25s;
}
.footer a:hover { opacity: 0.7; }
.footer .dot { opacity: 0.5; }

@media (max-width: 760px) {
  .layers { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .layers { grid-template-columns: 1fr; }
  .preset-btns { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.01ms !important; }
}
