/* ==========================================================================
   ambiental studio — v0.2.0 stylesheet
   Tokens, Layout, Components, Motion. Eine Datei. Hand-getunte Werte.
   Quelle: docs/design-concept-v2.md Sektion 4 + motion-spec.md
   ========================================================================== */

/* ---------- 1. Tokens & Resets ----------------------------------------- */

:root {
  /* Farben */
  --color-bg: #1A1208;
  --color-bg-deeper: #0F0904;
  --color-surface: #2C1F0E;
  --color-surface-elev: #3A2A14;
  --color-wood-mid: #5C3A1E;
  --color-wood-light: #8B5E3C;
  --color-wood-warm: #8B5E3C;
  --color-wood-grain: #3D2410;
  --color-leaf-dark: #1B3A1F;
  --color-leaf-mid: #2D6A30;
  --color-leaf-light: #4A8F4D;
  --color-moss: #5A7A3A;
  --color-accent: #C8860A;
  --color-accent-glow: #E8A020;
  --color-firefly: #E8A020;
  --color-text-primary: #F0E8D8;
  --color-text-secondary: #B8A88A;
  --color-text-muted: #7A6A55;
  --color-border: #3D2810;
  --color-parchment: #C4A882;
  --color-parchment-dark: #9A7A58;
  --color-parchment-cream: #DCC8A6;
  --color-danger: #C0392B;
  --color-success: #27AE60;

  /* Easings (motion-spec Appendix) */
  --ease-pendulum: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-paper: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-swell: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-brush: cubic-bezier(0.45, 0, 0.15, 1);
  --ease-accel: cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

/* Mitternachts-Override */
body.body--midnight {
  --color-bg: #120D06;
  --color-bg-deeper: #080502;
  --color-accent: #D49520;
  --color-accent-glow: #F0AC2A;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text-primary);
  font-feature-settings: "tnum" 1;
  background:
    radial-gradient(ellipse at 22% 18%, rgba(80, 50, 20, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse at 78% 82%, rgba(30, 50, 20, 0.22) 0%, transparent 60%),
    linear-gradient(160deg, var(--color-bg) 0%, var(--color-bg-deeper) 100%);
  overflow-x: hidden;
}

/* Holz-Atem-Hintergrund (chaos #6) — 3% Brightness Modulation, 26s Loop */
/* Pseudo-Element auf body, damit body's eigene Render-Flash-Animation nicht kollidiert. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 220, 170, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}
@media (prefers-reduced-motion: no-preference) {
  body::after {
    animation: wood-breathe 26s ease-in-out infinite;
  }
}
@keyframes wood-breathe {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1.0; }
}

body.body--midnight {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(70, 90, 130, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 22% 18%, rgba(60, 38, 18, 0.34) 0%, transparent 55%),
    linear-gradient(160deg, var(--color-bg) 0%, var(--color-bg-deeper) 100%);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-glow); }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.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;
}

/* Tabular nums fuer alle Slider/Counter */
.slider-row__value, .duration-row__value, .progress-pct,
.footer-version, .nav-strip__item {
  font-variant-numeric: tabular-nums;
}

/* ---------- 2. Layout: Stage & Frame ----------------------------------- */

.stage {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(80px, 9vw, 120px) clamp(20px, 5vw, 60px) 80px;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3.6rem);
}

.stage--tagebuch { gap: 2rem; }
.stage--404 { justify-content: center; align-items: center; }

/* Jungle-Frame */
.jungle-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.frame-corner {
  position: absolute;
  width: clamp(120px, 18vw, 240px);
  height: clamp(120px, 18vw, 240px);
  background: url('/assets/svg/vine-corner.svg') center / contain no-repeat;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
  opacity: 0.95;
}
.frame-corner--dense {
  background-image: url('/assets/svg/vine-corner-dense.svg');
}
.frame-corner--tl { top: 0; left: 0; }
.frame-corner--tr { top: 0; right: 0; transform: scaleX(-1); }
.frame-corner--bl { bottom: 0; left: 0; transform: scaleY(-1); }
.frame-corner--br { bottom: 0; right: 0; transform: scale(-1, -1); }

/* Leaf-Sway auf den Frame-Containern (UI/UX S1-1)
   Vier separate keyframes-Animationen, die das urspruengliche scale-Mirroring
   beibehalten und nur ein subtiles Wiegen +/-0.6 Grad addieren. */
@media (prefers-reduced-motion: no-preference) {
  .frame-corner--tl { animation: frame-sway-tl 7.2s var(--ease-pendulum) 0s    infinite alternate; transform-origin: top left; }
  .frame-corner--tr { animation: frame-sway-tr 6.4s var(--ease-pendulum) 1.1s  infinite alternate; transform-origin: top right; }
  .frame-corner--bl { animation: frame-sway-bl 8.1s var(--ease-pendulum) 0.4s  infinite alternate; transform-origin: bottom left; }
  .frame-corner--br { animation: frame-sway-br 6.8s var(--ease-pendulum) 1.7s  infinite alternate; transform-origin: bottom right; }
}
@keyframes frame-sway-tl {
  from { transform: rotate(-0.6deg); }
  to   { transform: rotate( 0.6deg); }
}
@keyframes frame-sway-tr {
  from { transform: scaleX(-1) rotate(-0.6deg); }
  to   { transform: scaleX(-1) rotate( 0.6deg); }
}
@keyframes frame-sway-bl {
  from { transform: scaleY(-1) rotate(-0.6deg); }
  to   { transform: scaleY(-1) rotate( 0.6deg); }
}
@keyframes frame-sway-br {
  from { transform: scale(-1, -1) rotate(-0.6deg); }
  to   { transform: scale(-1, -1) rotate( 0.6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .frame-corner--tl, .frame-corner--tr,
  .frame-corner--bl, .frame-corner--br {
    animation: none;
  }
}

/* Mitternachts-Mond hinter dem Logo */
.midnight-moon {
  position: fixed;
  top: 6vh;
  left: 50%;
  width: clamp(200px, 30vw, 380px);
  height: clamp(200px, 30vw, 380px);
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 50%,
    rgba(220, 220, 240, 0.10) 0%,
    rgba(160, 180, 220, 0.06) 30%,
    transparent 70%);
  pointer-events: none;
  z-index: 3;
  filter: blur(4px);
}

/* ---------- 3. Header & Logo ------------------------------------------- */

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  z-index: 5;
}

.logo-sign {
  display: block;
  width: clamp(260px, 36vw, 420px);
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transform: rotate(-3deg);
  transform-origin: 50% 0%;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,0.7));
  will-change: transform;
}
.logo-sign__svg {
  width: 100%;
  height: auto;
  pointer-events: none;
  display: block;
}
.logo-sign--small { width: clamp(180px, 22vw, 260px); margin-top: -10px; }

