:root {
  --bg0: #0b0d10;
  --bg1: #12161c;
  --ink: #f4efe6;
  --mute: #9aa3b2;
  --line: rgba(244, 239, 230, 0.12);
  --accent: #e8ff6b;
  --ember: #ff7a45;
  --tide: #5ec8ff;
  --forest: #6dffb0;
  --panel: rgba(255, 255, 255, 0.04);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 10% -10%, #1a2230 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #241812 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

.orb {
  pointer-events: none;
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-a {
  width: 42vw;
  height: 42vw;
  left: -12vw;
  top: 20vh;
  background: #1e3a4c;
}
.orb-b {
  width: 30vw;
  height: 30vw;
  right: -8vw;
  bottom: 10vh;
  background: #3a2418;
  animation-delay: -6s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(4vw, -3vh, 0) scale(1.08);
  }
}

.top {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  box-shadow: 0 0 0 3px rgba(232, 255, 107, 0.12);
}

.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
}

.tag {
  margin: 0;
  color: var(--mute);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.stage {
  position: relative;
  z-index: 3;
  min-height: calc(100vh - 12rem);
  padding: 0 clamp(1.25rem, 4vw, 3rem) 11.5rem;
}

.stage[data-state="composing"] .hero,
.stage[data-state="composing"] .poster {
  filter: blur(2px);
  opacity: 0.35;
  pointer-events: none;
}

.hero {
  max-width: 46rem;
  padding-top: clamp(2rem, 8vh, 5rem);
  animation: rise 0.9s ease both;
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 6.2vw, 3.8rem);
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.sub {
  margin: 1.1rem 0 0;
  max-width: 36rem;
  color: var(--mute);
  font-size: 1.05rem;
  line-height: 1.55;
}

.beats {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}
.beats li {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mute);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.poster {
  position: relative;
  max-width: 58rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  padding-top: clamp(3.2rem, 5vw, 3.6rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  scroll-margin-top: 5rem;
  scroll-margin-bottom: 10rem;
}

.card-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 4;
  display: flex;
  gap: 0.35rem;
}

.card-act {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(12, 14, 18, 0.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  line-height: 1;
}

.card-act:hover {
  border-color: rgba(232, 255, 107, 0.45);
}

.card-act-accent {
  background: var(--accent);
  color: #111;
  border-color: transparent;
}

.poster[hidden],
.hero[hidden],
.compose-veil[hidden],
.toast[hidden] {
  display: none !important;
}

.poster[data-palette="ember"] {
  border-color: rgba(255, 122, 69, 0.35);
}
.poster[data-palette="tide"] {
  border-color: rgba(94, 200, 255, 0.35);
}
.poster[data-palette="forest"] {
  border-color: rgba(109, 255, 176, 0.3);
}

.poster-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.kicker,
.mood {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-family: var(--font-body);
}
.kicker {
  color: var(--accent);
}
.mood {
  color: var(--mute);
  border-left: 1px solid var(--line);
  padding-left: 0.75rem;
}

.poster-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.85rem, 4.6vw, 2.85rem);
  line-height: 1.28;
  letter-spacing: 0.015em;
}

.poster-lead {
  margin: 1rem 0 1.25rem;
  max-width: 42rem;
  color: #d7d2c8;
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.hero-image,
.panel-image {
  margin: 0 0 1.5rem;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.panel-image {
  margin: 0 0 0.85rem;
  border-radius: 0.85rem;
}

.media-frame {
  position: relative;
  isolation: isolate;
}

.media-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vh, 640px);
  object-fit: cover;
  background: #0b0d10;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.panel-image img {
  max-height: min(42vh, 360px);
  aspect-ratio: 16 / 10;
}

.media-frame.is-ready img {
  opacity: 1;
}

.media-skeleton {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 12rem;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.1) 37%, rgba(255, 255, 255, 0.04) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.hero-image .media-skeleton {
  min-height: min(42vh, 320px);
  aspect-ratio: 16 / 9;
}

