:root {
  color-scheme: light;
  --ink: #18372f;
  --muted: #4d655b;
  --jade: #145642;
  --gold: #92652d;
  --paper: #fbf7ef;
  --wash: #f7f2e8;
  --surface: #fffdf8;
  --stroke: #e1dacb;
  --glass: #fffdf6f2;
  --pill: #e0eae0;
  --tap: #fffdf4;
  --search: #fffaf2;
  --shadow: 0 3px 12px #50452509;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  color: var(--ink);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  background: var(--paper);
}
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.app-frame {
  --gutter: 20px;
  --dock-space: calc(92px + env(safe-area-inset-bottom));
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: max(9px, env(safe-area-inset-top)) 0 var(--dock-space);
}
.topline, main > section:not(#screen-library) { padding-inline: max(var(--gutter),env(safe-area-inset-left)) max(var(--gutter),env(safe-area-inset-right)); }
.app-frame:has(#screen-library:not([hidden])) { padding-bottom: 0; background: var(--paper); }
a { color: var(--jade); text-underline-offset: 3px; }
a, button, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
input, textarea { font-size: 16px; }
:focus-visible { outline: 3px solid #b48034; outline-offset: 3px; }
h1:focus, h2:focus { outline: 0; }
.topline { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.topline a, .dock a, .source-action, .back-link { text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--ink); font-size: .85rem; font-weight: 830; letter-spacing: .07em; }
.brand .icon { width: 19px; height: 19px; color: var(--gold); }
.brand b { font-weight: 450; }
.install-chip { display: inline-flex; gap: 5px; align-items: center; justify-content: center; min-height: 44px; color: var(--jade); font-size: .8rem; font-weight: 650; }
.install-chip .icon { width: 18px; height: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { margin: 18px 0 18px; font-size: clamp(2.05rem,9.5vw,3.1rem); line-height: .99; font-weight: 750; letter-spacing: -.06em; }
h2 { font-size: 1.37rem; line-height: 1.18; font-weight: 710; letter-spacing: -.035em; }
h3 { font-size: 1rem; font-weight: 670; letter-spacing: -.01em; }
.hero {
  position: relative; isolation: isolate; display: grid; justify-items: center; align-content: center;
  gap: clamp(10px,1.8svh,18px); padding: clamp(13px,2.6svh,30px) var(--gutter) 30px;
  overflow: hidden; text-align: center; color: var(--ink); background: var(--paper);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg,#fbf7efed 0%,#fbf7efbf 18%,#fbf7efcd 45%,#fbf7eff2 72%,#fbf7ef 90%),
              url('/library/reading-hall.webp') center 40% / cover;
}
#library-title {
  margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400; font-size: clamp(2.16rem,8.7vw,3rem); letter-spacing: -.027em; line-height: 1.09;
}
#library-title span { color: #174c39; font-weight: 750; }
.hero-description { margin-top: 8px; color: #445349; font-size: .96rem; line-height: 1.35; }
.hero-cat { width: clamp(145px,min(53vw,24svh),224px); height: auto; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 3px 18px #5d481c40; }
.primary {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 5px;
  padding: 0 .83rem; border: 1px solid #124b3b; border-radius: 24px; background: #174c3a;
  color: #fffdf3; font-size: .87rem; line-height: 1.1; font-weight: 640; white-space: nowrap;
}
.primary .icon { width: 17px; height: 17px; }
#screen-library { min-height: calc(100svh - 44px - max(9px,env(safe-area-inset-top))); display: flex; flex-direction: column; }
.materials {
  flex: 1; display: flex; flex-direction: column; position: relative; isolation: isolate;
  padding: clamp(20px,3.1svh,32px) max(var(--gutter),env(safe-area-inset-right)) var(--dock-space) max(var(--gutter),env(safe-area-inset-left));
  margin-top: -5px; background: var(--paper); color: var(--ink);
}
.materials::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); border-top: 1px solid #e4dece; }
.material-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 1px 12px; }
.material-heading h2 { font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 1.45rem; font-weight: 550; letter-spacing: -.018em; }
.materials .result-count, .materials .notice { color: #657268; font-weight: 400; }
.materials .secondary { align-self: flex-start; }
.result-count, .metadata, .meta-line { color: var(--muted); font-size: .77rem; font-weight: 550; line-height: 1.4; }
.search-field {
  display: flex; align-items: center; gap: 8px; min-height: 46px; margin-bottom: 11px; padding: 5px 13px;
  border: 1px solid var(--stroke); border-radius: 16px; background: var(--surface); color: #62756a;
}
.search-field .icon { width: 19px; height: 19px; }
.search-field:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; }
.search-field input { min-width: 0; width: 100%; border: 0; padding: 6px 0; outline: 0; background: transparent; }
.search-field input::placeholder { color: #657268; opacity: 1; }
textarea::placeholder { color: var(--muted); opacity: 1; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li + li { margin-top: 8px; }
.card-link {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 17px 12px 17px 14px;
  border: 1px solid var(--stroke); border-radius: 19px; background: var(--surface); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow);
}
.card-mark { display: grid; place-items: center; width: 35px; height: 42px; border-radius: 8px 10px 10px 8px; border-left: 2px solid #d5ba83; background: #f1eada; color: #486254; }
.card-mark .icon { width: 20px; height: 20px; }
.card-main { display: grid; gap: 6px; min-width: 0; }
.card-name { font-size: 1.03rem; font-weight: 530; line-height: 1.33; letter-spacing: -.01em; }
.card-main .meta-line { font-weight: 400; color: #657268; }
.card-link > .icon { width: 14px; height: 16px; color: var(--muted); }
.quick-ask { margin-top: auto; padding-top: 22px; }
.quick-ask label { display: block; margin: 0 1px 8px; font-weight: 530; font-size: 1rem; color: var(--ink); }
.quick-field { display: flex; align-items: center; min-height: 50px; gap: 7px; border: 1px solid var(--stroke);
  border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); padding: 2px 3px 2px 15px; color: #193c2e; }
.quick-field:focus-within { outline: 2px solid #e3b86d; outline-offset: 2px; }
.quick-field input { min-width: 0; width: 100%; background: transparent; border: 0; padding: 6px 0; outline: 0; color: #193c2e; }
.quick-field input::placeholder { color: #5d675e; opacity: 1; }
.quick-field button { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 0; border-radius: 50%;
  color: #fffdf5; background: #226047; }
.quick-field button .icon { width: 21px; height: 21px; stroke-width: 2.1; }
.notice { margin: 13px 0; font-size: .93rem; line-height: 1.46; color: var(--muted); }
.notice:empty { display: none; }
.secondary { min-height: 44px; padding: .45rem .9rem; color: var(--jade); background: var(--surface); border: 1px solid var(--stroke); border-radius: 13px; }
.dock {
  position: fixed; bottom: max(12px,env(safe-area-inset-bottom)); left: 50%; z-index: 3; transform: translateX(-50%);
  width: min(344px,calc(100% - 36px)); display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
  padding: 5px; border: 1px solid #e1dbcf; border-radius: 32px; background: var(--glass);
  box-shadow: 0 4px 20px #51452e12;
  -webkit-backdrop-filter: blur(22px) saturate(155%); backdrop-filter: blur(22px) saturate(155%);
}
.dock a { display: grid; min-height: 49px; align-content: center; justify-items: center; gap: 3px; padding: 4px 2px; border-radius: 23px; color: var(--muted); font-size: .7rem; font-weight: 590; line-height: 1.1; }
.dock a[aria-current="page"] { color: var(--jade); background: var(--pill); font-weight: 600; }
.dock .icon { width: 22px; height: 22px; }
.ask-intro, .about-id { display: flex; align-items: center; gap: 13px; margin: 19px 0; }
.ask-intro img, .about-id img { border-radius: 50%; flex: none; }
.ask-intro p, .about-id p { font-size: .98rem; line-height: 1.45; }
.ask-form, .reading { background: var(--surface); border: 1px solid var(--stroke); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); }
.ask-form { display: grid; gap: 9px; }
.ask-form:focus-within { border-color: var(--gold); }
.ask-form label { font-size: .91rem; font-weight: 650; }
.ask-form textarea { border: 0; background: transparent; line-height: 1.45; resize: vertical; min-height: 5.2rem; width: 100%; padding: 3px 1px; }
.ask-form textarea:focus { outline-offset: 1px; }
.composer-actions { display: flex; justify-content: flex-end; }
.primary { padding-inline: 16px; }
.primary:disabled { opacity: .6; cursor: progress; }
.web-help { margin: 10px 2px; color: var(--muted); font-size: .85rem; }
.web-help summary { min-height: 40px; width: fit-content; padding-top: 10px; }
.web-help p, .install-guide li { line-height: 1.55; }
.web-help code { color: var(--ink); }
.reading { overflow-wrap: anywhere; }
.reading .material-text { white-space: pre-wrap; line-height: 1.6; margin: 15px 0; }
.answer { margin-top: 14px; }
#source-list { margin: 10px 0 0; padding-left: 20px; }
#source-list a { display: inline-block; padding: 5px 0; line-height: 1.5; }
#source-list li + li { margin-top: 6px; }
#source-list .original { display: block; width: fit-content; font-size: .86rem; }
.source-action, .back-link { display: inline-flex; gap: 7px; align-items: center; min-height: 44px; font-weight: 620; }
.source-action .icon, .back-link .icon { width: 16px; height: 16px; }
.back-link { margin: 4px 0 8px; }
.reading h1 { font-size: clamp(1.6rem,7vw,2.2rem); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.045em; }
.install-guide { margin: 18px 0 8px; }
.install-icon { width: 28px; height: 28px; margin-bottom: 9px; color: var(--gold); }
.install-guide ol { margin: 13px 0 0; padding-left: 1.3em; }
.install-guide li + li { margin-top: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-height: 730px) and (max-width: 570px) {
  .hero { grid-template-columns: clamp(101px,34vw,146px) minmax(0,1fr); align-items: center;
    gap: 14px; padding: 15px var(--gutter) 23px; text-align: left; }
  .hero::before { background: linear-gradient(96deg,#fbf7efb0,#fbf7efd9 38%,#fbf7eff7 75%),
                              url('/library/reading-hall.webp') center 44% / cover; }
  .hero-cat { width: 100%; }
  #library-title { font-size: clamp(1.64rem,6.9vw,2.1rem); }
  .hero-description { margin-top: 6px; font-size: .83rem; line-height: 1.34; }
  .hero-description br { display: none; }
  .materials { padding-top: 19px; }
  .material-heading { margin-bottom: 10px; }
  .card-link { padding-block: 12px; }
  .quick-ask { padding-top: 16px; }
}
@media (max-width: 350px) {
  .app-frame { --gutter: 15px; }
}
@media (max-height: 600px) and (max-width: 350px) {
  .hero { grid-template-columns: 85px minmax(0,1fr); gap: 10px; padding-block: 9px 16px; }
  #library-title { font-size: 1.45rem; }
  .hero-description { font-size: .77rem; }
  .materials { padding-top: 15px; }
  .card-link { gap: 8px; padding-block: 10px; }
  .card-name { font-size: .96rem; }
}
@media (min-width: 660px) {
  body { background: #f0ece2; }
  .app-frame { --gutter: 28px; margin-top: 20px; min-height: calc(100vh - 20px); padding-top: 18px; border: 1px solid #ffffff9e; border-bottom: none; border-radius: 32px 32px 0 0; background: linear-gradient(165deg,var(--paper),var(--wash)); box-shadow: 0 4px 44px #2f493112; }
  #screen-library { min-height: calc(100svh - 83px); }
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: #fffdf6dc; }
}
@media (prefers-reduced-transparency: reduce) { .dock { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); } }
@media (display-mode: standalone) { #installation, #install-guide { display: none; } }

.query-history { margin-block-start: 2rem; }
.query-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.query-heading button { min-height: 40px; padding: .45rem .8rem; background: none; border: 1px solid #dcd2c1; border-radius: 24px; color: #24513f; }
.query-card { margin-top: .7rem; padding: .9rem 1rem; color: var(--ink); background: #fffcf6; border: 1px solid #e1d9cb; border-radius: 18px; }
.query-card summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.query-card time { display: block; margin-top: .65rem; color: #52665b; font-size: .78rem; }
.query-answer { margin-block: .65rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.query-card a { display: block; color: #24513f; overflow-wrap: anywhere; }
