/* PandaFoxDrama H5 — a standalone, dependency-free workbench. */

:root {
  color-scheme: dark;
  --fs: 1.08;
  --bg: #08070d;
  --bg-2: #0c0a12;
  --panel: #121019;
  --panel-2: #171420;
  --panel-3: #1d1927;
  --line: rgba(243, 237, 226, 0.1);
  --line-strong: rgba(243, 237, 226, 0.2);
  --ink: #f3ede2;
  --muted: #a99d8d;
  --faint: #736958;
  --gold: #e8b96e;
  --gold-soft: rgba(232, 185, 110, 0.12);
  --coral: #ff5f4d;
  --teal: #6fd3c7;
  --warn: #f0b35c;
  --ok: #7bd6a8;
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Georgia, "Songti SC", "Noto Serif SC", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: calc(14px * var(--fs));
  line-height: 1.6;
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(232, 185, 110, 0.11), transparent 62%),
    radial-gradient(900px 540px at -8% 18%, rgba(255, 95, 77, 0.08), transparent 60%),
    radial-gradient(760px 460px at 62% 108%, rgba(111, 211, 199, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}

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

a { color: inherit; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

img { max-width: 100%; display: block; }

::selection { background: rgba(232, 185, 110, 0.28); color: #fff; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(243, 237, 226, 0.14); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 7, 13, 0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.topbar-inner {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 13px 30px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: none;
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-copy strong { font-family: var(--serif); font-size: calc(19px * var(--fs)); letter-spacing: 0.02em; }
.brand-copy span { color: var(--muted); font-size: calc(10.5px * var(--fs)); letter-spacing: 0.13em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: calc(11.5px * var(--fs));
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switch button.on { background: var(--gold); color: #191016; }
.lang-switch button:hover:not(.on) { color: var(--ink); }

/* ---------- layout ---------- */

.page {
  position: relative;
  z-index: 1;
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 28px 30px 72px;
  display: grid;
  grid-template-columns: 332px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.brief {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008)),
    rgba(12, 10, 18, 0.82);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.brief-head { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brief-title { min-width: 0; }
.brief-title .eyebrow { margin-bottom: 2px; }
.brief-title h2 { margin: 0; font-family: var(--serif); font-size: calc(19px * var(--fs)); font-weight: 600; letter-spacing: 0.02em; }
.brief-title p { margin: 2px 0 0; color: var(--muted); font-size: calc(11px * var(--fs)); line-height: 1.45; }
.brief-toggle {
  display: none;
  margin-left: auto;
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: calc(11px * var(--fs));
}

.brief-body { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: calc(10.5px * var(--fs)); font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); }
.field-note { font-size: calc(11px * var(--fs)); color: var(--faint); line-height: 1.45; }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.seg button {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 6px 4px;
  font-size: calc(11.5px * var(--fs));
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg button.on { background: var(--panel-3); color: var(--ink); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3); }
.seg button:hover:not(.on) { color: var(--ink); }

.genres { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.genre {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-align: left;
  line-height: 1.2;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.genre:hover { border-color: var(--line-strong); color: var(--ink); }
.genre.on { border-color: rgba(232, 185, 110, 0.55); background: var(--gold-soft); color: var(--ink); }
.genre-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--gc, #888); box-shadow: 0 0 10px rgba(255, 255, 255, 0.18); }
.genre-name { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.genre-name b { font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.genre-name em { font-style: normal; font-size: calc(9px * var(--fs)); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.select, .input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(9, 8, 14, 0.7);
  color: var(--ink);
  font-size: calc(12.5px * var(--fs));
}

.select { cursor: pointer; }
.input::placeholder { color: var(--faint); }
.select:hover, .input:hover { border-color: var(--line-strong); }

.range-row { display: flex; align-items: center; gap: 11px; }
.range { flex: 1; accent-color: var(--gold); }
.range-val { min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; font-size: calc(12.5px * var(--fs)); color: var(--gold); font-weight: 700; }

.actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
  font-size: calc(12px * var(--fs));
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, #f0c47d, #d99a4c); color: #1b1208; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 9px; font-size: calc(11px * var(--fs)); border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.hint {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  color: var(--faint);
  font-size: calc(10.5px * var(--fs));
  line-height: 1.5;
}
.hint svg { flex: none; margin-top: 1px; }

/* ---------- workspace ---------- */

.workspace { min-width: 0; }

.workhead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.workhead-main { min-width: 0; }
.workhead .eyebrow { margin-bottom: 5px; }
.workhead h2 { margin: 0; font-family: var(--serif); font-size: clamp(22px, 2.4vw, 31px); font-weight: 600; line-height: 1.2; letter-spacing: 0.01em; }
.workhead-sub { margin: 6px 0 0; color: var(--muted); font-size: calc(11.5px * var(--fs)); display: flex; flex-wrap: wrap; gap: 6px 10px; }
.workhead-sub .dot { color: var(--faint); }
.workhead-actions { margin-left: auto; flex: none; display: flex; gap: 8px; align-items: center; padding-top: 4px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 0 2px;
  margin-bottom: 18px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px 12px;
  font-size: calc(12px * var(--fs));
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--gold); }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); }
.tab .count { display: inline-block; margin-left: 5px; font-size: calc(9px * var(--fs)); color: var(--faint); font-weight: 500; }
.tab.on .count { color: rgba(232, 185, 110, 0.65); }

.content { animation: rise 0.25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  padding: 16px;
  min-width: 0;
}

.card.flat { background: transparent; }

.eyebrow {
  font-size: calc(9.5px * var(--fs));
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

.title { margin: 0; font-size: calc(16px * var(--fs)); font-weight: 600; }
.sub { color: var(--muted); font-size: calc(11.5px * var(--fs)); line-height: 1.5; }
.en { color: var(--muted); font-style: italic; }
.mono { font-family: var(--mono); }

/* ---------- overview ---------- */

.overview { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; align-items: start; }

.poster {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  padding: 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(120% 70% at 80% 8%, var(--pa, #5a1e2e), transparent 62%),
    linear-gradient(160deg, var(--pa, #5a1e2e) 0%, #140b1a 58%, #0b0710 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px);
  opacity: 0.35;
}

.poster > * { position: relative; z-index: 1; }
.poster-top { display: flex; justify-content: space-between; gap: 8px; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.poster-body { padding: 8px 0; }
.poster-title {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(26px * var(--fs));
  line-height: 1.24;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poster-en { margin-top: 7px; font-family: var(--serif); font-size: calc(11.5px * var(--fs)); line-height: 1.4; color: rgba(255, 255, 255, 0.65); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.poster-cover { margin: 12px 0 0; padding-left: 9px; border-left: 2px solid var(--pb, #e8b96e); font-size: calc(10.5px * var(--fs)); line-height: 1.55; color: rgba(255, 255, 255, 0.82); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.poster-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.poster-chip { font-size: calc(8.5px * var(--fs)); letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.82); }

.ov-main { display: flex; flex-direction: column; gap: 13px; min-width: 0; }

.logline-card { position: relative; overflow: hidden; }
.logline-card::before { content: "“"; position: absolute; right: 18px; top: -12px; font-family: var(--serif); font-size: calc(90px * var(--fs)); line-height: 1; color: rgba(232, 185, 110, 0.1); pointer-events: none; }
.logline { margin: 8px 0 0; font-size: calc(16.5px * var(--fs)); line-height: 1.66; letter-spacing: 0.005em; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: calc(10px * var(--fs)); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--muted); }

.selling { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sell-card { padding: 13px; }
.sell-num { font-family: var(--serif); font-size: calc(19px * var(--fs)); line-height: 1; color: var(--gold); }
.sell-card p { margin: 7px 0 0; font-size: calc(11.5px * var(--fs)); line-height: 1.55; color: var(--ink); }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info b { display: block; font-size: calc(9.5px * var(--fs)); letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.info p { margin: 0; font-size: calc(11.5px * var(--fs)); line-height: 1.55; color: var(--ink); }

/* ---------- characters ---------- */

.chars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.char { display: flex; flex-direction: column; gap: 12px; }
.char-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-family: var(--serif); font-size: calc(18px * var(--fs)); color: #fff; background: linear-gradient(145deg, var(--pa, #7a3b2e), var(--pb, #2a1038)); border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.25); }
.char-id { min-width: 0; }
.char-name { font-size: calc(14px * var(--fs)); font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-role { font-size: calc(9.5px * var(--fs)); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.char-tag { margin-left: auto; flex: none; font-size: calc(9px * var(--fs)); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

.defs { display: grid; grid-template-columns: 54px 1fr; gap: 8px; margin: 0; font-size: calc(11.5px * var(--fs)); line-height: 1.55; }
.defs dt { color: var(--faint); font-size: calc(10.5px * var(--fs)); }
.defs dd { margin: 0; color: var(--ink); }

.code-wrap { position: relative; margin-top: 7px; }
.code {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-family: var(--mono);
  font-size: calc(10.5px * var(--fs));
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 150px;
  overflow: auto;
}
.code-wrap .copybtn { position: absolute; top: 5px; right: 5px; opacity: 0; transition: opacity 0.12s ease; }
.code-wrap:hover .copybtn, .code-wrap:focus-within .copybtn { opacity: 1; }

.copybtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 2px 7px;
  font-size: calc(10px * var(--fs));
  line-height: 1.5;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.copybtn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- episodes ---------- */

.summary { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip { font-size: calc(10px * var(--fs)); padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, 0.025); }

.act { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.act b { font-size: calc(9.5px * var(--fs)); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.act::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.ep {
  display: grid;
  grid-template-columns: 46px minmax(120px, 1.05fr) minmax(100px, 0.78fr) minmax(170px, 1.45fr) minmax(150px, 1.2fr);
  gap: 10px;
  align-items: start;
  padding: 11px 13px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
}
.ep:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.035); }
.ep-n { font-family: var(--serif); font-size: calc(20px * var(--fs)); line-height: 1.1; color: var(--gold); font-variant-numeric: tabular-nums; }
.ep-title { font-size: calc(11.5px * var(--fs)); font-weight: 600; line-height: 1.45; }
.ep-phase { margin-top: 2px; font-size: calc(9.5px * var(--fs)); color: var(--faint); }
.ep-cell { min-width: 0; font-size: calc(10.5px * var(--fs)); line-height: 1.5; color: var(--ink); }
.ep-cell b { display: block; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: 1px; }
.pay { display: inline-flex; align-items: center; gap: 3px; margin-top: 5px; padding: 1px 6px; border: 1px solid rgba(240, 179, 92, 0.45); border-radius: 999px; color: var(--warn); font-size: calc(8.5px * var(--fs)); letter-spacing: 0.04em; }

/* ---------- script ---------- */

.script-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.script-head .actions { margin-left: auto; flex: none; }
.scene { border-left: 2px solid rgba(232, 185, 110, 0.3); padding: 2px 0 2px 16px; margin: 0 0 20px; }
.slug { font-family: var(--mono); font-size: calc(10px * var(--fs)); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.scene h3 { margin: 3px 0 8px; font-size: calc(14px * var(--fs)); font-weight: 600; }
.action { margin: 0 0 10px; font-size: calc(11.5px * var(--fs)); line-height: 1.65; color: var(--muted); font-style: italic; }
.line { display: grid; grid-template-columns: 92px 1fr; gap: 10px; margin-bottom: 6px; font-size: calc(12px * var(--fs)); line-height: 1.6; }
.line b { text-align: right; font-size: calc(10.5px * var(--fs)); color: var(--muted); font-weight: 700; padding-top: 1px; }
.line.hero b { color: var(--gold); }
.line.villain b { color: var(--coral); }

/* ---------- shots ---------- */

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.shot { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.shot-visual { position: relative; aspect-ratio: 16 / 7; padding: 12px 14px; display: flex; align-items: flex-end; justify-content: space-between; color: #fff; background: radial-gradient(110% 80% at 72% 15%, var(--pa, #2a1038), transparent 62%), linear-gradient(120deg, #241333, #09060d); }
.shot-visual::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px); opacity: 0.35; }
.shot-visual > * { position: relative; z-index: 1; }
.shot-no { font-family: var(--serif); font-size: calc(30px * var(--fs)); line-height: 1; opacity: 0.94; }
.shot-meta { text-align: right; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.55; color: rgba(255, 255, 255, 0.75); }
.shot-body { padding: 11px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.shot-sub { font-size: calc(10px * var(--fs)); color: var(--muted); }
.prompt-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 2px 0 3px; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); font-weight: 700; }

/* ---------- interactive ---------- */

.empty { max-width: 560px; margin: 9vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--gold-soft); color: var(--gold); }
.empty h2 { margin: 4px 0 0; font-family: var(--serif); font-size: calc(24px * var(--fs)); font-weight: 600; }
.empty p { margin: 0; color: var(--muted); font-size: calc(12.5px * var(--fs)); line-height: 1.65; }

.tree-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tree-top .actions { margin-left: auto; }

.node { position: relative; border: 1px solid var(--line); border-left: 2px solid var(--line-strong); border-radius: 11px; background: rgba(255, 255, 255, 0.022); padding: 12px 14px 12px 16px; margin-bottom: 8px; }
.node.start { border-left-color: var(--gold); }
.node.ending { border-left-color: var(--ok); }
.node.hidden { border-style: dashed; }
.node-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.node-id { font-family: var(--mono); font-size: calc(9.5px * var(--fs)); color: var(--faint); }
.node-kind { font-size: calc(8.5px * var(--fs)); letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; color: var(--muted); }
.node h3 { margin: 5px 0 4px; font-size: calc(13px * var(--fs)); font-weight: 600; }
.node p { margin: 0; font-size: calc(11.5px * var(--fs)); line-height: 1.6; color: var(--muted); }
.choices { display: flex; flex-direction: column; gap: 4px; margin-top: 9px; }
.choice { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: calc(10.5px * var(--fs)); line-height: 1.45; color: var(--ink); }
.choice svg { color: var(--faint); flex: none; }
.effect { font-size: calc(8.5px * var(--fs)); border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; color: var(--muted); }
.target { font-family: var(--mono); font-size: calc(8.5px * var(--fs)); color: var(--faint); }

.endings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.ending { border: 1px solid var(--line); border-radius: 11px; padding: 13px; background: rgba(255, 255, 255, 0.022); }
.ending .tone { font-size: calc(8.5px * var(--fs)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); }
.ending h3 { margin: 4px 0; font-size: calc(13px * var(--fs)); }
.ending p { margin: 0; font-size: calc(11px * var(--fs)); line-height: 1.55; color: var(--muted); }

.note { display: flex; gap: 7px; align-items: flex-start; margin-top: 14px; color: var(--faint); font-size: calc(10.5px * var(--fs)); line-height: 1.55; }
.note svg { flex: none; margin-top: 1px; }

/* ---------- compliance / export ---------- */

.checks { padding: 2px 0; }
.check { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--faint); }
.dot.pass { background: var(--ok); box-shadow: 0 0 10px rgba(123, 214, 168, 0.5); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px rgba(240, 179, 92, 0.45); }
.check-body { min-width: 0; }
.check-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: calc(12px * var(--fs)); font-weight: 600; }
.check p { margin: 3px 0 0; color: var(--muted); font-size: calc(11px * var(--fs)); line-height: 1.6; }
.level { font-size: calc(8.5px * var(--fs)); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 999px; padding: 1px 6px; }
.level.pass { color: var(--ok); }
.level.warn { color: var(--warn); }

.export { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.export-card { display: flex; flex-direction: column; gap: 7px; min-height: 126px; }
.export-card h3 { margin: 0; font-size: calc(13.5px * var(--fs)); }
.export-card p { margin: 0; color: var(--muted); font-size: calc(11px * var(--fs)); line-height: 1.55; }
.export-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 5px; }

/* ---------- footer ---------- */

.foot {
  position: relative;
  z-index: 1;
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 0 30px 40px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: calc(10.5px * var(--fs));
}
.foot-brand { color: var(--muted); letter-spacing: 0.06em; }

/* ---------- player modal ---------- */

.player-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 3, 8, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade 0.18s ease;
}
.player-layer[hidden] { display: none; }

.player {
  width: min(600px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(180deg, #15111d, #0b0910);
  box-shadow: var(--shadow);
  animation: rise 0.22s ease;
}
.player-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.player-head .eyebrow { margin-bottom: 1px; }
.player-title { font-family: var(--serif); font-size: calc(18px * var(--fs)); font-weight: 600; line-height: 1.25; }
.player-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.player-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.stat { font-size: calc(9.5px * var(--fs)); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.stat b { color: var(--gold); font-variant-numeric: tabular-nums; margin-left: 4px; }
.player-node .node-id { display: block; margin-bottom: 4px; }
.player-node h3 { margin: 0 0 8px; font-family: var(--serif); font-size: calc(22px * var(--fs)); font-weight: 600; line-height: 1.3; }
.player-node p { margin: 0; color: var(--muted); font-size: calc(13px * var(--fs)); line-height: 1.75; }
.player-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.player-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.03); padding: 11px 13px; color: var(--ink); font-size: calc(12.5px * var(--fs)); transition: border-color 0.15s ease, background 0.15s ease; }
.player-choice:hover:not([disabled]) { border-color: rgba(232, 185, 110, 0.55); background: var(--gold-soft); }
.player-choice .effect { flex: none; }
.player-choice[disabled] { opacity: 0.42; cursor: not-allowed; }
.player-ending { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(232, 185, 110, 0.06); }
.player-ending .tone { font-size: calc(9px * var(--fs)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); }
.player-ending h3 { margin: 5px 0 6px; font-family: var(--serif); font-size: calc(24px * var(--fs)); }
.player-ending p { margin: 0; color: var(--muted); font-size: calc(13px * var(--fs)); line-height: 1.7; }
.player-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--faint); font-size: calc(10px * var(--fs)); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: calc(11.5px * var(--fs));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.noscript { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .page { grid-template-columns: 1fr; padding: 20px 20px 60px; gap: 20px; }
  .brief { position: static; max-height: none; }
  .brief-toggle { display: inline-flex; }
  .brief.is-collapsed .brief-body { display: none; }
  .foot { padding: 0 20px 32px; }
}

@media (max-width: 760px) {
  body { font-size: calc(13px * var(--fs)); }
  .top-actions { gap: 6px; }
  .top-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .lang-switch button { padding: 5px 9px; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .brand-mark { width: 36px; height: 36px; object-fit: contain; }
  .brand-copy strong { font-size: calc(16px * var(--fs)); }
  .brand-copy span { display: none; }
  .page { padding: 14px 14px 52px; }
  .brief { padding: 14px; }
  .workhead { flex-wrap: wrap; gap: 10px; }
  .workhead h2 { font-size: calc(22px * var(--fs)); }
  .workhead-actions { width: 100%; margin-left: 0; }
  .workhead-actions .btn { flex: 1; }
  .overview { grid-template-columns: 138px minmax(0, 1fr); gap: 12px; }
  .poster { padding: 11px; border-radius: 12px; }
  .poster-title { font-size: calc(15px * var(--fs)); -webkit-line-clamp: 4; }
  .poster-en { font-size: calc(9px * var(--fs)); }
  .poster-cover { font-size: calc(8.5px * var(--fs)); margin-top: 8px; padding-left: 6px; -webkit-line-clamp: 3; }
  .poster-chip { font-size: calc(7.5px * var(--fs)); padding: 2px 5px; }
  .logline { font-size: calc(14px * var(--fs)); }
  .selling, .chars, .shots, .export, .endings, .info-grid { grid-template-columns: 1fr; }
  .ep { grid-template-columns: 38px minmax(0, 1fr); gap: 4px 10px; padding: 10px; }
  .ep-n { grid-row: 1 / span 4; }
  .ep-cell { grid-column: 2; }
  .line { grid-template-columns: 76px 1fr; gap: 7px; }
  .script-head { flex-direction: column; }
  .script-head .actions { margin-left: 0; }
  .foot { flex-direction: column; gap: 4px; padding: 0 14px 28px; }
  .player { padding: 18px; }
  .player-node h3 { font-size: calc(19px * var(--fs)); }
  .toast { bottom: 18px; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 420px) {
  .brand-copy { display: none; }
}

/* ---------- advanced brief / multilingual ---------- */

.advanced { border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); padding: 0 10px; }
.advanced summary { position: relative; list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 9px 0; font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--ink); }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "+"; position: absolute; right: 22px; color: var(--faint); }
.advanced[open] summary::after { content: "−"; }
.advanced summary span { color: var(--faint); font-size: calc(9.5px * var(--fs)); font-weight: 400; line-height: 1.45; padding-right: 18px; }
.advanced[open] { padding-bottom: 10px; }
.advanced-body { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.textarea { min-height: 66px; resize: vertical; line-height: 1.55; }
.ai-state { align-self: center; color: var(--faint); font-size: calc(9.5px * var(--fs)); }
.ai-state.ok { color: var(--ok); }

.multi-top { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 12px; }
.multi-top .actions { margin-left: auto; }
.multi-note { margin: 8px 0 0; color: var(--faint); font-size: calc(10.5px * var(--fs)); line-height: 1.55; }
.lang-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 7px 0 12px; }
.lang-option { border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.02); color: var(--muted); padding: 8px 9px; text-align: left; font-size: calc(11px * var(--fs)); line-height: 1.3; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.lang-option:hover { border-color: var(--line-strong); color: var(--ink); }
.lang-option.on { border-color: rgba(232, 185, 110, 0.55); background: var(--gold-soft); color: var(--ink); }
.lang-option b { display: block; font-size: calc(11.5px * var(--fs)); font-weight: 600; }
.lang-option span { display: block; margin-top: 1px; color: var(--faint); font-size: calc(9px * var(--fs)); }
.multi-result { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.multi-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.022); padding: 13px; }
.multi-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.multi-card-head h3 { margin: 0; font-size: calc(13px * var(--fs)); }
.multi-card-head .actions { margin-left: auto; }
.multi-out { max-height: 420px; }
.multi-error { color: var(--coral); font-size: calc(11px * var(--fs)); line-height: 1.5; }
@media (max-width: 760px) {
  .lang-grid { grid-template-columns: 1fr 1fr; }
  .multi-top .actions { width: 100%; margin-left: 0; }
  .multi-top .actions .btn { flex: 1; }
  .advanced summary { position: relative; }
}

.ai-card { margin-bottom: 14px; border-color: rgba(232, 185, 110, 0.22); background: linear-gradient(180deg, rgba(232, 185, 110, 0.06), rgba(255, 255, 255, 0.012)); }
.ai-card .title { margin: 0; }
.ai-card .sub { margin: 3px 0 0; }
.ai-card .script-head { align-items: center; }
@media (max-width: 760px) { .ai-card .script-head { align-items: flex-start; } }

/* ---------- header actions / project library ---------- */

.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: calc(11px * var(--fs));
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.top-btn:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }
.top-btn svg { flex: none; }

.library-layer {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 3, 8, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fade 0.18s ease;
}
.library-layer[hidden] { display: none; }
.library {
  width: min(620px, 94vw);
  max-height: 86vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(180deg, #15111d, #0b0910);
  box-shadow: var(--shadow);
  animation: rise 0.22s ease;
}
.library-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.library-head h2 { margin: 0; font-family: var(--serif); font-size: calc(22px * var(--fs)); font-weight: 600; }
.library-head p { margin: 3px 0 0; color: var(--muted); font-size: calc(11px * var(--fs)); line-height: 1.55; }
.library-head .actions { margin-left: auto; }
.library-form { display: flex; gap: 7px; margin-bottom: 10px; }
.library-form .input { flex: 1; }
.library-actions { display: flex; gap: 7px; margin-bottom: 14px; }
.project-list { display: flex; flex-direction: column; gap: 6px; }
.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
}
.project-row:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.035); }
.project-info { min-width: 0; flex: 1; }
.project-info b { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-info span { display: block; margin-top: 1px; color: var(--faint); font-size: calc(9.5px * var(--fs)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-row .actions { flex: none; display: flex; gap: 5px; }

@media (max-width: 760px) {
  .top-btn { padding: 0 9px; }
  .top-btn span:not(.aa) { display: none; }
  .library { padding: 16px; }
  .library-form { flex-direction: column; }
}

/* ---------- trend radar ---------- */

.trend-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.trend-head h2 { margin: 3px 0 0; font-family: var(--serif); font-size: clamp(24px, 2.6vw, 32px); font-weight: 600; line-height: 1.2; }
.trend-head p { margin: 5px 0 0; color: var(--muted); font-size: calc(11.5px * var(--fs)); }
.trend-meta { margin-left: auto; flex: none; text-align: right; display: flex; flex-direction: column; gap: 2px; }
.trend-meta > span { font-size: calc(8.5px * var(--fs)); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.trend-meta > b { font-family: var(--mono); font-size: calc(11px * var(--fs)); color: var(--gold); font-weight: 500; }

.market-tabs { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.market-tabs::-webkit-scrollbar { display: none; }
.market-tab { border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.025); color: var(--muted); padding: 6px 12px; font-size: calc(11px * var(--fs)); font-weight: 600; white-space: nowrap; }
.market-tab:hover { color: var(--ink); border-color: var(--line-strong); }
.market-tab.on { color: #191016; background: var(--gold); border-color: transparent; }

.market-note { margin-bottom: 14px; border-color: rgba(232, 185, 110, 0.2); background: linear-gradient(180deg, rgba(232, 185, 110, 0.055), rgba(255, 255, 255, 0.012)); }
.market-note-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.market-note-head h3 { margin: 1px 0 0; font-family: var(--serif); font-size: calc(19px * var(--fs)); }
.market-note p { margin: 0; color: var(--muted); font-size: calc(12px * var(--fs)); line-height: 1.65; }
.market-tags { margin-left: auto; display: flex; flex-wrap: wrap; gap: 5px; }

.trend-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.trend-card { position: relative; border: 1px solid var(--line); border-top: 2px solid var(--tc); border-radius: 13px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)); padding: 14px; min-width: 0; }
.trend-card.mismatch { opacity: 0.62; }
.trend-card:hover { border-color: var(--line-strong); border-top-color: var(--tc); opacity: 1; }
.trend-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.trend-rank { font-family: var(--serif); font-size: calc(13px * var(--fs)); color: var(--faint); }
.trend-delta { margin-left: auto; font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; }
.trend-delta small { display: block; font-size: calc(8px * var(--fs)); color: var(--faint); font-weight: 500; letter-spacing: 0.08em; text-align: right; }
.heat-ring { --size: 52px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; background: conic-gradient(var(--tc) calc(var(--heat, 0) * 1%), rgba(255, 255, 255, 0.075) 0); }
.heat-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #121019; }
.heat-ring b { position: relative; z-index: 1; font-family: var(--serif); font-size: calc(15px * var(--fs)); line-height: 1; color: var(--ink); }
.heat-ring small { position: relative; z-index: 1; margin-top: 2px; font-size: calc(7px * var(--fs)); letter-spacing: 0.08em; color: var(--faint); }
.trend-card h3 { margin: 0 0 2px; font-family: var(--serif); font-size: calc(18px * var(--fs)); font-weight: 600; line-height: 1.3; }
.trend-spark { height: 26px; margin: 4px 0 7px; opacity: 0.9; }
.spark { width: 100%; height: 26px; display: block; }
.trend-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.trend-chip { font-size: calc(8.5px * var(--fs)); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; white-space: nowrap; }
.trend-chip.on { color: var(--gold); border-color: rgba(232, 185, 110, 0.4); background: var(--gold-soft); }
.trend-section { margin: 6px 0; }
.trend-section b, .trend-formula b { display: block; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-bottom: 3px; }
.trend-section p { margin: 0; font-size: calc(10.5px * var(--fs)); line-height: 1.58; color: var(--muted); }
.trend-hook { margin: 8px 0; padding: 8px 10px; border-left: 2px solid var(--tc); background: rgba(0, 0, 0, 0.18); border-radius: 0 8px 8px 0; font-size: calc(11px * var(--fs)); line-height: 1.55; color: var(--ink); }
.trend-hook span { display: block; font-size: calc(8px * var(--fs)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.trend-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.trend-formula b { width: 100%; margin-bottom: 1px; }
.trend-formula span { font-size: calc(9px * var(--fs)); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.trend-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.trend-card-foot .sub { font-size: calc(9px * var(--fs)); color: var(--faint); }
.trend-card-foot .btn { margin-left: auto; }

.trend-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.trend-h3 { margin: 2px 0 10px; font-family: var(--serif); font-size: calc(18px * var(--fs)); font-weight: 600; }
.heat-list { display: flex; flex-direction: column; gap: 7px; }
.heat-row { display: grid; grid-template-columns: 112px 1fr 28px; gap: 8px; align-items: center; }
.heat-label { font-size: calc(9.5px * var(--fs)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.heat-track i { display: block; height: 100%; border-radius: 99px; }
.heat-row b { font-size: calc(10px * var(--fs)); color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

.force-grid { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.force { display: grid; grid-template-columns: 58px 1fr 30px; gap: 8px; align-items: center; }
.force span { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.force-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.force-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--coral)); }
.force b { text-align: right; font-size: calc(11px * var(--fs)); color: var(--gold); font-variant-numeric: tabular-nums; }
.check-list { display: flex; flex-direction: column; gap: 7px; margin: 10px 0; }
.tcheck { display: flex; gap: 8px; align-items: flex-start; }
.tcheck .dot { margin-top: 5px; }
.tcheck b { font-size: calc(10px * var(--fs)); color: var(--ink); font-weight: 600; }
.tcheck p { margin: 1px 0 0; color: var(--muted); font-size: calc(9.5px * var(--fs)); line-height: 1.5; }
.trend-tips { border-top: 1px solid var(--line); padding-top: 9px; }
.trend-tips b { font-size: calc(8.5px * var(--fs)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.trend-tips p { margin: 4px 0 0; font-size: calc(10px * var(--fs)); line-height: 1.55; color: var(--muted); }

.method-card { margin-top: 12px; border-color: rgba(232, 185, 110, 0.2); background: linear-gradient(180deg, rgba(232, 185, 110, 0.05), rgba(255, 255, 255, 0.012)); }
.method-card > p { margin: 0 0 8px; color: var(--muted); font-size: calc(11.5px * var(--fs)); line-height: 1.65; }

.platform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.platform-card { border: 1px solid var(--line); border-radius: 10px; padding: 11px; background: rgba(255, 255, 255, 0.022); }
.platform-head { display: flex; align-items: center; gap: 8px; }
.platform-head b { font-size: calc(11.5px * var(--fs)); font-weight: 600; }
.platform-head span { margin-left: auto; font-family: var(--serif); font-size: calc(14px * var(--fs)); color: var(--gold); }
.platform-role { margin-top: 2px; font-size: calc(8.5px * var(--fs)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.platform-card p { margin: 6px 0 0; color: var(--muted); font-size: calc(10px * var(--fs)); line-height: 1.55; }

.sources { margin-top: 12px; }
.source-links { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
.source-links a { color: var(--muted); font-size: calc(10px * var(--fs)); text-decoration: none; border-bottom: 1px solid var(--line); }
.source-links a:hover { color: var(--gold); border-color: var(--gold); }

@media (max-width: 900px) {
  .trend-cards, .trend-bottom, .platform-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .trend-head { flex-direction: column; gap: 6px; }
  .trend-meta { margin-left: 0; text-align: left; flex-direction: row; gap: 8px; align-items: baseline; }
  .trend-meta > span { display: none; }
  .market-tags { margin-left: 0; }
  .trend-card { padding: 12px; }
  .trend-card h3 { font-size: calc(16px * var(--fs)); }
  .heat-row { grid-template-columns: 92px 1fr 26px; }
  .trend-card-foot .btn { flex: 1; margin-left: 0; }
}

/* ---------- appearance panel ---------- */

.top-btn .aa { font-family: var(--serif); font-size: calc(13px * var(--fs)); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }

.appearance-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 140;
  width: 330px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: rise 0.18s ease;
}
.appearance-panel[hidden] { display: none; }
.ap-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.ap-head h3 { margin: 2px 0 0; font-family: var(--serif); font-size: calc(19px * var(--fs)); }
.ap-head .copybtn { margin-left: auto; flex: none; }
.ap-field { margin-top: 13px; }
.ap-field > .field-label { margin-bottom: 6px; }
.ap-note { margin-top: 12px; color: var(--faint); font-size: calc(10px * var(--fs)); line-height: 1.5; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.theme-option { border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 7px; text-align: left; color: var(--muted); font-size: calc(10px * var(--fs)); line-height: 1.3; }
.theme-option:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-option.on { border-color: var(--gold); color: var(--ink); background: var(--gold-soft); }
.theme-swatch { height: 26px; border-radius: 6px; margin-bottom: 5px; border: 1px solid rgba(255,255,255,.12); }
.sw-midnight { background: linear-gradient(135deg, #171020 0%, #3a1226 55%, #e8b96e 56%, #e8b96e 100%); }
.sw-ivory { background: linear-gradient(135deg, #fffaf1 0%, #f0e4d2 55%, #a8742a 56%, #a8742a 100%); }
.sw-neon { background: linear-gradient(135deg, #06101f 0%, #10284a 55%, #5ff0d0 56%, #ff5f9e 100%); }
.theme-option b { display: block; font-weight: 600; font-size: calc(10px * var(--fs)); }
@media (max-width: 760px) {
  .appearance-panel { top: 64px; left: 12px; right: 12px; width: auto; }
}

/* ---------- ivory theme ---------- */

[data-theme="ivory"] {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-2: #efe7db;
  --panel: #fffaf1;
  --panel-2: #f2e9dc;
  --panel-3: #e8ddcc;
  --line: rgba(36, 28, 20, 0.13);
  --line-strong: rgba(36, 28, 20, 0.24);
  --ink: #241d16;
  --muted: #6f6355;
  --faint: #9b8d7b;
  --gold: #a8742a;
  --gold-soft: rgba(168, 116, 42, 0.12);
  --coral: #c4513f;
  --teal: #2d7d72;
  --warn: #a9701b;
  --ok: #2f7d5d;
  --shadow: 0 24px 70px rgba(60, 40, 20, 0.18);
}
[data-theme="ivory"] body {
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(168, 116, 42, 0.14), transparent 62%),
    radial-gradient(900px 540px at -8% 18%, rgba(196, 81, 63, 0.08), transparent 60%),
    radial-gradient(760px 460px at 62% 108%, rgba(45, 125, 114, 0.06), transparent 60%),
    var(--bg);
}
[data-theme="ivory"] body::before {
  opacity: 0.6;
  background-image: linear-gradient(rgba(36, 28, 20, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 28, 20, 0.03) 1px, transparent 1px);
}
[data-theme="ivory"] .grain { opacity: 0.018; }
[data-theme="ivory"] .topbar { background: rgba(244, 239, 230, 0.82); }
[data-theme="ivory"] .brief { background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)), rgba(255, 250, 241, 0.88); }
[data-theme="ivory"] .card,
[data-theme="ivory"] .trend-card,
[data-theme="ivory"] .ep,
[data-theme="ivory"] .node,
[data-theme="ivory"] .ending,
[data-theme="ivory"] .multi-card,
[data-theme="ivory"] .project-row,
[data-theme="ivory"] .platform-card,
[data-theme="ivory"] .appearance-panel {
  background: var(--panel);
  box-shadow: 0 6px 22px rgba(60, 40, 20, 0.05);
}
[data-theme="ivory"] .ep:hover,
[data-theme="ivory"] .project-row:hover,
[data-theme="ivory"] .trend-card:hover { background: #fffdf8; }
[data-theme="ivory"] .market-note,
[data-theme="ivory"] .method-card,
[data-theme="ivory"] .ai-card { background: linear-gradient(180deg, rgba(168, 116, 42, 0.07), rgba(255, 255, 255, 0.2)); }
[data-theme="ivory"] .trend-hook { background: rgba(36, 28, 20, 0.045); }
[data-theme="ivory"] .heat-ring::before { background: var(--panel); }
[data-theme="ivory"] .library,
[data-theme="ivory"] .player { background: linear-gradient(180deg, #fffaf1, #f3ebdf); }
[data-theme="ivory"] .seg,
[data-theme="ivory"] .lang-switch,
[data-theme="ivory"] .top-btn,
[data-theme="ivory"] .btn,
[data-theme="ivory"] .select,
[data-theme="ivory"] .input { background: rgba(36, 28, 20, 0.035); }
[data-theme="ivory"] .select option { background: #fffaf1; color: #241d16; }
[data-theme="ivory"] .market-tab { background: rgba(36, 28, 20, 0.03); }
[data-theme="ivory"] .market-tab.on { color: #fffaf1; background: var(--gold); }
[data-theme="ivory"] .lang-switch button.on { color: #fffaf1; background: var(--gold); }
[data-theme="ivory"] .btn.primary { background: linear-gradient(135deg, #c28a3c, #9a6420); color: #fffaf1; }
[data-theme="ivory"] .code { background: #27211a; color: #f1e7d8; border-color: rgba(255, 255, 255, 0.08); }
[data-theme="ivory"] .copybtn { background: var(--panel-2); }
[data-theme="ivory"] .tab.on { color: var(--gold); }
[data-theme="ivory"] .tab.on::after { background: var(--gold); }
[data-theme="ivory"] .topbar { border-bottom-color: var(--line); }
[data-theme="ivory"] .poster { color: #fff; }

/* ---------- neon theme ---------- */

[data-theme="neon"] {
  --bg: #050811;
  --bg-2: #08101f;
  --panel: #0a1222;
  --panel-2: #0f1a30;
  --panel-3: #16243f;
  --line: rgba(120, 220, 255, 0.14);
  --line-strong: rgba(120, 220, 255, 0.3);
  --ink: #e8f8ff;
  --muted: #8aa9bb;
  --faint: #5f7e92;
  --gold: #5ff0d0;
  --gold-soft: rgba(95, 240, 208, 0.12);
  --coral: #ff5f9e;
  --teal: #7df9ff;
  --warn: #ffc857;
  --ok: #8affc1;
  --shadow: 0 26px 80px rgba(0, 8, 20, 0.7);
}
[data-theme="neon"] body {
  background:
    radial-gradient(1100px 620px at 80% -10%, rgba(95, 240, 208, 0.12), transparent 60%),
    radial-gradient(900px 540px at -10% 20%, rgba(255, 95, 158, 0.09), transparent 58%),
    radial-gradient(760px 460px at 62% 108%, rgba(76, 130, 255, 0.08), transparent 60%),
    var(--bg);
}
[data-theme="neon"] body::before { opacity: 0.55; }
[data-theme="neon"] .topbar { background: rgba(5, 8, 17, 0.74); }
[data-theme="neon"] .btn.primary { background: linear-gradient(135deg, #7df9ff, #7a8cff); color: #04121a; }
[data-theme="neon"] .lang-switch button.on { color: #04121a; }
[data-theme="neon"] .market-tab.on { color: #04121a; }
[data-theme="neon"] .heat-ring::before { background: var(--panel); }
[data-theme="neon"] .trend-card { background: linear-gradient(180deg, rgba(125, 249, 255, 0.045), rgba(255, 255, 255, 0.01)); }

.lang-region-title { margin: 14px 0 6px; font-size: calc(9.5px * var(--fs)); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.lang-region-title:first-of-type { margin-top: 6px; }

.trend-feed { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 4px; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.trend-feed-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; }
.trend-feed.on .trend-feed-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(111, 211, 199, 0.14); }
.trend-feed .btn { padding: 3px 7px; min-height: 0; font-size: calc(9px * var(--fs)); }
@media (max-width: 760px) {
  .trend-feed { justify-content: flex-start; margin-top: 0; }
}

/* UX polish: sticky tabs, next steps, compliance checks, language selection */
.tabs {
  position: sticky;
  top: 69px;
  z-index: 26;
  background: var(--bg);
  padding-top: 4px;
  margin-top: -4px;
}
.note { flex-wrap: wrap; }
.note .btn { margin-left: auto; flex: none; }
.btn:disabled, .lang-option:disabled { opacity: 0.42; cursor: not-allowed; }
button:focus-visible, a:focus-visible, .lang-option:focus-visible, .check-toggle:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.next-card {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-color: rgba(232, 185, 110, 0.22);
  background: linear-gradient(110deg, rgba(232, 185, 110, 0.07), rgba(255, 255, 255, 0.015));
}
.next-card h3 { margin: 3px 0 0; font-family: var(--serif); font-size: calc(18px * var(--fs)); }
.next-card p { margin: 4px 0 0; max-width: 600px; color: var(--muted); font-size: calc(11px * var(--fs)); line-height: 1.6; }
.next-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
@media (max-width: 760px) {
  .next-card { align-items: flex-start; flex-direction: column; }
  .next-actions { width: 100%; }
  .next-actions .btn { flex: 1; }
}
.compliance-summary .actions { margin-left: auto; align-items: center; }
.chip.ok { color: var(--ok); border-color: rgba(111, 211, 199, 0.35); }
.compliance-progress { height: 5px; margin: -4px 0 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.055); overflow: hidden; }
.compliance-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 0.25s ease; }
.check { align-items: flex-start; }
.check-toggle {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: #10201c;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check-toggle:hover { border-color: var(--gold); }
.check-toggle.on { background: var(--ok); border-color: transparent; }
.check.done .check-title { color: var(--muted); }
.check.done .check-body p { opacity: 0.62; }
.lang-option { position: relative; padding-right: 30px; }
.lang-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #191016;
}
.lang-check svg { display: block; }
@media (max-width: 760px) {
  .compliance-summary .actions { width: 100%; margin-left: 0; }
  .compliance-summary .actions .btn { flex: 1; }
  .tabs { top: 69px; }
}
.lang-option .lang-check { display: grid; margin: 0; color: #191016; font-size: 0; }
.compliance-progress { background: rgba(255, 255, 255, 0.09); height: 6px; margin: -6px 0 12px; }
.check { gap: 12px; padding: 14px 0; }
.check-body { flex: 1; }
.check-toggle { width: 24px; height: 24px; border-color: var(--muted); background: rgba(255, 255, 255, 0.045); opacity: 0.9; }
.check-toggle:hover { background: var(--gold-soft); border-color: var(--gold); }
.check-toggle.on { opacity: 1; }
.tabs { scroll-behavior: smooth; }
@media (max-width: 520px) {
  .overview { grid-template-columns: 1fr; gap: 14px; }
  .poster { aspect-ratio: auto; min-height: 218px; padding: 16px; }
  .poster-title { font-size: calc(23px * var(--fs)); -webkit-line-clamp: 3; }
  .poster-cover { -webkit-line-clamp: 2; margin-top: 8px; }
  .poster-body { padding: 2px 0; }
}
