:root {
  --sky-top: #7ec8f0;
  --sky-mid: #4aa3d9;
  --sky-deep: #1a6bb5;
  --ink: #1c2430;
  --ink-soft: #3a4656;
  --paper: #f7f3ea;
  --cloud: rgba(255, 255, 255, 0.88);
  --accent: #e8a54b;
  --accent-deep: #c47d28;
  --glass: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.35);
  --shadow: 0 18px 50px rgba(12, 40, 70, 0.22);
  --font-display: "ZCOOL XiaoWei", "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --radius: 18px;
  --header-h: 64px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: #eef6fc;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(26, 107, 181, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 35%, #fff 0 28%, transparent 29%),
    linear-gradient(145deg, #7ec8f0, #1a6bb5);
  box-shadow: 0 4px 12px rgba(26, 107, 181, 0.35);
}

.site-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}

.site-nav a:hover,
.site-nav a.nav-current {
  background: rgba(26, 107, 181, 0.1);
  color: var(--sky-deep);
}

/* —— Home hero —— */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  text-align: center;
  padding: 2rem 1.25rem 4rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(255,255,255,.35), transparent 55%),
    linear-gradient(180deg, #9ad4f5 0%, #4aa3d9 42%, #1a6bb5 100%);
  z-index: 0;
}

.hero-clouds {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: var(--cloud);
  border-radius: 999px;
  filter: blur(0.5px);
  opacity: 0.9;
  animation: drift linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: inherit;
}

.cloud-a { width: 180px; height: 54px; top: 18%; left: -10%; animation-duration: 48s; }
.cloud-a::before { width: 70px; height: 70px; top: -36px; left: 28px; }
.cloud-a::after { width: 90px; height: 90px; top: -48px; left: 70px; }

.cloud-b { width: 240px; height: 64px; top: 34%; left: 40%; animation-duration: 62s; animation-delay: -20s; }
.cloud-b::before { width: 90px; height: 90px; top: -42px; left: 36px; }
.cloud-b::after { width: 110px; height: 110px; top: -58px; left: 90px; }

.cloud-c { width: 160px; height: 48px; top: 58%; left: 10%; animation-duration: 54s; animation-delay: -10s; }
.cloud-c::before { width: 60px; height: 60px; top: -30px; left: 24px; }
.cloud-c::after { width: 80px; height: 80px; top: -42px; left: 60px; }

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(110vw); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  letter-spacing: 0.12em;
  margin: 0 0 0.75rem;
  text-shadow: 0 8px 40px rgba(10, 40, 80, 0.35);
  animation: rise 1s ease both;
}

.hero-lead {
  margin: 0 auto 1.75rem;
  max-width: 28em;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.7;
  opacity: 0.95;
  animation: rise 1s ease 0.15s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  animation: rise 1s ease 0.28s both;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: #fff;
  color: var(--sky-deep);
  box-shadow: 0 10px 30px rgba(10, 40, 80, 0.22);
}

.btn-ghost {
  background: var(--glass);
  border-color: var(--glass-border);
  color: #fff;
  backdrop-filter: blur(8px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 10px 28px rgba(196, 125, 40, 0.35);
}

.btn-block { width: 100%; }
.btn-sm { min-height: 2.2rem; padding: 0.4rem 0.9rem; font-size: 0.92rem; }

.section {
  padding: 3.5rem 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-head {
  margin-bottom: 1.75rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin: 0 0 0.4rem;
  letter-spacing: 0.08em;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
}

.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.poem-tile {
  position: relative;
  display: block;
  padding: 1.25rem 1.2rem 1.4rem;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 160px;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}

.poem-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 50px rgba(12, 40, 70, 0.28);
}

.poem-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(255,255,255,.28), transparent 40%),
    linear-gradient(160deg, #5eb8ef, #1a6bb5 70%, #0d3d6e);
  z-index: 0;
}

