@charset "UTF-8";
:root {
    color-scheme: light;
    --background: #fafafa; --surface: #fff; --surface-soft: #f3f3f3;
    --text: #242424; --muted: #666; --accent: #286746; --accent-hover: #1c5235;
    --accent-soft: #edf3ee; --button-text: #fff; --border: #e3e3e3; --border-strong: #c9c9c9;
    --focus: #608a57; --error: #9e453e;
    --header-background: #fafafa;
    --match-exact: #1b6b25; --match-exact-soft: #dff5ce;
    --match-prefix: #154bd1; --match-prefix-soft: #dce7ff;
    --match-contains: #7832ba; --match-contains-soft: #f0deff;
    --match-definition: #925600; --match-definition-soft: #ffebad;
    --match-definition-prefix: #b81565; --match-definition-prefix-soft: #ffd9eb;
    --match-definition-contains: #006f7b; --match-definition-contains-soft: #c9f4f5;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --background: #101010; --surface: #181818; --surface-soft: #202020;
    --text: #ededed; --muted: #a3a3a3; --accent: #b8d2ae; --accent-hover: #c9dfc0;
    --accent-soft: #252525; --button-text: #101010; --border: #303030; --border-strong: #484848;
    --focus: #b8d2ae; --error: #f0a199;
    --header-background: #101010;
    --match-exact: #64e270; --match-exact-soft: #203d18;
    --match-prefix: #7da7ff; --match-prefix-soft: #1c2d5e;
    --match-contains: #c191ff; --match-contains-soft: #42205e;
    --match-definition: #ffca50; --match-definition-soft: #584000;
    --match-definition-prefix: #ff7fbd; --match-definition-prefix-soft: #5b183c;
    --match-definition-contains: #40deeb; --match-definition-contains-soft: #064b53;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --background: #101010; --surface: #181818; --surface-soft: #202020;
        --text: #ededed; --muted: #a3a3a3; --accent: #b8d2ae; --accent-hover: #c9dfc0;
        --accent-soft: #252525; --button-text: #101010; --border: #303030; --border-strong: #484848;
        --focus: #b8d2ae; --error: #f0a199;
        --header-background: #101010;
        --match-exact: #64e270; --match-exact-soft: #203d18;
        --match-prefix: #7da7ff; --match-prefix-soft: #1c2d5e;
        --match-contains: #c191ff; --match-contains-soft: #42205e;
        --match-definition: #ffca50; --match-definition-soft: #584000;
        --match-definition-prefix: #ff7fbd; --match-definition-prefix-soft: #5b183c;
        --match-definition-contains: #40deeb; --match-definition-contains-soft: #064b53;
    }
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; scroll-behavior: smooth; scroll-padding-top: 100px; }
body { margin: 0; min-width: 280px; min-height: 100vh; display: flex; flex-direction: column; background: var(--background); color: var(--text); font-family: "Segoe UI", Arial, sans-serif; font-size: 16px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 4px; }
button svg, .search-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button, a, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
::selection { background: var(--accent-soft); color: var(--text); }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 200; transform: translateY(-150%); padding: 12px 20px; border-radius: 8px; background: var(--surface); }
.skip-link:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid var(--border); background: var(--header-background); }
.header-inner { width: min(800px, calc(100% - 64px)); min-height: 76px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 27px; line-height: 1; font-weight: 750; letter-spacing: -1.2px; }
.brand-dot { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 24px; }
.site-navigation { display: flex; align-items: center; gap: 8px; }
.site-navigation a { padding: 10px 16px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.site-navigation a:hover { color: var(--accent); background: var(--surface-soft); }
body[data-page="home"] [data-nav="home"], body[data-page="word"] [data-nav="home"], body[data-page="dictionary"] [data-nav="dictionary"] { color: var(--accent); background: var(--accent-soft); }
.theme-toggle { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text); transition: background 150ms ease, border-color 150ms ease; }
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--border-strong); }
.theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
.container { flex: 1; width: min(800px, calc(100% - 64px)); margin: 0 auto; padding: 64px 0; }
.hero { margin-bottom: 28px; }
.hero h1 { max-width: 680px; margin: 0; font-size: clamp(28px, 3.5vw, 36px); line-height: 1.3; letter-spacing: -1px; font-weight: 600; text-wrap: balance; }
.source-description { margin: 14px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.search-section { position: sticky; top: 0; z-index: 20; padding: 12px 0 16px; background: var(--background); }
.search-container { position: relative; display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 7px 8px 7px 18px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); transition: border-color 150ms ease, box-shadow 150ms ease; }
.search-container:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { color: var(--accent); margin-right: 7px; }
#search { width: 100%; min-width: 0; align-self: stretch; padding: 10px 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 18px; appearance: none; -webkit-appearance: none; }
#search::placeholder { color: var(--muted); opacity: 1; font-size: 16px; }
#search::-webkit-search-cancel-button { appearance: none; -webkit-appearance: none; }
.clear-search { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.clear-search:hover { color: var(--text); background: var(--surface-soft); }
.clear-search svg { width: 18px; height: 18px; }
.search-shortcut { flex-shrink: 0; width: 32px; height: 32px; margin-right: 10px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); color: var(--muted); }
.search-shortcut kbd { font: inherit; }
.search-submit { display: flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 48px; padding: 0 20px; border: 0; border-radius: 6px; background: var(--accent); color: var(--button-text); font-size: 14px; font-weight: 600; transition: background 150ms ease; }
.search-submit:hover { background: var(--accent-hover); }
.search-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.results-heading { display: flex; align-items: center; gap: 12px; margin: 21px 0 14px; }
.results-heading h2 { margin: 0; font-size: 16px; font-weight: 600; }
.results-count { display: grid; place-items: center; min-width: 26px; min-height: 26px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.results { display: flex; flex-direction: column; gap: 10px; }
.result-group, .result-group-cards { display: flex; flex-direction: column; gap: 10px; }
.result-group + .result-group { margin-top: 14px; }
.result-group-heading { display: flex; align-items: flex-start; gap: 10px; margin: 0; color: var(--match-color); font-size: 14px; font-weight: 650; line-height: 1.6; overflow-wrap: anywhere; }
.result-group-heading::before { content: ""; flex-shrink: 0; width: 8px; height: 8px; margin-top: .5em; border-radius: 50%; background: currentColor; }
.result-card { position: relative; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; transition: border-color 150ms ease; }
.result-card:is([data-match-type="exact"], [data-match-type="prefix"], [data-match-type="contains"], [data-match-type="definition"], [data-match-type="definition-exact"], [data-match-type="definition-prefix"], [data-match-type="definition-contains"])::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--match-color); pointer-events: none; }
.result-card:hover { border-color: var(--border-strong); }
.result-card.expanded { border-color: var(--border-strong); }
.result-header { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 74px; padding: 18px 24px; border: 0; background: transparent; color: inherit; text-align: left; }
.result-key { flex: 1; min-width: 0; font-family: system-ui, "Segoe UI", Arial, sans-serif; font-size: 24px; font-weight: 500; font-synthesis: none; line-height: 1.5; overflow-wrap: anywhere; }
.result-arrow { display: none; }
.result-card[data-match-type="exact"], .result-group[data-match-type="exact"] { --match-color: var(--match-exact); --match-background: var(--match-exact-soft); }
.result-card[data-match-type="prefix"], .result-group[data-match-type="prefix"] { --match-color: var(--match-prefix); --match-background: var(--match-prefix-soft); }
.result-card[data-match-type="contains"], .result-group[data-match-type="contains"] { --match-color: var(--match-contains); --match-background: var(--match-contains-soft); }
.result-card[data-match-type="definition"], [data-match-type="definition-exact"] { --match-color: var(--match-definition); --match-background: var(--match-definition-soft); }
[data-match-type="definition-prefix"] { --match-color: var(--match-definition-prefix); --match-background: var(--match-definition-prefix-soft); }
[data-match-type="definition-contains"] { --match-color: var(--match-definition-contains); --match-background: var(--match-definition-contains-soft); }
/* Occurrence metadata describes the match; the card controls its highlight palette. */
.result-card[data-match-type] .result-match { --match-color: inherit; --match-background: inherit; }
.result-key .result-match { color: var(--match-color); }
.result-value .result-match { color: inherit; background: var(--match-background); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.result-expandable { display: block; }
.result-expandable-inner { min-height: 0; overflow: hidden; }
.result-divider { height: 1px; margin: 0 24px; background: var(--border); }
.result-value { padding: 18px 24px 24px; color: var(--text); font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.result-value p { margin: 0; }
.result-value p + p { margin-top: 12px; }
.result-value sup, .result-key sup { font-size: .7em; }
.results[aria-busy="true"] { opacity: .55; }
.search-state { margin: 16px 0; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.state-title { display: block; margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.state-description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.search-state[data-state="loading"] { display: flex; align-items: center; gap: 12px; padding: 16px 20px; color: var(--muted); font-size: 14px; }
.search-state[data-state="loading"]::before { content: ""; flex-shrink: 0; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 800ms linear infinite; }
.search-state[data-state="error"] .state-title { color: var(--error); }
.search-state[data-state="hint"] { padding: 15px 20px; background: var(--surface-soft); }
.retry-search { min-height: 42px; margin-top: 16px; padding: 9px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.retry-search:hover { background: var(--surface-soft); }
.status { color: var(--muted); line-height: 1.7; }
@keyframes spin { to { transform: rotate(360deg); } }
.dictionary-index { margin-top: 24px; padding: 24px 0; border-top: 1px solid var(--border); }
.dictionary-index h2 { margin: 0 0 24px; font-size: 24px; font-weight: 600; letter-spacing: -.5px; }
.dictionary-letters, .dictionary-pagination { display: flex; flex-wrap: wrap; gap: 8px; }
.dictionary-letters { margin: 16px 0 28px; }
.dictionary-letters a, .dictionary-pagination a, .dictionary-pagination span { display: grid; place-items: center; min-width: 42px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text); text-decoration: none; font-size: 14px; transition: background 150ms ease; }
.dictionary-letters a:hover, .dictionary-pagination a:hover { border-color: var(--border-strong); background: var(--accent-soft); color: var(--accent); }
.dictionary-index [aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--button-text); }
.dictionary-words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; margin: 24px 0; padding: 0; list-style: none; }
.dictionary-words li { border-bottom: 1px solid var(--border); }
.dictionary-words a { display: block; padding: 13px 4px; color: var(--text); font-size: 16px; line-height: 1.4; text-decoration: none; overflow-wrap: anywhere; }
.dictionary-words a:hover { color: var(--accent); background: var(--surface-soft); }
.dictionary-pagination { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
    .header-inner, .container { width: calc(100% - 36px); }
    .header-inner { min-height: 76px; gap: 12px; flex-wrap: wrap; padding: 16px 0; }
    .brand { font-size: 26px; gap: 9px; }
    .header-actions { gap: 12px; }
    .site-navigation { gap: 0; }
    .site-navigation a { padding: 9px 10px; font-size: 12px; }
    .theme-toggle { width: 36px; height: 36px; }
    .theme-toggle svg { width: 19px; height: 19px; }
    .container { padding: 36px 0 42px; }
    .hero { margin-bottom: 22px; }
    .hero h1 { font-size: 28px; letter-spacing: -.6px; }
    .source-description { margin-top: 12px; font-size: 14px; }
    .search-container { min-height: 64px; padding: 7px 7px 7px 15px; gap: 4px; border-radius: 8px; }
    .search-icon { width: 20px; height: 20px; margin-right: 5px; }
    #search { font-size: 16px; }
    #search::placeholder { font-size: 13px; }
    .clear-search { width: 32px; height: 44px; }
    .search-shortcut { display: none; }
    .search-submit { min-height: 48px; padding: 0 13px; border-radius: 6px; }
    .result-header { padding: 16px 18px; min-height: 68px; }
    .result-key { font-size: 22px; }
    .result-divider { margin: 0 18px; }
    .result-value { padding: 16px 18px 20px; font-size: 16px; }
    .search-state { padding: 20px; }
    .dictionary-index { padding: 20px 0; }
    .dictionary-index h2 { font-size: 22px; }
    .dictionary-letters { gap: 6px; }
    .dictionary-letters a { min-width: 38px; }
    .dictionary-words { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
    .dictionary-words a { font-size: 14px; }
}
@media (max-width: 380px) {
    .header-inner { gap: 12px 6px; }
    .brand { font-size: 22px; gap: 7px; }
    .header-actions { gap: 6px; }
    .site-navigation a { padding: 9px 7px; font-size: 11px; }
    .theme-toggle { width: 32px; height: 36px; }
    .search-container { padding-left: 10px; }
    #search::placeholder { font-size: 12px; }
    .dictionary-words { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
