:root {
  color-scheme: light dark;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  --page: #f5f6f7;
  --surface: #fefefe;
  --subtle: #f0f3f3;
  --text: #232a2d;
  --secondary: #535f64;
  --muted: #637075;
  --border: #d9e0e2;
  --divider: #e8edef;
  --accent: #126859;
  --accent-hover: #0d5448;
  --accent-soft: #e7f3ee;
  --on-accent: #fefefe;
  --focus: #298773;
  --blue-bg: #edf2fc;
  --blue-text: #345c91;
  --amber-bg: #fff3dc;
  --amber-text: #80591c;
  --red-bg: #fceceb;
  --red-text: #9d3c38;
  --shadow: 0 3px 14px #253e3405;
  color: var(--text);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button, a, input, textarea, .image-picker { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 10px 16px; min-height: 44px; white-space: nowrap; font-size: 14px; font-weight: 550; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):hover { background: var(--subtle); }
button:not(:disabled):active { transform: translateY(1px); }
:where(button, a, input, textarea):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button img { flex: 0 0 auto; display: block; }
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1120px; min-height: 76px; margin: 0 auto; padding: 14px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { color: var(--text); text-decoration: none; font-size: 25px; font-weight: 750; white-space: nowrap; }
.brand span { display: inline-block; border-left: 1px solid var(--border); padding-left: 17px; margin-left: 15px; color: var(--accent); font-size: 14px; font-weight: 600; vertical-align: middle; }
#identity { display: flex; align-items: center; gap: 22px; min-width: 0; }
.account { display: grid; gap: 3px; min-width: 0; text-align: right; }
.account-label { font-size: 11px; color: var(--muted); }
#account-name { font-size: 13px; font-weight: 600; max-width: 180px; overflow-wrap: anywhere; }
.plain { background: transparent; color: var(--secondary); border-color: var(--border); font-size: 12px; min-height: 36px; padding: 7px 12px; }
main { max-width: 1040px; margin: 0 auto; padding: 0 32px 56px; }
#workspace { padding-top: 42px; }
h1 { font-size: 28px; line-height: 1.4; font-weight: 650; margin: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.text-icon, .icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; }
.text-icon { min-height: 42px; }
.icon { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; }
.primary, .accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.primary:not(:disabled):hover, .accent:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.accent img { filter: invert(1); }
#add-submission { padding-inline: 20px; box-shadow: 0 2px 4px #12382b12; }
.status-tabs { display: flex; gap: 18px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--border) transparent; border-bottom: 1px solid var(--border); max-width: 100%; }
.status-tabs [role=tab] { flex: 0 0 auto; min-width: 60px; min-height: 49px; padding: 11px 7px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--secondary); font-size: 14px; font-weight: 500; }
.status-tabs [role=tab]:not(:disabled):hover { background: transparent; color: var(--accent); }
.status-tabs [role=tab][aria-selected=true] { border-bottom-color: var(--accent); color: var(--accent); font-weight: 650; }
.status-tabs [role=tab]:focus-visible { outline-offset: -4px; }
.records-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; margin: 18px 0 16px; }
#total { color: var(--secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
.records-toolbar .icon { border-color: transparent; background: transparent; }
#records { display: grid; gap: 16px; }
.record { min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 24px 26px 0; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.record-header { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.record h2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0; font-size: 18px; font-weight: 650; line-height: 1.55; margin: 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 27px; padding: 4px 10px; border-radius: 4px; white-space: nowrap; font-size: 12px; line-height: 1.5; font-weight: 600; background: var(--subtle); color: var(--secondary); }
.badge.published { background: var(--accent-soft); color: var(--accent); }
.badge.generating, .badge.publishing { background: var(--blue-bg); color: var(--blue-text); }
.badge.failed { background: var(--red-bg); color: var(--red-text); }
.badge.unknown { background: var(--amber-bg); color: var(--amber-text); }
.publication-detail { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 7px 0 20px; }
.record-summary { min-width: 0; margin-bottom: 22px; }
.record-summary.has-image { display: grid; grid-template-columns: minmax(0,1fr) 108px; column-gap: 26px; align-items: start; }
.record-keyword { font-size: 13px; line-height: 1.6; color: var(--accent); margin: 0 0 10px; grid-column: 1; }
.record-copy { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-wrap; font-size: 14px; line-height: 1.85; color: var(--secondary); margin: 0; grid-column: 1; }
.record-image { grid-column: 2; grid-row: 1 / span 2; width: 108px; height: 108px; }
.record-image img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--subtle); border: 1px solid var(--divider); border-radius: 6px; }
.record-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 65px; padding: 10px 0; border-top: 1px solid var(--divider); }
.record-meta { display: flex; flex-wrap: wrap; gap: 5px 16px; color: var(--muted); font-size: 12px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.record-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.record-actions button, .record-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: transparent; border: 1px solid transparent; border-radius: 6px; min-height: 40px; font-size: 13px; font-weight: 550; color: var(--accent); padding: 8px 6px; text-decoration: none; }
.record-actions a:hover { background: var(--subtle); }
.record-actions .withdraw { color: var(--red-text); }
.record-actions img { width: 16px; height: 16px; }
.publication-error { white-space: pre-wrap; }
.detail-title { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 24px; }
.detail-title h2 { min-width: 0; margin: 0; font-size: 24px; font-weight: 650; line-height: 1.6; overflow-wrap: anywhere; }
.detail-section { padding: 24px 0; border-top: 1px solid var(--border); min-width: 0; }
.detail-section h3 { margin: 0 0 14px; font-size: 14px; font-weight: 650; }
.detail-section p { margin: 0 0 14px; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.detail-result > p { color: var(--secondary); }
.detail-result .publication-error { color: var(--red-text); }
.detail-meta { display: grid; grid-template-columns: 118px minmax(0,1fr); gap: 12px 22px; margin: 24px 0 0; font-size: 13px; line-height: 1.8; }
.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 36px; }
.detail-copy p { white-space: pre-wrap; }
.detail-media img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 24px; border-top: 1px solid var(--border); }
.detail-actions .danger { color: var(--red-text); }
#detail-retry { margin-top: 18px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 28px; font-size: 13px; color: var(--secondary); }
#page-label { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.pagination .icon { background: var(--surface); }
.empty { padding: 76px 24px; text-align: center; color: var(--muted); font-size: 14px; margin: 0; border: 1px dashed var(--border); border-radius: 8px; }
.skeleton { padding-bottom: 24px; box-shadow: none; }
.skeleton-line { height: 13px; border-radius: 3px; background: var(--subtle); margin-bottom: 14px; }
.skeleton-line:first-child { height: 20px; width: 36%; margin-bottom: 24px; }
.skeleton-line:last-child { width: 62%; margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.login-view { max-width: 420px; margin: 76px auto 0; padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.login-view h1 { font-size: 24px; margin-bottom: 28px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 24px 0 10px; line-height: 1.6; }
.login-view label:first-child { margin-top: 0; }
.optional { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
input:not([type=file]), textarea { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 12px 14px; font-size: 15px; outline: none; }
input:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled { background: var(--subtle); }
textarea { display: block; resize: vertical; min-height: 300px; line-height: 1.9; padding: 18px; }
.primary { min-height: 46px; }
.login-view .primary { width: 100%; margin-top: 28px; }
#compose-view { margin: 0 auto; }
#compose-view .section-title { margin-bottom: 32px; }
#submission-form { padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 236px; gap: 32px; align-items: start; }
.editor-fields, .editor-media { min-width: 0; }
.editor-fields .field:first-child label, .editor-media .label-row label { margin-top: 0; }
.editor-media { border-left: 1px solid var(--divider); padding-left: 26px; }
.required { color: var(--red-text); margin-left: 4px; }
.field-error { color: var(--red-text); font-size: 13px; line-height: 1.7; margin: 10px 0 0; }
.image-hint { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 12px 0 0; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.label-row label { min-width: 0; }
.label-row output, .label-row > span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.asset-area { display: flex; flex-direction: column; gap: 12px; }
.image-picker { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; margin: 0; width: 100%; height: 210px; border: 1px dashed var(--border); border-radius: 6px; background: var(--subtle); color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500; }
.image-picker:hover { border-color: var(--accent); }
.has-photo .image-picker { height: 40px; flex-direction: row; background: transparent; border-style: solid; gap: 8px; }
.has-photo .image-picker img { width: 18px; height: 18px; }
.has-photo .images-grid { order: -1; }
.file-input:focus-visible + .asset-area .image-picker { outline: 2px solid var(--focus); outline-offset: 3px; }
.file-input:disabled + .asset-area .image-picker { opacity: .45; cursor: not-allowed; }
.images-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; width: 100%; }
.record-image { position: relative; }
.image-total { position: absolute; right: 4px; bottom: 4px; background: var(--surface); color: var(--text); border: 1px solid var(--divider); padding: 2px 5px; font-size: 11px; border-radius: 4px; }
.images-grid:empty { display: none; }
.image-item { position: relative; min-width: 0; }
.image-item > img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--subtle); border: 1px solid var(--border); border-radius: 6px; }
.remove { display: flex; align-items: center; justify-content: center; position: absolute; right: 5px; top: 5px; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.remove img { width: 16px; height: 16px; }
.image-state { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-footer .primary { min-width: 148px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.7; }
#notice { font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
#notice:empty { display: none; }
#notice:not(:empty) { padding: 12px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin: 24px 0 0; }
#notice.error { background: var(--red-bg); color: var(--red-text); }

@media (prefers-color-scheme: dark) {
  :root {
    --page: #141819;
    --surface: #1c2224;
    --subtle: #293133;
    --text: #edf2f1;
    --secondary: #bdc9cc;
    --muted: #a1b0b4;
    --border: #384347;
    --divider: #303a3e;
    --accent: #8ad6bb;
    --accent-hover: #a1e1ca;
    --accent-soft: #233f35;
    --on-accent: #123629;
    --focus: #8ad6bb;
    --blue-bg: #26354b;
    --blue-text: #b2ccf3;
    --amber-bg: #423721;
    --amber-text: #e9cd8b;
    --red-bg: #482e30;
    --red-text: #f1b4b1;
    --shadow: none;
  }
  .icon img, .text-icon:not(.accent) img, .record-actions img, .remove img, .image-picker img { filter: invert(1); }
  .accent img { filter: none; }
}

@media (max-width: 768px) {
  .header-inner { padding: 14px 24px; min-height: 70px; }
  main { padding: 0 24px 40px; }
  #workspace { padding-top: 30px; }
  .record-footer { align-items: start; }
  .record-meta { gap: 3px 12px; }
  .record-summary.has-image { grid-template-columns: minmax(0,1fr) 88px; column-gap: 20px; }
  .record-image { width: 88px; height: 88px; }
  .editor-layout { grid-template-columns: 1fr; gap: 28px; }
  .detail-layout { grid-template-columns: 1fr; gap: 0; }
  .detail-media img { max-width: 400px; }
  .editor-media { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--divider); }
  .image-picker { height: 180px; }
  .image-item > img { height: auto; aspect-ratio: 1; }
}
@media (max-width: 520px) {
  .header-inner { padding: 14px 18px; gap: 16px; min-height: 68px; flex-wrap: wrap; }
  .brand { font-size: 22px; }
  .brand span { font-size: 12px; margin-left: 9px; padding-left: 10px; }
  #identity { gap: 12px; }
  .account-label { display: none; }
  #account-name { font-size: 12px; max-width: 84px; }
  .plain { padding: 6px 8px; min-height: 34px; font-size: 11px; }
  main { padding: 0 16px 36px; }
  #workspace { padding-top: 26px; }
  h1 { font-size: 23px; }
  .section-title { margin-bottom: 18px; gap: 12px; }
  .text-icon { padding-inline: 12px; font-size: 13px; }
  #add-submission { padding-inline: 16px; }
  .status-tabs { gap: 9px; }
  .status-tabs [role=tab] { min-width: 58px; font-size: 13px; }
  .records-toolbar { margin-top: 12px; margin-bottom: 12px; }
  #records { gap: 14px; }
  .record { padding: 18px 17px 0; }
  .record-header { gap: 14px; }
  .record h2 { font-size: 16px; }
  .publication-detail { margin-bottom: 16px; font-size: 12px; }
  .badge { padding: 4px 8px; }
  .record-summary { margin-bottom: 18px; }
  .record-summary.has-image { grid-template-columns: minmax(0,1fr) 72px; column-gap: 14px; }
  .record-image { width: 72px; height: 72px; }
  .record-keyword { font-size: 12px; margin-bottom: 8px; }
  .record-copy { font-size: 13px; line-height: 1.85; }
  .record-footer { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 0 7px; }
  .record-meta { font-size: 11px; gap: 3px 12px; }
  .record-actions { justify-content: space-between; }
  .record-actions button, .record-actions a { padding-inline: 0; }
  .detail-title h2 { font-size: 20px; }
  .detail-meta { grid-template-columns: 90px minmax(0,1fr); gap: 10px 14px; }
  .login-view { margin-top: 44px; padding: 26px; }
  .login-view h1 { font-size: 23px; }
  #compose-view .section-title { margin-bottom: 28px; }
  textarea { min-height: 270px; padding: 14px; }
  .form-footer { flex-direction: column; align-items: stretch; gap: 12px; }
  #submission-form { padding: 20px 18px; }
}
@media (max-width: 359px) {
  .header-inner { padding-inline: 16px; flex-wrap: wrap; gap: 9px; }
  #identity { margin-left: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .image-picker { transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
}