@media (prefers-reduced-motion: no-preference) {
  .logo-sign {
    animation: sign-pendulum 5.4s var(--ease-pendulum) 2.2s infinite alternate;
  }
  .logo-sign:hover,
  .logo-sign:focus-visible {
    animation: sign-strike 820ms var(--ease-overshoot) 1;
  }
  .logo-sign--struck { animation: sign-strike 820ms var(--ease-overshoot) 1; }
  .logo-sign--spinning { animation: sign-spin 1.4s cubic-bezier(0.4, 0.1, 0.3, 1.1) 1 forwards; }
}

@keyframes sign-pendulum {
  from { transform: rotate(-3.4deg); }
  to   { transform: rotate(-2.6deg); }
}
@keyframes sign-strike {
  0%   { transform: rotate(-3deg); }
  22%  { transform: rotate(-6.5deg); }
  48%  { transform: rotate(-1deg); }
  72%  { transform: rotate(-4deg); }
  100% { transform: rotate(-3deg); }
}
@keyframes sign-spin {
  0%   { transform: rotate(-3deg); }
  100% { transform: rotate(357deg); }
}

/* Brush-Reveal beim Page-Load fuer den Schriftzug */
.logo-sign__svg .sign-text-group {
  clip-path: inset(0 100% 0 0);
}
@media (prefers-reduced-motion: no-preference) {
  .logo-sign__svg .sign-text-group {
    animation: brush-reveal 1100ms var(--ease-brush) 250ms forwards;
  }
}
@keyframes brush-reveal {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-sign__svg .sign-text-group { clip-path: inset(0 0 0 0); animation: none; }
}

body.body--midnight .logo-sign {
  animation-duration: 7.5s;
}

