:root {
  color-scheme: dark;
  --ink: #f7f4ed;
  --muted: rgba(247, 244, 237, 0.64);
  --quiet: rgba(247, 244, 237, 0.43);
  --line: rgba(247, 244, 237, 0.18);
  --line-strong: rgba(247, 244, 237, 0.34);
  --panel: rgba(13, 14, 15, 0.58);
  --gold: #d9c27a;
  --teal: #59d6c2;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.52);
  --font: "Geist", Inter, ui-sans-serif, system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #020303;
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.studio-shell {
  min-height: 100vh;
  padding: clamp(16px, 2.5vw, 34px);
  background:
    radial-gradient(circle at 78% 10%, rgba(217, 194, 122, 0.15), transparent 28%),
    radial-gradient(circle at 12% 82%, rgba(89, 214, 194, 0.11), transparent 31%),
    #020303;
}

.ambient-stage {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - clamp(36px, 6vw, 80px));
  border: 1px solid rgba(247, 244, 237, 0.2);
  border-radius: 24px;
  padding: clamp(20px, 3vw, 42px);
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.08), transparent 26%),
    linear-gradient(47deg, transparent 10%, rgba(255, 255, 255, 0.052) 10% 26%, transparent 26% 52%, rgba(255, 255, 255, 0.04) 52% 67%, transparent 67%),
    linear-gradient(153deg, rgba(255, 255, 255, 0.03) 0 18%, transparent 18% 36%, rgba(255, 255, 255, 0.045) 36% 48%, transparent 48%),
    linear-gradient(180deg, #343434 0%, #181919 52%, #090a0a 100%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ambient-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.11), transparent 34%);
  mix-blend-mode: screen;
  opacity: 0.65;
}

.studio-identity,
.studio-flow,
.signal-mark {
  position: relative;
  z-index: 1;
}

.studio-identity {
  max-width: 820px;
  margin-bottom: clamp(18px, 3vw, 32px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 7.5vw, 7.8rem);
  font-weight: 400;
  line-height: 0.82;
}

.studio-copy {
  max-width: 620px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.4vw, 1.16rem);
  line-height: 1.55;
}

.signal-mark {
  position: absolute;
  z-index: 6;
  top: clamp(24px, 4vw, 54px);
  right: clamp(24px, 4vw, 54px);
  display: grid;
  grid-template-columns: repeat(4, 10px);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  opacity: 0.72;
  cursor: pointer;
  pointer-events: auto;
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    filter 220ms ease;
}

.signal-mark:hover,
.signal-mark.active {
  opacity: 1;
  filter: drop-shadow(0 0 20px rgba(132, 220, 204, 0.18));
  transform: translateY(-1px);
}

.signal-mark span {
  display: block;
  width: 10px;
  height: 82px;
  border: 1px solid rgba(247, 244, 237, 0.35);
  border-radius: 999px;
}

.signal-mark i {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(247, 244, 237, 0.34);
  border-radius: 50%;
  box-shadow: inset 0 0 0 17px rgba(247, 244, 237, 0.04);
}

.signal-mark.active i {
  border-color: rgba(132, 220, 204, 0.62);
  box-shadow:
    inset 0 0 0 17px rgba(132, 220, 204, 0.08),
    0 0 28px rgba(132, 220, 204, 0.18);
}

.studio-flow {
  display: grid;
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)), var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 18px 50px rgba(0, 0, 0, 0.24);
}

.create-panel,
.workspace-panel {
  padding: clamp(18px, 2vw, 28px);
}

.panel-kicker {
  margin-bottom: 8px;
  color: var(--quiet);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: clamp(1.45rem, 1.9vw, 2rem);
  font-weight: 500;
}

.panel-note {
  max-width: 520px;
  margin-top: 7px;
  color: color-mix(in srgb, var(--gold) 68%, var(--teal) 32%);
  font-size: 0.84rem;
  line-height: 1.45;
  opacity: 0.86;
}

.platform-note {
  margin-top: 10px;
  color: rgba(247, 244, 237, 0.38);
  font-size: 0.72rem;
  line-height: 1.45;
}

.icon-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}

