:root {
  --ink: #172127;
  --muted: #68747b;
  --paper: #f3eee3;
  --card: #fffdf8;
  --red: #b83a32;
  --red-dark: #85312d;
  --green: #28745c;
  --line: #dcd3c2;
  --gold: #bd8426;
  --shadow: rgba(76, 58, 36, .11);
}
.statistics-cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin:22px 0; }
.statistics-cards > div { padding:22px; border:1px solid var(--line); border-radius:18px; background:#fffdf8; display:flex; flex-direction:column; gap:7px; }
.statistics-cards strong { color:var(--red); font-size:30px; }
.statistics-cards span { color:var(--muted); }
.statistics-table { padding:24px; border:1px solid var(--line); border-radius:18px; background:#fffdf8; }
.statistics-table table { width:100%; margin-top:16px; border-collapse:collapse; }
.statistics-table th,.statistics-table td { padding:12px; border-bottom:1px solid var(--line); text-align:left; }
.statistics-phase { margin:0 0 18px; padding:16px 18px; border-left:5px solid var(--gold); background:#fff7df; color:#6f5625; line-height:1.65; }
.statistics-phase.official { border-left-color:var(--green); background:#edf8f2; color:#245d49; }
.statistics-phase strong { display:block; margin-bottom:3px; color:inherit; }
.statistics-start-official { margin:12px 0 0; display:block; }
.statistics-toolbar { display:flex; align-items:flex-end; gap:12px; }
.statistics-toolbar label { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px; }
.statistics-tabs { display:flex; gap:8px; margin:20px 0; padding:5px; border:1px solid var(--line); border-radius:14px; background:#eee8df; }
.statistics-tabs button { min-width:90px; padding:10px 18px; border:0; border-radius:10px; background:transparent; color:var(--muted); font-weight:700; }
.statistics-tabs button.active { color:#fff; background:var(--red); }
.statistics-blocks { display:grid; gap:18px; }
.statistics-table { overflow-x:auto; }
.statistics-table h2 { margin:0; font-size:19px; }
.statistics-table p { margin:6px 0 0; color:var(--muted); font-size:12px; }
.statistics-table td.long-copy { max-width:360px; line-height:1.55; }
.statistics-zero-note { margin:18px 0; padding:18px; border:1px dashed var(--line); color:var(--muted); background:rgba(255,253,248,.7); line-height:1.7; }
* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(111, 88, 57, .035) 1px, transparent 1px),
    radial-gradient(circle at 12% 5%, #fffaf0 0, transparent 28%),
    var(--paper);
  background-size: 100% 28px, auto, auto;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
}
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0 auto 0 max(18px, calc(50% - 550px));
  width: 1px;
  background: rgba(184, 58, 50, .15);
  pointer-events: none;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(184, 58, 50, .2);
  outline-offset: 2px;
}
.app-shell { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 72px; }
body.admin-open .app-shell { width: min(1600px, calc(100% - 48px)); }
body.admin-open::before { left: max(18px, calc(50% - 800px)); }
.screen { animation: appear .42s cubic-bezier(.2,.78,.26,1); }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 9px; color: var(--red); font-family: Arial, sans-serif; font-size: 12px; letter-spacing: .16em; font-weight: 700; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(48px, 8vw, 82px); line-height: 1; letter-spacing: .1em; }
h2 { margin: 0; font-size: 21px; }
.subtitle { margin: 16px 0 30px; color: var(--muted); font-size: 18px; line-height: 1.7; }
.masthead, .library-header, .game-header, .section-heading, .setting-row, .list-meta, .panel-title, .dialog-title, .dialog-actions, .ending-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.welcome-screen { padding-top: 4vh; }
.masthead { align-items: flex-start; }
.intro-card, .copy-card, .feedback, .play-settings, .result-board {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(70, 50, 27, .08), 7px 8px 0 var(--shadow);
}
.intro-card, .play-settings, .copy-card, .feedback, .result-board, .library-item, .period-panel { border-radius: 12px; overflow: hidden; }
.intro-card { max-width: 760px; margin-top: 34px; padding: 22px 26px; line-height: 1.9; }
.intro-card p { margin: 0; }
.rules { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.rules span { padding: 4px 10px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.section-heading { margin: 42px 0 16px; align-items: flex-end; }
.section-heading > div { display: flex; align-items: baseline; gap: 12px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.section-heading.compact { margin: 0 0 20px; }
.step-no { color: var(--red); font: 12px Arial, sans-serif; font-weight: bold; }
.period-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  max-height: 430px;
  padding: 3px 8px 8px 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}
.period-grid::-webkit-scrollbar { width: 7px; }
.period-grid::-webkit-scrollbar-track { background: transparent; }
.period-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
.period-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.3fr) 76px;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  padding: 17px 58px 17px 20px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .72);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(67, 48, 27, .035);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.period-card:hover { transform: translateX(5px); border-color: #b9aa94; background: var(--card); box-shadow: 0 12px 28px rgba(67,48,27,.08); }
.period-card.selected {
  border-color: var(--red);
  background: var(--card);
  box-shadow: inset 4px 0 0 var(--red), 4px 4px 0 rgba(184, 58, 50, .1);
}
.period-card.selected::after {
  content: "✓";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  transform: translateY(-50%);
  font: bold 14px Arial, sans-serif;
}
.period-card h3 { margin: 0; font-size: 18px; line-height: 1.45; }
.period-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.period-card small { margin: 0; color: var(--red); text-align: right; white-space: nowrap; font-family: Arial, sans-serif; }
.empty-card { padding: 30px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.play-settings { margin-top: 22px; padding: 22px 24px; }
.setting-row { justify-content: flex-start; }
.setting-row > label:first-child { display: grid; gap: 7px; min-width: 270px; color: var(--muted); font-size: 13px; }
.check-setting { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.check-setting input { width: 18px; height: 18px; accent-color: var(--red); }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
}
textarea { resize: vertical; line-height: 1.65; }
.primary-btn, .secondary-btn, .ghost-btn, .mini-btn, .icon-btn {
  border: 0;
  color: inherit;
  background: transparent;
}
.primary-btn {
  padding: 13px 26px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(184,58,50,.17), 4px 4px 0 var(--red-dark);
  font-weight: 700;
}
.primary-btn:hover { transform: translate(1px, 1px); box-shadow: 3px 3px 0 var(--red-dark); }
.secondary-btn {
  padding: 11px 17px;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--card);
  font-weight: 700;
  white-space: nowrap;
}
.secondary-btn:hover { color: #fff; background: var(--red); }
.hero-btn { margin-top: 26px; font-size: 17px; }
.hero-btn span, .ghost-btn span { margin-left: 12px; }
.ghost-btn { padding: 8px 2px; color: var(--muted); border-bottom: 1px solid currentColor; white-space: nowrap; }
.ghost-btn:hover { color: var(--red); }
.source-note { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* Game */
.game-screen { width: min(780px, 100%); margin: 0 auto; }
.game-header h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.game-header h2 small { color: var(--muted); font: 12px Arial, sans-serif; letter-spacing: .05em; }
.status { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font: 14px Arial, sans-serif; }
.lives { display: flex; gap: 6px; }
.lives i { width: 10px; height: 10px; background: var(--red); border-radius: 50%; transition: .2s; }
.lives i.lost { background: #d5cfc3; transform: scale(.75); }
.progress { height: 8px; margin: 24px 0 30px; overflow: hidden; border-radius: 10px; background: #dfd7c8; box-shadow: inset 0 1px 3px rgba(61,43,23,.12); }
.progress span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--gold), var(--red)); transition: width .35s cubic-bezier(.2,.8,.3,1); }
.copy-card { position: relative; padding: 28px 31px 33px; border-top: 5px solid var(--red); }
.copy-card::after { content: "校样"; position: absolute; right: 8px; bottom: -26px; color: rgba(97,70,39,.04); font-size: 110px; font-weight: 900; line-height: 1; pointer-events: none; }
.copy-topline { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 10px; }
.copy-label, .copy-topline span { margin: 0; color: var(--muted); font: 11px Arial, sans-serif; letter-spacing: .12em; }
.copy-topline span { color: var(--red); }
.copy-card blockquote { margin: 0; font-size: clamp(18px, 3.5vw, 23px); line-height: 1.85; }
.question-area { margin-top: 30px; }
.question { margin: 0 0 14px; font-weight: 700; }
.options { display: grid; gap: 12px; }
.option { position: relative; width: 100%; padding: 16px 18px 16px 52px; color: var(--ink); text-align: left; line-height: 1.55; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 253, 248, .72); box-shadow: 0 7px 18px rgba(67,48,27,.035); transition: transform .15s, border-color .15s, background .15s, box-shadow .15s; }
.option::before { content: attr(data-key); position: absolute; left: 17px; top: 15px; width: 23px; height: 23px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); font: 12px Arial, sans-serif; }
.option:hover:not(:disabled) { transform: translateX(5px); border-color: var(--red); background: #fff9ef; box-shadow: 0 10px 24px rgba(184,58,50,.09); }
.option:disabled { cursor: default; }
.option.correct { color: #13543f; border-color: var(--green); background: #edf7f1; animation: web-correct .42s ease; }
.option.correct::before { color: #fff; border-color: var(--green); background: var(--green); }
.option.wrong { color: #932c25; border-color: var(--red); background: #fff0ec; animation: web-wrong .38s ease; }
.option.wrong::before { color: #fff; border-color: var(--red); background: var(--red); }
.feedback { display: grid; grid-template-columns: 42px 1fr; gap: 16px; margin-top: 24px; padding: 21px 24px; border-left: 5px solid var(--green); line-height: 1.75; }
.feedback-enter { animation: feedback-up .4s cubic-bezier(.2,.8,.3,1); }
.feedback.bad { border-left-color: var(--red); }
.feedback-mark { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 50%; }
.feedback-mark::after { content: "✓"; font: bold 19px Arial, sans-serif; }
.feedback.bad .feedback-mark { background: var(--red); }
.feedback.bad .feedback-mark::after { content: "×"; }
.feedback p { margin: 0; }
#result-title { margin-bottom: 5px; font-weight: 700; font-size: 17px; }
.feedback .primary-btn { margin-top: 16px; }

/* Ending */
.ending-screen { position: relative; width: min(780px, 100%); margin: 0 auto; padding-top: 4vh; text-align: center; }
.ending-screen::before { content: "终审"; position: absolute; right: 5%; top: 2%; width: 72px; height: 72px; display: grid; place-items: center; color: var(--red); border: 4px double var(--red); border-radius: 50%; font-weight: 900; transform: rotate(10deg); opacity: .78; }
.ending-celebrate .result-board { animation: result-pop .65s cubic-bezier(.18,.85,.25,1.12); }
.result-board { display: grid; grid-template-columns: 2fr 1fr; max-width: 520px; margin: 20px auto 28px; }
.final-score, .accuracy { display: flex; align-items: baseline; justify-content: center; gap: 9px; padding: 20px; }
.accuracy { border-left: 1px solid var(--line); }
.final-score strong { color: var(--red); font: 50px Arial, sans-serif; }
.accuracy strong { color: var(--green); font: 28px Arial, sans-serif; }
.final-score small, .final-score span, .accuracy span { color: var(--muted); }
.review-list { display: grid; gap: 9px; text-align: left; }
.review { padding: 13px 15px; border-left: 4px solid var(--green); background: var(--card); line-height: 1.55; font-size: 14px; }
.review.missed { border-left-color: var(--red); }
.review b { display: block; margin-bottom: 4px; }
.review span { color: var(--muted); }
.ending-actions { justify-content: center; margin-top: 28px; }
.ending-actions .primary-btn { margin: 0; }

/* Admin */
.library-title { font-size: clamp(40px, 7vw, 65px); }
.library-header { align-items: flex-start; }
.admin-tabs { display: flex; gap: 28px; margin: 4px 0 25px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.admin-tabs button { position: relative; padding: 8px 1px; color: var(--muted); border: 0; background: transparent; font-size: 15px; font-weight: 700; }
.admin-tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 3px; background: transparent; }
.admin-tabs button.active { color: var(--red); }
.admin-tabs button.active::after { background: var(--red); }
.admin-layout { display: grid; grid-template-columns: var(--question-sidebar-width, 300px) 8px minmax(0,1fr); gap: 12px; margin-top: 12px; }
.admin-layout.topic-training-mode { grid-template-columns: 1fr; }
.admin-layout.topic-training-mode .period-panel, .admin-layout.topic-training-mode .sidebar-resizer { display: none; }
.topic-training-context { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 17px 19px; border-left: 4px solid var(--red); background: #fff8ef; }
.topic-training-context span { color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.topic-training-context h2 { margin: 5px 0 3px; font-size: 22px; }
.topic-training-context p { margin: 0; color: var(--muted); font-size: 13px; }
.topic-training-context .secondary-btn { flex: 0 0 auto; margin: 0; }
.topic-training-section { border-color: rgba(155, 35, 28, .2) !important; background: #fffaf4 !important; }
.topic-training-section p { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.topic-training-section p .period-status { margin-left: 4px; }
.topic-training-tools { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 11px; }
.topic-training-tools button { padding: 7px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 12px; }
.topic-training-tools .topic-training-action { color: #fff; border-color: var(--red); background: var(--red); font-weight: 700; }
.topic-training-tools .workflow-action { color: var(--green); border-color: rgba(40, 116, 92, .35); font-weight: 700; }
.period-panel, .question-panel { min-width: 0; }
.period-panel { padding: 18px; border: 1px solid var(--line); background: rgba(255, 253, 248, .55); align-self: start; }
.panel-title { margin-bottom: 14px; }
.panel-title h2 { font-size: 17px; }
.mini-btn { padding: 4px 0; color: var(--red); font-size: 13px; border-bottom: 1px solid currentColor; }
.period-filter { position: relative; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 10px; text-align: left; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.period-filter:hover { background: #fff9ef; }
.period-filter.active { color: var(--red); background: var(--card); }
.period-filter b { color: var(--muted); font: 12px Arial, sans-serif; }
.period-filter span { min-width: 0; line-height: 1.5; }
.period-status {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font: normal 10px Arial, sans-serif;
  vertical-align: 1px;
}
.status-draft { color: #765114; background: #fff8e8; }
.status-review { color: #285c75; background: #eef7fb; }
.status-published { color: var(--green); background: #edf7f1; }
.period-admin-item { position: relative; }
.period-sort-note { margin: -2px 8px 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.period-sort-note span { margin-right: 3px; color: var(--red); font-size: 15px; vertical-align: -1px; }
.period-admin-item .period-filter { padding-left: 34px; }
.period-drag-handle { position: absolute; z-index: 3; left: 7px; top: 13px; width: 22px; height: 28px; display: flex; align-items: center; justify-content: center; color: #a39789; border-radius: 5px; font: 19px/1 Arial,sans-serif; cursor: grab; user-select: none; touch-action: none; }
.period-drag-handle:hover, .period-drag-handle:focus-visible { color: var(--red); background: #f8e9e3; outline: none; }
.period-drag-handle:active { cursor: grabbing; }
.period-admin-item.is-dragging { z-index: 8; opacity: .58; background: #fffaf3; box-shadow: 0 12px 25px rgba(67,48,27,.15); }
.period-admin-item.is-dragging::before { content: ""; position: absolute; z-index: 9; left: 0; right: 0; top: -2px; height: 3px; border-radius: 3px; background: var(--red); }
#admin-periods.is-saving-order { opacity: .72; pointer-events: none; }
.period-actions { display: flex; gap: 9px; padding: 5px 10px 9px 34px; border-bottom: 1px solid var(--line); }
.period-actions button { padding: 0; color: var(--muted); border: 0; border-bottom: 1px solid currentColor; background: none; font-size: 12px; }
.period-actions .workflow-action { color: var(--green); font-weight: 700; }
.period-actions button:last-child { color: var(--red); }
.library-tools { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 14px; }
.search-box { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.library-actions { display: flex; align-items: center; gap: 10px; margin: 0 4px 4px 0; }
.library-tools .primary-btn, .library-tools .secondary-btn { margin: 0; }
.list-meta { margin: 22px 0 11px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.list-meta p { margin: 0; color: var(--muted); font-size: 13px; }
#library-context { color: var(--ink); font-weight: 700; }
.library-list { display: grid; gap: 16px; }
.library-item { padding: 0; border: 1px solid var(--line); background: var(--card); transition: transform .16s ease, box-shadow .16s ease; }
.library-item:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(67,48,27,.07); }
.library-item header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); background: rgba(247,242,233,.58); }
.library-item-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.library-question-number { padding-left: 12px; color: var(--muted); border-left: 1px solid var(--line); font-size: 12px; }
.library-item-body { display: grid; gap: 17px; padding: 18px; }
.library-prompt-block h3 { margin: 7px 0 0; color: var(--ink); font-size: 18px; line-height: 1.7; white-space: pre-wrap; }
.library-field-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.library-section-title { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.library-section-title b, .library-explanation-block > b { color: var(--ink); font-size: 13px; }
.library-section-title span { color: var(--green); font-size: 12px; font-weight: 700; }
.library-option-list { display: grid; gap: 8px; }
.library-option { min-height: 48px; padding: 9px 12px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 9px; }
.library-option p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.library-option-letter { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font: 700 13px/1 Arial, sans-serif; }
.library-option-state { min-width: 58px; padding: 4px 7px; border-radius: 20px; font-size: 11px; font-weight: 700; text-align: center; }
.library-option.is-correct { border-color: rgba(40,116,92,.33); background: #f1f8f4; }
.library-option.is-correct .library-option-letter { color: #fff; background: var(--green); }
.library-option.is-correct .library-option-state { color: var(--green); background: #dfeee6; }
.library-option.is-wrong { background: #fffdfa; }
.library-option.is-wrong .library-option-letter { color: var(--red); background: var(--red-soft); }
.library-option.is-wrong .library-option-state { color: #9a625c; background: #f7ebe8; }
.library-explanation-block { padding: 14px 15px; border-left: 4px solid var(--gold); background: #fbf7ed; }
.library-explanation-block p { margin: 7px 0 0; color: #5f574e; font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
.library-contributor { padding-top: 13px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.library-contributor b { color: var(--ink); }
.tag { color: var(--red); font: 11px Arial, sans-serif; letter-spacing: .06em; }
.item-actions { display: flex; gap: 10px; align-items: flex-start; flex: 0 0 auto; }
.item-actions button { padding: 0; color: var(--muted); border: 0; border-bottom: 1px solid currentColor; background: none; font-size: 12px; }
.item-actions button:last-child { color: var(--red); }
.empty-list { padding: 44px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }

.article-admin { min-width: 0; }
.article-tools { margin-top: 4px; }
.layout-management-shell { min-width: 0; }
.layout-management-shell.layout-mode { margin-top: 16px; display: grid; grid-template-columns: var(--layout-sidebar-width, 300px) 8px minmax(0,1fr); align-items: start; gap: 12px; }
.layout-management-content { min-width: 0; }
.sidebar-resizer { position: relative; width: 8px; min-height: 160px; align-self: stretch; cursor: col-resize; touch-action: none; outline: none; }
.sidebar-resizer::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; border-radius: 2px; background: transparent; transition: background .15s ease, box-shadow .15s ease; }
.sidebar-resizer:hover::before, .sidebar-resizer:focus-visible::before, body.sidebar-resizing .sidebar-resizer::before { background: var(--red); box-shadow: 0 0 0 3px rgba(184,58,50,.1); }
.sidebar-resizer::after { content: "⋮"; position: sticky; top: 46vh; display: grid; place-items: center; width: 8px; height: 34px; color: #b9aa96; font: 700 18px/1 Arial,sans-serif; }
.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after { color: var(--red); }
body.sidebar-resizing { cursor: col-resize; user-select: none; }
.layout-directory-panel { position: sticky; top: 76px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,252,246,.92); box-shadow: 0 8px 22px rgba(67,48,27,.055); }
.layout-directory-heading { padding: 16px 15px 13px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); background: #f7f0e5; }
.layout-directory-heading span { color: var(--red); font: 9px/1 Arial,sans-serif; letter-spacing: .12em; }
.layout-directory-heading h2 { margin: 5px 0 0; color: var(--ink); font-size: 19px; }
.layout-directory-heading strong { padding-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.layout-directory-search { margin: 12px 12px 8px; display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.layout-directory-search input { width: 100%; padding: 8px 9px; border: 1px solid var(--line); background: #fffdf9; font: 12px var(--sans); }
.layout-directory-list { max-height: calc(100vh - 270px); padding: 4px 8px 10px; overflow-y: auto; }
.layout-directory-item { width: 100%; min-height: 42px; margin: 0; padding: 8px 8px 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 9px; color: #514a42; border: 0; border-bottom: 1px solid rgba(220,209,193,.7); border-radius: 0; background: transparent; text-align: left; font-size: 12px; }
.layout-directory-item .layout-directory-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-directory-actions { display: inline-flex; flex: 0 0 auto; gap: 2px; opacity: .42; }
.layout-directory-item:hover .layout-directory-actions, .layout-directory-item:focus-visible .layout-directory-actions { opacity: 1; }
.layout-directory-move { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; color: inherit; font: 700 14px/1 Arial,sans-serif; }
.layout-directory-move:not(.disabled):hover, .layout-directory-move:not(.disabled):focus { color: var(--red); background: #fff; outline: none; }
.layout-directory-item.active .layout-directory-move:not(.disabled):hover, .layout-directory-item.active .layout-directory-move:not(.disabled):focus { color: var(--red); }
.layout-directory-move.disabled { opacity: .2; cursor: default; }
.layout-directory-item b { min-width: 26px; padding: 3px 6px; color: var(--muted); border-radius: 10px; background: #eee6da; font: 700 10px/1 Arial,sans-serif; text-align: center; }
.layout-directory-item:hover { color: var(--red); background: #fff4ee; }
.layout-directory-item.active { color: #fff; border-color: var(--red); background: var(--red); font-weight: 700; }
.layout-directory-item.active b { color: var(--red); background: #fff; }
.layout-directory-item.quick { margin-bottom: 7px; border-radius: 7px; background: #f6ead7; }
.layout-directory-item.quick.active { background: var(--red); }
.layout-directory-item.warning:not(.active) { color: #8a5d17; }
.layout-directory-item.all { margin-top: 7px; border-top: 1px solid var(--line); border-bottom: 0; }
.layout-directory-empty { padding: 22px 10px; color: var(--muted); font-size: 12px; text-align: center; }
.layout-mode .list-meta { margin-top: 0; }
.article-list { display: grid; gap: 19px; }
.article-admin-card { border: 1px solid var(--line); background: var(--card); box-shadow: 0 10px 26px rgba(67,48,27,.045); }
.article-admin-card > header { padding: 18px 20px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; border-bottom: 1px solid var(--line); background: rgba(247,242,233,.58); }
.article-admin-heading { min-width: 0; }
.article-admin-heading h2 { margin: 9px 0 7px; font-size: 22px; line-height: 1.45; }
.article-admin-heading > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.article-admin-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.article-featured-badge { padding: 3px 7px; color: #765114; border: 1px solid #d8b56d; background: #fff8e8; font-size: 10px; font-weight: 700; }
.article-topic-badge { padding: 3px 8px; color: #fffaf3; border: 1px solid var(--red); background: var(--red); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.article-layout-badge { padding: 3px 7px; color: #8f2c25; border: 1px solid #dfaaa4; background: #fff0ec; font-size: 10px; font-weight: 700; }
.article-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 280px; }
.article-actions .workflow-action { color: var(--green); font-weight: 700; }
.article-admin-body { display: grid; gap: 18px; padding: 20px; }
.article-admin-body section > b { display: block; margin-bottom: 8px; color: var(--ink); font-size: 13px; }
.article-admin-body section > p { margin: 0; color: #5f574e; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.article-content-preview { max-height: 300px; padding: 15px 17px; overflow-y: auto; color: #453f39; border-left: 4px solid var(--gold); background: #fbf7ed; font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.article-admin-body footer { display: flex; flex-wrap: wrap; gap: 9px 20px; padding-top: 13px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.article-setting-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: end; }
#article-metadata-fields { display: grid; gap: 14px; }
.featured-setting { min-height: 42px; display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
.featured-setting input { width: 18px; height: 18px; }
.article-rights-note { padding: 12px 14px; color: #765114; border: 1px solid #e5c992; background: #fff8e8; font-size: 12px; line-height: 1.65; }
.article-import-note { padding: 11px 13px; color: #765114; border-left: 4px solid var(--gold); background: #fff8e8; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.layout-fields { display: grid; gap: 13px; padding: 15px; border: 1px solid #e0c9a1; background: #fffaf1; }
.layout-upload-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.layout-upload-row input { flex: 1; min-width: 220px; }
.layout-upload-row span { color: var(--muted); font-size: 12px; }
.layout-image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 12px; }
.layout-image-preview-item { margin: 0; padding: 8px; min-width: 0; border: 1px solid var(--line); background: #fff; }
.layout-image-preview-item img { display: block; width: 100%; height: 240px; object-fit: contain; background: #eee9e1; }
.layout-image-preview-item figcaption { margin-top: 7px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.layout-image-caption { width: 100%; min-height: 74px; margin-top: 8px; padding: 8px 9px; box-sizing: border-box; resize: vertical; color: var(--ink); border: 1px solid var(--line); background: #fffdf8; font: 12px/1.55 var(--sans); }
.layout-tag-field { margin-top: 8px; display: grid; gap: 6px; }
.layout-tag-field > b { color: var(--muted); font-size: 11px; }
.layout-tag-options { display: flex; flex-wrap: wrap; gap: 5px; }
.layout-tag-options button { padding: 5px 8px; color: var(--muted); border: 1px solid #d8cec1; border-radius: 13px; background: #f7f1e8; font: 10px/1.2 var(--sans); }
.layout-tag-options button.selected { color: #fffaf3; border-color: #765114; background: #8a6427; }
.layout-common-tag-field { min-width: 0; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.layout-common-tag-field > b { color: var(--muted); font-size: 13px; font-weight: 400; }
.layout-common-tag-field > small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.layout-common-tag-options { align-content: flex-start; gap: 8px; padding: 12px; border: 1px solid var(--line); background: #fffdf8; }
.layout-common-tag-options button { min-width: 58px; min-height: 36px; padding: 8px 13px; border-radius: 18px; font-size: 13px; font-weight: 700; cursor: pointer; }
.article-admin-layout-preview { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 18px; align-items: start; }
.article-admin-layout-preview img { width: 150px; max-height: 210px; object-fit: cover; object-position: top; border: 1px solid var(--line); background: #eee8df; }
.article-list.layout-admin-grid { grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 18px; align-items: start; }
.layout-admin-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 8px 22px rgba(67,48,27,.07); transition: transform .16s ease, box-shadow .16s ease; }
.layout-admin-card.is-selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(155,35,28,.16), 0 13px 30px rgba(67,48,27,.11); }
.layout-admin-selector { position: absolute; z-index: 6; right: 10px; top: 10px; width: 30px; height: 30px; margin: 0; display: grid; place-items: center; cursor: pointer; }
.layout-admin-selector input { position: absolute; opacity: 0; pointer-events: none; }
.layout-admin-selector span { width: 26px; height: 26px; display: grid; place-items: center; color: transparent; border: 2px solid rgba(255,255,255,.96); border-radius: 50%; background: rgba(41,39,37,.5); box-shadow: 0 2px 8px rgba(41,39,37,.2); font: 700 14px/1 Arial,sans-serif; }
.layout-admin-selector:hover span { background: rgba(155,35,28,.72); }
.layout-admin-selector input:checked + span { color: #fff; border-color: var(--red); background: var(--red); }
.layout-admin-card:hover { transform: translateY(-3px); box-shadow: 0 13px 30px rgba(67,48,27,.11); }
.layout-admin-visual { position: relative; width: 100%; height: 330px; margin: 0; padding: 0; display: block; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #e9e3da; cursor: pointer; }
.layout-admin-visual img { width: 100%; height: 100%; display: block; object-fit: contain; background: linear-gradient(145deg,#ede7de,#f8f5ef); transition: transform .22s ease; }
.layout-admin-card:hover .layout-admin-visual img { transform: scale(1.018); }
.layout-admin-no-image { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.layout-admin-status { position: absolute; left: 10px; top: 10px; padding: 4px 7px; border: 1px solid currentColor; border-radius: 3px; font-size: 10px; font-weight: 700; box-shadow: 0 3px 8px rgba(55,39,24,.12); }
.layout-admin-edit-hint { position: absolute; right: 9px; bottom: 9px; padding: 5px 8px; color: #fff; border-radius: 3px; background: rgba(41,39,37,.74); font-size: 10px; opacity: 0; transform: translateY(4px); transition: .16s ease; }
.layout-admin-card:hover .layout-admin-edit-hint, .layout-admin-visual:focus-visible .layout-admin-edit-hint { opacity: 1; transform: none; }
.layout-admin-info { padding: 13px 14px 12px; }
.layout-admin-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.layout-admin-title-row h2 { min-width: 0; margin: 0; overflow: hidden; color: var(--ink); font-size: 17px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.layout-admin-title-row > span { flex: none; padding-top: 3px; color: var(--muted); font-size: 10px; }
.layout-admin-summary { min-height: 38px; margin: 8px 0 0; overflow: hidden; color: #665e56; font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.layout-admin-tags { min-height: 23px; margin-top: 9px; display: flex; flex-wrap: nowrap; gap: 5px; overflow: hidden; }
.layout-admin-tags span { flex: none; padding: 3px 6px; color: #8f2c25; border: 1px solid #e2b5ae; border-radius: 10px; background: #fff2ee; font-size: 9px; white-space: nowrap; }
.layout-admin-meta { margin-top: 10px; padding-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.layout-admin-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-admin-meta span:first-child { min-width: 0; }
.layout-admin-meta span:last-child { flex: none; }
.layout-admin-actions { padding: 9px 12px 11px; display: flex; align-items: center; flex-wrap: wrap; gap: 7px 11px; border-top: 1px solid var(--line); background: rgba(247,242,233,.55); }
.layout-admin-actions button { margin: 0; padding: 0; color: var(--muted); border: 0; border-bottom: 1px solid currentColor; border-radius: 0; background: transparent; font-size: 11px; }
.layout-admin-actions .workflow-action { color: var(--green); font-weight: 700; }
.layout-admin-actions button:last-child { margin-left: auto; color: var(--red); }
.layout-batch-toolbar { position: sticky; z-index: 20; top: 8px; margin: 15px 0 4px; padding: 11px 13px; display: flex; align-items: center; gap: 10px; border: 1px solid #d9c8b0; border-radius: 9px; background: rgba(255,250,242,.97); box-shadow: 0 8px 22px rgba(67,48,27,.08); backdrop-filter: blur(8px); }
.layout-batch-toolbar > label { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 13px; cursor: pointer; }
.layout-batch-toolbar > label input { width: 17px; height: 17px; accent-color: var(--red); }
.layout-batch-toolbar strong { min-width: 68px; color: var(--red); font-size: 13px; }
.layout-selection-hint { color: var(--muted); font-size: 12px; white-space: nowrap; }
.layout-batch-spacer { flex: 1; }
.layout-batch-toolbar button { min-height: 34px; margin: 0; padding: 7px 12px; font-size: 12px; }
.danger-outline-btn { color: var(--red); border: 1px solid var(--red); border-radius: 6px; background: transparent; }
.danger-outline-btn:hover:not(:disabled) { color: #fff; background: var(--red); }
.layout-batch-toolbar button:disabled { opacity: .4; cursor: not-allowed; }
.layout-batch-dialog form { width: min(620px,88vw); }
.batch-dialog-note { margin: 0 0 18px; padding: 11px 13px; color: #6d4b18; background: #fff5df; font-size: 13px; }
.layout-batch-tags { margin: 15px 0; padding: 13px; border: 1px solid var(--line); }
.layout-batch-tags legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.batch-directory-toggle { margin: 14px 0 10px; display: flex; align-items: center; gap: 8px; }
.batch-directory-toggle input { width: 17px; height: 17px; accent-color: var(--red); }
.batch-safety-note { margin-top: 16px; padding: 11px 13px; color: var(--muted); border-left: 3px solid var(--gold); background: #fbf7ed; font-size: 12px; line-height: 1.65; }
@media (max-width: 1000px) {
  .layout-management-shell.layout-mode { --layout-sidebar-width: 240px; gap: 10px; }
  .article-list.layout-admin-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
.hotspot-url { color: var(--red); overflow-wrap: anywhere; }
.hotspot-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.hotspot-stats > div { padding: 18px; border: 1px solid #e4d8c5; background: #fffaf1; text-align: center; }
.hotspot-stats strong { display: block; color: var(--red); font: 700 30px/1 var(--serif); }
.hotspot-stats span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.feedback-admin-list { display: grid; gap: 12px; max-height: 55vh; overflow-y: auto; }
.feedback-admin-item { padding: 15px 16px; border-left: 4px solid var(--red); background: var(--card); }
.feedback-admin-item.handled { border-left-color: var(--green); opacity: .72; }
.feedback-admin-item header { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 12px; }
.feedback-admin-item header b { color: var(--ink); }
.feedback-admin-item p { margin: 11px 0; line-height: 1.75; white-space: pre-wrap; }
.feedback-admin-item button { padding: 0; color: var(--red); border: 0; border-bottom: 1px solid currentColor; background: transparent; font-size: 12px; }
.feedback-admin-item.handled button { color: var(--green); }

/* Dialogs */
dialog { width: min(670px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); border: 0; background: transparent; }
dialog::backdrop { background: rgba(23, 33, 39, .58); backdrop-filter: blur(2px); }
dialog form, .import-sheet { display: grid; gap: 14px; padding: 25px; overflow-y: auto; max-height: calc(100vh - 28px); border: 1px solid var(--line); background: var(--paper); }
dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
dialog label small { color: var(--muted); }
.dialog-title { align-items: flex-start; padding-bottom: 4px; }
.icon-btn { width: 34px; height: 34px; color: var(--muted); font: 26px/1 Arial, sans-serif; }
.icon-btn:hover { color: var(--red); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid > .full-row { grid-column: 1 / -1; }
.article-tag-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px; border: 1px solid var(--line); background: #fffdf8; }
.article-tag-options button { min-height: 34px; padding: 6px 13px; color: var(--muted); border: 1px solid #d8cec1; border-radius: 18px; background: #f7f1e8; font: 12px/1.2 var(--sans); cursor: pointer; transition: .15s ease; }
.article-tag-options button:hover { color: var(--red); border-color: rgba(184,58,50,.45); transform: translateY(-1px); }
.article-tag-options button.selected { color: #fffaf3; border-color: var(--red); background: var(--red); box-shadow: 0 4px 10px rgba(184,58,50,.18); }
.article-tag-options button:focus-visible { outline: 2px solid rgba(184,58,50,.32); outline-offset: 2px; }
fieldset { display: grid; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--line); }
legend { padding: 0 7px; color: var(--ink); font-size: 13px; font-weight: bold; }
fieldset label { grid-template-columns: 55px 1fr; align-items: center; }
.dialog-actions { justify-content: flex-end; margin-top: 5px; }
.dialog-actions .primary-btn { margin: 0; }
.import-intro { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
#article-import-dialog { width: min(720px, calc(100% - 28px)); }
.article-import-sheet { width: 100%; max-height: calc(100vh - 28px); box-sizing: border-box; }
.article-import-method { padding: 15px 16px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px 18px; border: 1px solid var(--line); background: var(--card); }
.article-import-method > div { display: grid; gap: 5px; }
.article-import-method b { color: var(--ink); font-size: 14px; }
.article-import-method span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.article-import-file-box { grid-column: 1 / -1; padding: 12px 13px; display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: 12px; border: 1px dashed #ccbca8; background: #fffdf8; }
.article-import-file-box input { max-width: 260px; }
.article-import-file-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-template-link { color: var(--red); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.article-import-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.article-import-divider::before,.article-import-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.article-import-text-label textarea { min-height: 190px; }
.article-import-status { padding: 10px 12px; color: var(--muted); border: 1px solid var(--line); background: rgba(255,253,248,.55); font-size: 12px; line-height: 1.6; }
.article-import-status.loading { color: #285c75; border-color: #b9d7e4; background: #eef7fb; }
.article-import-status.error { color: var(--red); border-color: #e2aaa5; background: #fff0ec; }
.import-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--card);
}
.import-file-bar > div { display: grid; gap: 3px; min-width: 0; }
.import-file-bar span { color: var(--muted); font-size: 12px; }
.import-file-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-loading { padding: 22px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.import-preview { display: grid; gap: 10px; }
.import-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--card); }
.import-summary > div { display: grid; gap: 5px; padding: 13px 15px; border-right: 1px solid var(--line); }
.import-summary > div:last-child { border-right: 0; }
.import-summary span { color: var(--muted); font-size: 12px; }
.import-summary strong { font: 24px Arial, sans-serif; }
.import-summary strong.good { color: var(--green); font: bold 15px "微软雅黑", sans-serif; }
.import-summary strong.bad { color: var(--red); font: bold 15px "微软雅黑", sans-serif; }
.import-period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 15px;
  border-left: 4px solid var(--gold);
  background: var(--card);
}
.import-period > div { display: grid; gap: 4px; }
.import-period span { color: var(--muted); font-size: 12px; }
.import-period > strong { color: var(--red); white-space: nowrap; font: 13px Arial, sans-serif; }
.import-messages, .import-status { padding: 13px 15px; line-height: 1.65; font-size: 13px; }
.import-messages ul { margin: 7px 0 0; padding-left: 20px; }
.import-messages.error, .import-status.error { color: #8f2c25; border: 1px solid #e6b7b1; background: #fff0ec; }
.import-messages.warning { color: #765114; border: 1px solid #e5c992; background: #fff8e8; }
.import-status { display: grid; gap: 3px; }
.import-status.ok { color: #175943; border: 1px solid #abd0c1; background: #edf7f1; }
.import-help { display: grid; gap: 4px; padding: 13px 15px; color: var(--muted); border: 1px dashed var(--line); font-size: 12px; line-height: 1.6; }
.import-help b { color: var(--ink); }
.import-help a { justify-self: start; color: var(--red); text-decoration: none; border-bottom: 1px solid currentColor; }
#confirm-import:disabled { cursor: not-allowed; opacity: .45; transform: none; box-shadow: none; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; max-width: calc(100% - 32px); padding: 11px 18px; color: #fff; background: var(--ink); box-shadow: 4px 4px 0 rgba(0, 0, 0, .16); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red-dark); }

.sound-toggle {
  position: fixed;
  z-index: 30;
  right: 22px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--red);
  border: 1px solid rgba(184,58,50,.38);
  border-radius: 50%;
  background: rgba(255,253,248,.94);
  box-shadow: 0 10px 28px rgba(56,39,21,.15);
  font: 700 20px/1 Arial, sans-serif;
  transition: transform .15s ease, opacity .15s ease;
}
.sound-toggle:hover { transform: translateY(-2px) scale(1.04); }
.sound-toggle.muted { color: var(--muted); opacity: .72; }

@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes question-enter { from { opacity: 0; transform: translateX(24px) rotate(.4deg); } to { opacity: 1; transform: none; } }
@keyframes web-correct { 0%,100% { transform: scale(1); } 55% { transform: scale(1.012); } }
@keyframes web-wrong { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-7px); } 65% { transform: translateX(5px); } }
@keyframes feedback-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes result-pop { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }
.question-enter { animation: question-enter .42s cubic-bezier(.2,.8,.3,1); }
@media (max-width: 760px) {
  .app-shell { width: min(100% - 26px, 1100px); padding-top: 28px; }
  .admin-layout { grid-template-columns: 1fr; }
  .period-panel { position: static; }
  #question-sidebar-resizer { display: none; }
  .layout-management-shell.layout-mode { display: block; }
  .layout-directory-panel { position: static; margin-bottom: 16px; }
  .layout-directory-list { max-height: none; display: flex; gap: 7px; overflow-x: auto; }
  .layout-directory-item { min-width: 180px; border: 1px solid var(--line); border-radius: 7px; }
  #layout-sidebar-resizer { display: none; }
  .masthead, .library-header { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .article-list.layout-admin-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 520px) {
  .masthead, .library-header, .game-header, .setting-row, .ending-actions { align-items: flex-start; flex-direction: column; }
  .masthead .ghost-btn, .library-header .ghost-btn { align-self: flex-end; }
  .intro-card, .copy-card { padding: 20px; }
  .period-grid { max-height: 360px; padding-right: 5px; }
  .period-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    min-height: 0;
    padding: 15px 52px 15px 16px;
  }
  .period-card h3 { grid-column: 1; font-size: 17px; }
  .period-card small { grid-column: 2; grid-row: 1; }
  .period-card p { grid-column: 1 / -1; font-size: 13px; }
  .period-card.selected::after { right: 13px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .setting-row > label:first-child { width: 100%; min-width: 0; }
  .status { align-items: flex-start; }
  .game-header { gap: 12px; }
  .result-board { grid-template-columns: 1fr; }
  .accuracy { border-top: 1px solid var(--line); border-left: 0; }
  .library-tools { grid-template-columns: 1fr; }
  .library-actions { justify-self: start; flex-wrap: wrap; }
  .import-summary { grid-template-columns: 1fr; }
  .import-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .import-summary > div:last-child { border-bottom: 0; }
  .library-item header { display: block; }
  .item-actions { margin-top: 12px; }
  .article-admin-card > header { display: block; }
  .article-list.layout-admin-grid { grid-template-columns: 1fr; }
  .layout-management-shell.layout-mode { display: block; }
  #layout-sidebar-resizer { display: none; }
  .layout-directory-panel { position: static; margin-bottom: 16px; }
  .layout-directory-list { max-height: none; display: flex; gap: 7px; overflow-x: auto; }
  .layout-directory-item { min-width: 150px; border: 1px solid var(--line); border-radius: 7px; }
  .layout-admin-visual { height: min(520px,115vw); }
  .layout-batch-toolbar { flex-wrap: wrap; }
  .layout-batch-spacer { display: none; }
  .article-actions { justify-content: flex-start; max-width: none; margin-top: 14px; }
  .article-setting-row { grid-template-columns: 1fr; }
  .library-section-title { align-items: flex-start; flex-direction: column; gap: 5px; }
  .library-option { grid-template-columns: 32px minmax(0, 1fr); }
  .library-option-state { grid-column: 2; justify-self: start; }
  .feedback { grid-template-columns: 1fr; }
  .ending-actions .ghost-btn { align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.period-kind { margin: 0 6px; padding: 2px 6px; color: #79551e; border-radius: 10px; background: #f4e3bd; font-size: 10px; font-style: normal; font-weight: 800; }
#topic-dialog { width: min(920px, calc(100vw - 32px)); }
#topic-dialog textarea#topic-units-json { min-height: 270px; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 13px; line-height: 1.55; }
.article-image-fields { padding: 18px; border: 1px solid #d8d0c3; border-radius: 16px; background: #faf8f3; }
.article-image-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.article-image-heading > div { display: flex; flex-direction: column; gap: 5px; }
.article-image-heading small, .article-image-status { color: #746d64; font-size: 12px; line-height: 1.5; }
.article-image-upload { padding: 9px 14px; flex: none; color: #fff; border-radius: 10px; background: #765148; cursor: pointer; font-weight: 700; }
.article-image-status { margin-top: 9px; }
.article-image-list { margin-top: 12px; display: grid; gap: 12px; }
.article-image-item { padding: 12px; display: grid; grid-template-columns: 150px minmax(0,1fr) auto; gap: 14px; align-items: center; border: 1px solid #ded7cb; border-radius: 13px; background: #fff; }
.article-image-item > img { width: 150px; max-height: 120px; display: block; object-fit: contain; border-radius: 8px; background: #eee9e1; }
.article-image-fields-grid { display: grid; grid-template-columns: 130px minmax(180px,1fr); gap: 9px 12px; }
.article-image-fields-grid label { display: grid; gap: 5px; color: #625b53; font-size: 12px; }
.article-image-fields-grid label:last-child { grid-column: 1 / -1; }
.article-image-fields-grid input { min-width: 0; }
.article-image-position { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.article-image-position input { width: 65px; }
.article-image-actions { display: flex; flex-direction: column; gap: 7px; }
.article-image-actions button { padding: 7px 10px; border: 1px solid #d7cfc4; border-radius: 8px; background: #f7f3ed; }
.article-image-actions .danger-text { color: #a13f37; }
@media (max-width: 760px) {
  .article-image-item { grid-template-columns: 100px minmax(0,1fr); }
  .article-image-item > img { width: 100px; }
  .article-image-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .article-image-fields-grid { grid-template-columns: 1fr; }
  .article-image-fields-grid label:last-child { grid-column: auto; }
}
/* 正式后台入口与账号权限 */
.admin-auth-screen { min-height: 100vh; padding: 7vh 24px 54px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; background: linear-gradient(145deg,rgba(245,239,226,.98),rgba(235,226,208,.96)), repeating-linear-gradient(0deg,transparent 0 31px,rgba(94,116,124,.08) 31px 32px); }
.admin-auth-brand { width: min(680px,100%); margin-bottom: 28px; text-align: center; }
.admin-auth-brand .eyebrow { color: var(--red); font-weight: 800; letter-spacing: .28em; }
.admin-auth-brand h1 { margin: 9px 0 5px; color: var(--ink); font: 700 clamp(42px,7vw,72px)/1.1 "Songti SC","SimSun",serif; letter-spacing: .08em; }
.admin-auth-brand > p:last-child { color: var(--muted); font-size: 18px; letter-spacing: .15em; }
.admin-auth-card { width: min(680px,100%); padding: 36px 40px; box-sizing: border-box; border: 1px solid #ded2bf; border-radius: 22px; background: rgba(255,253,248,.96); box-shadow: 0 22px 60px rgba(74,54,35,.13); }
.admin-auth-card > div:first-child { margin-bottom: 26px; }
.admin-auth-card h2 { margin: 8px 0; font-size: 30px; }
.admin-auth-card p { color: var(--muted); line-height: 1.7; }
.admin-auth-kicker { color: var(--red); font: 700 12px/1.2 Arial,sans-serif; letter-spacing: .22em; }
.admin-auth-card form { display: grid; gap: 19px; }
.admin-auth-card label { display: grid; gap: 8px; color: var(--ink); font-weight: 700; }
.admin-auth-card input { width: 100%; height: 50px; padding: 0 15px; box-sizing: border-box; color: var(--ink); border: 1px solid #d9cebe; border-radius: 10px; background: #faf6ee; font: inherit; }
.admin-auth-card input:focus { outline: 3px solid rgba(191,58,48,.12); border-color: var(--red); }
.admin-auth-card .primary-btn { width: 100%; margin-top: 5px; }
.admin-setup-card { width: min(860px,100%); }
.admin-setup-card fieldset { margin: 0; padding: 20px; border: 1px solid #e1d6c6; border-radius: 14px; background: #fcf9f3; }
.admin-setup-card legend { padding: 0 8px; color: var(--red); font-weight: 800; }
.admin-account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.admin-setup-note { padding: 15px 18px; color: #6c6259; border-left: 4px solid var(--gold); background: #f7edda; line-height: 1.65; }
.admin-session-box { display: flex; align-items: center; gap: 14px; }
.admin-session-box > span { color: var(--muted); font-size: 14px; }
.admin-account-list { display: grid; gap: 14px; }
.admin-account-card { min-height: 102px; padding: 18px 20px; display: flex; align-items: center; gap: 17px; border: 1px solid #dfd4c5; border-radius: 15px; background: #fffdf8; }
.admin-account-card.is-disabled { opacity: .6; }
.admin-account-avatar { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; color: #fff; border-radius: 16px; background: var(--red); font: 800 23px/1 "Songti SC",serif; }
.admin-account-copy { min-width: 0; flex: 1; }
.admin-account-copy > div { display: flex; align-items: center; gap: 12px; }
.admin-account-copy h2 { margin: 0; font-size: 21px; }
.admin-account-copy span { padding: 4px 9px; color: #8a5d22; border-radius: 20px; background: #f6e7c9; font-size: 12px; }
.admin-account-copy p { margin: 8px 0 5px; color: var(--ink); }
.admin-account-copy small { color: var(--muted); }
.admin-role-editor [data-delete-period],.admin-role-editor [data-delete-question],.admin-role-editor [data-delete-article],.admin-role-editor [data-delete-topic],.admin-role-editor [data-delete-hotspot],.admin-role-editor #layout-batch-delete,.admin-role-editor [data-start-official] { display: none !important; }
@media (max-width:680px) { .admin-auth-screen { padding: 35px 16px; } .admin-auth-card { padding: 27px 22px; } .admin-account-grid { grid-template-columns: 1fr; } .admin-session-box { align-items: flex-end; flex-direction: column; } }