/* Greeting */
.greeting {
  margin: 0;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--color-text-secondary);
  text-align: center;
  opacity: 0;
  animation: greeting-fade 6.8s ease-in-out forwards;
  animation-delay: 1.6s;
}
@keyframes greeting-fade {
  0% { opacity: 0; transform: translateY(4px); }
  10% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* Nav-Strip */
.nav-strip {
  display: flex;
  gap: 1.5rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.nav-strip__item {
  text-decoration: none;
  color: var(--color-text-muted);
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
  background: none;
  border-top: 0; border-left: 0; border-right: 0;
  cursor: pointer;
  font-size: 0.875rem;
}
.nav-strip__item:hover { color: var(--color-text-secondary); border-bottom-color: var(--color-text-muted); }
.nav-strip__item--active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
.nav-strip__item--ghost { font-style: italic; }

/* ---------- 4. Section Labels ----------------------------------------- */

.section-label {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  color: var(--color-text-secondary);
  margin: 0 0 0.8rem;
  letter-spacing: 0.02em;
  transform: rotate(-0.5deg);
}

/* ---------- 5. Templates ---------------------------------------------- */

.templates {
  position: relative;
  z-index: 5;
}
.templates__scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-wood-mid) transparent;
  margin: 0 calc(-1 * clamp(20px, 5vw, 60px));
  padding: 0 clamp(20px, 5vw, 60px);
}
.templates__scroll::-webkit-scrollbar { height: 6px; }
.templates__scroll::-webkit-scrollbar-thumb { background: var(--color-wood-mid); border-radius: 3px; }

.templates__grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 14px;
  padding-bottom: 8px;
}

.templates__loading {
  font-family: 'Caveat', cursive;
  color: var(--color-text-muted);
  font-style: italic;
}

.templates__notice {
  margin-top: 0.6rem;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 16px;
  background:
    linear-gradient(160deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-wood-grain);
  border-radius: 6px 10px 8px 6px;
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
  font-family: 'Lora', Georgia, serif;
  transition: transform 180ms var(--ease-paper),
              filter 180ms ease,
              border-color 200ms ease,
              box-shadow 220ms ease;
  overflow: hidden;
  min-height: 120px;
}
/* Holz-Maserung pro Template via deterministischem Seed */
.template-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      calc(85deg + (var(--grain-seed, 0) * 1deg)),
      transparent 0,
      transparent 6px,
      rgba(61, 36, 16, 0.18) 6px,
      rgba(61, 36, 16, 0.18) 7px,
      transparent 7px,
      transparent 14px
    );
  opacity: 0.45;
  pointer-events: none;
}
.template-card:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  border-left-color: var(--color-wood-light);
}
.template-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.template-card--active {
  border-left: 4px solid var(--color-accent);
  box-shadow: 0 0 12px rgba(200, 134, 10, 0.35), inset 0 0 30px rgba(200, 134, 10, 0.06);
  filter: brightness(1.04);
}
.template-card--active .template-card__marginalie { opacity: 1; }

.template-card__name {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.55rem;
  color: var(--color-text-primary);
  line-height: 1.05;
  margin-right: 50px;
}
.template-card__hint {
  font-family: 'Lora', serif;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}
.template-card__layers {
  margin-top: auto;
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}
.template-card__marginalie {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  color: var(--color-text-secondary);
  opacity: 0.5;
  transition: opacity 240ms var(--ease-paper);
  pointer-events: none;
}
.template-card__marginalie svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- 6. Layer-Editor ------------------------------------------- */

.layer-editor {
  position: relative;
  z-index: 5;
}
.layer-editor__empty {
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--color-text-secondary);
  padding: 1rem 0;
}
.layer-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-card {
  position: relative;
  background:
    linear-gradient(170deg, var(--color-surface-elev) 0%, var(--color-surface) 100%);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-wood-grain);
  border-radius: 6px 8px 6px 10px;
  padding: 14px 16px 12px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) rotate(var(--tilt, 0deg));
  animation: paper-settle 320ms var(--ease-paper) forwards;
  transition: filter 240ms ease, opacity 240ms ease;
}
.layer-card--muted {
  filter: grayscale(0.6) brightness(0.7);
  opacity: 0.55;
}
.layer-card--previewing {
  border-left-color: var(--color-accent);
  box-shadow: 0 0 18px rgba(200, 134, 10, 0.28);
}

