:root {
  --paper: #f4f0e6;
  --paper-deep: #e8e0d1;
  --ink: #182321;
  --muted: #65706c;
  --line: rgba(24, 35, 33, 0.16);
  --green: #1f6b58;
  --green-dark: #12483b;
  --orange: #e36f3d;
  --yellow: #e8b84c;
  --blue: #3f6f88;
  --card: rgba(255, 253, 248, 0.72);
  --shadow: 0 24px 70px rgba(38, 47, 43, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .28; background-image: radial-gradient(rgba(24,35,33,.18) .5px, transparent .5px); background-size: 5px 5px; mix-blend-mode: multiply; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a, input, select, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, label:has(input:focus-visible) { outline: 3px solid rgba(227,111,61,.55); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -4rem; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 10px; }
.skip-link:focus { top: 1rem; }
.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

.topbar { position: sticky; top: 0; z-index: 20; height: 82px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: rgba(244,240,230,.88); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; justify-self: start; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50% 50% 44% 56%; color: var(--paper); background: var(--green); font-family: Georgia, serif; font-size: 1.18rem; transform: rotate(-4deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .93rem; letter-spacing: .05em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: .69rem; letter-spacing: .08em; }
.nav { display: flex; align-items: center; gap: 5px; padding: 5px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.32); }
.nav-button { border: 0; background: transparent; padding: 9px 18px; border-radius: 999px; color: var(--muted); cursor: pointer; font-size: .88rem; }
.nav-button.is-active { color: var(--paper); background: var(--ink); }
.icon-button { justify-self: end; border: 1px solid var(--line); background: transparent; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-weight: 800; letter-spacing: 2px; }

.view { min-height: calc(100vh - 82px); }
.rag-view { min-height: 0; background: #eef3f9; }
.rag-frame { display: block; width: 100%; height: calc(100dvh - 82px); min-height: 620px; border: 0; background: #eef3f9; }
.hero { min-height: 565px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 70px; align-items: center; padding-block: 70px 54px; }
.eyebrow, .section-kicker, .card-label { margin: 0 0 16px; color: var(--green); font-size: .7rem; font-weight: 800; letter-spacing: .18em; }
.hero h1, .view-header h1 { margin: 0; max-width: 760px; font-family: Georgia, "Songti SC", serif; font-weight: 500; line-height: 1.02; letter-spacing: -.035em; }
.hero h1 { font-size: clamp(3.5rem, 7vw, 6.6rem); }
.hero h1 em { color: var(--orange); font-weight: 500; }
.hero-description { max-width: 610px; margin: 28px 0 0; color: var(--muted); font-size: 1.04rem; line-height: 1.85; }
.hero-actions { display: flex; gap: 18px; align-items: center; margin-top: 34px; }
.primary-button, .secondary-button, .text-button, .danger-button { border: 0; border-radius: 999px; cursor: pointer; font-weight: 700; }
.primary-button { padding: 15px 22px; color: white; background: var(--green); box-shadow: 0 10px 30px rgba(31,107,88,.2); }
.primary-button span { padding-left: 18px; }
.secondary-button { padding: 12px 18px; color: var(--ink); background: transparent; border: 1px solid var(--line); }
.text-button { padding: 12px 5px; border-radius: 0; background: transparent; border-bottom: 1px solid currentColor; }
.danger-button { padding: 12px 18px; color: #8a3029; background: #f5ded8; }

.hero-orbit { position: relative; width: min(420px, 100%); aspect-ratio: 1; justify-self: center; border: 1px solid rgba(31,107,88,.32); border-radius: 50%; }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.hero-orbit::before { inset: 17%; }
.hero-orbit::after { inset: 35%; background: rgba(255,255,255,.25); }
.orbit-core { position: absolute; inset: 39%; z-index: 2; display: grid; align-content: center; text-align: center; border-radius: 50%; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); }
.orbit-core span { font-family: Georgia, serif; font-size: 1.7rem; }
.orbit-core small { font-size: .62rem; color: #d4ddd9; }
.orbit-label { position: absolute; z-index: 3; padding: 7px 10px; border-radius: 999px; color: white; font-size: .63rem; font-weight: 800; letter-spacing: .09em; box-shadow: 0 8px 22px rgba(24,35,33,.15); }
.label-1 { left: 43%; top: -3%; background: var(--green); }
.label-2 { right: -6%; top: 32%; background: var(--orange); }
.label-3 { right: 3%; bottom: 10%; background: var(--blue); }
.label-4 { left: 10%; bottom: 2%; background: #8c654b; }
.label-5 { left: -5%; top: 28%; color: var(--ink); background: var(--yellow); }

.dashboard { display: grid; grid-template-columns: 1.45fr 1fr; gap: 22px; margin-bottom: 90px; }
.today-card, .metric-card { min-height: 170px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.today-card { display: flex; align-items: center; justify-content: space-between; padding: 34px 36px; color: var(--paper); background: var(--green-dark); box-shadow: var(--shadow); }
.today-card .section-kicker { color: #8fd0ba; }
.today-card h2 { margin: 0; font-family: Georgia, serif; font-size: 2.25rem; font-weight: 500; }
.today-card h2 span { color: #f4c560; }
.today-card p:last-child { margin: 11px 0 0; color: #bfd1c9; }
.round-button { width: 60px; height: 60px; border: 0; border-radius: 50%; color: var(--green-dark); background: #f4c560; font-size: 1.55rem; cursor: pointer; }
.metric-card { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; background: var(--card); }
.metric-card div { display: grid; place-content: center; gap: 8px; text-align: center; border-right: 1px solid var(--line); }
.metric-card div:last-child { border: 0; }
.metric-card strong { font-family: Georgia, serif; font-size: 2.35rem; font-weight: 500; }
.metric-card span { color: var(--muted); font-size: .76rem; }

.domains-section { padding-bottom: 110px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 500; }
.section-heading > p { max-width: 360px; color: var(--muted); line-height: 1.7; }
.domain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.domain-card { position: relative; min-height: 250px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); overflow: hidden; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.domain-card:hover { transform: translateY(-4px); background: rgba(255,255,255,.88); }
.domain-index { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.domain-card h3 { margin: 56px 0 10px; font-family: Georgia, serif; font-size: 1.55rem; font-weight: 500; }
.domain-card p { margin: 0; color: var(--muted); line-height: 1.65; font-size: .9rem; }
.domain-card .domain-accent { position: absolute; width: 105px; height: 105px; right: -36px; bottom: -40px; border-radius: 50%; background: var(--domain-color); opacity: .82; }

.study-view, .library-view { padding-block: 60px 100px; }
.view-header { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 38px; }
.view-header h1 { font-size: clamp(2.7rem, 6vw, 5.3rem); }
.study-filters { display: flex; align-items: center; gap: 12px; }
.study-filters label:not(.check-label) { display: grid; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 700; }
select { min-width: 180px; padding: 11px 36px 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.5); color: var(--ink); }
.check-label { display: flex; align-items: center; gap: 8px; padding: 20px 0 0 8px; color: var(--muted); font-size: .82rem; }
.check-label input { accent-color: var(--green); }
.study-progress { display: grid; grid-template-columns: 55px 1fr; gap: 14px; align-items: center; max-width: 860px; margin: 0 auto 18px; color: var(--muted); font-size: .76rem; }
.progress-track { height: 5px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--orange); transition: width .25s ease; }
.flashcard { max-width: 860px; min-height: 530px; margin: auto; padding: 32px 42px 26px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,253,248,.82); box-shadow: var(--shadow); }
.flashcard-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .73rem; }
.topic-pill { padding: 7px 10px; border-radius: 999px; color: var(--green-dark); background: #d8e9e2; font-weight: 800; }
.flashcard-question { margin: 58px 0 28px; }
.flashcard-question h2 { max-width: 720px; margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(2rem, 4.2vw, 3.45rem); font-weight: 500; line-height: 1.2; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 24px; }
.tag { padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .69rem; }
.flashcard-answer { padding: 28px 0 10px; border-top: 1px solid var(--line); animation: rise .25s ease; }
.answer-lead { margin: 0; color: var(--green-dark); font-family: Georgia, "Songti SC", serif; font-size: 1.35rem; line-height: 1.65; }
.flashcard-answer ul { margin: 18px 0; padding-left: 1.2rem; color: #3f4b47; line-height: 1.72; }
.source-line { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; margin: 22px 0 0; padding: 15px 17px; border-radius: 12px; background: rgba(232,224,209,.55); font-size: .72rem; }
.source-line span { grid-row: 1 / 3; color: var(--muted); }
.source-line strong { font-weight: 700; }
.source-line small { color: var(--muted); margin-top: 3px; }
.reveal-button { margin-top: auto; padding: 15px; border: 0; border-radius: 13px; color: white; background: var(--ink); cursor: pointer; font-weight: 800; }
kbd { display: inline-grid; place-items: center; min-width: 21px; min-height: 20px; padding: 1px 5px; border: 1px solid rgba(255,255,255,.3); border-radius: 5px; font-family: inherit; font-size: .65rem; }
.reveal-button kbd { margin-left: 9px; }
.rating-panel { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.rating-panel > p { margin: 0 0 11px; color: var(--muted); text-align: center; font-size: .76rem; }
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rating-grid button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: transparent; cursor: pointer; text-align: left; }
.rating-grid button:hover { background: var(--paper); }
.rating-grid kbd { grid-row: 1 / 3; align-self: center; border-color: var(--line); }
.rating-grid strong { font-size: .78rem; }
.rating-grid small { color: var(--muted); font-size: .63rem; }
.keyboard-hint { text-align: center; color: var(--muted); font-size: .7rem; }
.empty-state { max-width: 860px; margin: 50px auto; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 76px; height: 76px; margin: auto; border-radius: 50%; color: white; background: var(--green); font-size: 2rem; }
.empty-state h2 { font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }

.library-header { align-items: center; }
.search-box { display: flex; align-items: center; gap: 10px; min-width: min(380px, 100%); padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.5); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filter-chip { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: .76rem; }
.filter-chip.is-active { color: white; background: var(--green); border-color: var(--green); }
.result-count { color: var(--muted); font-size: .77rem; margin: 22px 0; }
.knowledge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.knowledge-item { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); overflow: hidden; }
.knowledge-item summary { position: relative; list-style: none; padding: 24px 58px 24px 24px; cursor: pointer; }
.knowledge-item summary::-webkit-details-marker { display: none; }
.knowledge-item summary::after { content: "+"; position: absolute; right: 24px; top: 22px; font-size: 1.35rem; font-weight: 300; }
.knowledge-item[open] summary::after { content: "−"; }
.knowledge-item h2 { margin: 12px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 1.25rem; font-weight: 500; line-height: 1.45; }
.knowledge-item-content { padding: 0 24px 24px; border-top: 1px solid var(--line); }
.knowledge-item-content > p:first-child { color: var(--green-dark); font-weight: 650; line-height: 1.65; }
.knowledge-item-content ul { padding-left: 1.2rem; color: #46504c; line-height: 1.65; }
.rag-reference-sections { display: grid; gap: 18px; margin-top: 22px; }
.rag-reference-section { padding-top: 18px; border-top: 1px solid var(--line); }
.rag-reference-section h3, .rag-interview-title { margin: 0; color: var(--green-dark); font-family: Georgia, "Songti SC", serif; font-size: 1.08rem; font-weight: 600; }
.rag-reference-section ul { margin-bottom: 0; }
.rag-code-example { margin-top: 14px; border: 1px solid rgba(24,35,33,.16); border-radius: 14px; overflow: hidden; background: #17211f; color: #e9f2ed; }
.rag-code-header { display: flex; justify-content: space-between; gap: 14px; padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.12); background: #21302c; }
.rag-code-header strong { font-size: .78rem; }
.rag-code-header span { color: #9fd2bf; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .68rem; text-transform: uppercase; }
.rag-code-mapping { margin: 0; padding: 10px 14px; color: #b9c9c2; font-size: .74rem; line-height: 1.55; }
.rag-code-example pre { margin: 0; padding: 15px 14px 18px; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.1); background: #111a18; }
.rag-code-example code { font: .73rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; white-space: pre; }
.rag-interview-title { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.rag-interview-list { display: grid; gap: 10px; margin: 14px 0 0; }
.rag-interview-item { padding: 14px 16px; border-radius: 12px; background: rgba(232,224,209,.45); }
.rag-interview-item dt { color: var(--ink); font-weight: 750; line-height: 1.55; }
.rag-interview-item dd { margin: 7px 0 0; color: var(--muted); line-height: 1.65; }
.knowledge-item .source-line { margin-top: 18px; }
.knowledge-meta { display: flex; gap: 8px; color: var(--muted); font-size: .68rem; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--radius-lg); background: transparent; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15,25,22,.48); backdrop-filter: blur(5px); }
.dialog-card { padding: 28px; background: #fbf8f0; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.dialog-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.dialog-card > p { color: var(--muted); line-height: 1.65; }
.close-button { border: 0; background: transparent; font-size: 1.8rem; cursor: pointer; }
.dialog-actions { display: grid; gap: 9px; margin-top: 24px; }
.dialog-actions > * { text-align: center; }
.file-button input { position: absolute; opacity: 0; pointer-events: none; }
.dialog-status { min-height: 1.5rem; margin-bottom: 0; font-size: .75rem; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; transform: translate(-50%, 30px); padding: 11px 17px; border-radius: 999px; color: white; background: var(--ink); opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); font-size: .8rem; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
footer { min-height: 90px; padding: 28px max(24px, calc((100vw - 1180px) / 2)); display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .nav { position: fixed; z-index: 30; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(244,240,230,.94); box-shadow: var(--shadow); }
  .icon-button { grid-column: 2; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-orbit { width: min(360px, 86vw); }
  .dashboard, .domain-grid { grid-template-columns: 1fr; }
  .domain-grid { grid-template-columns: repeat(2, 1fr); }
  .view-header { align-items: start; flex-direction: column; }
  .library-header, .search-box { width: 100%; }
  .knowledge-grid { grid-template-columns: 1fr; }
  footer { padding-bottom: 100px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 28px, 1180px); }
  .topbar { height: 70px; padding-inline: 14px; }
  .rag-frame { height: calc(100dvh - 70px); min-height: 540px; }
  .brand small { display: none; }
  .nav-button { padding: 9px 12px; }
  .hero { min-height: auto; padding-block: 48px; }
  .hero h1 { font-size: clamp(3rem, 15vw, 4.6rem); }
  .hero-description { font-size: .94rem; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-orbit { margin-top: 24px; }
  .dashboard { margin-bottom: 70px; }
  .today-card { padding: 28px 24px; }
  .metric-card { min-height: 130px; }
  .metric-card strong { font-size: 1.75rem; }
  .domain-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .study-view, .library-view { padding-block: 42px 90px; }
  .study-filters { width: 100%; align-items: start; flex-direction: column; }
  .study-filters label, select { width: 100%; }
  .check-label { padding-top: 4px; }
  .flashcard { min-height: 570px; padding: 24px 22px 20px; }
  .flashcard-question { margin-top: 42px; }
  .rating-grid { grid-template-columns: repeat(2, 1fr); }
  .keyboard-hint { display: none; }
  .source-line { grid-template-columns: 1fr; }
  .source-line span { grid-row: auto; }
  footer { gap: 14px; align-items: start; flex-direction: column; }
}