.create-row {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.72fr);
  gap: 14px;
  align-items: stretch;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.agent-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 10px;
  align-items: center;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  text-align: left;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.agent-card.selected {
  border-color: rgba(89, 214, 194, 0.72);
  box-shadow: inset 0 0 0 1px rgba(89, 214, 194, 0.2), 0 0 34px rgba(89, 214, 194, 0.08);
}

.agent-orb {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  grid-row: span 2;
  border-radius: 50%;
  background: rgba(89, 214, 194, 0.15);
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 700;
}

.agent-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
  line-height: 1.25;
}

.agent-card small {
  font-size: 0.72rem;
}

.agent-card small,
.media-preview small,
.checkout-list span,
.checkout-figure p {
  color: var(--quiet);
}

.media-dropzone {
  position: relative;
  min-height: 238px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 35%),
    rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.media-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.media-preview,
.hero-canvas {
  position: relative;
  display: grid;
  place-items: center;
}

.media-preview {
  height: 100%;
  min-height: 238px;
  padding: 24px;
  text-align: center;
}

.media-glyph {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border: 1px solid rgba(217, 194, 122, 0.54);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.9rem;
  font-weight: 300;
}

.media-preview strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.url-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.url-import input {
  min-height: 38px;
  border-radius: 999px;
  padding-inline: 14px;
}

.url-import button {
  min-height: 38px;
  border: 1px solid rgba(132, 220, 204, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(132, 220, 204, 0.12), rgba(217, 194, 122, 0.06)),
    rgba(255, 255, 255, 0.03);
  color: var(--ink);
  padding: 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.compose-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.12fr) minmax(330px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.hero-canvas {
  width: min(100%, 780px);
  aspect-ratio: 4 / 5;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 38%, rgba(217, 194, 122, 0.12), transparent 36%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.hero-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -80px 100px rgba(0, 0, 0, 0.35);
}

.hero-empty {
  color: var(--quiet);
}

.output-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.output-frame img,
.output-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.output-frame .base-image {
  position: relative;
  z-index: 0;
}

.output-frame .presence-image {
  position: absolute;
  top: var(--presence-y);
  left: var(--presence-x);
  z-index: 2;
  width: calc(100% * var(--presence-scale));
  height: auto;
  max-height: none;
  object-fit: contain;
  opacity: var(--presence-opacity);
  filter:
    blur(var(--presence-softness))
    contrast(calc(0.8 + (var(--presence-focus) * 0.45)))
    saturate(calc(0.86 + (var(--presence-focus) * 0.36)))
    drop-shadow(0 22px 46px rgba(0, 0, 0, 0.42))
    drop-shadow(0 calc(42px * var(--presence-shadow-scale)) calc(52px * var(--presence-shadow-scale)) rgba(0, 0, 0, var(--presence-shadow-opacity)));
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.output-frame .presence-image.active {
  outline: 1px solid rgba(217, 194, 122, 0.72);
  outline-offset: 8px;
  filter:
    blur(var(--presence-softness))
    contrast(calc(0.8 + (var(--presence-focus) * 0.45)))
    saturate(calc(0.86 + (var(--presence-focus) * 0.36)))
    drop-shadow(0 24px 52px rgba(0, 0, 0, 0.5))
    drop-shadow(0 calc(42px * var(--presence-shadow-scale)) calc(52px * var(--presence-shadow-scale)) rgba(0, 0, 0, var(--presence-shadow-opacity)));
}

.output-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, transparent 34%, rgba(0, 0, 0, var(--vignette-opacity, 0.28)) 100%),
    linear-gradient(180deg, rgba(247, 244, 237, var(--matte-opacity, 0.012)), transparent 46%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), transparent 38%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.68), transparent 54%);
}

.output-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity, 0.08);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22) 0 0.5px, transparent 0.7px),
    radial-gradient(circle at 70% 62%, rgba(0, 0, 0, 0.28) 0 0.6px, transparent 0.8px);
  background-size: 9px 9px, 11px 11px;
  mix-blend-mode: soft-light;
}

