:root {
  --paper: #f5f2e9;
  --paper-raised: rgba(255, 253, 247, .92);
  --ink: #293832;
  --muted: #6d7972;
  --brand: #567266;
  --brand-dark: #3e5b4e;
  --brand-soft: #e8efea;
  --accent: #a05d47;
  --border: #d9d3c5;
  --shadow: rgba(47, 64, 53, .07);
  --nav-height: 64px;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  position: relative;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(245, 242, 233, .88), rgba(245, 242, 233, .70) 55%, rgba(245, 242, 233, .90));
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.65;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("./assets/landscape-full.webp") center / cover no-repeat;
  opacity: .50;
}
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1020;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(245, 242, 233, .97), rgba(245, 242, 233, .90));
}
nav, main { position: relative; z-index: 1; }
main.container { max-width: 1180px; padding-top: calc(var(--nav-height) + 1.5rem) !important; }
h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: "STSong", "SimSun", "Noto Serif CJK SC", serif;
  color: #2f443a;
  letter-spacing: .025em;
}
a { color: var(--brand-dark); text-decoration-color: rgba(86, 114, 102, .35); }
a:hover { color: var(--accent); }
.text-secondary, .form-text { color: var(--muted) !important; }
.navbar.bg-white {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: transparent !important;
  border-bottom: 0 !important;
  backdrop-filter: none;
}
.navbar-brand { color: var(--brand-dark); letter-spacing: .14em; }
.navbar .btn-link { color: var(--brand-dark); text-decoration: none; }
.navbar .btn-link:hover { color: var(--accent); background: var(--brand-soft); }
.card {
  background: var(--paper-raised);
  border: 1px solid rgba(194, 187, 168, .7);
  border-radius: 6px;
  box-shadow: 0 8px 28px var(--shadow);
  backdrop-filter: blur(5px);
}
.card-body { padding: 1.25rem; }
.btn { border-radius: 3px; transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fffdf7;
  box-shadow: 0 2px 0 rgba(43, 65, 53, .16);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(62, 91, 78, .16);
}
.btn-primary:disabled { background: #9aa9a0; border-color: #9aa9a0; }
.btn-outline-primary { color: var(--brand-dark); border-color: rgba(86, 114, 102, .65); background: rgba(255, 253, 247, .55); }
.btn-outline-primary:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-outline-secondary { color: #59655e; border-color: #b9b4a7; background: rgba(255, 253, 247, .5); }
.btn-outline-secondary:hover { color: var(--brand-dark); background: var(--brand-soft); border-color: var(--brand); }
.btn-link { color: var(--brand-dark); }
.form-control, .form-select {
  color: var(--ink);
  background-color: rgba(255, 254, 249, .88);
  border: 1px solid #c9c3b5;
  border-radius: 3px;
}
.form-control:focus, .form-select:focus {
  background-color: #fffef9;
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(86, 114, 102, .13);
}
.form-control::placeholder { color: #929a91; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.answer-choice {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 253, 248, .72);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.answer-choice:hover { border-color: #8ca094; background: #eef2eb; }
.answer-choice .form-check-input { flex: 0 0 auto; margin-top: .3rem; }
.knowledge-box {
  border-left: 3px solid var(--brand);
  background: linear-gradient(100deg, #eaf0ea, #f3f1e6);
  border-radius: 3px;
  padding: 1rem 1.1rem;
}
.answer-panel { border-top: 1px solid var(--border); padding-top: 1rem; overflow-wrap: break-word; word-break: normal; }
.note-content { white-space: pre-wrap; }
textarea { line-height: 1.75; }
.progress { background: rgba(86, 114, 102, .12); }
.progress-bar { background: var(--brand); }
.badge { font-weight: 500; }
.text-bg-light { color: #526159 !important; background: #eeece3 !important; }
.text-bg-info { color: #426762 !important; background: #e1eeea !important; }
.text-bg-success { color: #fff !important; background: #6d8571 !important; }
.text-bg-warning { color: #765d31 !important; background: #eee4c9 !important; }
.text-bg-danger { color: #fff !important; background: var(--accent) !important; }
.alert { border-radius: 4px; }
.alert-success { color: #36533f; background: #e8f0e7; border-color: #bccdbb; }
.alert-danger { color: #79463b; background: #f5e8e2; border-color: #dec1b5; }
.alert-info { color: #3f5d57; background: #e7efeb; border-color: #bfd0c6; }
.alert-warning { color: #6d5c3b; background: #f3ecda; border-color: #dbcfaf; }
.library-card { color: inherit; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.library-card:hover { transform: translateY(-2px); border-color: #9caea1; box-shadow: 0 10px 26px rgba(62, 91, 78, .1); }
.library-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #a4b3a7;
  border-radius: 3px;
  background: #e8eee7;
  color: var(--brand-dark);
  font-family: "STSong", "SimSun", serif;
  font-size: 1.2rem;
  font-weight: 700;
}
.question-type-tabs { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .3rem; }
.type-tab {
  flex: 0 0 auto;
  padding: .5rem .85rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: #596a60;
  text-decoration: none;
  background: rgba(255, 253, 247, .7);
}
.type-tab span { color: #8b968d; margin-left: .25rem; }
.type-tab:hover { border-color: var(--brand); color: var(--brand-dark); }
.type-tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.type-tab.active span { color: #e6eee8; }
.breadcrumb { font-size: .92rem; }
.breadcrumb-item a { color: var(--brand-dark); text-decoration: none; }
.breadcrumb-item.active { color: var(--muted); }
.stat-card { border-top: 2px solid rgba(86, 114, 102, .55); }
details > summary { color: var(--brand-dark); cursor: pointer; }
details > summary:hover { color: var(--accent); }
.table { color: var(--ink); }
.table > :not(caption) > * > * { border-bottom-color: rgba(217, 211, 197, .75); background: transparent; }
.subject-mode { border: 0; padding: 0; margin: 0; }
@media (max-width: 576px) {
  :root { --nav-height: 100px; }
  body::before { background-size: cover; background-position: center; opacity: .42; }
  main.container { padding-left: .75rem; padding-right: .75rem; padding-top: calc(var(--nav-height) + 1rem) !important; }
  .navbar .container { align-items: flex-start; }
  .navbar .btn-link { padding: .25rem; }
  .card-body { padding: 1rem; }
  h1.h4 { font-size: 1.2rem; }
  .answer-choice { padding: .85rem; }
}

.hidden { display: none !important; }
#sync-status { position: fixed; top: 72px; right: 20px; z-index: 4; }
.list { display: grid; gap: 12px; }
.list-item { background: var(--paper-raised); border: 1px solid var(--border); border-radius: 6px; padding: 16px; box-shadow: 0 8px 28px var(--shadow); }
.list-item h3 { margin: 0 0 6px; font-size: 1rem; }
.list-item p { margin: 4px 0; }
.list-meta { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }
.file-button input { display: none; }
dialog { border: 0; background: transparent; padding: 0; max-width: 100%; width: 100%; height: 100%; }
dialog::backdrop { background: rgba(25, 38, 31, .42); }
#question-kind { margin-bottom: 1rem; }
#next-question { margin-top: 1rem; }
#answer-alert:empty { display: none; }
@media (max-width: 576px) { #sync-status { top: 104px; right: 12px; } }
