/* PHP 面试题库 · 备考题册风格
   纸面 / 墨色 / 朱砂红圈阅 + 靛蓝批注 */

:root {
  --paper: #f5efe1;
  --paper-2: #fbf7ec;
  --paper-3: #efe7d3;
  --ink: #292318;
  --ink-2: #7a6f5b;
  --rule: #d9cdb2;
  --red: #b7332a;
  --red-soft: rgba(183, 51, 42, .12);
  --indigo: #3d4a7e;
  --mark: #ffe08a;
  --shadow: 0 2px 14px rgba(60, 45, 20, .08);
  --serif: "Noto Serif SC", "Source Han Serif SC", "STZhongsong", "SimSun", serif;
  --sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

[data-theme="dark"] {
  --paper: #15171e;
  --paper-2: #1c1f28;
  --paper-3: #232733;
  --ink: #e9e2d0;
  --ink-2: #97907d;
  --rule: #333846;
  --red: #e05a4c;
  --red-soft: rgba(224, 90, 76, .16);
  --indigo: #93a3dd;
  --mark: #6d5a1c;
  --shadow: 0 2px 14px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(61, 74, 126, .06), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(120, 100, 60, .012) 2px 4px),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
}

/* 作业本左侧红色装订线 */
.margin-rule {
  position: fixed; top: 0; bottom: 0; left: 38px;
  width: 1.5px; background: var(--red); opacity: .28; pointer-events: none; z-index: 5;
}

code {
  font-family: var(--mono);
  font-size: .88em;
  color: var(--red);
  background: var(--red-soft);
  padding: .08em .38em;
  border-radius: 3px;
}

mark {
  background: var(--mark);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* ============ 封面 ============ */
.cover {
  border-bottom: 4px double var(--ink);
  padding: 54px 0 0;
}
.cover-inner, .toolbar-inner, .layout, .colophon-inner, .cover .stats {
  max-width: 1180px; margin: 0 auto; padding: 0 48px 0 76px;
}
.cover .stats { padding-top: 18px; padding-bottom: 22px; }
.cover-main { position: relative; }
.eyebrow {
  font-family: var(--kai);
  color: var(--ink-2);
  letter-spacing: .28em;
  font-size: 13px;
  margin: 0 0 10px;
  white-space: nowrap;
}
.cover h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(42px, 6.5vw, 72px);
  letter-spacing: .08em;
  line-height: 1.15;
  margin: 0;
}
.cover .sub {
  font-family: var(--kai);
  color: var(--ink-2);
  margin: 12px 0 30px;
  letter-spacing: .12em;
}
.seal {
  position: absolute; right: 8px; top: 6px;
  transform: rotate(-5deg);
  border: 3px solid var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--red);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .3em;
  line-height: 1.35;
  text-align: center;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px var(--red);
  opacity: .92;
}
.cover .cover-main { position: relative; }
.cover .stats {
  display: flex; flex-wrap: wrap; gap: 34px; align-items: flex-end;
  border-top: 1px solid var(--rule);
}
.stat .num {
  font-family: var(--mono);
  font-size: 30px; font-weight: 700; line-height: 1;
  color: var(--ink);
}
.stat .num.red { color: var(--red); }
.stat .lab {
  font-size: 12px; color: var(--ink-2);
  letter-spacing: .2em; margin-top: 5px;
}
.progress-wrap { flex: 1; min-width: 220px; padding-bottom: 4px; }
.progress-track {
  height: 6px; background: var(--paper-3);
  border: 1px solid var(--rule); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red), #d86a3c);
  transition: width .5s ease;
}
.progress-lab { font-size: 12px; color: var(--ink-2); margin-top: 6px; letter-spacing: .1em; }

/* ============ 工具栏 ============ */
.toolbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.toolbar-inner {
  display: flex; align-items: center; gap: 14px;
  padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 220px; }
