:root {
  color-scheme: light;
  --ink: #172b23;
  --muted: #5b6c62;
  --green: #164d3b;
  --green-deep: #103e30;
  --mint: #edf5ee;
  --border: #e0e7e1;
  --bg: #f5f7f3;
  --white: #fff;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 310px; }
button, textarea, select { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid #79ac80; outline-offset: 3px; }
svg { width: 1.15em; height: 1.15em; vertical-align: middle; flex-shrink: 0; }
.shell { width: min(1280px, calc(100% - 104px)); margin-inline: auto; }
.topbar { background: var(--white); border-bottom: 1px solid var(--border); }
.top-inner { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; min-width: max-content; }
.brand strong { display: block; font-size: 21px; line-height: 1; letter-spacing: -.06em; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.tabs { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.tabs a { display: flex; gap: 8px; align-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 10px 13px; border-radius: 9px; }
.tabs a:hover, .tabs a[aria-current="page"] { background: var(--mint); color: var(--green-deep); }
.tabs small { font-size: 12px; color: var(--muted); font-weight: 500; }
.page-heading { padding: 32px 0 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--green); font-weight: 750; font-size: 12px; letter-spacing: .12em; }
.accent-line { width: 20px; height: 2px; background: #519076; }
h1, h2, h3, p { margin: 0; }
h1 { font-weight: 760; font-size: clamp(42px, 5vw, 65px); line-height: 1.08; letter-spacing: -.07em; margin: 4px 0 12px; }
h1 span { color: #398264; }
.page-heading p { color: var(--muted); max-width: 660px; }
.kb-status { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #e9f2e9; border: 1px solid #dceadd; border-radius: 999px; color: var(--green-deep); font-weight: 620; font-size: 13px; margin-bottom: 4px; }
.kb-status i { width: 8px; height: 8px; border-radius: 50%; background: #368c61; }
.kb-status[data-empty] i { background: #8b815e; }
.mentor-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: 17px; min-width: 0; box-shadow: 0 2px 4px #163f2c06; overflow: clip; }
.card-head { display: flex; gap: 12px; align-items: center; min-height: 75px; padding: 15px 19px; border-bottom: 1px solid var(--border); }
.card-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--mint); color: var(--green); font-size: 18px; flex-shrink: 0; }
.card-head h2 { color: var(--ink); font-size: 19px; font-weight: 750; letter-spacing: -.025em; line-height: 1.2; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; flex-shrink: 0; border-radius: 10px; }
.muted-button { background: var(--white); color: var(--green); border: 1px solid var(--border); border-radius: 9px; padding: 7px 12px; }
.muted-button:hover:not(:disabled) { background: var(--mint); }
#reset-chat { margin-left: auto; padding: 0; }
.settings { display: grid; grid-template-columns: .55fr 1.12fr 1fr 1.25fr; padding: 12px 19px 15px; gap: 10px; background: #fcfdfb; border-bottom: 1px solid var(--border); }
.settings label, .labeled-select { display: flex; flex-direction: column; color: var(--muted); gap: 4px; font-size: 13px; font-weight: 650; min-width: 0; }
select { appearance: none; padding: 7px 28px 7px 10px; min-height: 38px; width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%235a6e61' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center; color: var(--ink); font-size: 14px; border: 1px solid #dce5dc; border-radius: 8px; }
.messages { height: clamp(315px, 41vh, 425px); overflow: auto; padding: 17px 19px; scrollbar-gutter: stable; }
.welcome { display: grid; justify-items: center; align-content: center; text-align: center; min-height: 100%; padding: 8px 0; }
.welcome-mark { border-radius: 17px; width: 53px; height: 53px; display: grid; place-items: center; color: #285941; background: #e8f2e8; font-size: 24px; margin-bottom: 13px; }
.welcome h3 { font-size: 25px; letter-spacing: -.045em; line-height: 1.12; }
.welcome p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(100%, 518px); margin: 19px 0 0; }
.example { display: flex; text-align: left; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fcfdfb; color: var(--ink); font-size: 13px; line-height: 1.35; }
.example:hover { border-color: #a4c7ae; background: var(--mint); }
.example > span:first-child { color: #3d795d; margin-top: 2px; }
.example strong { display: block; font-size: 13px; margin-bottom: 2px; }
.example small { font-size: 12px; color: var(--muted); display: block; }
.composer-area { padding: 0 19px 14px; }
.composer { display: flex; align-items: end; gap: 9px; border: 1px solid #c8d6cc; border-radius: 12px; background: #fff; padding: 6px; }
.composer:focus-within { border-color: #6b9c7d; box-shadow: 0 0 0 3px #e1eee2; }
.composer textarea { flex: 1; border: 0; outline: 0; padding: 9px 8px; width: 0; resize: none; min-height: 42px; max-height: 120px; color: var(--ink); background: transparent; }
.composer textarea::placeholder { color: #637468; }
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 8px; background: var(--green); color: white; border: 1px solid var(--green); border-radius: 9px; text-decoration: none; font-weight: 650; }
.primary:hover:not(:disabled) { background: var(--green-deep); }
.composer-note { color: var(--muted); font-size: 12px; margin: 9px 0 0; }
.composer-note svg { margin-right: 4px; }
.turn { margin: 0 0 14px; }
.turn-user { display: flex; justify-content: flex-end; }
.turn-user p { overflow-wrap: anywhere; color: #193d30; background: #e8f3ea; padding: 10px 14px; border-radius: 13px 13px 4px 13px; max-width: 91%; white-space: pre-wrap; }
.turn-assistant { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.assistant-mark { width: 32px; height: 32px; display: grid; place-items: center; color: var(--green); background: var(--mint); border-radius: 9px; }
.reply-content { background: #f7f9f6; padding: 11px 13px; border-radius: 4px 13px 13px; min-width: 0; }
.reply-content p { margin: 0 0 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.reply-content p:last-child { margin-bottom: 0; }
.reply-status { font-size: 14px; color: var(--muted); }
.context-line { padding-top: 8px; border-top: 1px solid var(--border); }
.context-line strong { display: block; font-size: 13px; color: var(--muted); }
.citations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.cite { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid #c9dfce; padding: 3px 6px; border-radius: 6px; background: #edf5ed; color: var(--green); font-size: 12px; font-weight: 680; text-align: left; }
.cite span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cite:hover { background: #dceedd; }
.cite-inline { margin-left: 5px; vertical-align: baseline; }
.source-content { padding: 13px 15px 15px; }
.player-area { aspect-ratio: 16 / 8.5; border-radius: 10px; overflow: hidden; position: relative; background: #1a3c31; display: grid; place-items: center; color: #e5f4e8; }
.player-area > button { position: relative; width: 100%; height: 100%; padding: 0; border: 0; color: white; background: #173d31; }
.player-area img { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.83); }
.player-area iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-area audio { width: calc(100% - 28px); position: absolute; bottom: 13px; left: 14px; }
.player-area .audio-poster { position: absolute; inset: 0; }
.play-overlay { position: absolute; inset: 0; display: grid; place-items: center; }
.play-overlay > span { display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid #ffffff75; border-radius: 50%; background: #173e33e8; backdrop-filter: blur(4px); font-size: 25px; }
.source-detail { min-height: 59px; padding: 9px 2px 11px; }
.source-detail h3 { font-size: 15px; line-height: 1.35; }
.source-detail p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.source-detail .excerpt { margin-top: 7px; max-height: 117px; overflow-y: auto; padding: 8px 9px; border-left: 2px solid #7fa589; background: #f5f8f3; color: #2c4839; }
.source-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 10px; margin-top: 5px; }
.source-links a, .source-links button { border: 0; background: transparent; color: var(--green); padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.episode-heading { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding: 11px 2px 6px; }
.episode-heading h3 { font-size: 15px; }
.episode-heading span { background: #eef3ec; border-radius: 6px; padding: 0 7px; font-size: 12px; color: var(--green); font-weight: 700; }
.episode-list { display: grid; gap: 5px; }
.episode { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; text-align: left; border: 1px solid var(--border); padding: 6px 8px; border-radius: 9px; color: var(--ink); background: white; }
.episode:hover, .episode[aria-pressed="true"] { background: #eef5ed; border-color: #cfdfd0; }
.episode-icon { padding: 5px; border-radius: 6px; background: #e7f0e6; color: var(--green); }
.episode strong { display: block; font-size: 13px; line-height: 1.25; }
.episode small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.episode .episode-time { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.footer { margin-top: 14px; padding-block: 13px 22px; display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.book-grid, .stat-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.book-options { padding: 17px 19px 23px; display: grid; gap: 17px; }
.book-options p { color: var(--muted); font-size: 14px; }
.switch-label { display: flex; align-items: center; gap: 9px; }
.switch-label input { width: 18px; height: 18px; accent-color: var(--green); }
.paper-stage { display: grid; place-items: center; min-height: 500px; background: #eef2ec; padding: 24px; user-select: none; }
.paper-stage img { width: min(100%, 480px); box-shadow: 0 3px 15px #153c2e24; -webkit-user-drag: none; }
.page-controls { display: flex; gap: 12px; justify-content: center; align-items: center; padding: 12px; }
.stat-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.2fr); }
.stat-actions { display: flex; align-items: end; gap: 9px; }
.download { white-space: nowrap; min-height: 38px; padding: 6px 11px; font-size: 14px; }
.privacy { display: flex; gap: 8px; align-items: center; background: #eaf2e9; color: #2f533f; border: 1px solid #dae8da; padding: 11px 14px; border-radius: 10px; margin: 0 0 17px; font-size: 14px; }
.bar-chart { display: grid; gap: 15px; padding: 20px; }
.bar-label { display: flex; justify-content: space-between; color: var(--ink); font-size: 14px; padding-bottom: 4px; }
.track { width: 100%; height: 11px; background: #edf2ed; border-radius: 99px; overflow: hidden; display: block; }
.track span { display: block; height: 100%; background: #3b8263; border-radius: 99px; }
.table-scroll { overflow: auto; max-height: 405px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th, td { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--green-deep); font-weight: 680; background: #eef4ed; }
.stats-table th:first-child, .stats-table td:first-child { padding-left: 18px; }
.stats-table th:last-child, .stats-table td:last-child { text-align: right; padding-right: 18px; }
.table-scroll tr:last-child td { border-bottom: 0; }
.answer-table td { overflow-wrap: anywhere; }
.answer-table td:first-child { min-width: 110px; }
@media (max-width: 1150px) {
  .shell { width: calc(100% - 48px); }
  .mentor-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { width: calc(100% - 28px); }
  .top-inner { height: auto; min-height: 68px; padding-block: 10px; gap: 12px; }
  .tabs { gap: 2px; }
  .tabs a { padding: 8px; gap: 4px; }
  .tabs small { display: none; }
  .page-heading { padding: 26px 0 19px; align-items: flex-start; }
  .kb-status { margin-top: 10px; }
  .mentor-grid, .book-grid, .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .player-area { max-height: 420px; }
}
@media (max-width: 590px) {
  .top-inner, .page-heading { flex-direction: column; gap: 8px; }
  .top-inner { align-items: start; }
  .tabs a { padding: 7px 6px; font-size: 13px; }
  .tabs svg { display: none; }
  h1 { font-size: clamp(37px, 10vw, 56px); }
  .kb-status { margin-top: 2px; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .messages { height: 390px; padding-inline: 13px; }
  .composer-area, .card-head, .settings { padding-inline: 13px; }
  .welcome p { font-size: 13px; }
  .examples { gap: 5px; }
  .example { padding: 7px; gap: 5px; }
  .example > span:first-child { display: none; }
  .footer { flex-direction: column; gap: 4px; }
  .paper-stage { padding: 14px; min-height: 300px; }
  .privacy { align-items: start; }
}

.login-wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); align-items: center; gap: 4vw; min-height: 62vh; padding-block: 48px; max-width: 930px; }
.login-intro > p:last-child { color: var(--muted); max-width: 390px; }
.login-form { display: grid; gap: 8px; padding: 26px; }
.login-form h2 { margin: 4px 0 6px; font-size: 24px; }
.login-form label, .member-form label { font-size: 14px; font-weight: 630; color: var(--muted); }
.login-form input, .member-form input { min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid #dce5dc; border-radius: 8px; font: inherit; color: var(--ink); background: white; }
.login-form .primary { margin-top: 6px; min-height: 41px; }
.form-status { color: var(--muted); font-size: 14px; }
.form-status:empty { display: none; }
.member-card { margin-top: 20px; }
.member-form { display: grid; grid-template-columns: 1.15fr 1fr 1fr auto; gap: 10px; padding: 14px 18px; align-items: end; }
.member-form input { display: block; margin-top: 4px; }
.member-form .primary { min-height: 42px; padding-inline: 13px; }
.member-status { padding: 0 18px 10px; }
#logout { font-size: 14px; margin-left: 4px; }
.identity-setting { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 650; }
.identity-setting strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--ink); font-size: 14px; padding-block: 8px; }
.cite { text-decoration: none; }
@media (max-width: 690px) {
  .login-wrap { grid-template-columns: 1fr; gap: 18px; padding-block: 25px; }
  .member-form { grid-template-columns: 1fr 1fr; }
}