@keyframes paper-settle {
  0%   { opacity: 0; transform: translateY(14px) rotate(var(--tilt, 0deg)); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* Holz-Maserungs-DNA als hintere SVG-Schicht */
.layer-card__grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--color-wood-grain);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.layer-card__head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.layer-card__num {
  display: inline-block;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  transform: rotate(-3deg);
  opacity: 0.7;
  width: 28px;
  text-align: center;
}

.layer-card__title-wrap { min-width: 0; }
.layer-card__title {
  margin: 0;
  font-family: 'Lora', serif;
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-card__sub {
  margin: 2px 0 0;
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.layer-card__mode {
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.layer-card__preview {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--color-wood-mid);
  border-radius: 4px;
  color: var(--color-text-secondary);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.layer-card__preview:hover {
  background: rgba(92, 58, 30, 0.3);
  border-color: var(--color-wood-light);
  color: var(--color-text-primary);
}
.layer-card__preview.is-active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(200, 134, 10, 0.10);
}
.layer-card__preview-icon { display: inline-flex; }
.layer-card__preview-bars {
  display: none;
  align-items: end;
  gap: 2px;
  height: 14px;
}
.layer-card__preview.is-active .layer-card__preview-bars { display: inline-flex; }
.layer-card__preview.is-active .layer-card__preview-icon { display: none; }
.layer-card__preview-bars span {
  display: block;
  width: 3px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 1px;
  animation: eq-pulse 720ms var(--ease-pendulum) infinite alternate;
}
.layer-card__preview-bars span:nth-child(1) { animation-delay: 0ms; }
.layer-card__preview-bars span:nth-child(2) { animation-delay: 120ms; }
.layer-card__preview-bars span:nth-child(3) { animation-delay: 60ms; }
.layer-card__preview-bars span:nth-child(4) { animation-delay: 200ms; }
@keyframes eq-pulse {
  from { height: 4px; }
  to   { height: 14px; }
}

.layer-card__toggle {
  background: transparent;
  border: 1px solid var(--color-wood-mid);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: 'Caveat', cursive;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  transition: color 200ms ease, border-color 200ms ease;
}
.layer-card__toggle[aria-pressed="true"] {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.layer-card__sliders {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

/* ---------- 7. Sliders -------------------------------------------------- */

.slider-row {
  display: grid;
  grid-template-columns: 90px 1fr 80px;
  align-items: center;
  gap: 10px;
}
.slider-row__label {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.slider-row__value {
  text-align: right;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-accent);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background:
    linear-gradient(180deg, var(--color-bg-deeper), var(--color-wood-grain));
  border: 1px solid #1a0e06;
  border-radius: 3px;
  box-shadow: inset 0 -3px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255, 220, 170, 0.04);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  background: linear-gradient(180deg, var(--color-bg-deeper), var(--color-wood-grain));
  border: 1px solid #1a0e06;
  border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -8px;
  width: 18px;
  height: 22px;
  border-radius: 3px;
  background:
    radial-gradient(circle at 30% 30%,
      var(--color-wood-light) 0%,
      var(--color-wood-mid) 60%,
      var(--color-wood-grain) 100%);
  border: 1px solid var(--color-wood-grain);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255, 220, 170, 0.18);
  transform: rotate(2deg);
  transition: transform 140ms var(--ease-overshoot), box-shadow 220ms ease;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 22px;
  border-radius: 3px;
  background: radial-gradient(circle at 30% 30%, var(--color-wood-light) 0%, var(--color-wood-mid) 60%, var(--color-wood-grain) 100%);
  border: 1px solid var(--color-wood-grain);
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: rotate(0deg) scale(1.08);
  box-shadow: 0 0 8px rgba(200, 134, 10, 0.55), 0 1px 2px rgba(0,0,0,0.6);
}
input[type="range"]:focus-visible {
  outline: none;
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(200, 134, 10, 0.45);
}

/* ---------- 8. Render-Controls --------------------------------------- */

.render-controls {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(170deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border: 1px solid var(--color-border);
  border-radius: 6px 12px 6px 10px;
}

.duration-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px;
  align-items: center;
  gap: 10px;
}
.duration-row__label {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.duration-row__value {
  text-align: right;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--color-accent);
}

.btn-render {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 26px;
  background: linear-gradient(170deg, var(--color-accent-glow) 0%, var(--color-accent) 100%);
  color: #1a0e06;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 2px solid #8B5E00;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.32),
    inset 0 -2px 4px rgba(80, 40, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 80ms ease-out, background 220ms ease, box-shadow 220ms ease;
}
.btn-render:hover:not(:disabled) {
  background: linear-gradient(170deg, #F5B433 0%, var(--color-accent-glow) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.4),
    inset 0 -2px 4px rgba(80, 40, 0, 0.4),
    0 0 18px rgba(200, 134, 10, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.45);
}
.btn-render:active:not(:disabled) { transform: scale(0.97); }
.btn-render:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-render__flame {
  width: 22px;
  height: 22px;
  display: inline-flex;
}
.btn-render__flame img {
  width: 100%; height: 100%; pointer-events: none;
  display: block;
}
.btn-render--running {
  animation: glow-bloom 2.6s var(--ease-swell) infinite alternate;
}
@keyframes glow-bloom {
  from { box-shadow: inset 0 1px 0 rgba(255,240,200,0.4), 0 0 8px rgba(200,134,10,0.35), 0 4px 12px rgba(0,0,0,0.45); }
  to   { box-shadow: inset 0 1px 0 rgba(255,240,200,0.5), 0 0 28px rgba(232,160,32,0.75), 0 4px 12px rgba(0,0,0,0.45); }
}
.btn-render--done {
  background: linear-gradient(170deg, var(--color-accent) 0%, #8B5E00 100%);
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: progress-appear 220ms var(--ease-paper);
}
@keyframes progress-appear {
  from { max-height: 0; opacity: 0; transform: translateY(-4px); }
  to   { max-height: 80px; opacity: 1; transform: translateY(0); }
}
.progress-track {
  position: relative;
  height: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg,
    #8B5E00 0%,
    var(--color-accent) 50%,
    var(--color-accent-glow) 100%);
  border-right: 1px solid rgba(255, 220, 170, 0.4);
  transition: width 320ms var(--ease-swell);
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 240, 200, 0.4) 50%,
    transparent 100%);
  transform: translateX(-100%);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.85rem;
}
.progress-pct {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  color: var(--color-accent);
}
.progress-status {
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--color-text-secondary);
  text-align: right;
  flex: 1;
  transition: opacity 800ms ease;
}

.render-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--color-border);
  animation: paper-settle 320ms var(--ease-paper);
}
.render-result__title {
  margin: 0;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--color-accent);
}
.render-result__audio {
  flex: 1 1 240px;
  height: 36px;
  filter: invert(0.85) hue-rotate(180deg);
  border-radius: 4px;
}
.render-result__midnight {
  font-family: 'Caveat', cursive;
  font-size: 0.95rem;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  padding: 2px 8px;
  border-radius: 3px;
  transform: rotate(-2deg);
  letter-spacing: 0.02em;
}

