:root {
    --ink: #1b2430;
    --muted: #5c6775;
    --paper: #f3efe6;
    --card: #fffdf8;
    --line: #e4dccb;
    --blue: #1d4e89;
    --blue-dark: #163a64;
    --amber: #b86e00;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.topbar {
    background: var(--ink);
    color: #fff;
    padding: 0.85rem 0;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.brand img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 100%;
}

.brand:hover { color: #fff; }

.mode-switch {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.mode-switch a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    background: rgba(255, 255, 255, 0.55);
}

.mode-switch a[aria-current="page"],
.mode-switch a:hover {
    color: #fff;
    background: var(--blue);
}

.translate {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.1rem;
}

.translate-langs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
    margin-bottom: 0.8rem;
}

.translate-langs label,
.translate-label {
    display: grid;
    gap: 0.25rem;
    font-weight: 700;
}

.translate-langs label {
    flex: 1 1 12rem;
}

.translate select,
.translate textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    padding: 0.55rem 0.7rem;
}

.translate textarea {
    min-height: 8rem;
    resize: vertical;
}

#translate-swap {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    height: 2.4rem;
    min-width: 2.4rem;
    font-size: 1.1rem;
    cursor: pointer;
}

#translate-swap:disabled { opacity: 0.4; cursor: default; }

.translate-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.8rem;
}

.translate-bar span { color: var(--muted); margin-right: auto; }

.translate-bar button {
    border: 0;
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    font-weight: 700;
}

#translate-clear { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.translate-result {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
}

#translate-output {
    min-height: 8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-weight: 400;
    padding: 0.55rem 0.7rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.85rem;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
    width: 2.2rem;
    height: 2.2rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.nav-bars,