#search {
  width: 100%;
  background: transparent;
  border: none; border-bottom: 2px solid var(--ink);
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  padding: 6px 26px 6px 2px;
  outline: none;
  transition: border-color .2s;
}
#search:focus { border-bottom-color: var(--red); }
#search::placeholder { color: var(--ink-2); }
#clearSearch {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--ink-2); cursor: pointer; font-size: 14px;
}
.stamp-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.stamp-toggle input { display: none; }
.stamp-toggle span {
  font-family: var(--serif); font-weight: 600; font-size: 13.5px;
  color: var(--ink-2);
  border: 1.5px solid var(--rule);
  border-radius: 4px; padding: 4px 10px;
  transform: rotate(-1.5deg);
  transition: all .2s;
  letter-spacing: .15em;
}
.stamp-toggle input:checked + span {
  color: var(--red); border-color: var(--red);
  background: var(--red-soft);
  transform: rotate(-4deg) scale(1.04);
  box-shadow: inset 0 0 0 1.5px var(--paper), inset 0 0 0 2.5px var(--red);
}
.tool-btn {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--serif); font-weight: 600; font-size: 13.5px;
  padding: 5px 14px; border-radius: 4px;
  cursor: pointer; letter-spacing: .12em;
  transition: all .18s;
}
.tool-btn:hover { background: var(--ink); color: var(--paper); }
.tool-btn.active { background: var(--ink); color: var(--paper); }
a.tool-btn { text-decoration: none; display: inline-block; }
.hit-count { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); margin-left: auto; }

