:root {
    color-scheme: light;
    --ink: #1f2926;
    --muted: #62706a;
    --soft: #f4f8f5;
    --surface: #fffefd;
    --surface-strong: #ffffff;
    --line: #dce7df;
    --accent: #9a3f3f;
    --accent-dark: #173f36;
    --accent-soft: #f6e7e7;
    --green: #1f6f61;
    --shadow: 0 16px 40px rgba(23, 63, 54, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    background: #173f36;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(154, 63, 63, 0.13), transparent 32rem),
        radial-gradient(circle at top right, rgba(31, 111, 97, 0.12), transparent 28rem),
        linear-gradient(180deg, #fbfffc 0%, #eef7f1 52%, #f7f4ef 100%);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(23, 63, 54, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(154, 63, 63, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
}

a:hover {
    color: var(--accent-dark);
}

button,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(35, 105, 90, 0.28);
    outline-offset: 2px;
}

/* ---------- Header ---------- */
header.site-header {
    color: #f8fffb;
    background:
        linear-gradient(135deg, rgba(13, 45, 38, 0.98), rgba(28, 83, 72, 0.95)),
        linear-gradient(90deg, var(--accent-dark), var(--accent));
    border-bottom: 1px solid rgba(248, 255, 251, 0.16);
    box-shadow: 0 12px 30px rgba(17, 54, 47, 0.24);
}

header.site-header .header-top,
nav.site-nav {
    width: min(100%, 1040px);
    margin-inline: auto;
}

header.site-header .header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}

header.site-header h1 {
    max-width: 70%;
    margin: 0;
    font-size: clamp(1.15rem, 3vw, 1.7rem);
    font-weight: 700;
    line-height: 1.15;
}

header.site-header h1 a {
    color: #f8fffb;
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#navToggle,
#installAppBtn {
    min-height: 40px;
    border: 1px solid rgba(248, 255, 251, 0.38);
    border-radius: var(--radius);
    cursor: pointer;
    color: #f8fffb;
    background: rgba(248, 255, 251, 0.1);
    box-shadow: none;
}

#navToggle {
    display: none;
    min-width: 42px;
    padding: 8px 10px;
    font-size: 1.25rem;
    line-height: 1;
}

#installAppBtn {
    display: none;
    padding: 8px 12px;
    font-weight: 700;
}

#navToggle:hover,
#installAppBtn:hover {
    background: rgba(248, 255, 251, 0.18);
}

nav.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 16px;
    font-family: Arial, sans-serif;
    font-size: 0.86rem;
}

nav.site-nav a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(248, 255, 251, 0.14);
    border-radius: var(--radius);
    color: #e8fff7;
    background: rgba(255, 255, 255, 0.055);
    text-decoration: none;
}

nav.site-nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
}

/* ---------- Main content ---------- */
main {
    flex: 1;
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 24px 16px 44px;
}