.btn-download {
  display: inline-block;
  padding: 8px 18px;
  background: var(--color-accent);
  color: #1a0e06;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
  border-radius: 3px;
  border: 1px solid #8B5E00;
  text-decoration: none;
  transition: background 220ms ease, transform 120ms ease;
}
.btn-download:hover {
  background: var(--color-accent-glow);
  transform: translateY(-1px);
  color: #1a0e06;
}

.render-error {
  margin: 0;
  padding: 8px 12px;
  background: rgba(192, 57, 43, 0.08);
  border-left: 3px solid var(--color-danger);
  color: var(--color-text-primary);
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.92rem;
}

/* ---------- 9. Generic Buttons --------------------------------------- */

.btn-primary {
  display: inline-block;
  padding: 10px 22px;
  background: var(--color-accent);
  color: #1a0e06;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.92rem;
  border-radius: 4px;
  border: 1px solid #8B5E00;
  cursor: pointer;
  text-decoration: none;
  transition: background 220ms ease, transform 120ms ease, box-shadow 220ms ease;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-glow);
  box-shadow: 0 0 14px rgba(200, 134, 10, 0.5);
  color: #1a0e06;
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary--danger { background: var(--color-danger); border-color: #8B1A0F; color: var(--color-text-primary); }
.btn-primary--danger:hover { background: #D04A3A; color: var(--color-text-primary); }

.btn-secondary {
  display: inline-block;
  padding: 7px 14px;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  border: 1px solid var(--color-wood-mid);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.btn-secondary:hover {
  background: rgba(92, 58, 30, 0.32);
  color: var(--color-text-primary);
  border-color: var(--color-wood-light);
}

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--color-text-muted);
  border-radius: 3px;
  padding: 6px 12px;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}
.btn-ghost:hover { color: var(--color-text-secondary); border-color: var(--color-text-secondary); }
.btn-ghost--danger:hover { color: var(--color-danger); border-color: var(--color-danger); }

/* ---------- 10. Pergament-Cards (Tagebuch) --------------------------- */

.page-title {
  margin: 0;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  transform: rotate(-1deg);
}

.tagebuch-loading,
.tagebuch-empty {
  text-align: center;
  padding: 2rem 1rem;
  font-family: 'Lora', serif;
}
.tagebuch-empty__head {
  font-family: 'Caveat', cursive;
  font-size: clamp(2rem, 5vw, 2.6rem);
  margin: 0;
  color: var(--color-text-primary);
}
.tagebuch-empty__body {
  margin: 0.6rem 0 1.4rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-parchment {
  position: relative;
  padding: 18px 22px;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255, 235, 200, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 80%, rgba(120, 80, 40, 0.10) 0%, transparent 60%),
    var(--color-parchment-cream);
  background-blend-mode: normal;
  color: var(--color-bg-deeper);
  border: 1px solid var(--color-parchment-dark);
  border-radius: 4px 12px 4px 10px;
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 0 30px rgba(140, 100, 60, 0.18);
  font-family: 'Lora', serif;
  opacity: 0;
  transform: translateY(14px) rotate(var(--rot, 0deg));
  animation: paper-settle 320ms var(--ease-paper) forwards;
  transition: transform 240ms var(--ease-paper), box-shadow 240ms ease;
}
.card-parchment:hover {
  transform: translateY(-2px) rotate(var(--rot, 0deg));
  box-shadow:
    0 8px 26px rgba(0, 0, 0, 0.55),
    inset 0 0 30px rgba(140, 100, 60, 0.22);
}
/* Eselsohren via Pseudo-Elements */
.card-parchment::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 22px; height: 22px;
  background: linear-gradient(225deg, var(--color-parchment) 50%, var(--color-parchment-dark) 50%);
  border-bottom-left-radius: 2px;
  box-shadow: -1px 1px 2px rgba(0,0,0,0.18);
}

