:root {
  color-scheme: dark;
  --bg: #12100e;
  --panel: #1b1714;
  --panel-strong: #211c18;
  --fg: #f4efe7;
  --muted: #b8ada2;
  --accent: #ff5a36;
  --line: #3a3029;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; overflow: hidden; background: var(--bg); color: var(--fg); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
a { color: inherit; }
.topbar { min-height: 148px; padding: 30px 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--line); }
.kicker { margin: 0 0 10px; color: var(--accent); font: 600 12px/1 "IBM Plex Mono", monospace; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 62px); letter-spacing: -.055em; }
.author-line { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.author-line strong { color: var(--accent); }
.topbar-right { display: flex; align-items: flex-end; gap: 28px; }
.topbar-actions { display: flex; gap: 10px; padding-bottom: 10px; }
.nav-pill { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: 160ms ease; }
.nav-link { display: inline-flex; align-items: center; text-decoration: none; }
.nav-pill:hover, .nav-pill.active { border-color: var(--accent); color: var(--fg); background: rgba(255,90,54,.1); }
.library-count { display: flex; gap: 12px; align-items: baseline; }
.library-count span { color: var(--accent); font-size: 46px; font-weight: 800; }
.library-count small { color: var(--muted); }
main { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 148px); overflow: hidden; }
.sidebar { min-height: 0; padding: 24px 18px 24px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.search-wrap { flex: 0 0 auto; margin-bottom: 18px; padding-right: 6px; }
#template-list { min-height: 0; overflow-y: auto; padding: 12px 16px 32px 0; scroll-padding: 22px 0 34px; }
#template-list::-webkit-scrollbar, .workspace::-webkit-scrollbar { width: 8px; }
#template-list::-webkit-scrollbar-thumb, .workspace::-webkit-scrollbar-thumb { background: #3a3029; border-radius: 999px; }
#template-list::-webkit-scrollbar-track, .workspace::-webkit-scrollbar-track { background: transparent; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); padding: 12px 14px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.template-card { width: 100%; margin-bottom: 12px; padding: 18px; display: grid; gap: 7px; text-align: left; color: var(--fg); background: var(--panel); border: 1px solid transparent; border-radius: 14px; cursor: pointer; transition: 160ms ease; }
.template-card:hover, .template-card.active { background: var(--panel-strong); border-color: var(--accent); }
.template-category, .template-meta { color: var(--accent); font: 600 11px/1.4 "IBM Plex Mono", monospace; letter-spacing: .08em; }
.template-name { font-size: 20px; }
.template-description { color: var(--muted); font-size: 13px; line-height: 1.55; }
.template-meta { margin-top: 5px; color: var(--muted); }
.workspace { min-width: 0; height: 100%; overflow-y: auto; padding: 34px; scroll-behavior: smooth; }
.workspace-grid { display: grid; grid-template-columns: minmax(420px, 1.4fr) minmax(310px, .8fr); gap: 28px; }
.preview-panel { min-width: 0; position: sticky; top: 0; align-self: start; }
.preview { position: relative; aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; background: #090807; border: 1px solid var(--line); border-radius: 18px; }
.preview video { width: 100%; height: 100%; object-fit: contain; }
.preview-placeholder { max-width: 420px; padding: 30px; text-align: center; color: var(--muted); line-height: 1.7; }
.preview-placeholder strong { display: block; margin-bottom: 8px; color: var(--fg); font-size: 24px; }
.workspace-title { margin: 24px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.workspace-description { margin: 0; color: var(--muted); line-height: 1.7; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tag { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.editor { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.editor h2 { margin: 0 0 18px; font-size: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.color-field { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.color-field input[type="color"] { height: 44px; padding: 4px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.button { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--fg); cursor: pointer; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #21100c; font-weight: 800; }
.button:disabled { opacity: .45; cursor: wait; }
.status { min-height: 22px; margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.status.error { color: #ff8d76; }
.preset-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 18px; }
.preset-row .button { padding-inline: 12px; }
.empty-state { color: var(--muted); }
.guide { max-width: 1180px; margin: 0 auto; display: grid; gap: 28px; }
.guide-hero { padding: 38px; border: 1px solid rgba(255,90,54,.38); border-radius: 26px; background: radial-gradient(circle at 85% 10%, rgba(255,90,54,.16), transparent 38%), var(--panel); }
.guide-hero h2 { margin: 0 0 14px; font-size: clamp(38px, 5vw, 72px); letter-spacing: -.065em; line-height: .98; }
.guide-hero p { max-width: 820px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.75; }
.creator-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.creator-strip span { color: var(--muted); }
.creator-chip { padding: 8px 12px; border: 1px solid rgba(255,90,54,.34); border-radius: 999px; color: var(--fg); background: rgba(255,90,54,.08); font-size: 13px; }
.star-callout { margin-top: 22px; padding: 16px 18px; border: 1px solid rgba(255,90,54,.28); border-radius: 16px; background: #211c18; color: var(--fg); line-height: 1.7; }
.star-callout strong { color: var(--accent); }
.star-callout a { color: var(--accent); font-weight: 800; text-decoration: none; border-bottom: 1px solid rgba(255,90,54,.45); }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.guide-card { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.guide-card strong { display: block; margin-bottom: 10px; color: var(--accent); font: 800 13px/1 "IBM Plex Mono", monospace; letter-spacing: .12em; }
.guide-card h3 { margin: 0 0 12px; font-size: 26px; letter-spacing: -.04em; }
.guide-card p, .guide-card li { color: var(--muted); line-height: 1.7; }
.guide-card ul, .guide-card ol { margin: 10px 0 0; padding-left: 20px; }
.guide-card pre { overflow-x: auto; margin: 16px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #090807; color: var(--fg); font: 13px/1.6 "IBM Plex Mono", monospace; }
.guide-card.wide { grid-column: 1 / -1; }
.guide-prompt { white-space: pre-wrap; }
@media (max-width: 900px) {
  body { height: auto; overflow: auto; }
  main { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .sidebar { max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { height: auto; overflow: visible; }
  .preview-panel { position: static; }
  .workspace-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
}