/* ============ 布局 ============ */
.layout { display: flex; gap: 46px; padding-top: 30px; padding-bottom: 70px; }
.sidebar {
  width: 252px; flex-shrink: 0;
  position: sticky; top: 62px;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 6px;
}
.side-item {
  display: block; text-decoration: none; color: var(--ink-2);
  border-left: 3px solid transparent;
  padding: 7px 10px; margin-bottom: 2px;
  transition: all .15s;
}
.side-item:hover { color: var(--ink); background: var(--paper-2); }
.side-item.active {
  color: var(--ink); border-left-color: var(--red); background: var(--paper-2);
}
.side-item .row1 { display: flex; align-items: baseline; gap: 8px; }
.side-item .zh-num {
  font-family: var(--serif); font-weight: 900; font-size: 15px; color: var(--ink);
  white-space: nowrap; flex-shrink: 0;
}
.side-item.active .zh-num { color: var(--red); }
.side-item .name { font-size: 13px; flex: 1; }
.side-item .meta { font-family: var(--mono); font-size: 10.5px; opacity: .8; white-space: nowrap; }
.side-bar { height: 3px; background: var(--paper-3); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.side-bar span { display: block; height: 100%; background: var(--red); width: 0; transition: width .4s; }

.content { flex: 1; min-width: 0; }

/* ============ 模块 ============ */
.module { position: relative; margin-bottom: 58px; }
.module-num {
  position: absolute; top: -38px; left: -14px;
  font-family: var(--serif); font-weight: 900; font-size: 120px; line-height: 1;
  color: var(--ink); opacity: .055;
  pointer-events: none; user-select: none;
}
.module > header { padding-bottom: 10px; border-bottom: 3px double var(--ink); margin-bottom: 6px; }
.module > header h2 {
  font-family: var(--serif); font-weight: 900;
  font-size: 27px; letter-spacing: .06em;
  margin: 0 0 6px;
}
.module > header h2 .zh-num { color: var(--red); margin-right: 12px; }
.mod-intro {
  font-family: var(--kai);
  color: var(--ink-2);
  border-left: 3px solid var(--red);
  padding: 2px 0 2px 14px;
  margin: 10px 0 4px;
  font-size: 14px;
}

/* ============ 小节 ============ */
.sec { border-bottom: 1px solid var(--rule); padding: 14px 0 6px; }
.sec-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; background: none; border: none;
  cursor: pointer; text-align: left; padding: 2px 0;
  color: var(--ink); font-family: inherit;
}
.sec-label {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--indigo);
  border: 1px solid var(--indigo); border-radius: 3px;
  padding: 1px 7px; flex-shrink: 0;
}
.sec-title { font-family: var(--serif); font-weight: 600; font-size: 18.5px; letter-spacing: .04em; }
.sec-meta { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.sec-meta .high { color: var(--red); }
.sec-caret { font-size: 11px; color: var(--ink-2); transition: transform .25s; flex-shrink: 0; }
.sec.collapsed .sec-caret { transform: rotate(-90deg); }
.sec.collapsed .sec-body { display: none; }
.sec-plain { border-bottom: none; padding-top: 2px; }
.sec-plain .sec-body .q:first-child { border-top: 1px dashed var(--rule); }
.sec-note {
  font-family: var(--kai); color: var(--ink-2); font-size: 13px;
  margin: 8px 0 2px;
}

/* ============ 题目 ============ */
.q {
  display: grid;
  grid-template-columns: 44px 1fr auto 30px;
  gap: 12px; align-items: start;
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule);
}
.q:last-child { border-bottom: none; }
.q-num {
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  color: var(--indigo); background: none; border: none;
  cursor: pointer; text-align: left; padding: 3px 0 0;
  opacity: .85;
}
.q-num:hover { color: var(--red); text-decoration: underline; }
.q-text { margin: 0; font-family: var(--serif); font-size: 15.5px; line-height: 1.85; }
.q-note { color: var(--ink-2); font-size: 13px; font-family: var(--sans); }
.badge-high {
  display: inline-block; vertical-align: 2px;
  margin-left: 8px;
  font-family: var(--serif); font-weight: 700; font-size: 10.5px;
  color: var(--red); border: 1.5px solid var(--red); border-radius: 3px;
  padding: 0 5px; letter-spacing: .25em;
  transform: rotate(-2deg);
  box-shadow: inset 0 0 0 1px var(--paper-2), inset 0 0 0 2px var(--red);
  user-select: none;
}
.master-btn {
  width: 22px; height: 22px; margin-top: 4px;
  border: 1.5px solid var(--ink-2); border-radius: 52% 48% 50% 50%;
  background: transparent; cursor: pointer;
  color: transparent; font-size: 13px; line-height: 1;
  padding: 0; justify-self: end;
  transition: all .18s;
}
.master-btn:hover { border-color: var(--red); color: var(--red); }
.q.mastered .master-btn {
  border: 2px solid var(--red); color: var(--red);
  transform: rotate(-6deg);
  background: var(--red-soft);
}
.q.mastered .q-text { opacity: .55; }
.q.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0%, 60% { background: var(--mark); box-shadow: 0 0 0 6px var(--mark); }
  100% { background: transparent; }
}
.q.hidden, .sec.hidden, .module.hidden { display: none; }

/* ============ 参考答案 ============ */
.ans-btn {
  border: 1px solid var(--indigo);
  background: transparent;
  color: var(--indigo);
  font-family: var(--serif); font-weight: 600; font-size: 12px;
  padding: 2px 10px; border-radius: 3px;
  cursor: pointer; letter-spacing: .2em;
  margin-top: 3px;
  transition: all .18s;
}
.ans-btn:hover { background: var(--indigo); color: var(--paper-2); }
.ans-btn.open { background: var(--indigo); color: var(--paper-2); }
.q-answer {
  grid-column: 1 / -1;
  margin: 2px 0 6px 56px;
  padding: 12px 18px 12px 20px;
  border-left: 3px solid var(--red);
  background: var(--paper-2);
  box-shadow: var(--shadow);
  border-radius: 0 6px 6px 0;
  font-family: var(--kai);
  font-size: 13.8px;
  line-height: 1.95;
  color: var(--ink);
  position: relative;
}
.q-answer p { margin: 0; }
.q-answer strong { color: var(--red); font-weight: 700; }
.q-answer code {
  font-family: var(--mono); font-size: .9em;
  color: var(--red); background: var(--red-soft);
  padding: .05em .35em; border-radius: 3px;
}
.q-answer pre {
  margin: 8px 0; padding: 10px 14px;
  background: var(--paper-3);
  border: 1px solid var(--rule); border-radius: 4px;
  overflow-x: auto;
}
.q-answer pre code {
  background: none; padding: 0; color: var(--ink);
  font-size: 12.2px; line-height: 1.7;
}
.ans-cap {
  position: absolute; top: -9px; left: 12px;
  background: var(--red); color: var(--paper-2);
  font-family: var(--serif); font-size: 11px; font-weight: 700;
  padding: 0 8px; border-radius: 2px;
  letter-spacing: .3em; transform: rotate(-1.5deg);
}
body.show-all .q-answer { display: block; }
body.show-all .ans-btn { background: var(--indigo); color: var(--paper-2); }