.media-pct {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.media-frame.is-error .media-pct {
  color: #ff9b7a;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.panels {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.9rem;
}

.panel {
  position: relative;
  grid-column: span 6;
  padding: 1.1rem 1.15rem;
  border-radius: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  animation: panelIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.panel[data-weight="high"] {
  grid-column: span 12;
  background: rgba(232, 255, 107, 0.06);
  border-color: rgba(232, 255, 107, 0.22);
}
.panel[data-weight="low"] {
  grid-column: span 4;
}

.panel-kind {
  display: inline-block;
  margin-bottom: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.panel-illustrated {
  padding-top: 0.85rem;
}

.panel h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.panel p {
  margin: 0;
  color: #cfc9be;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.closing {
  margin: 1.75rem 0 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: #efe9dc;
}

.compose-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(10px);
}

.constellation {
  position: absolute;
  inset: 12% 8%;
  pointer-events: none;
}

.dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
  animation: pulse 1.6s ease-in-out infinite;
}

.veil-card {
  position: relative;
  z-index: 2;
  width: min(22rem, calc(100vw - 2.5rem));
  padding: 1.5rem 1.4rem 1.35rem;
  border-radius: 1.25rem;
  border: 1px solid var(--line);
  background: rgba(18, 22, 28, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
}

.veil-pct {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
}

.veil-bar {
  margin: 1rem auto 0.85rem;
  height: 0.45rem;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.veil-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffb86b);
  transition: width 0.35s ease;
}

.veil-label {
  margin: 0;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  font-size: 0.88rem;
  color: var(--mute);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 8.5rem;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  background: #2a1510;
  border: 1px solid rgba(255, 122, 69, 0.45);
  color: #ffe8dc;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin: 1rem auto 0;
  max-width: 58rem;
}

.act {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.65rem 1.05rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.act:hover {
  border-color: rgba(232, 255, 107, 0.4);
}

.act-accent {
  background: var(--accent);
  color: #111;
  border-color: transparent;
}

.sheet[hidden] {
  display: none !important;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(28rem, 100%);
  max-height: min(88vh, 40rem);
  overflow: auto;
  padding: 1.15rem 1.15rem 1.4rem;
  border-radius: 1.35rem 1.35rem 0 0;
  background: #14181f;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow);
}

@media (min-width: 720px) {
  .sheet-panel {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: 1.25rem;
    border-bottom: 1px solid var(--line);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sheet-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.sheet-x {
  border: 0;
  background: transparent;
  color: var(--mute);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.sheet-desc {
  margin: 0.65rem 0 1rem;
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sheet-qr-wrap {
  display: grid;
  place-items: center;
  margin: 0 auto 0.85rem;
  padding: 0.7rem;
  width: fit-content;
  border-radius: 1rem;
  background: #f4efe6;
}

.sheet-url {
  margin: 0 0 1rem;
  text-align: center;
  word-break: break-all;
  color: #d7d2c8;
  font-size: 0.78rem;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.share-page .share-stage {
  padding-bottom: 3rem;
}

.share-page .poster {
  margin-top: 0.5rem;
}

.share-page .poster-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.share-tip {
  text-align: center;
  color: var(--mute);
  font-size: 0.8rem;
  margin: 1rem auto 0;
  max-width: 28rem;
}

@media print {
  .top,
  .dock,
  .reel,
  .grain,
  .orb,
  .card-actions,
  .share-actions,
  .sheet,
  .toast,
  .hint,
  .share-tip {
    display: none !important;
  }
  body {
    background: #12161c !important;
  }
  .poster {
    box-shadow: none !important;
    break-inside: avoid;
  }
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 1.5rem));
  z-index: 20;
}

.lens {
  padding: 0.85rem 0.95rem 0.75rem;
  border-radius: 1.35rem;
  border: 1px solid var(--line);
  background: rgba(18, 22, 28, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.lens.is-drag {
  border-color: rgba(232, 255, 107, 0.55);
  transform: translateY(-2px);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.25rem 0.5rem 0.25rem 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--mute);
}
.chip img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: cover;
  border-radius: 50%;
}
.chip button {
  border: 0;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: 500 1rem/1.45 var(--font-body);
  min-height: 3.2rem;
}

.lens-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.attach {
  cursor: pointer;
  color: var(--mute);
  font-size: 0.85rem;
  font-weight: 500;
}
.attach:hover {
  color: var(--ink);
}

.go {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #111;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.go:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.go:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.hint {
  margin: 0.55rem 0 0;
  text-align: center;
  color: rgba(154, 163, 178, 0.8);
  font-size: 0.72rem;
}

.reel {
  position: fixed;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 15;
  max-height: 60vh;
  overflow: auto;
  padding: 0.25rem;
}

.reel-item {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.85rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  overflow: hidden;
  padding: 0.35rem;
}
.reel-item:hover,
.reel-item.is-active {
  border-color: rgba(232, 255, 107, 0.55);
  background: rgba(232, 255, 107, 0.08);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes panelIn {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.9;
  }
}

@media (max-width: 820px) {
  .panel,
  .panel[data-weight="low"],
  .panel[data-weight="high"] {
    grid-column: span 12;
  }
  .reel {
    display: none;
  }
  .tag {
    display: none;
  }
}
