:root {
  color-scheme: light;
  --ink: #142d35;
  --muted: #516d72;
  --accent: #08766a;
  --accent-deep: #065f56;
  --accent-tint: #e6f4ef;
  --line: #d9e5e3;
  --paper: #fff;
  --surface: #f3f7f6;
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--accent-deep); }
:focus-visible { outline: 3px solid #0b907e; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { background: #0c2831; color: white; border-bottom: 1px solid #21434b; }
.topbar-inner { max-width: 1460px; min-height: 70px; margin: auto; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-size: 17px; font-weight: 700; }
.brand small { margin-left: 8px; font-weight: 500; font-size: 13px; color: #a4c5c3; white-space: nowrap; }
.brand-mark { position: relative; flex: none; width: 36px; height: 36px; border: 1px solid #6fbbaa; border-radius: 10px; background: #133f46; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 15px; height: 2px; background: #9cdbcb; left: 11px; transform-origin: left; }
.brand-mark::before { top: 18px; transform: rotate(-39deg); }
.brand-mark::after { top: 18px; transform: rotate(36deg); }
.brand-mark i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #aff0d9; left: 8px; top: 16px; }
.brand-mark i:nth-child(2) { left: 21px; top: 7px; }
.brand-mark i:nth-child(3) { left: 21px; top: 24px; }
.top-note { display: flex; align-items: center; gap: 8px; color: #cddfdd; font-size: 14px; white-space: nowrap; }
.top-note span { width: 7px; height: 7px; background: #88d0b7; border-radius: 50%; }
main { max-width: 1460px; padding: 0 34px 34px; margin: auto; }
.search-area { padding: 30px 0 26px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(29px, 3.45vw, 49px); font-weight: 700; line-height: 1.22; }
h1 span { color: var(--accent); }
.search-form { max-width: 740px; display: flex; align-items: center; gap: 13px; padding: 5px 5px 5px 17px; margin-top: 18px; background: var(--paper); border: 1px solid #c8dbd6; border-radius: 12px; box-shadow: 0 3px 10px #16483d0c; }
.search-form:focus-within { border-color: #129583; box-shadow: 0 0 0 3px #d0eae3; }
#suggestions { max-width: 740px; max-height: 230px; overflow-y: auto; overscroll-behavior: contain; margin: 6px 0 0; padding: 4px; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 5px 15px #123d3614; }
#suggestions:empty { display: none; }
#suggestions li { align-content: center; min-height: 44px; padding: 7px 12px; border-radius: 7px; cursor: pointer; overflow-wrap: anywhere; }
#suggestions li:hover, #suggestions li[aria-selected="true"] { background: var(--accent-tint); color: var(--accent-deep); }
.magnifier { width: 15px; height: 15px; border: 2px solid #64817d; border-radius: 50%; position: relative; margin-right: 4px; flex: none; }
.magnifier::after { content: ""; position: absolute; width: 7px; height: 2px; right: -5px; bottom: -2px; background: #64817d; transform: rotate(45deg); }
.search-form input { border: 0; flex: 1; width: 0; min-height: 40px; outline: 0; color: var(--ink); font-size: 17px; }
.button { min-height: 39px; padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.primary { background: var(--accent); color: white; border: 1px solid var(--accent); }
.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.subtle { background: white; color: var(--accent-deep); border: 1px solid #cbded9; }
.subtle:hover { background: var(--accent-tint); }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.examples span { margin-right: 2px; }
.examples button { border: 1px solid #d6e4e1; background: #f8fbfa; color: #31575a; padding: 4px 10px; border-radius: 20px; }
.examples button:hover { background: var(--accent-tint); color: var(--accent-deep); }
.workspace { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(400px, 1.2fr); align-items: start; gap: 18px; }
.left-column { display: grid; gap: 14px; min-width: 0; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 3px 10px #123d3608; overflow: hidden; }
.card-header { min-height: 56px; padding: 9px 17px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
h2 { font-size: 16px; font-weight: 600; }
.result-count { font-size: 13px; font-weight: 700; background: var(--accent-tint); color: var(--accent-deep); padding: 4px 8px; border-radius: 6px; }
.result-status { font-size: 14px; color: var(--muted); padding: 12px 17px; }
.results { list-style: none; max-height: 232px; padding: 0 8px 8px; margin: 0; overflow: auto; }
.results:empty { display: none; }
.result-button { display: flex; text-align: left; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 9px 10px; background: white; color: var(--ink); font-weight: 600; }
.result-button:hover { background: #f4f8f7; }
.result-button[aria-current="true"] { background: var(--accent-tint); color: var(--accent-deep); border-color: #c9e4da; }
.result-edition { white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--muted); }
.definition-body { padding: 20px 22px 23px; min-height: 184px; }
.muted { color: var(--muted); }
.entry-source { color: var(--accent-deep); font-weight: 600; font-size: 14px; }
h3 { font-size: clamp(26px, 3.1vw, 40px); line-height: 1.22; margin: 6px 0 13px; overflow-wrap: anywhere; font-weight: 700; }
.definition-text { font-size: 17px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
#edit-form label { display: block; color: var(--muted); margin-bottom: 7px; font-size: 14px; font-weight: 600; }
#editor-key-field { margin-top: 10px; }
#editor-key { width: 100%; border: 1px solid #9dbfb6; border-radius: 8px; padding: 9px 12px; }
textarea { display: block; width: 100%; padding: 10px 12px; line-height: 1.6; border: 1px solid #9dbfb6; border-radius: 8px; resize: vertical; min-height: 115px; color: var(--ink); background: #fbfefd; }
.edit-actions { display: flex; gap: 8px; margin-top: 10px; }
.message { margin-top: 12px; background: var(--accent-tint); color: var(--accent-deep); border-radius: 7px; padding: 8px 10px; font-size: 14px; }
.message.error { background: #fff1eb; color: #873d26; }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 13px; border-bottom: 1px solid var(--line); background: #f8fbfa; }
.page-controls, .zoom-controls, .source-pages { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.page-controls span { min-width: 82px; text-align: center; white-space: nowrap; }
.zoom-controls output { min-width: 43px; text-align: center; font-variant-numeric: tabular-nums; }
.icon-button, .source-pages button { background: white; border: 1px solid #d2e1dd; border-radius: 6px; color: #214a4b; min-height: 32px; min-width: 32px; line-height: 1; }
.icon-button { font-size: 20px; }
.icon-button:hover:not(:disabled), .source-pages button:hover { background: var(--accent-tint); }
.source-pages button[aria-current="page"] { color: var(--accent-deep); border-color: #87b8ab; background: var(--accent-tint); }
.pdf-scroll { height: min(59vh, 660px); min-height: 350px; overflow: auto; background: #eaf1ef; padding: 15px; overscroll-behavior: contain; container-type: size; }
#retry-page { display: flex; margin: 0 auto; }
.pdf-status { color: var(--muted); padding: 12px 5px; text-align: center; }
.pdf-sheet { width: var(--zoom, 100%); max-width: calc(1000px * var(--zoom-number, 1)); position: relative; background: white; margin: 0 auto; box-shadow: 0 2px 13px #102c3330; }
.pdf-scroll.full-page .pdf-sheet { width: min(100%, calc(100cqh * var(--page-ratio, .77))); max-width: none; }
.pdf-sheet img { display: block; width: 100%; height: auto; }
.highlights { position: absolute; inset: 0; pointer-events: none; }
.highlight { position: absolute; background: #3698ed31; border: 1px solid #1d78b582; border-radius: 2px; }
.highlight.word { background: #ffbe465a; border-color: #ac7e1dab; }
.legend { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { height: 9px; width: 13px; border-radius: 2px; }
.legend-word { background: #efb5478a; }
.legend-definition { background: #4a9fe97a; }
.text-button { background: none; border: 0; color: var(--accent-deep); font-weight: 600; padding: 3px 0; margin-left: auto; }
.text-button:hover { text-decoration: underline; }
@media (max-width: 880px) {
  main, .topbar-inner { padding-left: 19px; padding-right: 19px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px; }
}
@media (max-width: 680px) {
  .topbar-inner { min-height: 58px; }
  .top-note { display: none; }
  .search-area { padding: 24px 0 19px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .pdf-scroll { min-height: 345px; height: 57vh; }
  .definition-body { padding: 15px 16px 18px; }
}