.poem-tile[data-theme="ink"]::before {
  background: linear-gradient(160deg, #4a5560, #1c2430 70%, #0b0f14);
}
.poem-tile[data-theme="anime"]::before {
  background: linear-gradient(160deg, #ff9ecd, #7ec8f0 55%, #8b7cf6);
}
.poem-tile[data-theme="cinematic"]::before {
  background: linear-gradient(160deg, #2b5876, #4e4376 60%, #1a1a2e);
}

.poem-tile > * { position: relative; z-index: 1; }
.poem-tile h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  letter-spacing: 0.06em;
}
.poem-tile .meta {
  margin: 0 0 0.8rem;
  opacity: 0.88;
  font-size: 0.92rem;
}
.poem-tile .excerpt {
  margin: 0;
  opacity: 0.9;
  line-height: 1.6;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* —— Browse —— */
.page-browse,
.page-narrow,
.page-admin {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(26, 107, 181, 0.08);
}

.filters input,
.filters select {
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(26, 107, 181, 0.18);
  border-radius: 12px;
  background: #f8fbfe;
}

.filters input { flex: 1 1 180px; }

/* —— Immersive poem —— */
body.page-poem {
  background: #0d3d6e;
}

.poem-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: #fff;
}

.theme-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.theme-sky {
  background: linear-gradient(180deg, #9ad4f5 0%, #4aa3d9 45%, #1a6bb5 100%);
}
.theme-sky .theme-clouds {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.theme-sky .tc {
  position: absolute;
  background: rgba(255,255,255,.82);
  border-radius: 999px;
  animation: drift linear infinite;
}
.theme-sky .tc1 { width: 200px; height: 56px; top: 12%; left: -15%; animation-duration: 50s; }
.theme-sky .tc2 { width: 260px; height: 70px; top: 40%; left: 20%; animation-duration: 70s; animation-delay: -25s; }
.theme-sky .tc3 { width: 180px; height: 50px; top: 68%; left: -5%; animation-duration: 58s; animation-delay: -12s; }

.theme-ink {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.08), transparent 40%),
    linear-gradient(165deg, #2c333c, #12161c 60%, #07090c);
}
.theme-ink::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

.theme-anime {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.45), transparent 30%),
    radial-gradient(circle at 80% 30%, rgba(255,170,220,.35), transparent 35%),
    linear-gradient(160deg, #a8e0ff, #c9b6ff 50%, #ffb8d9);
}
.theme-anime .petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.theme-anime .petal {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 70% 0 70% 0;
  background: rgba(255,255,255,.65);
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0.2; }
}

.theme-cinematic {
  background:
    linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.55)),
    linear-gradient(120deg, #1a2a6c, #b21f1f, #fdbb2d);
  background-size: cover, 200% 200%;
  animation: cinematicShift 18s ease-in-out infinite alternate;
}
@keyframes cinematicShift {
  from { background-position: center, 0% 40%; }
  to { background-position: center, 100% 60%; }
}
.theme-cinematic::before,
.theme-cinematic::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 12%;
  background: #000;
  opacity: 0.55;
  z-index: 1;
}
.theme-cinematic::before { top: 0; }
.theme-cinematic::after { bottom: 0; }

.poem-scroll {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.5rem 7rem;
  text-align: center;
}

.poem-kicker {
  margin: 0 0 0.75rem;
  letter-spacing: 0.35em;
  font-size: 0.85rem;
  opacity: 0.85;
  text-transform: uppercase;
}

.poem-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.4rem);
  margin: 0 0 0.5rem;
  letter-spacing: 0.16em;
  text-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.poem-author {
  margin: 0 0 2rem;
  opacity: 0.9;
  letter-spacing: 0.12em;
}

.poem-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 22em;
}

.poem-lines li {
  margin: 0.55rem 0;
  font-size: clamp(1.15rem, 3.6vw, 1.55rem);
  line-height: 1.85;
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translateY(14px);
  animation: lineIn 0.7s ease forwards;
  text-shadow: 0 4px 18px rgba(0,0,0,.2);
}

.poem-lines li.is-active {
  color: #ffe7a8;
  transform: scale(1.03);
}

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

