:root {
  color-scheme: dark;
  --bg: #100203;
  --panel: #1b0709;
  --red: #38080b;
  --gold: #e6bd76;
  --light: #ffedbd;
  --muted: #c7a48d;
  --line: rgba(230, 189, 118, .31);
  --serif: "Songti SC", STSong, "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; color: var(--light); font-family: var(--sans); background: radial-gradient(ellipse at 50% 12%, #370b0e, #100203 66%) fixed; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: linear-gradient(#190407a6, #0a0102ef), url("/imports/夜空.webp") center top / cover; filter: sepia(.55) saturate(1.25) hue-rotate(321deg) brightness(.60); opacity: .64; }
button, input, a { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 2px solid #ffdc9b; outline-offset: 4px; }
a { text-decoration: none; color: inherit; }
h1, h2 { margin: 0; font-family: var(--serif); line-height: 1.26; }
h1 { font-size: clamp(32px, 6vw, 52px); letter-spacing: .06em; text-wrap: balance; }
.masthead { border-bottom: 1px solid #e6bd7627; background: #10020398; }
.masthead-inner { min-height: 76px; max-width: 1280px; padding: 12px 24px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 13px; font: bold 23px var(--serif); letter-spacing: .16em; }
.brand img { border-radius: 11px; box-shadow: 0 0 0 1px var(--line), 0 7px 20px #0006; }
.quiet { background: #23090b; border: 1px solid var(--line); padding: 8px 14px; border-radius: 9px; min-height: 40px; font-size: 14px; }
.quiet:hover:not(:disabled) { background: #411719; border-color: var(--gold); }
.primary { color: #2a0b08; min-height: 46px; padding: 10px 18px; border: 1px solid #f5d391; border-radius: 10px; background: linear-gradient(#ffe8b9, #cea065); display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 700; }
.primary:hover { background: linear-gradient(#fff0c9, #dfb477); }
.entrance { min-height: calc(100dvh - 77px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px 35px; }
.bagua { flex: none; width: min(100%, clamp(212px, 38dvh, 360px)); aspect-ratio: 430 / 420; background: url("/imports/八卦静止.png") center / contain no-repeat; mask-image: radial-gradient(ellipse, #000 54%, transparent 74%); }
.bagua video { display: block; width: 100%; height: 100%; visibility: hidden; }
.bagua[data-motion="playing"] video { visibility: visible; }
.login-panel { padding: clamp(18px, 4vw, 34px); border: 1px solid var(--line); border-radius: 24px; width: min(100%, 452px); background: linear-gradient(140deg, #390e10f2, #180608fc); box-shadow: inset 0 1px #ffe5b21a, 0 26px 70px #0008; }
.login-panel h1 { font-size: clamp(26px, 6.3vw, 38px); text-align: center; margin-bottom: 18px; }
#login-form { display: grid; gap: 10px; }
#login-form label { font-size: 14px; }
#phone { border: 1px solid var(--line); border-radius: 10px; min-width: 0; width: 100%; color: #fff3d8; background: #140304; padding: 12px 14px; font-size: 16px; }
#phone::placeholder { color: #bb9b87; }
.message { color: #ffc8b2; margin: 0; font-size: 14px; }
.message:empty { display: none; }
#login-form .primary { margin-top: 8px; }
.collection { max-width: 1280px; margin: auto; padding: clamp(34px, 7vw, 80px) 24px 64px; }
.course-chooser { max-width: 1010px; }
.course-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 26px; }
.course { min-height: 128px; text-align: left; display: flex; align-items: center; gap: 18px; padding: 19px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(132deg, #390e0f, #180507); box-shadow: inset 0 1px #ffe5b21c, 0 14px 40px #0004; }
.course:hover { border-color: var(--gold); background: linear-gradient(132deg, #4b1616, #1e080a); }
.course-mark { flex: 0 0 62px; width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 4px 9px #0008); }
.course-copy { display: grid; gap: 7px; }
.course-copy strong { font: bold clamp(23px, 4vw, 30px) var(--serif); letter-spacing: .06em; }
.course-copy small { font-size: 13px; color: var(--muted); }
.chevron { margin-left: auto; color: var(--gold); font-size: 25px; }
.back { margin-bottom: 17px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 0 1 auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 9px 15px; min-height: 43px; }
.tabs [aria-selected="true"] { color: #2a0b08; font-weight: 700; background: linear-gradient(#ffe8b9, #cea065); border-color: #ffdc9b; }
#card-count { min-height: 20px; color: var(--muted); margin: 16px 0; font-size: 14px; }
#card-count:empty { display: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 194px), 1fr)); gap: 14px; }
.card { display: grid; grid-template-rows: auto 1fr; text-align: left; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(#260c0e, #190608); }
.card:hover { border-color: #f9ca83; }
.card-cover { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #2a100c; }
.card-label { display: flex; align-items: baseline; gap: 8px; padding: 11px 9px 12px; }
.card-number { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.card-title { min-width: 0; overflow-wrap: anywhere; font-size: 15px; line-height: 1.38; }
.empty { margin-top: 22px; border: 1px dashed var(--line); border-radius: 14px; padding: 44px 18px; text-align: center; color: var(--muted); background: var(--panel); }
body:has(dialog[open]) { overflow: hidden; }
dialog { width: min(960px, calc(100% - 24px)); max-height: calc(100dvh - 24px); background: #1b0709; color: var(--light); border: 1px solid var(--line); border-radius: 17px; padding: 0; box-shadow: 0 24px 100px #0009; }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog::backdrop { background: #080102e3; }
.reader-head, .reader-actions { display: flex; align-items: center; gap: 8px; padding: 12px 15px; }
.reader-head { justify-content: space-between; }
.reader-text { min-width: 0; }
.reader-head h2 { font-size: clamp(18px, 4vw, 26px); overflow-wrap: anywhere; }
.reader-head p { color: var(--muted); margin: 3px 0 0; font-size: 12px; }
.reader-stage { background: #100303; overflow: auto; height: min(71dvh, 850px); text-align: center; }
.original-link { display: inline-flex; height: 100%; max-width: 100%; vertical-align: top; cursor: pointer; }
.original-link:focus-visible { outline-offset: -3px; }
.reader-stage img { display: block; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.reader-stage.zoomed .original-link { height: auto; max-width: none; }
.reader-stage.zoomed img { max-width: none; max-height: none; }
.reader-stage p { color: var(--muted); margin: 16px; }
.reader-stage p:empty { display: none; }
.reader-actions { border-top: 1px solid var(--line); }
.reader-actions .zoom { margin-left: auto; }
@media (max-width: 640px) {
  .masthead-inner { min-height: 65px; padding-inline: 16px; }
  .entrance { min-height: calc(100dvh - 66px); }
  .brand { font-size: 20px; }
  .brand img { width: 38px; height: 38px; }
  .collection { padding-inline: 16px; }
  .course-options { grid-template-columns: 1fr; gap: 12px; }
  .course { min-height: 105px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card-label { gap: 5px; padding-inline: 7px; }
  .card-title { font-size: 14px; }
  .card-number { font-size: 11px; }
  .reader-head, .reader-actions { padding-inline: 10px; }
  .reader-actions .quiet { padding-inline: 10px; }
}