.card-parchment__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.card-parchment__title {
  margin: 0;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--color-bg-deeper);
}
.card-parchment__title--lg { font-size: clamp(1.8rem, 4.5vw, 2.4rem); }
.card-parchment__time {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: rgba(20, 14, 6, 0.7);
}
.card-parchment__meta {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: rgba(20, 14, 6, 0.78);
}
.card-parchment__body {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-bg-deeper);
}
.card-parchment__pointe {
  font-style: italic;
  font-size: 0.92rem;
  color: rgba(20, 14, 6, 0.6);
  margin: 0.4rem 0 1rem;
}
.dot-sep { color: rgba(20,14,6,0.4); margin: 0 4px; }

.card-parchment__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.card-parchment__actions .btn-secondary {
  color: rgba(20, 14, 6, 0.85);
  border-color: rgba(20, 14, 6, 0.4);
}
.card-parchment__actions .btn-secondary:hover {
  background: rgba(20, 14, 6, 0.08);
  color: var(--color-bg-deeper);
  border-color: var(--color-bg-deeper);
}
.card-parchment__actions .btn-ghost {
  color: rgba(20, 14, 6, 0.55);
  border-color: rgba(20, 14, 6, 0.32);
}

.card-parchment__audio {
  width: 100%;
  margin-top: 10px;
  height: 36px;
}

.midnight-stamp {
  position: absolute;
  top: 12px;
  right: 38px;
  padding: 3px 8px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
  border-radius: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(calc(var(--stamp-rot, -2) * 1deg));
  background: rgba(255, 235, 200, 0.4);
  pointer-events: none;
}
.card-parchment--midnight { box-shadow:
  0 6px 20px rgba(0, 0, 0, 0.5),
  inset 0 0 30px rgba(140, 100, 60, 0.18),
  0 0 0 1px rgba(200, 134, 10, 0.18);
}
.card-parchment--404 {
  text-align: center;
  max-width: 540px;
  padding: 36px 38px;
}
.card-parchment--404 .btn-primary {
  margin-top: 1rem;
}

/* ---------- 11. Footer ----------------------------------------------- */