.output-text {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 5vw, 56px);
  z-index: 3;
  width: min(78%, 820px);
  color: var(--text-color, #f7f4ed);
  font-family: var(--text-font, var(--serif));
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  transform: translateX(-50%);
}

.output-text h3 {
  margin: 0;
  background: var(--text-fill, var(--text-color, #f7f4ed));
  color: var(--text-color, #f7f4ed);
  font-family: inherit;
  font-size: calc(clamp(2.6rem, 5vw, 5.6rem) * var(--text-scale, 1));
  font-weight: 400;
  line-height: 0.95;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.output-text p {
  max-width: 620px;
  margin-right: auto;
  margin-left: auto;
  margin-top: 14px;
  color: color-mix(in srgb, var(--text-color, #f7f4ed) 82%, transparent);
  font-size: calc(clamp(1rem, 1.4vw, 1.2rem) * var(--text-scale, 1));
  line-height: 1.55;
}

.compose-controls {
  display: grid;
  align-content: start;
  gap: 8px;
}

.journal-form,
.image-director,
.keepsake-composer {
  display: grid;
  gap: 14px;
}

.presence-panel {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
  min-width: 0;
  margin-top: 12px;
  border: 1px solid rgba(247, 244, 237, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(89, 214, 194, 0.052), transparent 38%),
    rgba(255, 255, 255, 0.018);
  padding: 10px 12px;
  opacity: 0.58;
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}

.presence-panel.available {
  opacity: 1;
  border-color: rgba(89, 214, 194, 0.2);
}

.presence-panel.has-presence {
  border-color: rgba(89, 214, 194, 0.24);
  background:
    linear-gradient(90deg, rgba(89, 214, 194, 0.075), transparent 42%),
    rgba(255, 255, 255, 0.02);
}

.presence-head {
  display: flex;
  align-items: start;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.presence-head span {
  display: block;
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presence-head small {
  display: none;
  margin-top: 5px;
  color: var(--quiet);
  line-height: 1.35;
}

.presence-button {
  position: relative;
  display: inline-grid;
  min-width: 126px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(89, 214, 194, 0.26);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(89, 214, 194, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.presence-panel:not(.available) .presence-button {
  cursor: default;
  opacity: 0.5;
}

.presence-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.presence-strip {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(247, 244, 237, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.026);
  padding: 7px 10px;
}

.presence-strip[hidden] {
  display: none;
}

.presence-strip span,
.presence-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-strip span {
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presence-strip strong {
  color: var(--muted);
  font-size: 0.76rem;
}

.presence-strip div {
  display: flex;
  gap: 8px;
}

.presence-token {
  border: 0;
  border-bottom: 1px solid rgba(247, 244, 237, 0.28);
  background: transparent;
  color: rgba(247, 244, 237, 0.68);
  padding: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.presence-token:hover {
  color: var(--ink);
}

.presence-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  grid-column: 1 / -1;
  align-items: end;
  gap: 9px 12px;
  min-width: 0;
}

.presence-controls[hidden] {
  display: none;
}

.presence-controls input[type="range"] {
  accent-color: var(--teal);
  padding: 0;
}

.presence-clear {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.026);
  color: rgba(247, 244, 237, 0.68);
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.presence-clear:hover {
  color: var(--ink);
}

.journal-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.text-tools {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(110px, 1fr) 42px 42px minmax(88px, 0.8fr);
  gap: 10px;
  align-items: end;
}

.text-tools select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  padding: 8px 10px;
}

.text-tools input[type="color"] {
  width: 100%;
  height: 34px;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 999px;
  background: transparent;
  padding: 3px;
}

.text-tools input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.text-tools input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.journal-form.compact,
.image-director,
.keepsake-composer {
  border: 1px solid rgba(247, 244, 237, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
  padding: 11px;
}

.image-director {
  position: relative;
  overflow: hidden;
  border-color: rgba(132, 220, 204, 0.18);
  background:
    radial-gradient(circle at 20% 0%, rgba(132, 220, 204, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.016) 46%),
    rgba(3, 6, 6, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -28px 54px rgba(0, 0, 0, 0.22),
    0 18px 44px rgba(0, 0, 0, 0.18);
}

.image-director::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(247, 244, 237, 0.045);
  border-radius: 10px;
}

.image-director::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 54px;
  height: 8px;
  pointer-events: none;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(132, 220, 204, 0.85), rgba(217, 194, 122, 0.66)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(132, 220, 204, 0.28);
}

.director-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.director-head span {
  color: rgba(247, 244, 237, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.director-head small {
  max-width: 210px;
  color: var(--quiet);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: right;
  display: none;
}

.fit-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(247, 244, 237, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px;
}

.fit-choice {
  min-height: 31px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.fit-choice.active {
  border-color: rgba(132, 220, 204, 0.42);
  background:
    linear-gradient(135deg, rgba(132, 220, 204, 0.16), rgba(217, 194, 122, 0.08)),
    rgba(255, 255, 255, 0.04);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.director-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.director-grid label {
  position: relative;
  gap: 8px;
  min-height: 74px;
  border: 1px solid rgba(247, 244, 237, 0.075);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.014)),
    rgba(0, 0, 0, 0.18);
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.director-grid label::after {
  content: "";
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(132, 220, 204, 0.72), rgba(217, 194, 122, 0.32)),
    rgba(255, 255, 255, 0.06);
  opacity: 0.34;
}

.director-grid input[type="range"] {
  accent-color: var(--teal);
  padding: 0;
}

.image-director input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background:
    linear-gradient(90deg, rgba(132, 220, 204, 0.58), rgba(217, 194, 122, 0.32)),
    rgba(247, 244, 237, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.image-director input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  background:
    radial-gradient(circle at 35% 30%, #f7f4ed, #84dccc 38%, #2d6e67 100%);
  box-shadow:
    0 0 0 4px rgba(132, 220, 204, 0.08),
    0 7px 18px rgba(0, 0, 0, 0.34);
}

.image-director input[type="range"]::-moz-range-track {
  height: 4px;
  background:
    linear-gradient(90deg, rgba(132, 220, 204, 0.58), rgba(217, 194, 122, 0.32)),
    rgba(247, 244, 237, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.image-director input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background:
    radial-gradient(circle at 35% 30%, #f7f4ed, #84dccc 38%, #2d6e67 100%);
  box-shadow:
    0 0 0 4px rgba(132, 220, 204, 0.08),
    0 7px 18px rgba(0, 0, 0, 0.34);
}

.image-reset {
  grid-column: 1 / -1;
}

.image-reset {
  justify-self: start;
  border: 1px solid rgba(247, 244, 237, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(247, 244, 237, 0.68);
  padding: 7px 11px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.image-reset:hover {
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
}

label span,
.composition span {
  color: var(--quiet);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 10px;
  outline: none;
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}

input[type="range"] {
  height: 18px;
  border: 0;
  background: transparent;
  padding: 0;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(247, 244, 237, 0.26);
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(89, 214, 194, 0.08);
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(247, 244, 237, 0.26);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(89, 214, 194, 0.08);
}

input:focus,
textarea:focus {
  border-color: rgba(217, 194, 122, 0.7);
  box-shadow: 0 0 0 4px rgba(217, 194, 122, 0.12);
}

.primary-action,
.checkout-button,
.secondary-action {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-action,
.checkout-button {
  background: linear-gradient(135deg, var(--ink), #c9b677);
  color: #10100d;
}

.secondary-action {
  border: 1px solid rgba(247, 244, 237, 0.2);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
}

.primary-action:hover,
.checkout-button:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.checkout-button:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.composition {
  display: grid;
  gap: 14px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.choice {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 9px 12px;
  color: var(--muted);
  cursor: pointer;
}

.choice.active {
  border-color: rgba(217, 194, 122, 0.64);
  color: var(--ink);
  background: rgba(217, 194, 122, 0.12);
}

.output-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.output-row .choice {
  display: grid;
  gap: 2px;
  min-height: 58px;
  align-content: center;
  border-radius: 12px;
  text-align: left;
}

.output-row .choice strong {
  font-size: 0.94rem;
}

.output-row .choice small {
  color: var(--quiet);
  font-size: 0.74rem;
}

.selected-stack {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  border: 1px solid rgba(247, 244, 237, 0.105);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.12);
  padding: 16px;
}

.composed-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid rgba(217, 194, 122, 0.15);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(217, 194, 122, 0.06), rgba(255, 255, 255, 0.014)),
    rgba(0, 0, 0, 0.14);
  padding: 16px;
}

.tray-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tray-heading span {
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tray-heading small {
  color: var(--quiet);
}

.media-tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 190px));
  gap: 10px;
  justify-content: start;
}

.composed-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.media-thumb-card {
  display: grid;
  grid-template-rows: auto auto;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(247, 244, 237, 0.105);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.028);
  padding: 8px;
}

.media-thumb-card.active {
  border-color: rgba(89, 214, 194, 0.72);
  box-shadow: inset 0 0 0 1px rgba(89, 214, 194, 0.18);
}

.media-thumb {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  aspect-ratio: 1.34;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.media-thumb span {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-remove {
  justify-self: start;
  border: 0;
  border-bottom: 1px solid rgba(247, 244, 237, 0.3);
  background: transparent;
  color: rgba(247, 244, 237, 0.66);
  padding: 0 0 2px;
  font-size: 0.74rem;
  cursor: pointer;
}

.media-remove:hover {
  color: var(--ink);
}

.composed-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 94px;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.composed-card.active {
  border-color: rgba(217, 194, 122, 0.68);
  background: rgba(217, 194, 122, 0.1);
}

.composed-card:hover {
  border-color: rgba(247, 244, 237, 0.28);
}

.composed-card img {
  width: 76px;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.composed-card strong {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composed-card small {
  display: block;
  margin-top: 4px;
  color: var(--quiet);
  font-size: 0.76rem;
}

.reflection-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 14px;
}

.media-summary {
  border-color: rgba(89, 214, 194, 0.45);
  background: linear-gradient(135deg, rgba(89, 214, 194, 0.1), rgba(0, 0, 0, 0.18));
}

.reflection-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.reflection-card p {
  color: var(--muted);
  line-height: 1.5;
}

.reflection-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--quiet);
  font-size: 0.78rem;
}

.empty-state {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--quiet);
  text-align: center;
}

.save-state {
  border: 1px solid rgba(89, 214, 194, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(89, 214, 194, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(255, 255, 255, 0.018);
  color: var(--teal);
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.save-state:hover,
.save-state.active {
  border-color: rgba(89, 214, 194, 0.36);
  background:
    linear-gradient(135deg, rgba(89, 214, 194, 0.11), rgba(255, 255, 255, 0.032)),
    rgba(255, 255, 255, 0.026);
  color: var(--ink);
  transform: translateY(-1px);
}

.compose-heading-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-orb {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(132, 220, 204, 0.32);
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 28%, rgba(247, 244, 237, 0.2), transparent 24%),
    linear-gradient(135deg, rgba(132, 220, 204, 0.16), rgba(217, 194, 122, 0.08)),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 28px rgba(0, 0, 0, 0.24),
    0 0 0 0 rgba(132, 220, 204, 0.18);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.story-orb::before,
.story-orb::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(247, 244, 237, 0.22);
  border-radius: 999px;
  pointer-events: none;
}

.story-orb::before {
  inset: 9px;
}

.story-orb::after {
  inset: -5px;
  opacity: 0;
  transform: scale(0.86);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.story-orb b {
  position: absolute;
  top: 11px;
  width: 3px;
  height: 20px;
  border: 1px solid rgba(247, 244, 237, 0.45);
  border-radius: 999px;
  background: rgba(247, 244, 237, 0.035);
  transition:
    border-color 180ms ease,
    transform 220ms ease;
}

.story-orb b:nth-child(1) {
  left: 10px;
}

.story-orb b:nth-child(2) {
  left: 15px;
}

.story-orb b:nth-child(3) {
  left: 20px;
}

.story-orb span {
  position: absolute;
  right: 7px;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(247, 244, 237, 0.44);
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(247, 244, 237, 0.12) 0 30%, transparent 32%),
    rgba(247, 244, 237, 0.035);
}

.story-orb i {
  position: absolute;
  right: 13px;
  top: 19px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(217, 194, 122, 0.48);
}

.story-orb:hover,
.story-orb.active {
  border-color: rgba(132, 220, 204, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 16px 36px rgba(0, 0, 0, 0.3),
    0 0 32px rgba(132, 220, 204, 0.12);
  transform: translateY(-1px);
}

.story-orb.active::after {
  opacity: 1;
  transform: scale(1);
}

.story-orb.active b {
  border-color: rgba(132, 220, 204, 0.64);
}

.story-orb.active b:nth-child(1) {
  transform: translateY(-2px);
}

.story-orb.active b:nth-child(2) {
  transform: translateY(2px);
}

.story-orb.active b:nth-child(3) {
  transform: translateY(-1px);
}

.story-panel {
  position: absolute;
  z-index: 5;
  top: clamp(96px, 8vw, 128px);
  right: clamp(22px, 4vw, 54px);
  display: block;
  width: min(520px, calc(100% - clamp(44px, 8vw, 108px)));
  perspective: 1200px;
  transform-style: preserve-3d;
  pointer-events: auto;
}

.story-panel[hidden] {
  display: none;
}

.story-page {
  position: relative;
  display: grid;
  gap: 14px;
  overflow: auto;
  height: min(780px, calc(100vh - 150px));
  min-height: min(620px, calc(100vh - 150px));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 4px 18px 18px 4px;
  background:
    linear-gradient(96deg, rgba(230, 223, 207, 0.58), transparent 4%),
    linear-gradient(108deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72) 54%, rgba(247, 244, 237, 0.54)),
    rgba(247, 244, 237, 0.78);
  padding: clamp(24px, 3vw, 34px);
  color: #151616;
  box-shadow:
    -18px 20px 42px rgba(0, 0, 0, 0.24),
    inset 22px 0 34px rgba(90, 82, 58, 0.14),
    inset -1px 0 0 rgba(255, 255, 255, 0.66),
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 26px 70px rgba(0, 0, 0, 0.34);
  transform-origin: right center;
  animation: storyPageFlip 720ms cubic-bezier(0.16, 0.84, 0.18, 1) both;
  backdrop-filter: blur(24px) saturate(1.18);
}

.story-page::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 28px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(49, 43, 31, 0.24), rgba(49, 43, 31, 0.045), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 38%, rgba(217, 194, 122, 0.12)),
    rgba(255, 255, 255, 0.22);
}

.story-page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, 0.34) 50%, transparent 52%),
    linear-gradient(116deg, transparent 0 74%, rgba(0, 0, 0, 0.07) 76%, transparent 88%),
    radial-gradient(circle at 86% 10%, rgba(132, 220, 204, 0.16), transparent 28%);
  mix-blend-mode: multiply;
  opacity: 0.32;
}

@keyframes storyPageFlip {
  from {
    opacity: 0;
    transform: rotateY(76deg) translateX(44px) translateY(-8px) scale(0.965);
    filter: blur(3px) brightness(1.04);
  }
  58% {
    opacity: 1;
    transform: rotateY(-5deg) translateX(-2px) translateY(0) scale(1);
    filter: blur(0.4px);
  }
  to {
    opacity: 1;
    transform: rotateY(0deg) translateX(0) translateY(0) scale(1);
    filter: blur(0);
  }
}

.story-panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.story-panel-head span {
  display: block;
  color: rgba(54, 48, 32, 0.66);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-panel-head h3 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.15rem, 3.1vw, 3.75rem);
  font-weight: 400;
  line-height: 0.95;
  color: #171716;
}

.story-close {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(20, 22, 22, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(20, 22, 22, 0.66);
  padding: 7px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.story-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 16px;
}

.story-grid textarea {
  min-height: clamp(220px, 30vh, 400px);
}

.story-grid label span {
  color: rgba(20, 22, 22, 0.46);
}

.story-grid input,
.story-grid textarea {
  border-color: rgba(20, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.44);
  color: #151616;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.story-grid input:focus,
.story-grid textarea:focus {
  border-color: rgba(132, 110, 54, 0.54);
  box-shadow: 0 0 0 4px rgba(217, 194, 122, 0.18);
}

.story-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-actions button {
  border: 1px solid rgba(20, 22, 22, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: rgba(20, 22, 22, 0.72);
  padding: 7px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.checkout-panel {
  display: grid;
  grid-template-columns: auto minmax(300px, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  border-top: 1px solid rgba(247, 244, 237, 0.12);
  padding-top: 18px;
}

.checkout-figure {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 8px;
  align-items: baseline;
}

.checkout-figure p {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-figure strong {
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 400;
  line-height: 0.85;
}

.checkout-figure small {
  color: var(--quiet);
  font-size: 0.76rem;
}

.checkout-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.checkout-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 38px;
  border: 1px solid rgba(247, 244, 237, 0.1);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.025);
}

.checkout-list strong {
  font-size: 0.86rem;
  font-weight: 600;
}

.checkout-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, auto));
  gap: 10px;
}

.payment-button {
  background:
    linear-gradient(135deg, rgba(132, 220, 204, 0.92), rgba(217, 194, 122, 0.72)),
    var(--ink);
}

.final-render-panel {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  border: 1px solid rgba(217, 194, 122, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(217, 194, 122, 0.1), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.18);
  padding: 14px;
}

.payment-result {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  border: 1px solid rgba(89, 214, 194, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(89, 214, 194, 0.1), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.18);
  padding: 14px;
}

.payment-result[hidden] {
  display: none;
}

.payment-result div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.payment-result span,
.payment-result small {
  color: var(--quiet);
}

.payment-result span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.final-render-panel[hidden] {
  display: none;
}

.final-render-panel div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.final-render-panel span,
.final-render-panel small {
  color: var(--quiet);
}

.final-render-panel span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.final-render-panel strong {
  font-size: 0.92rem;
}

.render-download {
  justify-self: start;
  border: 1px solid rgba(247, 244, 237, 0.14);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  padding: 10px 14px;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.render-download:hover {
  border-color: rgba(132, 220, 204, 0.42);
  background: rgba(132, 220, 204, 0.08);
}

.render-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.video-preview-panel {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.video-preview-panel[hidden] {
  display: none;
}

.video-preview-panel video {
  width: min(100%, 520px);
  max-height: 320px;
  border: 1px solid rgba(247, 244, 237, 0.12);
  border-radius: 12px;
  background: #050606;
}

.video-preview-panel small {
  max-width: 620px;
  color: var(--quiet);
}

@media (max-width: 1120px) {
  .create-row,
  .compose-layout,
  .presence-panel,
  .checkout-panel {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  .studio-shell {
    padding: 0;
  }

  .ambient-stage {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 28px 16px 20px;
  }

  .signal-mark {
    top: 36px;
    right: 18px;
    grid-template-columns: repeat(4, 6px);
    gap: 5px;
    min-width: 54px;
    min-height: 44px;
  }

  .signal-mark span {
    width: 6px;
    height: 44px;
  }

  .signal-mark i {
    width: 32px;
    height: 32px;
    box-shadow: inset 0 0 0 10px rgba(247, 244, 237, 0.04);
  }

  .studio-identity {
    padding-top: 52px;
    margin-bottom: 20px;
  }

  h1 {
    font-size: clamp(3.9rem, 18vw, 4.9rem);
  }

  .studio-copy {
    margin-top: 14px;
  }

  .panel {
    border-radius: 16px;
  }

  .create-panel,
  .workspace-panel {
    padding: 18px;
  }

  .agent-grid,
  .media-tray,
  .director-grid,
  .presence-controls,
  .text-tools,
  .checkout-actions,
  .journal-actions,
  .output-row,
  .checkout-list {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-card {
    min-height: 82px;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .agent-orb {
    grid-row: auto;
  }

  .director-head {
    align-items: start;
    flex-direction: column;
  }

  .director-head small,
  .presence-head small {
    max-width: none;
    text-align: left;
  }

  .presence-head {
    align-items: start;
    flex-direction: column;
  }

  .presence-strip {
    grid-template-columns: 1fr;
    border-radius: 14px;
  }

  .compose-heading-tools {
    align-items: end;
    flex-direction: column;
    gap: 8px;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

}