.search-box {
    position: sticky;
    top: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 18px;
    padding: 10px;
    border: 1px solid rgba(31, 111, 97, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 254, 253, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.search-box input[type="text"] {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: #fbfffc;
    font-family: Arial, sans-serif;
    font-size: 1rem;
}

.search-box input[type="text"]::placeholder {
    color: #76837d;
}

.search-box a.clear-search {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: #f8fffb;
    background: var(--accent-dark);
    font-family: Arial, sans-serif;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.result-summary {
    margin: 2px 2px 14px;
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: 0.92rem;
}

/* ---------- Word list ---------- */
.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.word-list li {
    min-width: 0;
}

.word-list a {
    display: flex;
    min-height: 48px;
    align-items: center;
    padding: 11px 13px;
    border: 1px solid rgba(31, 111, 97, 0.16);
    border-radius: var(--radius);
    color: var(--ink);
    background: rgba(255, 254, 253, 0.88);
    box-shadow: 0 6px 18px rgba(23, 63, 54, 0.055);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.word-list a:hover {
    border-color: rgba(154, 63, 63, 0.38);
    background: #fff6f6;
    transform: translateY(-1px);
}

.no-results {
    margin: 0;
    padding: 28px 18px;
    border: 1px dashed rgba(31, 111, 97, 0.26);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(255, 254, 253, 0.8);
    text-align: center;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
    margin-top: 22px;
    font-family: Arial, sans-serif;
}

.pagination a,
.pagination span {
    display: inline-flex;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--surface-strong);
    font-size: 0.92rem;
    text-decoration: none;
}

.pagination a:hover {
    border-color: rgba(154, 63, 63, 0.38);
    background: var(--accent-soft);
}

.pagination .current {
    color: #f8fffb;
    border-color: var(--accent-dark);
    background: var(--accent-dark);
}

.pagination .disabled {
    color: #9ca9a3;
    background: rgba(255, 254, 253, 0.56);
    pointer-events: none;
}

/* ---------- Word detail page ---------- */
.word-detail {
    padding: clamp(20px, 4vw, 34px);
    border: 1px solid rgba(31, 111, 97, 0.18);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.word-detail .word-title {
    margin: 0 0 18px;
    color: var(--accent-dark);
    font-size: 2.2em;
    line-height: 1.12;
}

.word-detail .definition {
    font-size: 1.08em;
}

.word-detail .definition p {
    margin: 0 0 16px;
    line-height: 1.72;
}

.word-detail .definition p:last-child {
    margin-bottom: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding: 8px;
    border: 1px solid rgba(31, 111, 97, 0.16);
    border-radius: var(--radius);
    background: rgba(255, 254, 253, 0.84);
    box-shadow: 0 8px 24px rgba(23, 63, 54, 0.07);
}

.toolbar button {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--accent-dark);
    background: #fbfffc;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
}

.toolbar button:hover {
    border-color: rgba(154, 63, 63, 0.38);
    background: var(--accent-soft);
}

.toolbar .copy-feedback {
    display: none;
    align-self: center;
    color: var(--green);
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
}

.back-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    margin-bottom: 14px;
    color: var(--accent-dark);
    font-family: Arial, sans-serif;
    font-size: 0.94rem;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.about-page p {
    margin: 0 0 12px;
    line-height: 1.65;
}

.about-page h3 {
    margin: 28px 0 9px;
    color: var(--accent-dark);
    font-size: 1.16rem;
    line-height: 1.25;
}

.about-page h3:first-of-type {
    margin-top: 8px;
}

/* Honeypot link (bot.php): present in the HTML for crawlers to find, but
   not visible or reachable for real visitors. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Footer ---------- */
footer.site-footer {
    padding: 28px 16px 30px;
    color: #d9eee8;
    background: #173f36;
    border-top: 1px solid rgba(248, 255, 251, 0.1);
    text-align: center;
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
}

footer.site-footer p {
    margin: 0 auto 10px;
}

footer.site-footer .dictionary-info {
    max-width: 620px;
    color: #e7fbf5;
}

footer.site-footer .dictionary-info strong {
    color: #ffffff;
}

footer.site-footer .footer-links {
    max-width: 820px;
    line-height: 2;
}

footer.site-footer a {
    color: #ffd0d0;
    text-decoration: none;
    margin: 0 5px;
}

footer.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

footer.site-footer .verse {
    color: #cbe4dc;
    font-style: italic;
}

footer.site-footer .visitors {
    margin-bottom: 0;
    color: #a9c5bc;
}

@media (max-width: 720px) {
    body {
        font-size: 16px;
    }

    header.site-header .header-top {
        padding: 14px 14px 12px;
    }

    header.site-header h1 {
        max-width: calc(100% - 110px);
    }

    #navToggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    nav.site-nav {
        display: none;
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px 14px;
        border-top: 1px solid rgba(248, 255, 251, 0.16);
    }

    nav.site-nav.open {
        display: flex;
    }

    nav.site-nav a {
        width: 100%;
        justify-content: flex-start;
    }

    main {
        padding: 16px 12px 34px;
    }

    .search-box {
        margin-inline: -2px;
    }

    .word-list {
        grid-template-columns: 1fr;
    }

    .toolbar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .toolbar button {
        width: 100%;
        padding-inline: 8px;
    }

    .toolbar #copyTextBtn,
    .toolbar #copyLinkBtn,
    .toolbar .copy-feedback {
        grid-column: span 3;
    }
}

@media (max-width: 420px) {
    .word-detail .word-title {
        font-size: 1.75em;
    }

    .search-box {
        grid-template-columns: 1fr;
    }

    .search-box a.clear-search {
        width: 100%;
    }

    .pagination a,
    .pagination span {
        min-width: 36px;
        min-height: 38px;
        padding-inline: 10px;
    }
}