/* ============ 空状态 / 页脚 ============ */
.empty { text-align: center; padding: 70px 20px; }
.empty-stamp {
  display: inline-block;
  font-family: var(--serif); font-weight: 900; font-size: 44px;
  color: var(--red);
  border: 4px solid var(--red); border-radius: 10px;
  padding: 4px 18px; transform: rotate(-6deg);
  box-shadow: inset 0 0 0 2.5px var(--paper), inset 0 0 0 4px var(--red);
}
.empty-text { color: var(--ink-2); font-family: var(--kai); margin-top: 22px; letter-spacing: .2em; }

.colophon { border-top: 4px double var(--ink); padding: 34px 0 60px; }
.colophon h3 {
  font-family: var(--serif); font-size: 18px; font-weight: 900; letter-spacing: .1em;
  margin: 0 0 16px;
}
.src-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px 34px; }
.src-group h4 {
  font-family: var(--serif); font-size: 14px; margin: 10px 0 6px;
  color: var(--ink); letter-spacing: .1em;
}
.src-group a {
  display: block; font-size: 12.5px; color: var(--indigo);
  text-decoration: none; padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src-group a:hover { color: var(--red); text-decoration: underline; }
.maintain {
  margin-top: 28px;
  border: 1.5px dashed var(--ink-2); border-radius: 6px;
  padding: 14px 18px;
  font-family: var(--kai); font-size: 13.5px; color: var(--ink-2);
  background: var(--paper-2);
}
.maintain code { font-family: var(--mono); }

/* ============ 打卡计划页 ============ */
.plan-controls {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-top: 16px; padding-bottom: 20px;
  border-top: 1px solid var(--rule);
}
.back-link { color: var(--red); text-decoration: none; font-size: 12.5px; letter-spacing: .15em; }
.back-link:hover { text-decoration: underline; }
.date-wrap {
  font-family: var(--serif); font-size: 13.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px; letter-spacing: .08em;
}
.date-wrap input {
  border: 1.5px solid var(--rule); background: var(--paper-2); color: var(--ink);
  border-radius: 4px; padding: 4px 8px; font-family: var(--mono); font-size: 13px;
}
.today-chip {
  font-family: var(--serif); font-weight: 700; font-size: 13px;
  color: var(--paper-2); background: var(--red);
  padding: 4px 12px; border-radius: 99px; letter-spacing: .2em;
  transform: rotate(-2deg);
}
.plan-progress { flex: 1; min-width: 240px; max-width: 460px; }

.plan-wrap { max-width: 860px; margin: 0 auto; padding: 34px 48px 40px 76px; }

.day-card {
  position: relative;
  border: 1.5px solid var(--rule); border-radius: 8px;
  background: var(--paper-2);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.day-card.tier1 { border-left: 5px solid var(--red); }
.day-card.tier2 { border-left: 5px solid var(--indigo); }
.day-card.tier3 { border-left: 5px solid var(--ink-2); }
.day-card.today { border-color: var(--red); box-shadow: 0 4px 20px rgba(183, 51, 42, .18); }
.day-card.fold .day-body { display: none; }
.day-card.fold .sec-caret { transform: rotate(-90deg); }

.day-head {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; cursor: pointer; user-select: none;
  border-bottom: 1px dashed var(--rule);
  background: var(--paper-2);
}
.day-no {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--ink); color: var(--ink);
  font-family: var(--serif); font-weight: 900; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--paper);
}
.day-card.today .day-no { border-color: var(--red); color: var(--red); }
.day-info { flex: 1; min-width: 0; }
.day-title { display: block; font-family: var(--serif); font-weight: 900; font-size: 16.5px; letter-spacing: .05em; }
.day-sub { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; letter-spacing: .1em; }
.day-meta { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.today-tag {
  font-family: var(--serif); font-weight: 700; font-size: 12px;
  color: var(--red); border: 1.5px solid var(--red); border-radius: 3px;
  padding: 1px 8px; letter-spacing: .25em; transform: rotate(-2deg);
}
.day-stamp {
  font-family: var(--serif); font-weight: 900; font-size: 13px;
  color: var(--red); border: 2px solid var(--red); border-radius: 4px;
  padding: 2px 8px; letter-spacing: .2em; transform: rotate(-6deg);
  box-shadow: inset 0 0 0 1px var(--paper-2), inset 0 0 0 2px var(--red);
}
.day-body { padding: 8px 18px 14px 22px; }
.day-tip {
  font-family: var(--kai); font-size: 12.5px; color: var(--ink-2);
  border-top: 1px dashed var(--rule); padding-top: 8px; margin: 10px 0 0;
}

.pq-list { display: flex; flex-direction: column; }
.pq-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--rule);
}
.pq-row:last-child { border-bottom: none; }
.pq-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex-shrink: 0;
  border: 1.5px solid var(--ink-2); border-radius: 50%;
  cursor: pointer; position: relative; top: 2px;
}
.pq-row input[type="checkbox"]:checked {
  border: 2px solid var(--red); background: var(--red-soft);
}
.pq-row input[type="checkbox"]:checked::after {
  content: "✓"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-size: 11px; font-weight: 700;
}
.pq-row a {
  flex: 1; min-width: 0;
  color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-size: 14.5px; line-height: 1.7;
}
.pq-row a:hover { color: var(--red); text-decoration: underline; }
.pq-row a code { font-size: .85em; }
.pq-row.on a { opacity: .45; text-decoration: line-through; }
.pq-loc {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  white-space: nowrap; flex-shrink: 0;
}