.footer {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  margin: 40px auto 24px;
  padding: 16px clamp(20px, 5vw, 60px);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--color-border);
}
.footer-tag {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.footer-version {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.footer-version a {
  color: var(--color-text-muted);
  border-bottom: 1px dotted var(--color-text-muted);
}
.footer-version a:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---------- 12. Toasts ----------------------------------------------- */

.toast-container {
  position: fixed;
  top: clamp(60px, 8vw, 120px);
  right: clamp(16px, 4vw, 60px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
  max-width: 320px;
}
.toast-parchment {
  position: relative;
  pointer-events: auto;
  padding: 12px 16px 10px;
  background: var(--color-parchment-cream);
  color: var(--color-bg-deeper);
  border: 1px solid var(--color-parchment-dark);
  border-radius: 3px 8px 4px 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  animation: note-arrive 400ms var(--ease-paper);
  font-family: 'Lora', serif;
  font-style: italic;
  transform: rotate(-1.6deg);
}
.toast-parchment.toast--leaving {
  animation: note-fall 900ms cubic-bezier(0.4, 0.5, 0.7, 1) forwards;
}
@keyframes note-arrive {
  0% { opacity: 0; transform: translateX(40%) translateY(-10%) rotate(4deg); }
  100% { opacity: 1; transform: translateX(0) translateY(0) rotate(-1.6deg); }
}
@keyframes note-fall {
  0% { opacity: 1; transform: translateX(0) translateY(0) rotate(-1.6deg); }
  100% { opacity: 0; transform: translateY(80px) rotate(10deg); }
}
.toast-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}
.toast-details {
  margin-top: 4px;
  background: transparent;
  border: 1px solid rgba(20,14,6,0.32);
  border-radius: 2px;
  padding: 2px 8px;
  font-family: 'Caveat', cursive;
  font-size: 0.85rem;
  color: rgba(20,14,6,0.65);
  cursor: pointer;
}
.toast-sigle {
  position: absolute;
  top: 4px;
  right: 8px;
  font-family: 'Caveat', cursive;
  font-style: normal;
  font-size: 0.72rem;
  color: rgba(20,14,6,0.45);
}

/* ---------- 13. Modal ------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 8, 4, 0.86);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: backdrop-fade 220ms ease-out;
}
@keyframes backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-sign {
  position: relative;
  width: 100%;
  max-width: 540px;
  background:
    repeating-linear-gradient(91deg, transparent 0, transparent 8px,
      rgba(61, 36, 16, 0.22) 8px, rgba(61, 36, 16, 0.22) 9px,
      transparent 9px, transparent 18px),
    linear-gradient(170deg, var(--color-surface-elev) 0%, var(--color-surface) 100%);
  border: 2px solid var(--color-wood-mid);
  border-radius: 6px 14px 6px 12px;
  padding: 28px 30px 22px;
  color: var(--color-text-primary);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  animation: modal-open 320ms var(--ease-overshoot) 60ms backwards;
}
.modal-sign--small { max-width: 420px; padding: 22px 24px; }
@keyframes modal-open {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  line-height: 1;
}
.modal-close:hover { color: var(--color-text-primary); }

.modal-title {
  margin: 0 0 6px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--color-text-primary);
}
.modal-subtitle {
  margin: 0 0 1rem;
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--color-text-secondary);
  font-size: 0.92rem;
}
.modal-body {
  margin: 0 0 1.2rem;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
}

.feedback-type {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
}
.feedback-type legend {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  padding: 0;
}
.chip {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 6px 14px;
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-wood-mid);
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.chip:hover { color: var(--color-text-primary); border-color: var(--color-wood-light); }
.chip--active {
  background: rgba(200, 134, 10, 0.16);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.feedback-field {
  display: block;
  margin-bottom: 12px;
}
.feedback-field__label {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.feedback-field input,
.feedback-field textarea {
  width: 100%;
  background: var(--color-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 8px 10px;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  resize: vertical;
}
.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

.feedback-validation {
  margin: 0 0 0.6rem;
  color: var(--color-danger);
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 0.6rem;
}

/* ---------- 14. Concert-Mode ------------------------------------------ */

.body--concert .templates,
.body--concert .layer-editor,
.body--concert .render-controls,
.body--concert .footer,
.body--concert .nav-strip,
.body--concert .greeting {
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms var(--ease-paper);
}
.body--concert .logo-sign { transform: scale(1.15) rotate(-3deg); transition: transform 600ms var(--ease-paper); }
.concert-hint {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  z-index: 10;
  pointer-events: none;
}

/* ---------- 15. Fireflies (motion-spec 5.4) -------------------------- */

.firefly {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(232, 160, 32, 1) 0%,
    rgba(200, 134, 10, 0.6) 35%,
    rgba(200, 134, 10, 0) 70%
  );
  filter: blur(0.5px);
  opacity: 0;
  z-index: 50;
  will-change: transform, opacity;
}

/* ---------- 16. Thunder-Flash (motion-spec 5.5) ---------------------- */

.thunder-flash {
  position: fixed;
  inset: 0;
  background: rgba(255, 240, 200, 0);
  pointer-events: none;
  z-index: 9999;
}
.thunder-flash.is-active {
  animation: thunder-flash 220ms cubic-bezier(0.4, 0, 0.6, 1) 1;
}
body.is-rendering-flash {
  animation: render-desat 200ms cubic-bezier(0.4, 0, 0.6, 1) 1;
}
@keyframes thunder-flash {
  0%   { background: rgba(255, 240, 200, 0); }
  20%  { background: rgba(255, 240, 200, 0.18); }
  100% { background: rgba(255, 240, 200, 0); }
}
@keyframes render-desat {
  0%   { filter: saturate(1); }
  20%  { filter: saturate(0.7); }
  100% { filter: saturate(1); }
}

/* ---------- 17. Drift-Leaf (long-idle) ------------------------------- */

.leaf-drift {
  position: fixed;
  width: 28px;
  height: 28px;
  background: url('/assets/svg/leaf-single.svg') center / contain no-repeat;
  opacity: 0.10;
  pointer-events: none;
  z-index: 5;
}

/* ---------- 18. Butterfly (easter-egg) ------------------------------- */

.butterfly-fly {
  position: fixed;
  width: 32px;
  height: 32px;
  background: url('/assets/svg/butterfly.svg') center / contain no-repeat;
  pointer-events: none;
  z-index: 51;
}
.butterfly-fly::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  animation: wing-flap 220ms ease-in-out infinite;
  transform-origin: center;
}
@keyframes wing-flap {
  0%, 100% { transform: scaleX(1); }
  50%      { transform: scaleX(0.55); }
}

