:root {
    --ink: #17211b;
    --muted: #6e756f;
    --paper: #f6f3ed;
    --card: #fffdf9;
    --line: #dcd8cf;
    --accent: #df573d;
    --green: #315b43;
    --soft-green: #dbe7db;
    --shadow: 0 16px 42px rgba(36, 43, 37, .08);
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 6%, rgba(223, 87, 61, .08), transparent 24rem),
        linear-gradient(180deg, #f8f5ef 0%, var(--paper) 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

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

.shell {
    width: min(100% - 32px, 900px);
    margin: 0 auto;
    padding: 56px 0 32px;
}

.hero {
    position: relative;
    min-height: 320px;
    padding: 48px 48px 42px;
    overflow: hidden;
    color: #fff;
    background: var(--ink);
    border-radius: 32px;
    box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.hero::before {
    width: 250px;
    height: 250px;
    top: -125px;
    right: -30px;
    background: var(--accent);
    opacity: .9;
}

.hero::after {
    width: 150px;
    height: 150px;
    right: 72px;
    bottom: -90px;
    border: 24px solid #7ca184;
    opacity: .75;
}

.brand-mark {
    display: flex;
    gap: 6px;
    margin-bottom: 44px;
}

.brand-mark span { display: block; width: 24px; height: 6px; border-radius: 99px; }
.brand-mark span:nth-child(1) { background: #fff; }
.brand-mark span:nth-child(2) { background: var(--accent); width: 12px; }
.brand-mark span:nth-child(3) { background: #7ca184; width: 6px; }

.eyebrow,
.section-kicker,
.admin-label {
    margin: 0 0 8px;
    color: #a7c1ad;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .18em;
}

.hero h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    max-width: 560px;
    font-family: Georgia, "Songti SC", "STSong", serif;
    font-size: clamp(42px, 8vw, 72px);
    line-height: 1.08;
    letter-spacing: -.04em;
}

.hero-copy { position: relative; z-index: 1; margin: 18px 0 34px; color: #c7d0ca; font-size: 16px; }

.date-pill {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    color: #f7f5ee;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pulse-dot { width: 8px; height: 8px; background: #ff775f; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,119,95,.14); }

.content-section,
.archive-section { padding: 64px 8px 0; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-heading.compact { margin-bottom: 18px; }
.section-kicker { color: var(--accent); }
.section-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(26px, 5vw, 36px); line-height: 1.2; }
.text-link { color: var(--green); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }

.article-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.article-card {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 22px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.article-card:hover { transform: translateY(-2px); border-color: #c3beb4; box-shadow: 0 12px 32px rgba(36,43,37,.07); }
.article-index { color: var(--accent); font-family: Georgia, serif; font-size: 20px; font-style: italic; }
.article-main { min-width: 0; }
.article-main h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.45; }
.article-meta { margin: 0; color: var(--muted); font-size: 13px; }
.article-signals { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.article-signals > span:not(.crowding-status) { position: relative; }
.article-signals > span:not(.crowding-status) + span:not(.crowding-status)::before { content: ""; position: absolute; top: 50%; left: -7px; width: 3px; height: 3px; background: #b3b7b3; border-radius: 50%; transform: translate(-50%, -50%); }
.article-signals strong { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.crowding-status { padding: 3px 8px; border-radius: 999px; font-weight: 750; }
.crowding-status.low { color: #2f6546; background: #e3eee5; }
.crowding-status.medium { color: #805e18; background: #f5e8bd; }
.crowding-status.high { color: #9a3829; background: #f7dfda; }
.article-actions { display: flex; align-items: center; gap: 8px; }
.open-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    color: #fff;
    background: var(--green);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}
.mimic-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--green); background: #f2f6f1; border: 1px solid #cad6cc; border-radius: 12px; font-size: 14px; font-weight: 750; cursor: pointer; }
.mimic-button.active { color: #fff; background: var(--accent); border-color: var(--accent); }

.empty-state { padding: 60px 24px; text-align: center; background: rgba(255,255,255,.55); border: 1px dashed #c9c3b9; border-radius: 24px; }
.empty-icon { color: var(--accent); font-size: 34px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; }

.archive-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.archive-link { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; background: transparent; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.archive-link span { font-weight: 750; }
.archive-link small { color: var(--muted); }
.archive-link.active { color: #fff; background: var(--green); border-color: var(--green); }
.archive-link.active small { color: #d8e6dc; }
.site-footer { padding: 72px 8px 12px; color: #8b908c; text-align: center; font-size: 12px; letter-spacing: .08em; }
/* Admin */
.admin-body { background: #edf0ec; }
.admin-header { display: flex; align-items: center; justify-content: space-between; width: min(100% - 40px, 1120px); margin: 0 auto; padding: 36px 0 22px; }
.admin-header h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 34px; }
.admin-label { color: var(--accent); }
.admin-nav { display: flex; align-items: center; gap: 16px; }
.admin-nav a, .link-button { padding: 0; color: var(--green); background: none; border: 0; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
.admin-shell { display: grid; gap: 22px; width: min(100% - 40px, 1120px); margin: 0 auto; padding-bottom: 64px; }
.panel { padding: 28px; background: #fff; border: 1px solid #dce1dc; border-radius: 22px; box-shadow: 0 12px 34px rgba(31,47,37,.05); }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid #e8ebe7; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 24px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.step-number { display: grid; place-items: center; width: 36px; height: 36px; color: var(--accent); background: #f9e9e5; border-radius: 50%; font-size: 12px; font-weight: 800; }
.create-form { display: grid; grid-template-columns: 1fr 180px auto; align-items: end; gap: 14px; padding-top: 22px; }
.field { display: grid; gap: 7px; }
.field label, .stack-form label, .edit-form label { color: #49524c; font-size: 13px; font-weight: 750; }
input { width: 100%; min-height: 46px; padding: 0 13px; color: var(--ink); background: #fbfcfa; border: 1px solid #cfd6d0; border-radius: 10px; outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,91,67,.1); }
.primary-button, .small-primary { min-height: 46px; padding: 0 20px; color: #fff; background: var(--green); border: 0; border-radius: 10px; font-weight: 750; cursor: pointer; }
.small-primary { min-height: 40px; }
.admin-date-group { padding-top: 28px; }
.admin-date-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.admin-date-heading h3 { margin: 0; font-size: 16px; }
.admin-date-heading span { color: var(--muted); font-size: 12px; }
.admin-records { display: grid; gap: 8px; }
.admin-record { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px; background: #f8faf7; border: 1px solid #e2e7e2; border-radius: 14px; }
.record-order { color: var(--accent); font-family: Georgia, serif; font-size: 15px; }
.record-content { min-width: 0; }
.record-content h4 { margin: 0 0 4px; font-size: 15px; }
.record-content > a { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.record-status { margin-top: 5px; font-size: 11px; }
.record-status.success { color: #2c7547; }
.record-status.failed { color: #a24735; }
.record-controls { display: flex; align-items: center; gap: 7px; }
.inline-actions { display: flex; gap: 5px; }
.inline-actions button, .edit-details summary, .danger-button { min-height: 34px; padding: 0 10px; color: #455048; background: #fff; border: 1px solid #d5dbd6; border-radius: 8px; font-size: 12px; cursor: pointer; }
.edit-details { position: relative; }
.edit-details summary { display: flex; align-items: center; list-style: none; }
.edit-details[open] .edit-form { display: grid; }
.edit-form { position: absolute; z-index: 5; top: 42px; right: 0; display: none; gap: 12px; width: min(360px, 80vw); padding: 18px; background: #fff; border: 1px solid #ccd4cd; border-radius: 14px; box-shadow: var(--shadow); }
.edit-form label { display: grid; gap: 5px; }
.danger-button { color: #a43d2c; border-color: #edcbc4; }
.alert { padding: 13px 16px; border-radius: 10px; font-size: 14px; }
.alert.success { color: #245c38; background: #dcecdf; border: 1px solid #bfd8c5; }
.alert.error { color: #8e3527; background: #f8e3de; border: 1px solid #edc2b9; }
.admin-empty { padding: 48px 20px 24px; color: var(--muted); text-align: center; }
.user-create-form { display: grid; grid-template-columns: 1fr 1fr 1fr 120px auto; align-items: end; gap: 12px; padding-top: 22px; }
.user-table-wrap { overflow-x: auto; padding-top: 20px; }
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th, .user-table td { padding: 13px 10px; text-align: left; border-bottom: 1px solid #e8ebe7; white-space: nowrap; }
.user-table th { color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.user-table td:first-child { white-space: normal; }
.user-table td small { display: block; margin-top: 3px; color: var(--muted); }
.user-actions { display: flex; align-items: center; gap: 6px; }
.small-control, .reset-details summary { min-height: 34px; padding: 0 10px; color: #455048; background: #fff; border: 1px solid #d5dbd6; border-radius: 8px; font-size: 12px; cursor: pointer; }
.reset-details { position: relative; }
.reset-details summary { display: flex; align-items: center; list-style: none; }
.reset-details form { position: absolute; z-index: 8; top: 42px; right: 0; display: grid; gap: 8px; width: 260px; padding: 14px; background: #fff; border: 1px solid #ccd4cd; border-radius: 12px; box-shadow: var(--shadow); }
.usage-filter { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; align-items: end; gap: 12px; padding-top: 22px; }
.usage-filter select { width: 100%; min-height: 46px; padding: 0 10px; color: var(--ink); background: #fbfcfa; border: 1px solid #cfd6d0; border-radius: 10px; }
.usage-totals { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 22px; }
.usage-totals div { padding: 18px; background: #f6f8f5; border-radius: 12px; }
.usage-totals strong, .usage-totals span { display: block; }
.usage-totals strong { font-family: Georgia, serif; font-size: 24px; }
.usage-totals span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.usage-table td { vertical-align: top; }
.usage-table td small { max-width: 320px; white-space: normal; }
.usage-table td a { color: var(--green); font-weight: 750; }
.usage-status { display: inline-block; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 750; }
.usage-status.success { color: #2c7547; background: #deeddf; }
.usage-status.failed { color: #8a3d2d; background: #f5dfda; }
.usage-status.processing { color: #805e18; background: #f5e8bd; }

.login-body { display: grid; place-items: center; }
.login-shell { width: min(100% - 36px, 430px); }
.back-home { display: inline-block; margin-bottom: 16px; color: var(--muted); font-size: 13px; text-decoration: none; }
.login-card { padding: 38px; background: #fff; border-radius: 24px; box-shadow: var(--shadow); }
.admin-badge { display: inline-block; margin-bottom: 26px; padding: 5px 9px; color: var(--accent); background: #f9e9e5; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.login-card h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 34px; }
.login-card > p { margin: 8px 0 26px; color: var(--muted); font-size: 14px; }
.stack-form { display: grid; gap: 10px; }
.stack-form .primary-button { margin-top: 8px; }
.login-card .alert { margin-bottom: 16px; }

/* Writer */
.writer-body { min-height: 100vh; color: #17211b; background: #eef1ed; }
.writer-header { display: flex; align-items: center; justify-content: space-between; width: min(100% - 40px, 980px); margin: 0 auto; padding: 26px 0; }
.writer-brand { color: var(--green); font-family: Georgia, "Songti SC", serif; font-size: 21px; font-weight: 800; text-decoration: none; }
.writer-brand span { color: var(--accent); }
.writer-header nav { display: flex; align-items: center; gap: 16px; }
.writer-header nav a { color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.writer-header nav form { margin: 0; }
.writer-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; width: min(100% - 40px, 900px); margin: 0 auto; padding: 24px 0 72px; }
.writer-workspace { width: min(100% - 40px, 1180px); }
.writer-workspace > .writer-intro, .writer-workspace > .writer-card { width: min(100%, 1060px); min-width: 0; margin-inline: auto; }
.writer-intro { text-align: center; padding: 4px 0 8px; }
.writer-intro h1, .history-title h1 { margin: 5px 0 10px; font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 5vw, 50px); line-height: 1.08; }
.writer-intro > p:not(.section-kicker) { max-width: 620px; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.8; }
.quota-pill { display: inline-block; margin-top: 13px; padding: 7px 11px; color: #2f6546; background: #dceade; border-radius: 999px; font-size: 12px; font-weight: 750; }
.writer-card, .writer-result, .writer-recent { padding: 26px; background: #fff; border: 1px solid #dce1dc; border-radius: 20px; box-shadow: 0 12px 34px rgba(31,47,37,.05); }
.writer-form { display: grid; gap: 12px; }
.writer-form label { color: #49524c; font-size: 13px; font-weight: 750; }
.writer-controls { display: grid; grid-template-columns: minmax(0, 1fr) 250px 126px; align-items: end; gap: 12px; min-width: 0; }
.writer-control { display: grid; gap: 7px; min-width: 0; }
.writer-control select { width: 100%; min-height: 46px; padding: 0 12px; color: var(--ink); background: #f7f9f6; border: 1px solid #d8dfd9; border-radius: 10px; outline: none; }
.writer-control select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,91,67,.1); }
.writer-control option:disabled { color: #a8ada9; }
.writer-generate-button { width: 126px; }
.prompt-editor { display: grid; gap: 10px; margin-top: 8px; padding-top: 18px; border-top: 1px solid #e7eae6; }
.prompt-editor-heading, .prompt-snapshot-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.prompt-editor-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.prompt-editor-actions, .prompt-snapshot-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.prompt-editor-actions > span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.prompt-editor textarea {
    width: 100%;
    min-height: 310px;
    resize: vertical;
    padding: 16px;
    color: var(--ink);
    background: #f7f9f6;
    border: 1px solid #d8dfd9;
    border-radius: 12px;
    outline: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.75;
}
.prompt-editor textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,91,67,.1); }
button:disabled { cursor: not-allowed; opacity: .55; }
.generate-status { min-height: 19px; margin: 2px 0 0; font-size: 12px; }
.generate-status.loading { color: #75652e; }
.generate-status.warning { color: #8a6418; }
.generate-status.success { color: #2c7547; }
.generate-status.error { color: #a24735; }
.writer-result[hidden] { display: none; }
.result-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid #e7eae6; }
.result-heading span { color: var(--muted); font-size: 12px; }
.quality-warning { margin-top: 18px; padding: 13px 15px; color: #765510; background: #fff8df; border: 1px solid #ead89c; border-radius: 10px; font-size: 13px; line-height: 1.65; }
.result-metrics { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.result-metrics[hidden] { display: none; }
.result-metrics span { padding: 7px 10px; color: #55665b; background: #eff3ef; border-radius: 8px; font-size: 12px; }
.result-metrics strong { color: var(--green); }
.comparison-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 22px; align-items: start; }
.comparison-grid.single-column { grid-template-columns: 1fr; }
.comparison-pane { min-width: 0; padding: 24px; background: #fafbf9; border: 1px solid #e1e6e1; border-radius: 15px; }
.source-pane { background: #f6f4ef; border-color: #e4dfd4; }
.pane-label { margin: 0 0 16px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.writer-result .comparison-pane h1, .writer-result .comparison-pane h2, .writer-result .comparison-pane h3 { margin: 0 0 20px; font-family: Georgia, "Songti SC", serif; font-size: 24px; line-height: 1.5; }
.comparison-pane h3 a { color: var(--ink); text-decoration: none; }
.comparison-pane .source-body { max-height: none; overflow: visible; padding: 0; background: transparent; }
.copy-button, .secondary-button { min-height: 38px; padding: 0 14px; color: var(--green); background: #f4f7f3; border: 1px solid #cbd6ce; border-radius: 9px; font-weight: 750; cursor: pointer; }
.writer-result h1, .writer-result h2 { margin: 26px 0 22px; font-family: Georgia, "Songti SC", serif; font-size: 28px; line-height: 1.45; }
.result-body { color: #303a33; font-family: Georgia, "Songti SC", serif; font-size: 16px; line-height: 2; }
.result-body p { margin: 0 0 18px; white-space: pre-line; }
.result-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.result-tags span { padding: 6px 9px; color: #55665b; background: #eff3ef; border-radius: 7px; font-size: 12px; }
.secondary-button { margin-top: 22px; }
.writer-recent { margin-top: 12px; }
.history-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 18px; }
.history-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; color: var(--ink); background: #f8faf7; border: 1px solid #e2e7e2; border-radius: 12px; text-decoration: none; }
.history-item div { min-width: 0; }
.history-item strong, .history-item small { display: block; }
.history-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.history-item small { overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.history-item.quality-failed { background: #fffaf0; border-color: #eadcad; }
.history-status { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; font-size: 10px; font-weight: 750; vertical-align: 1px; }
.history-status.success { color: #2c7547; background: #deeddf; }
.history-status.failed { color: #805e18; background: #f5e8bd; }
.history-item small.history-failure-reason { color: #805e18; text-overflow: clip; white-space: normal; line-height: 1.5; }
.history-item time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.history-shell { max-width: 980px; }
.history-title { display: flex; align-items: end; justify-content: space-between; }
.history-title h1 { font-size: 42px; }
.history-title > span { color: var(--muted); font-size: 13px; }
.history-search { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.full-history { margin-top: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding-top: 12px; }
.pagination a { color: var(--green); font-weight: 750; text-decoration: none; }
.pagination span { color: var(--muted); font-size: 12px; }
.result-shell { width: min(100% - 40px, 1180px); max-width: none; }
.static-result { padding: clamp(22px, 5vw, 46px); }
.prompt-snapshot { margin-top: 2px; }
.prompt-snapshot-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; }
.prompt-snapshot-actions form { margin: 0; }
.prompt-snapshot-actions .primary-button { min-height: 38px; padding: 0 14px; }
.secondary-link { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; color: var(--green); background: #f4f7f3; border: 1px solid #cbd6ce; border-radius: 9px; font-size: 13px; font-weight: 750; text-decoration: none; }
.prompt-snapshot pre { overflow: auto; max-height: 560px; margin: 20px 0 0; padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; color: #303a33; background: #f7f9f6; border: 1px solid #e1e6e1; border-radius: 12px; font-size: 13px; line-height: 1.75; }
.source-body { max-height: 520px; overflow-y: auto; padding: 18px; color: #59625c; background: #f7f9f6; border-radius: 12px; font-family: Georgia, "Songti SC", serif; font-size: 14px; line-height: 1.9; }
.source-body p { margin: 0 0 14px; white-space: pre-line; }
.source-body p:last-child { margin-bottom: 0; }

@media (max-width: 760px) {
    .shell { width: min(100% - 20px, 900px); padding-top: 10px; }
    .hero { min-height: 300px; padding: 32px 24px; border-radius: 24px; }
    .hero::before { width: 180px; height: 180px; top: -100px; right: -50px; }
    .hero::after { right: 22px; }
    .brand-mark { margin-bottom: 46px; }
    .hero h1 { font-size: 45px; }
    .content-section, .archive-section { padding: 48px 4px 0; }
    .section-heading { align-items: center; }
    .article-card { grid-template-columns: 34px 1fr; gap: 12px; padding: 18px 16px; }
    .article-actions { grid-column: 2; flex-wrap: wrap; }
    .open-button, .mimic-button { min-height: 40px; }
    .archive-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-header { width: min(100% - 24px, 1120px); padding-top: 24px; }
    .admin-header h1 { font-size: 26px; }
    .admin-shell { width: min(100% - 20px, 1120px); }
    .panel { padding: 20px 16px; border-radius: 18px; }
    .panel-heading { display: block; }
    .panel-heading p { margin-top: 12px; }
    .create-form { grid-template-columns: 1fr; }
    .user-create-form { grid-template-columns: 1fr; }
    .usage-filter, .usage-totals { grid-template-columns: 1fr; }
    .admin-record { grid-template-columns: 36px 1fr; align-items: start; }
    .record-controls { grid-column: 2; flex-wrap: wrap; }
    .edit-form { position: fixed; top: 50%; right: 16px; left: 16px; width: auto; transform: translateY(-50%); }
    .admin-nav { gap: 10px; }
    .writer-header { width: min(100% - 24px, 980px); padding: 20px 0; }
    .writer-header nav { gap: 10px; }
    .writer-header nav a, .writer-header .link-button { font-size: 12px; }
    .writer-shell { width: min(100% - 20px, 900px); padding-top: 14px; }
    .writer-workspace { width: min(100% - 20px, 1180px); }
    .writer-intro h1 { font-size: 38px; }
    .writer-card, .writer-result, .writer-recent { padding: 20px 16px; border-radius: 16px; }
    .writer-controls, .history-search { grid-template-columns: minmax(0, 1fr); }
    .writer-generate-button { width: 100%; }
    .prompt-editor-heading, .prompt-snapshot-heading { display: grid; }
    .prompt-editor-actions, .prompt-snapshot-actions { justify-content: flex-start; }
    .prompt-editor textarea { min-height: 360px; }
    .writer-result h1, .writer-result h2 { font-size: 23px; }
    .comparison-grid { grid-template-columns: 1fr; }
    .comparison-pane { padding: 20px 16px; }
    .history-item { align-items: flex-start; }
    .history-item time { display: none; }
    .history-title h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
