* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #f1f4fa; --ink: #222d44; --muted: #53627a; --panel: #fff;
  --frost: #ecf3fc; --line: #d7e0ed; --accent: #54449b; --accent-ink: #fff;
  --error: #973d4b; --shadow: 0 12px 35px #28374e0c;
  font: 15px/1.55 "Segoe UI", "Microsoft YaHei UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151a29; --ink: #eef0fb; --muted: #bdc6db; --panel: #20283b;
  --frost: #29334c; --line: #424e69; --accent: #c5b6fc; --accent-ink: #231841;
  --error: #ffadb8; --shadow: none;
}
body { margin: 0; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
.masthead { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px,4vw,56px); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand span { color: var(--accent); font-size: 30px; }
.brand strong { display: block; font-size: clamp(15px,3vw,19px); }
small { color: var(--muted); display: block; }
.brand small { letter-spacing: .18em; }
.shell { display: grid; grid-template-columns: minmax(145px,200px) minmax(0,1fr); gap: 28px; max-width: 1400px; margin: auto; padding: 28px clamp(16px,4vw,56px); }
.side { align-self: start; position: sticky; top: 20px; }
nav { display: grid; gap: 8px; margin-bottom: 18px; }
nav button { text-align: left; }
nav button[aria-current] { background: var(--frost); border-color: var(--accent); color: var(--accent); font-weight: 650; }
h1, h2, h3, p { margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { font-size: clamp(24px,4vw,34px); }
h2 { font-size: 19px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; padding: clamp(14px,2.5vw,25px); box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.login { width: min(420px,calc(100% - 32px)); margin: 8vh auto; }
form, .stack { display: grid; gap: 14px; }
label { display: grid; gap: 5px; min-width: 0; }
input, textarea, select, button, .button { font: inherit; color: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; background: var(--panel); }
textarea { min-height: 105px; resize: vertical; }
.markdown { min-height: 290px; }
button, .button { cursor: pointer; min-height: 42px; }
button:hover, .button:hover { border-color: var(--accent); }
button:disabled { opacity: .6; cursor: wait; }
.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
button.danger, [data-error] { color: var(--error); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
a.button { text-decoration: none; display: inline-flex; align-items: center; }
.toolbar, .actions, .record, .pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar { margin: 12px 0; }
.record { justify-content: space-between; border-bottom: 1px solid var(--line); padding: 10px 0; }
.record:last-child { border-bottom: 0; }
.record>div:first-child { flex: 1; min-width: 10rem; overflow-wrap: anywhere; }
.record picture, .record img { display: block; width: 62px; height: 58px; object-fit: contain; background: var(--frost); border-radius: 6px; }
.preview-image { width: min(100%,340px); height: 230px; object-fit: contain; background: var(--frost); border-radius: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,190px),1fr)); gap: 12px; }
.stat strong { display: block; font-size: 24px; color: var(--accent); }
.stat { margin: 0; }
.pager { margin-top: 12px; }
.preview { overflow-wrap: anywhere; }
.preview pre { overflow: auto; background: var(--frost); padding: 10px; }
.preview blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 12px; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; }
.media-order { align-items: start; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.media-order img { width: 100%; height: 112px; object-fit: contain; background: var(--frost); }
.media-order small, .release-diff small { overflow-wrap: anywhere; }
.release-diff { padding: 8px 0; border-bottom: 1px solid var(--line); }
.release-diff summary { cursor: pointer; overflow-wrap: anywhere; }
.diff-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.diff-columns pre { margin: 4px 0; padding: 8px; background: var(--frost); white-space: pre-wrap; overflow-wrap: anywhere; }
#notice:not(:empty) { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px clamp(16px,4vw,56px); }
.skip { position: absolute; left: 16px; top: -100px; background: var(--panel); padding: 10px; z-index: 3; }
.skip:focus { top: 6px; }
@media (max-width: 710px) {
  .shell { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; }
  .side { position: static; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
  nav { display: flex; flex-wrap: wrap; margin: 0; }
  .record>div:first-child { min-width: min(100%,7rem); }
}