/* ---------- 19. Responsive ------------------------------------------- */

@media (max-width: 767px) {
  .frame-corner { width: clamp(70px, 22vw, 120px); height: clamp(70px, 22vw, 120px); }
  .stage { padding: 70px 16px 60px; gap: 1.6rem; }
  .templates__grid { grid-auto-columns: minmax(180px, 220px); }
  .layer-card__head {
    grid-template-columns: auto 1fr;
    grid-template-areas: "num title" ". preview" ". toggle";
    row-gap: 6px;
  }
  .layer-card__num { grid-area: num; }
  .layer-card__title-wrap { grid-area: title; }
  .layer-card__preview { grid-area: preview; justify-self: start; }
  .layer-card__toggle { grid-area: toggle; justify-self: start; }
  .slider-row { grid-template-columns: 80px 1fr 70px; gap: 6px; }
  .duration-row { grid-template-columns: 80px 1fr 80px; }
  .render-result__audio { flex-basis: 100%; order: 2; }
  .footer { flex-direction: column; align-items: flex-start; gap: 4px; }
  .midnight-moon { width: 70vw; height: 70vw; }
  .toast-container { right: 12px; left: 12px; max-width: none; }
  .modal-sign { padding: 22px 18px 18px; }
}

@media (max-width: 380px) {
  .frame-corner--bl, .frame-corner--br { display: none; }
  .stage { padding-bottom: 40px; }
}

/* ---------- 20. Reduced-Motion --------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .logo-sign { transform: rotate(-3deg); }
  .firefly, .leaf-drift, .butterfly-fly { display: none !important; }
  body { animation: none; }
  .progress-fill::after { display: none; }
  .thunder-flash.is-active { animation: none; background: rgba(255, 240, 200, 0); }
}

/* ---------- 21. Visibility-Pause (motion-spec 4) --------------------- */

body.app--hidden *,
body.app--hidden *::before,
body.app--hidden *::after {
  animation-play-state: paused !important;
}