.nav-bars::before,
.nav-bars::after {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.nav-bars { position: relative; }

.nav-bars::before,
.nav-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-bars::before { top: -6px; }
.nav-bars::after { top: 6px; }

.top-actions.is-open .nav-bars { background: transparent; }
.top-actions.is-open .nav-bars::before { top: 0; transform: rotate(45deg); }
.top-actions.is-open .nav-bars::after { top: 0; transform: rotate(-45deg); }

.site-menus {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.drop-menu { position: relative; }

.drop-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.15rem 0;
    cursor: pointer;
}

.drop-toggle::after {
    content: "";
    display: inline-block;
    margin-left: 0.15rem;
    border: 4px solid transparent;
    border-top-color: currentColor;
    vertical-align: 0.12em;
}

.lang-icon {
    width: 1rem;
    height: 1rem;
    display: block;
}

.drop-menu.is-open .drop-toggle { color: #fff; }

@media (hover: hover) and (pointer: fine) {
    .drop-menu:hover .drop-toggle { color: #fff; }
    .drop-menu:hover .drop-list { display: block; }
}

.drop-list {
    display: none;
    position: absolute;
    z-index: 30;
    right: 0;
    top: 100%;
    min-width: 12.5rem;
    margin: 0.45rem 0 0;
    padding: 0.35rem;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(27, 36, 48, 0.12);
}

.dict-menu .drop-list { min-width: 15.5rem; }

.drop-list::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -0.5rem;
    height: 0.5rem;
}

.drop-menu.is-open .drop-list { display: block; }

.drop-menu.is-shut .drop-list { display: none; }

.drop-list a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.drop-list a:hover,
.drop-list a:focus,
.drop-list a[aria-current="true"] { background: #e7eef6; color: var(--blue); }

.flag {
    width: 18px;
    height: 12px;
    flex: 0 0 18px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.hero {
    padding: 2rem 0 1.35rem;
    background:
        radial-gradient(ellipse at top, rgba(29, 78, 137, 0.09), transparent 58%),
        var(--paper);
}

.hero h1 {
    font-family: Literata, Georgia, serif;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.lead-copy {
    color: var(--muted);
    margin-bottom: 1rem;
}

.search-row {
    display: flex;
    gap: 0.5rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.45rem;
    box-shadow: 0 10px 30px rgba(27, 36, 48, 0.06);
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-row input {
    width: 100%;
    border: 0;
    background: transparent;
    font-size: 1.2rem;
    padding: 0.55rem 0.75rem;
    min-width: 0;
    outline: none;
    font-family: Literata, Georgia, serif;
}

.suggest {
    position: absolute;
    z-index: 20;
    left: 0.15rem;
    right: 0.15rem;
    top: calc(100% + 0.35rem);
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(27, 36, 48, 0.12);
    max-height: 32rem;
    overflow: auto;
}

.suggest[hidden] { display: none; }

.search-row .suggest button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-family: Literata, Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.45rem 0.7rem;
}

.search-row .suggest button.active,
.search-row .suggest button:hover {
    background: #e7eef6;
    color: var(--blue);
}

.search-row button {
    border: 0;
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    padding: 0.55rem 1.2rem;
    font-weight: 700;
}

.search-row button:hover { background: var(--blue-dark); }

.chars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.chars button {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 8px;
    min-width: 2.2rem;
    padding: 0.25rem 0.45rem;
    font-family: Literata, Georgia, serif;
}

.chars button:hover { border-color: var(--blue); color: var(--blue); }

.ad-slot {
    margin: 1rem 20px 0;
}
.ad-slot:has(ins.adsbygoogle:empty) {
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
}
.ad-slot .adsbygoogle {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}
.ad-slot .adsbygoogle > iframe,
.ad-slot .adsbygoogle > div {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    flex: 0 0 auto !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    transform-origin: top center !important;
}

.results { padding-bottom: 3rem; }

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.35rem;
}

.list-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem 1rem 0.45rem;
    box-shadow: 0 10px 28px rgba(27, 36, 48, 0.04);
}

.list-card h2 {
    font-family: Literata, Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--blue);
}

.word-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.word-list li {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    padding: 0.42rem 0.1rem;
    border-bottom: 1px solid rgba(228, 220, 203, 0.85);
}

.word-list li:last-child { border-bottom: 0; }

.rank {
    width: 1.4rem;
    flex: none;
    color: var(--muted);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.word-list a {
    flex: 1;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
    font-family: Literata, Georgia, serif;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.word-list a:hover { color: var(--blue); }

.hits {
    flex: none;
    color: var(--amber);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.92rem;
}

.count {
    color: var(--muted);
    margin: 0.4rem 0 1rem;
}

.didyou {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--amber);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin: 0.2rem 0 1rem;
}

.didyou a {
    font-family: Literata, Georgia, serif;
    font-weight: 700;
    color: var(--blue);
    text-decoration: none;
}

.didyou a:hover { text-decoration: underline; }

.direction { margin-bottom: 1.8rem; }

.direction h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.8rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--blue);
    display: inline-block;
}

.direction h3 {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0.9rem 0 0.45rem;
}

.stack { display: flex; flex-direction: column; gap: 0.55rem; }

.entry {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.entry-word {
    font-family: Literata, Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.entry-word a { color: var(--ink); text-decoration: none; }
.entry-word a:hover { color: var(--blue); }

.article {
    color: var(--amber);
    font-weight: 600;
    margin-right: 0.25rem;
    font-size: 0.95rem;
}

.pron {
    color: #9a3412;
    font-size: 0.92rem;
    margin-top: 0.15rem;
}

.meaning {
    margin-top: 0.35rem;
    font-size: 1.05rem;
    line-height: 1.45;
}

.meaning .meaning-list {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

.note {
    color: var(--muted);
    font-size: 0.92rem;
    margin-left: 0.25rem;
}

.stem {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.stem a { color: var(--blue); }

.empty {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 1.2rem;
}

.legal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.3rem 1.3rem 1.5rem;
    max-width: 46rem;
}

.legal h1 {
    font-family: Literata, Georgia, serif;
    font-size: 1.8rem;
    margin: 0 0 0.8rem;
}

.legal-updated {
    color: var(--muted);
    margin: 0 0 1rem;
}

.legal h2,
.legal-copy h2 {
    font-size: 1.2rem;
    margin: 1.2rem 0 0.45rem;
}

.legal-copy h3 {
    font-size: 1.08rem;
    margin: 1.15rem 0 0.4rem;
}

.legal-copy h4,
.legal-copy h5 {
    font-size: 1rem;
    margin: 1rem 0 0.3rem;
}

.legal p,
.legal li {
    line-height: 1.5;
    margin: 0.35rem 0;
}

.legal ul {
    margin: 0.3rem 0 0.6rem;
    padding-left: 1.15rem;
}

.legal a { color: var(--blue); }

.legal-address { margin-top: 0.6rem; }

.contact-form {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.2rem;
}

.contact-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.28rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    padding: 0.55rem 0.7rem;
}

.contact-form textarea {
    min-height: 8rem;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: 2px solid rgba(29, 78, 137, 0.35);
    border-color: var(--blue);
}

.contact-form .is-invalid {
    border-color: #8a2b2b;
}

.field-error {
    color: #8a2b2b;
    font-size: 0.9rem;
    margin: 0.25rem 0 0;
}

.form-note {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

.form-alert {
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    margin: 0.8rem 0 0;
}

.form-alert.ok {
    background: #e7f3ea;
    color: #1d5a32;
}

.form-alert.bad {
    background: #f8ecec;
    color: #8a2b2b;
}

.contact-form button {
    justify-self: start;
    border: 0;
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    padding: 0.6rem 1.3rem;
    font-weight: 700;
}

.contact-form button:hover { background: var(--blue-dark); }

.hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.site-foot {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
    padding: 1rem 0 1.4rem;
}

.foot-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.4rem;
    align-items: center;
    justify-content: space-between;
}

.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.foot-links a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.foot-links a:hover { color: var(--blue); }

@media (max-width: 768px) {
    .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .topbar { position: relative; }
    .topbar .container { flex-wrap: nowrap; gap: 0.6rem; }
    .brand img { height: 32px; max-width: calc(100vw - 5.5rem); }
    .nav-toggle { display: inline-flex; }
    .site-menus {
        display: none;
        position: absolute;
        z-index: 40;
        left: 0.75rem;
        right: 0.75rem;
        top: calc(100% + 0.35rem);
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 0.85rem 0.85rem 0.35rem;
        box-shadow: 0 16px 36px rgba(27, 36, 48, 0.12);
    }
    .top-actions.is-open .site-menus { display: flex; }
    .drop-menu { position: static; }
    .drop-toggle {
        color: var(--muted);
        pointer-events: none;
        font-size: 0.82rem;
    }
    .drop-toggle::after,
    .drop-list::before { display: none; }
    .drop-list,
    .site-menus .drop-menu.is-shut .drop-list {
        display: block;
        position: static;
        min-width: 0;
        margin: 0.35rem 0 0.15rem;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
    }
}

@media (max-width: 576px) {
    .search-row { flex-direction: column; }
    .search-row > button { width: 100%; padding: 0.7rem; }
    .contact-form button { justify-self: stretch; }
    .suggest {
        position: static;
        margin-top: 0.35rem;
    }
}
