:root {
  /* Typography compliance tokens from DESIGN.md: IBM Plex Mono** Interface labels */
  --monitor-plum: #241632;
  --aurora-mint: #7CF4C8;
  --polar-violet: #9B7CFF;
  --reluctant-blush: #FF6F91;
  --aged-cel-cream: #F4E7CF;
  --ink-pine: #183B35;
  --amber-scanline: #FFC857;
  --display: "Libre Baskerville", Georgia, serif;
  --body: "Cormorant Garamond", Garamond, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --jp: "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--monitor-plum); }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--aged-cel-cream);
  background:
    radial-gradient(circle at 58% 28%, rgba(124, 244, 200, calc(.12 + var(--bloom, .48) * .22)), transparent 32rem),
    radial-gradient(circle at 73% 74%, rgba(155, 124, 255, .33), transparent 32rem),
    radial-gradient(circle at 22% 82%, rgba(255, 111, 145, .20), transparent 26rem),
    linear-gradient(135deg, #160d20 0%, var(--monitor-plum) 55%, #130d18 100%);
  font-family: var(--body);
}

button, input { font: inherit; }
button { cursor: pointer; }

.studio-grain, .scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: .17;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(244, 231, 207, .11) 0 1px, transparent 1px);
  background-size: 100% 4px, 13px 13px;
  mix-blend-mode: soft-light;
}

.scanlines { position: absolute; z-index: 5; opacity: calc(.12 + var(--static, .32) * .32); }

.cursor-leaf {
  position: fixed;
  width: 22px;
  height: 22px;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid var(--reluctant-blush);
  border-radius: 100% 0 100% 0;
  box-shadow: 0 0 18px rgba(124, 244, 200, .42);
  opacity: .75;
}

.studio {
  --rail: clamp(12rem, 17vw, 17rem);
  --mix: clamp(15rem, 24vw, 24rem);
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail) minmax(22rem, 1fr) var(--mix);
  grid-template-rows: minmax(34rem, 1fr) 8.5rem;
  gap: 1rem;
  padding: 1rem;
  transition: filter .5s cubic-bezier(.2, 1.4, .35, 1), background .6s ease;
}

.acetate-rail, .mixer, .timeline, .pass-notes, .monitor {
  border: 1px solid rgba(244, 231, 207, .22);
  box-shadow: 0 24px 80px rgba(0,0,0,.34), inset 0 0 0 1px rgba(124,244,200,.08);
  backdrop-filter: blur(14px);
}

.acetate-rail {
  grid-row: 1 / span 2;
  padding: 1rem .75rem;
  border-radius: 1.6rem;
  background: linear-gradient(180deg, rgba(244,231,207,.16), rgba(155,124,255,.08));
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transform: rotate(-.8deg);
}

.rail-label, .monitor-topline, .folder-tab, .pass-card small, .cel-code, .frame span, .stamp, .kana, .emotional-metrics span {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .68rem;
}

.rail-label { color: var(--amber-scanline); padding: .35rem .55rem .65rem; }

.cel-pane {
  position: relative;
  min-height: 7rem;
  border: 1px solid rgba(244, 231, 207, .32);
  border-radius: 1rem;
  color: var(--aged-cel-cream);
  background: rgba(244, 231, 207, .08);
  text-align: left;
  padding: 1.25rem .85rem .8rem;
  transition: transform .45s cubic-bezier(.17, 1.7, .32, 1), background .35s ease, border-color .35s ease;
}

.cel-pane:nth-child(odd) { transform: translateX(.45rem) rotate(1.4deg); }
.cel-pane:nth-child(even) { transform: translateX(-.2rem) rotate(-1.2deg); }
.cel-pane.active { background: rgba(124,244,200,.14); border-color: var(--aurora-mint); transform: translateX(.9rem) rotate(.5deg) scale(1.03); }
.cel-pane strong { display: block; font-family: var(--display); font-size: 1.05rem; line-height: 1.15; margin: .4rem 0 .35rem; }
.cel-pane em { color: var(--reluctant-blush); font-family: var(--mono); font-size: .66rem; font-style: normal; text-transform: uppercase; }
.peg { position: absolute; top: .55rem; right: .7rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; border: 2px solid rgba(244,231,207,.55); }

.monitor {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  border-radius: 2rem;
  background: linear-gradient(145deg, rgba(36,22,50,.74), rgba(24,59,53,.28));
}

.monitor-topline {
  display: flex;
  justify-content: space-between;
  padding: .95rem 1.2rem;
  color: var(--aurora-mint);
  border-bottom: 1px solid rgba(244,231,207,.16);
}

