@font-face {
  font-family: Inter;
  src: url("/inter.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
  --gray: #6b7280;
  --line: #e5e7eb;
  --border: #d1d5db;
  --blue: #1e3a8a;
  --blue-dark: #172554;
  --blue-pale: #eff6ff;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #fff; }
button, input, select { font: inherit; }
input[type="checkbox"] { accent-color: var(--blue); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--blue); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #1e40af; outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 18px; line-height: 1.5; font-weight: 600; }
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  min-height: 38px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 20px;
}
.primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px #0001; }
.primary:hover:not(:disabled) { background: var(--blue-dark); color: #fff; }
.secondary { background: #fff; color: #374151; border-color: var(--border); }
.secondary:hover:not(:disabled) { background: #f9fafb; color: #111827; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; padding: 6px; background: transparent; color: #6b7280; border: 0; border-radius: 8px; }
.icon-button:hover { color: #111827; background: #f3f4f6; }
.error-box { padding: 12px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; font-size: 14px; }

.login-shell { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); min-height: 100dvh; }
.login-cover { display: flex; align-items: center; justify-content: center; height: 100dvh; min-height: 0; overflow: hidden; }
.login-cover img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px; min-width: 0; }
.login-card { width: 100%; max-width: 420px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 24px; }
.login-brand img { display: block; border-radius: 12px; object-fit: contain; }
.login-brand h1 { text-align: center; font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.375; }
.login-subtitle { text-align: center; color: var(--gray); line-height: 24px; margin-bottom: 40px; }
.login-card > .error-box { margin-bottom: 20px; }
.login-form { display: grid; gap: 20px; }
.login-form label, .dialog-body label { display: block; color: #374151; font-size: 14px; font-weight: 500; line-height: 20px; }
.login-form input:not([type="checkbox"]), .dialog-body input:not([type="checkbox"]), .dialog-body select, .management-actions input {
  display: block; width: 100%; min-width: 0; margin-top: 8px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff; color: #1f2937; padding: 0 16px; height: 48px; font-weight: 400; font-size: 16px;
}
input::placeholder { color: #9ca3af; opacity: 1; }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 46px !important; }
.password-field button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.password-field input::-ms-reveal { display: none; }
.password-field button[aria-pressed="false"] .eye-open,
.password-field button[aria-pressed="true"] .eye-closed { display: none; }
.login-form .remember, .dialog-body .remember { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.remember input { margin: 0; width: 16px; height: 16px; }
.login-submit { height: 48px; width: 100%; border-radius: 12px; font-size: 16px; box-shadow: 0 10px 15px -3px #0002,0 4px 6px -4px #0002; }
.login-footer { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); text-align: center; color: #4b5563; font-size: 14px; line-height: 20px; }
.login-footer a { display: inline-flex; align-items: center; gap: 12px; }
.login-footer svg { width: 16px; height: 16px; }
body.admin-login #reveal, body.admin-login #login-switch svg { display: none; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 256px; border-right: 1px solid var(--border); background: #fff; box-shadow: 0 1px 2px #0001; z-index: 5; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.side-brand img, .admin-brand img { border-radius: 8px; object-fit: contain; }
.side-brand button { margin-left: auto; font-size: 24px; line-height: 20px; }
.sidebar nav { flex: 1; padding: 16px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 4px; border: 1px solid transparent; border-radius: 8px; color: #374151; font-size: 14px; }
.sidebar nav a:hover { background: #f3f4f6; }
.sidebar nav a[aria-current="page"] { color: var(--blue); border-color: #bfdbfe; background: var(--blue-pale); font-weight: 500; }
.side-account { padding: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; font-size: 13px; color: var(--gray); }
.side-account span { overflow-wrap: anywhere; }
.app-shell { margin-left: 256px; min-height: 100vh; }
body.nav-closed .sidebar { display: none; }
body.nav-closed .app-shell { margin-left: 0; }
.platform-header { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); }
.platform-header > div { display: flex; align-items: center; gap: 10px; }
.platform-header h1 { font-size: 19px; font-weight: 600; }
#open-nav { display: none; }
body.nav-closed #open-nav { display: inline-flex; }
.platform-header > span { color: var(--gray); font-size: 13px; text-align: right; }
.platform-main { max-width: 1350px; padding: 26px 28px; margin: auto; }
.workspace { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; align-items: start; }
.controls { display: grid; gap: 20px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 1px 2px #0001; min-width: 0; }
.section, .intro { padding: 20px; }
.intro > p:first-of-type { color: var(--gray); font-size: 14px; line-height: 1.6; margin: 6px 0 18px; }
.story-count { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px; color: #374151; font-size: 14px; }
.story-count select { min-height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; color: inherit; background: #fff; }
.generate-row, .section-title, .downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#clear-today:hover:not(:disabled) { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.section-title { justify-content: space-between; }
#number, .feedback, .coverage, .template-label, .section-title span, #empty-archive { color: var(--gray); font-size: 13px; line-height: 1.55; }
.feedback:not(:empty), #empty-archive { margin-top: 12px; }
.feedback[data-error="true"] { color: #b91c1c; }
.generation-progress { margin-top: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafb; }
.generation-progress h3 { font-size: 14px; font-weight: 600; }
#progress-elapsed { font-variant-numeric: tabular-nums; }
#progress-steps { list-style: none; display: grid; gap: 8px; padding: 0; margin: 12px 0; }
#progress-steps > li { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; align-items: center; color: var(--gray); font-size: 13px; line-height: 1.55; }
.step-mark { width: 11px; height: 11px; border: 1px solid #9ca3af; border-radius: 50%; justify-self: center; }
#progress-steps > li[data-status="active"] { color: var(--blue); font-weight: 600; }
[data-status="active"] .step-mark { border: 2px solid #bfdbfe; border-top-color: var(--blue); animation: progress-spin .85s linear infinite; }
[data-status="done"] .step-mark { border: 0; display: grid; place-items: center; color: var(--blue); font-weight: 700; }
[data-status="done"] .step-mark::after { content: "✓"; line-height: 1; }
[data-status="failed"] .step-mark { border-color: #b91c1c; background: #fef2f2; }
#progress-sources { grid-column: 2; margin: 5px 0 3px; font-weight: 400; color: #4b5563; font-size: 12px; }
#progress-sources summary { cursor: pointer; width: fit-content; }
#progress-source-list { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 5px 0 0; padding: 0; }
#progress-source-list li { padding: 2px 6px; border: 1px solid var(--line); background: #fff; border-radius: 4px; }
.progress-detail { color: var(--gray); font-size: 13px; line-height: 1.55; }
.generation-progress[data-status="failed"] .progress-detail { color: #b91c1c; }
@keyframes progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { [data-status="active"] .step-mark { animation: none; } }
.coverage { margin-top: 12px; }
#issue-versions { margin-top: 12px; color: #4b5563; font-size: 13px; }
#issue-versions summary { cursor: pointer; width: fit-content; }
#version-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; }
#version-list button { min-height: 30px; padding: 4px 10px; font-size: 12px; }
#version-list button[aria-current="true"] { color: var(--blue); border-color: #bfdbfe; background: var(--blue-pale); }
#history, #stories { list-style: none; margin: 10px 0 0; padding: 0; }
#history li + li, #stories li + li { border-top: 1px solid var(--line); }
#history button { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: baseline; width: 100%; text-align: left; padding: 10px 0; background: none; border: 0; gap: 8px; color: inherit; font-size: 14px; }
#history button:hover, #history button[aria-current="true"] { color: var(--blue); }
.history-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#history time { font-size: 12px; color: var(--gray); }
#stories li { padding: 10px 0; }
#stories strong { font-size: 15px; line-height: 1.55; }
#stories p { margin: 5px 0; font-size: 13px; line-height: 1.65; }
#stories a { color: var(--blue); display: inline-block; font-size: 12px; margin: 3px 10px 0 0; text-decoration: underline; }
.preview { overflow: hidden; }
.preview-header { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.preview-frame { padding: 16px; background: #f9fafb; }
.poster-sheet { position: relative; max-width: 440px; margin: auto; box-shadow: 0 1px 6px #0002; }
.poster-sheet img { display: block; width: 100%; height: auto; }
/* Match the footer background rectangle in the exported slide. */
.poster-sheet:has(> img:is([src="/template.png"], [src="/template-5.png"]))::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 75.6844%;
  width: 17.3913%;
  margin-bottom: 7.2464%;
  aspect-ratio: 216 / 76;
  background: #e1e1e1;
  pointer-events: none;
}
#live-poster { position: absolute; inset: 0; width: 100%; height: 100%; stroke: none; pointer-events: none; }
#live-poster text { font-weight: 700; white-space: pre; }
.template-button { margin: 0 0 14px 8px; }
.poster-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; stroke: none; }
.poster-overlay text { font-weight: 700; white-space: pre; }
.poster-hotspot { pointer-events: all; cursor: pointer; fill: transparent; stroke: transparent; stroke-width: 2; }
.poster-hotspot:hover, .poster-hotspot:focus-visible { fill: #60a5fa16; stroke: #3b82f6; outline: none; }
.poster-hotspot[data-active="true"] { stroke: #2563eb; stroke-dasharray: 5 3; }
.story-edit-link { display: block; width: 100%; padding: 0; background: none; text-align: left; border: 0; color: inherit; }
.story-edit-link:hover { color: var(--blue); }
.poster-editor { width: min(940px, calc(100vw - 28px)); max-height: 92dvh; padding: 0; border: 1px solid var(--line); border-radius: 13px; color: inherit; box-shadow: 0 22px 65px #131d3c42; }
.poster-editor::backdrop { background: #0f172a66; }
.poster-editor > header, .poster-editor > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 20px; }
.poster-editor > header { border-bottom: 1px solid var(--line); }
.poster-editor > footer { border-top: 1px solid var(--line); justify-content: flex-end; }
#reset-template { margin-right: auto; }
.editor-main { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(280px, 1fr); max-height: min(700px, 73dvh); overflow: auto; }
.editor-controls { padding: 18px 20px; min-width: 0; }
.editor-hint { color: var(--gray); font-size: 13px; line-height: 1.65; margin-bottom: 12px; }
.type-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; border: 0; padding: 0; margin: 0 0 15px; }
.type-controls legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.editor-label, .type-controls label { display: grid; gap: 4px; color: #475569; font-size: 13px; }
.editor-controls select, .editor-controls input, .editor-controls textarea { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; color: inherit; font: inherit; background: #fff; }
#edit-field, #edit-copy { margin: 4px 0 12px; }
#edit-copy { resize: vertical; line-height: 1.55; }
#inherit-style { margin-bottom: 10px; }
.editor-preview { min-width: 0; padding: 12px 16px 18px; background: #f8fafc; border-left: 1px solid var(--line); }
.editor-preview-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; color: var(--gray); font-size: 13px; }
.editor-preview-bar button { font-size: 12px; }
.editor-preview .poster-sheet { max-width: 350px; }
.editor-proof { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (max-width: 660px) {
  .editor-main { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { border-left: 0; border-top: 1px solid var(--line); }
  .poster-editor > header, .poster-editor > footer { padding-inline: 12px; }
}

.admin-width { max-width: 1280px; margin: 0 auto; padding-inline: 24px; }
.admin-header { border-bottom: 1px solid var(--line); }
.admin-bar, .admin-brand, .admin-nav, .admin-tabs, .management-actions { display: flex; align-items: center; gap: 12px; }
.admin-bar { justify-content: space-between; padding-block: 16px; flex-wrap: wrap; }
.admin-brand strong { font-size: 18px; font-weight: 600; }
#admin-email { color: var(--gray); font-size: 12px; line-height: 16px; }
.admin-nav { flex-wrap: wrap; font-size: 14px; color: #4b5563; }
.admin-tabs { padding: 4px; border: 1px solid var(--line); background: #f3f4f6; border-radius: 8px; gap: 4px; }
.admin-tabs button { background: none; color: #4b5563; border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 500; }
.admin-tabs button[aria-current="page"] { background: #fff; color: var(--blue); box-shadow: 0 1px 2px #0001; }
.admin-main { padding-block: 32px; }
#admin-message:not([hidden]) { margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.stat { display: grid; gap: 8px; padding: 20px; border-radius: 8px; }
.stat span { color: var(--gray); font-size: 14px; }
.stat strong { font-size: 30px; line-height: 36px; }
.stat:nth-child(2) strong { color: var(--blue); }
.management-header { padding: 16px 24px; border-bottom: 1px solid var(--line); }
.management-header h2 span { color: #9ca3af; }
.management-actions input { width: min(256px,45vw); margin-top: 0; height: 38px; padding: 0 12px; border-radius: 8px; font-size: 14px; }
.management-list { display: grid; gap: 12px; padding: 16px 24px; }
.record-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.record-row span { color: var(--gray); display: block; margin-top: 4px; font-size: 12px; }
.record-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.user-dialog { padding: 0; width: min(560px,calc(100vw - 32px)); border: 1px solid var(--line); color: #111827; border-radius: 12px; box-shadow: 0 24px 50px #0004; }
.user-dialog::backdrop { background: #0006; }
.user-dialog header, .user-dialog footer { padding: 16px 24px; }
.user-dialog header { border-bottom: 1px solid var(--line); }
.user-dialog footer { border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.dialog-body { padding: 20px 24px; display: grid; gap: 14px; }
.dialog-body input:not([type="checkbox"]), .dialog-body select { height: 40px; font-size: 14px; border-radius: 8px; }
.muted { color: var(--gray); font-size: 14px; }
@media (max-width: 1023px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-cover { display: none; }
  .login-side { background: #f5f8fc; }
  .login-card { border-radius: 24px; padding: 28px; background: #fff; box-shadow: 0 18px 45px #0f274b1f; }
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .app-shell { margin-left: 0; }
  .sidebar { box-shadow: 0 8px 30px #0002; }
  .platform-header, .platform-main { padding-inline: 16px; }
  .admin-width { padding-inline: 16px; }
  .management-header,.management-list { padding-inline: 14px; }
  .record-row { flex-wrap: wrap; }
  .stat { padding: 12px; }
  .stat span { font-size: 12px; }
  .stat strong { font-size: 22px; }
}
@media (max-width: 460px) {
  .login-side { padding: 20px; }
  .login-card { padding: 22px; }
  .login-brand h1 { font-size: 24px; }
}

