@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,500;6..72,600;6..72,700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --paper: #f7f3ee;
  --surface: #fffdf9;
  --ink: #25221f;
  --muted: #776f67;
  --line: #e3dbd1;
  --soft-line: #eee8e1;
  --accent: #bf4f3d;
  --accent-deep: #963828;
  --accent-soft: #f4ded8;
  --sage: #587064;
  --shadow: 0 18px 45px rgba(65, 45, 30, 0.08);
  --radius: 10px;
  --font-sans: Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-serif: Newsreader, "Noto Serif SC", "Songti SC", STSong, serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background-color: var(--paper); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(191, 79, 61, 0.35); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .55; }

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 10; padding: 10px 14px; color: #fff; background: var(--accent-deep); border-radius: 6px; }
.skip-link:focus { top: 12px; }
.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, 0.9); }
.header-inner { display: flex; align-items: center; gap: 32px; width: min(1280px, calc(100% - 48px)); min-height: 76px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--surface); background: var(--accent); border-radius: 50%; font-family: var(--font-serif); font-size: 20px; font-weight: 700; }
.brand strong { display: block; font-family: var(--font-serif); font-size: 21px; line-height: 1.05; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.top-nav { display: flex; align-self: stretch; gap: 24px; margin-left: 20px; }
.nav-link { position: relative; padding: 4px 0; color: var(--muted); background: transparent; border: 0; font-weight: 500; }
.nav-link::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; content: ""; background: transparent; }
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after { background: var(--accent); }
.header-status { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; background: var(--sage); border-radius: 50%; }

.app-shell { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 80px; }
.view[hidden] { display: none; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 35px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-deep); font-size: 13px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: var(--font-serif); font-weight: 600; letter-spacing: 0; }
h1 { max-width: 760px; margin-bottom: 10px; font-size: clamp(38px, 5vw, 64px); line-height: 1.05; }
h2 { margin-bottom: 0; font-size: 24px; line-height: 1.2; }
.intro-copy { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 17px; }
.session-stat { min-width: 105px; padding: 14px 0 0 24px; border-left: 1px solid var(--line); text-align: right; }
.session-stat span { display: block; color: var(--accent-deep); font-family: var(--font-serif); font-size: 36px; line-height: 1; }
.session-stat small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.home-hero { display: block; max-width: 920px; margin: 0 auto; padding: 26px 0 58px; border-bottom: 1px solid var(--line); text-align: center; }
.home-hero h1 { max-width: 840px; margin: 0 auto 22px; font-size: clamp(42px, 6vw, 78px); line-height: 1.02; }
.home-lead { max-width: 700px; margin: 0 auto 28px; color: var(--muted); font-size: 19px; line-height: 1.7; }
.home-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.home-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 38px; max-width: 1100px; margin: 54px auto 0; }
.home-info-block { padding-top: 18px; border-top: 2px solid var(--ink); text-align: center; }
.home-info-block h2 { margin-bottom: 12px; font-size: 26px; }
.home-info-block p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }

.play-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: 42px; }
.filter-panel { position: sticky; top: 20px; padding: 25px 24px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--soft-line); }
.filter-heading h2 { font-size: 22px; }
.text-button { padding: 4px 0; color: var(--accent-deep); background: transparent; border: 0; font-size: 13px; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.filter-groups { display: grid; gap: 20px; padding: 20px 0; }
.filter-group h3 { margin: 0 0 9px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.filter-options { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-option { padding: 7px 10px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.2; transition: border-color .2s, color .2s, background .2s; }
.filter-option:hover { color: var(--ink); border-color: #bfb3a8; }
.filter-option.is-selected { color: var(--accent-deep); background: var(--accent-soft); border-color: #dca59a; font-weight: 500; }
.filter-footer { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--soft-line); }
.filter-footer > span { color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 6px; font-weight: 700; transition: transform .2s, background .2s, border-color .2s; }
.primary-button { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover { background: var(--accent-deep); transform: translateY(-1px); }
.secondary-button { color: var(--ink); background: transparent; border: 1px solid #cfc4b9; }
.secondary-button:hover { background: var(--surface); border-color: #9f8d7e; transform: translateY(-1px); }
.full-button { width: 100%; }
.primary-button svg, .secondary-button svg, .icon-button svg, .search-box svg { width: 16px; height: 16px; stroke-width: 2; }

.discussion-column { display: grid; gap: 24px; min-width: 0; }
.question-card { position: relative; min-height: 350px; padding: 34px 38px 30px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.question-card::before { position: absolute; top: 0; left: 0; width: 7px; height: 100%; content: ""; background: var(--accent); }
.question-topline, .question-meta, .question-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.question-topline { color: var(--muted); font-size: 12px; }
.question-id { color: var(--accent-deep); font-weight: 700; letter-spacing: .08em; }
.question-actions { gap: 8px; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 50%; transition: background .2s, color .2s, transform .2s; }
.icon-button:hover { color: var(--accent-deep); background: var(--accent-soft); transform: translateY(-1px); }
.icon-button.is-favorite { color: var(--accent-deep); background: var(--accent-soft); border-color: #dca59a; }
.question-card h2 { max-width: 820px; margin: 58px 0 50px; font-size: clamp(32px, 4.2vw, 54px); line-height: 1.22; }
.question-meta { justify-content: flex-start; flex-wrap: wrap; padding-top: 19px; border-top: 1px solid var(--soft-line); }
.tag, .difficulty { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border-radius: 5px; font-size: 12px; }
.tag { color: var(--muted); background: var(--paper); border: 1px solid var(--line); }
.difficulty { color: var(--accent-deep); background: var(--accent-soft); }
.source-link { margin-left: auto; color: var(--muted); font-size: 12px; text-decoration: none; }
.source-link:hover { color: var(--accent-deep); text-decoration: underline; }
.question-loading { display: grid; min-height: 286px; place-items: center; color: var(--muted); }
.question-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--soft-line); }
.comment-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 13px; }
.comment-toggle:hover, .comment-toggle.is-expanded { color: var(--accent-deep); }
.comment-toggle svg { width: 17px; height: 17px; }
.comment-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; color: var(--accent-deep); background: var(--accent-soft); border-radius: 20px; font-size: 11px; }
.comment-chevron { transition: transform .2s; }
.comment-toggle.is-expanded .comment-chevron { transform: rotate(180deg); }
.comments-panel { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--soft-line); }
.comments-intro { margin-bottom: 17px; color: var(--muted); font-size: 13px; }
.comments-list { display: grid; gap: 10px; max-height: 240px; overflow: auto; padding-right: 4px; }
.comment-item { padding: 13px 15px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.comment-item-top { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 13px; }
.comment-item-top time { color: var(--muted); font-size: 11px; }
.comment-item p { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.comments-empty, .comments-loading { padding: 18px 0; color: var(--muted); font-size: 13px; }
.comment-form { max-width: 760px; padding-top: 18px; margin-top: 16px; border-top: 1px solid var(--soft-line); }
.comment-form-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 12px; }
.comment-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.comment-form input, .comment-form textarea { width: 100%; padding: 9px 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; line-height: 1.5; }
.comment-form textarea { min-height: 76px; max-height: 140px; resize: vertical; }
.comment-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.comment-form-footer > span { color: var(--muted); font-size: 11px; }
.comment-form-footer .primary-button { min-height: 40px; padding: 0 14px; font-size: 13px; }

.library-intro { align-items: flex-end; }
.search-box { display: flex; align-items: center; gap: 10px; width: min(330px, 100%); min-height: 48px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.search-box input { width: 100%; color: var(--ink); background: transparent; border: 0; outline: 0; }
.search-box svg { color: var(--muted); }
.library-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 0 16px; color: var(--muted); font-size: 13px; }
.library-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.library-item { display: grid; gap: 15px; padding: 21px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, transform .2s; }
.library-item:hover { border-color: #cbb7aa; transform: translateY(-2px); }
.library-item-top, .library-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.library-item-id { color: var(--accent-deep); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.library-item h2 { margin: 0; font-size: 24px; line-height: 1.35; }
.library-item-bottom { padding-top: 13px; border-top: 1px solid var(--soft-line); }
.mini-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; }
.load-more { display: flex; margin: 24px auto 0; }
.empty-state { grid-column: 1 / -1; padding: 60px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: min(360px, calc(100% - 44px)); padding: 11px 15px; color: #fff; background: #342c28; border-radius: 6px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .play-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
  .question-card { padding-right: 30px; padding-left: 30px; }
  .question-card h2 { font-size: clamp(30px, 4vw, 45px); }
}
@media (max-width: 760px) {
  body { background-position: center 112px; background-size: auto 760px; background-attachment: scroll; }
  .header-inner, .app-shell { width: min(100% - 32px, 620px); }
  .header-inner { flex-wrap: wrap; gap: 16px; padding: 16px 0 12px; }
  .top-nav { order: 3; width: 100%; height: 32px; margin-left: 0; gap: 20px; }
  .header-status { margin-left: auto; font-size: 12px; }
  .app-shell { padding-top: 36px; }
  .page-intro { display: block; margin-bottom: 26px; }
  h1 { font-size: clamp(38px, 12vw, 54px); }
  .intro-copy { font-size: 16px; }
  .home-hero { padding-top: 0; padding-bottom: 38px; }
  .home-hero h1 { font-size: clamp(40px, 12vw, 58px); }
  .home-lead { font-size: 17px; line-height: 1.65; }
  .home-info-grid { grid-template-columns: 1fr; gap: 28px; }
  .home-info-block h2 { font-size: 24px; }
  .session-stat { display: flex; align-items: baseline; gap: 7px; width: fit-content; margin-top: 22px; padding: 0; border: 0; text-align: left; }
  .session-stat span { font-size: 28px; }
  .play-layout { display: block; }
  .filter-panel { position: static; margin-bottom: 22px; }
  .filter-groups { grid-template-columns: 1fr 1fr; gap: 16px; }
  .filter-group:first-child { grid-column: 1 / -1; }
  .question-card { min-height: 300px; padding: 26px 24px 24px; }
  .question-card h2 { margin: 45px 0 42px; font-size: clamp(30px, 8vw, 44px); }
  .source-link { width: 100%; margin-left: 0; }
  .question-footer { align-items: stretch; flex-direction: column; }
  .question-footer .secondary-button { width: 100%; }
  .comment-form-row { grid-template-columns: 1fr; }
  .comment-form-footer { align-items: flex-start; flex-direction: column; }
  .comment-form-footer .primary-button { width: 100%; }
  .library-list { grid-template-columns: 1fr; }
  .library-intro .search-box { width: 100%; margin-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