.mock-box { padding: 6px 2px; }
.mock-box p { margin: 6px 0; font-family: var(--kai); font-size: 14px; line-height: 1.9; }
.mock-box .mock-left { color: var(--ink-2); font-size: 13px; }
.mock-box strong { color: var(--red); }
.mock-box .tool-btn { margin-top: 8px; }
.mopup-note { font-family: var(--kai); color: var(--ink-2); font-size: 13.5px; margin: 4px 0 8px; }
.mopup-note strong { color: var(--red); }

@media (max-width: 720px) {
  .plan-wrap { padding: 24px 18px; }
  .plan-controls { padding-left: 18px; padding-right: 18px; }
  .pq-loc { display: none; }
}
.to-top {
  position: fixed; right: 26px; bottom: 30px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink);
  font-size: 17px; cursor: pointer; box-shadow: var(--shadow);
  transition: all .2s; z-index: 50;
}
.to-top:hover { background: var(--ink); color: var(--paper); }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-size: 13px; padding: 8px 20px; border-radius: 99px;
  z-index: 60; box-shadow: var(--shadow);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 1020px) {
  .sidebar { display: none; }
  .margin-rule { display: none; }
  .cover-inner, .toolbar-inner, .layout, .colophon-inner { padding-left: 22px; padding-right: 22px; }
  .seal { position: static; margin-top: 18px; display: inline-block; }
  .cover .cover-main { display: block; }
}
@media print {
  .toolbar, .sidebar, .to-top, .margin-rule, .master-btn { display: none !important; }
  .sec-body { display: block !important; }
  body { background: #fff; }
  .q { break-inside: avoid; }
}