.canvas-wrap { position: absolute; inset: 3rem 0 0; }
.bloom-svg { width: 100%; height: 100%; display: block; }
.cel-sheet { fill: rgba(244,231,207,.055); stroke: rgba(244,231,207,.28); stroke-width: 2; }
.registration { stroke: var(--amber-scanline); stroke-width: 2; opacity: .65; }
.grid-line { stroke: rgba(244,231,207,.13); stroke-width: 1; }
.aurora-orb { transform-origin: center; animation: auroraPulse 7s ease-in-out infinite alternate; opacity: calc(.5 + var(--bloom, .48) * .45); }
.vine { fill: none; stroke: var(--aurora-mint); stroke-width: 3; opacity: .78; stroke-linecap: round; }
.vine.ink { stroke: var(--ink-pine); opacity: .6; }
.petal { fill: rgba(255,111,145,.68); stroke: rgba(244,231,207,.7); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; transition: d .7s ease, fill .45s ease; }
.petal.mint { fill: rgba(124,244,200,.58); }
.petal.violet { fill: rgba(155,124,255,.58); }
.onion .petal { fill: none; stroke: rgba(244,231,207,.22); transform: scale(1.16); }
.seed-dot { fill: var(--amber-scanline); opacity: .88; }
.handle { stroke: var(--reluctant-blush); stroke-width: 1; opacity: .72; }
.annotation-layer path { fill: none; stroke: var(--reluctant-blush); stroke-width: 3; stroke-dasharray: 6 7; }
.annotation-layer text { fill: var(--reluctant-blush); font-family: var(--mono); font-size: 20px; text-transform: uppercase; }

.opening-copy {
  position: absolute;
  left: clamp(1rem, 5vw, 4rem);
  bottom: clamp(2rem, 8vw, 5rem);
  z-index: 7;
  max-width: 32rem;
  transform: rotate(-2deg);
}
.opening-copy .curt {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(2.5rem, 6vw, 6.8rem);
  line-height: .88;
  color: var(--aged-cel-cream);
  text-shadow: 0 0 34px rgba(155,124,255,.58);
}
.opening-copy .soft {
  display: inline-block;
  margin: .8rem 0 0 1rem;
  padding: .35rem .65rem;
  color: var(--ink-pine);
  background: var(--aurora-mint);
  font-family: var(--mono);
  text-transform: uppercase;
  transform: scale(.86) translateY(-.4rem);
  opacity: calc(.22 + var(--warmth, .38));
  transition: transform .45s cubic-bezier(.17,1.65,.36,1), opacity .3s ease;
}
.monitor:hover .soft { transform: scale(1) translateY(0) rotate(1deg); opacity: 1; }

.note-cluster { position: absolute; right: 1.4rem; bottom: 1.2rem; z-index: 8; display: flex; align-items: end; gap: .7rem; flex-wrap: wrap; justify-content: end; }
.stamp {
  border: 2px solid currentColor;
  color: var(--reluctant-blush);
  background: rgba(36,22,50,.64);
  padding: .45rem .7rem;
  transform: rotate(-7deg);
  transition: transform .45s cubic-bezier(.17,1.7,.32,1), color .25s ease, background .25s ease;
}
.stamp.amber { color: var(--amber-scanline); transform: rotate(5deg); }
.stamp:hover { color: var(--ink-pine); background: var(--reluctant-blush); transform: rotate(0) scale(1.12); }
.kana { color: var(--aurora-mint); font-family: var(--jp); opacity: .8; }

.mixer {
  grid-column: 3;
  grid-row: 1;
  border-radius: 1.5rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(244,231,207,.92), rgba(244,231,207,.72));
  color: var(--ink-pine);
  transform: rotate(.7deg);
}
.folder-tab { display: inline-block; background: var(--amber-scanline); padding: .45rem .8rem; border-radius: .75rem .75rem .25rem .25rem; color: var(--monitor-plum); }
.mixer h2 { font-family: var(--display); font-style: italic; font-size: clamp(1.4rem, 2.2vw, 2.35rem); line-height: 1.05; margin: 1rem 0; }
.dial-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.dial { position: relative; min-height: 6.8rem; border: 1px solid rgba(24,59,53,.26); border-radius: 1.1rem; padding: .75rem; background: rgba(255,255,255,.22); overflow: hidden; }
.dial.wide { grid-column: 1 / -1; min-height: 5.4rem; }
.dial span { display: block; font-family: var(--mono); text-transform: uppercase; font-size: .72rem; color: var(--monitor-plum); }
.dial input { position: absolute; inset: auto .75rem .75rem; width: calc(100% - 1.5rem); accent-color: var(--reluctant-blush); }
.dial b { position: absolute; width: 3.1rem; height: 3.1rem; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(calc(var(--turn, 135) * 1deg)); background: conic-gradient(var(--aurora-mint), var(--polar-violet), var(--reluctant-blush), var(--aurora-mint)); box-shadow: inset 0 0 0 .55rem var(--aged-cel-cream), 0 0 18px rgba(155,124,255,.45); transition: transform .32s cubic-bezier(.17,1.65,.36,1); }
.dial b::after { content: ""; position: absolute; left: 50%; top: .28rem; width: 3px; height: .82rem; background: var(--ink-pine); border-radius: 9px; }
.emotional-metrics { margin-top: 1rem; border-top: 1px dashed rgba(24,59,53,.35); padding-top: .85rem; }
.emotional-metrics p { display: flex; justify-content: space-between; gap: 1rem; margin: .55rem 0; }
.emotional-metrics strong { font-family: var(--mono); color: var(--reluctant-blush); }

