:root {
  color-scheme: light;
  --paper: #eef1ef;
  --surface: #fbfcfb;
  --ink: #1c2924;
  --muted: #4a6054;
  --green: #136c49;
  --edge: #c7d4cb;
  --sage: #dce8df;
  font: 16px/1.5 "Aptos", "Helvetica Neue", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
a { color: var(--green); }
.wrap { width: min(72rem, calc(100% - 3rem)); margin-inline: auto; }
.top { border-bottom: 1px solid var(--edge); }
.top-content { min-height: 4.75rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.brand { display: inline-flex; gap: .65rem; align-items: center; text-decoration: none; font-weight: 750; font-size: 1.3rem; color: var(--ink); letter-spacing: -.035em; }
nav { display: flex; gap: .35rem; }
main { padding-block: clamp(2.4rem, 7vw, 6rem); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.65rem, 6.4vw, 5.85rem); line-height: .96; letter-spacing: -.077em; font-weight: 720; }
h2 { font-size: 1.32rem; line-height: 1.2; letter-spacing: -.035em; }
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 25rem); align-items: center; gap: clamp(2rem, 8vw, 7rem); }
.welcome h1 { max-width: 13ch; text-wrap: balance; }
.welcome > div > p { color: var(--muted); font-size: 1.13rem; max-width: 34ch; margin-top: 1.5rem; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: .65rem; }
.auth, .form-stack { display: grid; gap: 1.05rem; }
.auth { padding: clamp(1.25rem, 4vw, 2rem); }
.auth h2 { margin-bottom: .35rem; }
label { display: grid; gap: .32rem; color: var(--muted); font-size: .92rem; font-weight: 600; }
input, button { font: inherit; }
input { width: 100%; min-width: 0; min-height: 2.85rem; padding: .5rem .7rem; border: 1px solid #aebfb3; border-radius: .38rem; background: white; color: var(--ink); font-size: 1rem; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #378460; outline-offset: 3px; }
button { cursor: pointer; min-height: 2.85rem; border: 1px solid transparent; border-radius: .4rem; padding: .52rem .9rem; font-weight: 650; }
button:disabled { opacity: .63; cursor: wait; }
.primary { background: var(--green); color: white; }
.primary:hover:enabled { background: #0c5538; }
.quiet { color: var(--green); background: transparent; }
.quiet:hover:enabled { background: var(--sage); }
.switch { margin-top: -.45rem; }
.library-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.library-heading h1 { font-size: clamp(2.5rem, 5.5vw, 4.9rem); }
.library-heading .primary { flex-shrink: 0; }
.filters { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(8rem, 11rem) minmax(8rem, 11rem) auto; gap: .75rem; align-items: end; padding: 1rem; }
.results-heading { display: flex; align-items: baseline; gap: 1em; margin: 2.5rem 0 1rem; }
#results-summary, .hint { color: var(--muted); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(13rem, 100%), 1fr)); gap: 1rem; }
.empty { grid-column: 1 / -1; color: var(--muted); border-block: 1px solid var(--edge); padding: 1.5rem 0; }
.result { text-align: left; font-weight: 400; padding: 0; overflow: hidden; border: 1px solid var(--edge); border-radius: .55rem; background: var(--surface); color: var(--ink); }
.result:hover { border-color: var(--green); }
.result img { display: block; width: 100%; height: 12.5rem; background: var(--sage); object-fit: contain; }
.result-placeholder { display: grid; place-items: center; padding: 1rem; height: 12.5rem; background: var(--sage); color: var(--muted); text-align: center; }
.result-copy { display: grid; gap: .4rem; padding: .8rem; }
.caption { color: var(--muted); font-size: .86rem; }
.excerpt { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 1.5em; }
.tags { color: #15583d; overflow-wrap: anywhere; font-size: .88rem; }
.more { margin-top: 1rem; }
dialog { max-width: min(calc(100% - 2rem), 32rem); width: 100%; max-height: calc(100dvh - 2rem); background: var(--surface); color: var(--ink); padding: 1.35rem; border: 1px solid var(--edge); border-radius: .75rem; }
dialog::backdrop { background: #15241d9c; }
.capture-dialog { max-width: min(calc(100% - 2rem), 48rem); }
.dialog-header, .actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.actions { justify-content: flex-end; flex-wrap: wrap; }
#capture-details { display: grid; gap: .7rem; overflow-wrap: anywhere; }
#capture-details img { display: block; width: 100%; max-height: 65dvh; object-fit: contain; background: var(--sage); border-radius: .4rem; }
.ocr { white-space: pre-wrap; }
.status, .inline-status:not(:empty), .token { overflow-wrap: anywhere; border-radius: .4rem; background: var(--sage); padding: .65rem .8rem; }
.status { margin-bottom: 1rem; }
.inline-status:empty { display: none; }
.token { font-family: ui-monospace, monospace; user-select: all; }
.capture-video { display: grid; gap: .55rem; margin-block: .4rem; padding: .8rem; border: 1px solid var(--edge); border-radius: .4rem; }
.capture-video button, .capture-video a { justify-self: start; }
@media (max-width: 43rem) {
  .wrap { width: calc(100% - 2rem); }
  .welcome { grid-template-columns: 1fr; }
  .welcome > div > p { margin-top: .9rem; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keywords, .filters button { grid-column: 1 / -1; }
}
@media (max-width: 29rem) {
  .library-heading { align-items: start; flex-direction: column; }
  .top-content nav button { font-size: .88rem; padding-inline: .35rem; }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .result img, .result-placeholder { height: 9.5rem; }
}