.poem-tap-hint {
  position: absolute;
  bottom: 5.5rem;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  font-size: 0.85rem;
  opacity: 0.7;
  pointer-events: none;
  transition: opacity .3s;
}

.poem-stage.is-chrome-open .poem-tap-hint { opacity: 0; }

.poem-chrome {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: rgba(10, 24, 40, 0.55);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,.18);
  transform: translateY(110%);
  transition: transform .28s ease;
}

.poem-stage.is-chrome-open .poem-chrome {
  transform: translateY(0);
}

.poem-chrome-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.poem-chrome-top a,
.poem-chrome-top button {
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.9;
}

.chrome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.chrome-actions .btn {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
  color: #fff;
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.chrome-actions .btn.is-on {
  background: #fff;
  color: var(--sky-deep);
}

.scene-hint {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  opacity: 0.8;
  color: #fff;
}

/* drawers */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.drawer.is-open { display: block; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.drawer-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72vh;
  overflow: auto;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  background: #fff;
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.25);
  animation: sheetUp .28s ease;
}
@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.drawer-panel h3 {
  font-family: var(--font-display);
  margin: 0 0 0.75rem;
  letter-spacing: 0.08em;
}
.drawer-panel p { line-height: 1.75; color: var(--ink-soft); }
.analysis-block { margin-bottom: 1rem; }
.analysis-block h4 { margin: 0 0 0.35rem; font-size: 0.95rem; color: var(--sky-deep); }
.muted { color: var(--ink-soft); }

/* studio */
.studio-shell {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .studio-shell {
    grid-template-columns: 320px 1fr;
    min-height: calc(100vh - var(--header-h));
  }
}

.studio-side {
  padding: 1.25rem;
  background: #fff;
  border-bottom: 1px solid rgba(26,107,181,.1);
}

@media (min-width: 960px) {
  .studio-side { border-bottom: 0; border-right: 1px solid rgba(26,107,181,.1); }
}

.studio-side h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
  letter-spacing: 0.08em;
}

.studio-side .field {
  display: block;
  margin: 0.85rem 0;
}
.studio-side .field span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.studio-side select,
.studio-side input[type="range"] {
  width: 100%;
}

.studio-preview-wrap {
  position: relative;
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: #0f1720;
}

.studio-frame {
  width: min(360px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  position: relative;
}

.studio-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.studio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* compare */
.compare-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 800px) {
  .compare-grid { grid-template-columns: repeat(2, 1fr); }
  .compare-grid.compare-3 { grid-template-columns: repeat(3, 1fr); }
}
.compare-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(26,107,181,.08);
}
.compare-card h3 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
  letter-spacing: 0.08em;
}
.compare-card pre {
  white-space: pre-wrap;
  font-family: var(--font-body);
  line-height: 1.85;
  letter-spacing: 0.08em;
  margin: 1rem 0 0;
}
.compare-points {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(126,200,240,.2), rgba(255,255,255,.9));
  border-radius: var(--radius);
}
.compare-points li { margin: 0.45rem 0; line-height: 1.65; }

.site-footer {
  padding: 2.5rem 1.25rem 3rem;
  background: #10263d;
  color: rgba(255,255,255,.85);
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  margin: 0 0 0.35rem;
}
.footer-tagline { margin: 0 0 1rem; opacity: 0.8; }
.footer-products {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.footer-products a { text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin: 0 0 0.5rem; }
.footer-legal a { opacity: 0.85; }
.footer-op { margin: 0; opacity: 0.65; font-size: 0.9rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}
.admin-table th,
.admin-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #eef2f6;
  text-align: left;
  font-size: 0.92rem;
}
.admin-table th { background: #f4f8fc; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e8f3fb;
  color: var(--sky-deep);
  font-size: 0.78rem;
}
.badge-warn { background: #fff3d9; color: #9a6700; }
.badge-ok { background: #e4f7ea; color: #1b7a3d; }

.page-404 main,
.page-narrow h1 {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .site-header { padding: 0.65rem 0.85rem; }
  .brand-text { font-size: 1rem; }
  .hero { padding-top: 3rem; }
}