.timeline {
  position: relative;
  grid-column: 2 / span 2;
  grid-row: 2;
  border-radius: 4rem 2rem 2rem 4rem;
  background: rgba(36,22,50,.72);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .6rem;
  padding: 1rem;
  transform: perspective(700px) rotateX(8deg) rotate(-.6deg);
}
.scrubber { position: absolute; top: .42rem; left: var(--scrub-left, 3%); width: 3rem; height: calc(100% - .84rem); border: 2px solid var(--amber-scanline); border-radius: 1rem; box-shadow: 0 0 18px rgba(255,200,87,.42); transition: left .55s cubic-bezier(.17,1.65,.36,1); }
.frame { border: 1px solid rgba(244,231,207,.2); border-radius: 1.1rem; color: var(--aged-cel-cream); background: repeating-linear-gradient(90deg, rgba(244,231,207,.08) 0 11px, rgba(36,22,50,.32) 11px 18px); padding: .7rem; text-align: left; transition: transform .35s cubic-bezier(.17,1.65,.36,1), border-color .25s ease; }
.frame.active { transform: translateY(-.45rem) scale(1.03); border-color: var(--amber-scanline); }
.frame span { display: block; color: var(--amber-scanline); }
.frame em { font-style: normal; font-family: var(--mono); text-transform: uppercase; font-size: .65rem; }

.pass-notes {
  position: fixed;
  left: calc(var(--rail) + 2.2rem);
  top: 5.1rem;
  z-index: 9;
  width: clamp(16rem, 24vw, 28rem);
  min-height: 12rem;
  border-radius: 1.3rem;
  background: rgba(244,231,207,.9);
  color: var(--ink-pine);
  transform: rotate(-1.4deg);
  overflow: hidden;
}
.pass-card { display: none; padding: 1rem 1.15rem; }
.pass-card.active { display: block; animation: cardIn .5s cubic-bezier(.17,1.65,.36,1); }
.pass-card h1 { margin: .3rem 0; font-family: var(--display); font-size: clamp(1.7rem, 3vw, 3rem); line-height: .95; color: var(--monitor-plum); }
.pass-card p { font-size: 1.18rem; line-height: 1.25; margin: .75rem 0 0; }
.pass-card small { color: var(--reluctant-blush); }

.studio.final-take .acetate-rail { transform: translateX(.4rem) rotate(-4deg); }
.studio.final-take .mixer { transform: rotate(3deg) translateY(.8rem); }
.studio.final-take .monitor { box-shadow: 0 0 110px rgba(124,244,200,.24), inset 0 0 0 1px rgba(255,200,87,.2); }
.studio.final-take .opening-copy .curt::after { content: "\A tsundere.studio"; white-space: pre; color: var(--aurora-mint); text-shadow: 0 0 40px rgba(255,111,145,.55); }

@keyframes auroraPulse { from { transform: scale(.94) rotate(-2deg); } to { transform: scale(1.08) rotate(3deg); } }
@keyframes cardIn { 0% { opacity: 0; transform: translateY(1rem) rotate(-3deg) scale(.96); } 70% { transform: translateY(-.25rem) rotate(1deg) scale(1.03); } 100% { opacity: 1; transform: none; } }
@keyframes petalGrow { from { transform: scale(.3) rotate(var(--r)); opacity: .1; } 70% { transform: scale(1.08) rotate(var(--r)); opacity: 1; } to { transform: scale(1) rotate(var(--r)); opacity: .95; } }

@media (max-width: 1040px) {
  .studio { grid-template-columns: 1fr; grid-template-rows: auto 36rem auto auto; }
  .acetate-rail, .monitor, .mixer, .timeline { grid-column: 1; grid-row: auto; }
  .acetate-rail { flex-direction: row; overflow-x: auto; transform: none; }
  .cel-pane { min-width: 12rem; }
  .pass-notes { position: relative; left: auto; top: auto; grid-column: 1; width: auto; }
  .timeline { grid-column: 1; }
}

@media (max-width: 640px) {
  .studio { padding: .55rem; gap: .55rem; }
  .timeline { grid-template-columns: 1fr; border-radius: 1.4rem; transform: none; }
  .scrubber { display: none; }
  .monitor { min-height: 34rem; }
  .monitor-topline { gap: .75rem; flex-wrap: wrap; }
}
