:root {
    color-scheme: dark;
    font-family: Georgia, "Times New Roman", serif;
    background: #17140f;
    color: #f2e6c9;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 20rem;
    background: #17140f;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, rgba(114, 72, 27, 0.35), transparent 42rem),
        #17140f;
}

.translator-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        max(1.25rem, env(safe-area-inset-top))
        max(1rem, env(safe-area-inset-right))
        max(1.5rem, env(safe-area-inset-bottom))
        max(1rem, env(safe-area-inset-left));
    background: rgba(35, 29, 20, 0.96);
}

.translator-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font: 700 0.85rem/1.4 Arial, sans-serif;
}

.translator-nav a {
    color: #d5b477;
    text-underline-offset: 0.2em;
}

.translator-choice-shell {
    align-content: start;
}

.translator-choices {
    display: grid;
    gap: 1rem;
}

.translator-choice {
    display: grid;
    gap: 0.45rem;
    min-height: 12rem;
    border: 1px solid #76562f;
    border-radius: 0.65rem;
    padding: 1.25rem;
    color: #f2e6c9;
    text-decoration: none;
    background: linear-gradient(145deg, rgba(95, 55, 24, 0.42), rgba(18, 15, 11, 0.92));
    transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}

.translator-choice:hover,
.translator-choice:focus-visible {
    border-color: #d89b45;
    background: linear-gradient(145deg, rgba(126, 70, 27, 0.54), rgba(24, 19, 13, 0.96));
    transform: translateY(-0.15rem);
    outline: none;
}

.elven-choice {
    background: linear-gradient(145deg, rgba(42, 85, 62, 0.48), rgba(14, 24, 20, 0.94));
}

.elven-choice:hover,
.elven-choice:focus-visible {
    background: linear-gradient(145deg, rgba(51, 112, 78, 0.58), rgba(15, 31, 24, 0.97));
}

.choice-kicker {
    color: #ca9b54;
    font: 700 0.72rem/1.3 Arial, sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.translator-choice strong {
    align-self: end;
    font-size: clamp(1.5rem, 7vw, 2.1rem);
}

.translator-choice > span:not(.choice-kicker):not(.choice-action) {
    color: #cfc1a5;
    font: 1rem/1.5 Arial, sans-serif;
}

.choice-action {
    align-self: end;
    color: #e3c183;
    font: 700 0.9rem/1.4 Arial, sans-serif;
}

.choice-footer {
    grid-template-columns: 1fr;
}

.source-note {
    margin: 1.5rem 0 0;
    color: #9f927b;
    font: 0.78rem/1.5 Arial, sans-serif;
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: #ca9b54;
    font-family: Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2 {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.6rem;
    font-size: clamp(2rem, 11vw, 3.6rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.intro {
    margin-bottom: 1.5rem;
    color: #cfc1a5;
    line-height: 1.6;
}

.translator-form {
    display: grid;
    gap: 0.75rem;
}

label {
    font-family: Arial, sans-serif;
    font-weight: 700;
}

textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 10rem;
    resize: vertical;
    border: 1px solid #83643b;
    border-radius: 0.4rem;
    padding: 0.875rem;
    background: #100e0b;
    color: #fff8e8;
    font: 1rem/1.5 Arial, sans-serif;
    overflow-wrap: anywhere;
}

textarea:focus,
button:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 3px solid #d89b45;
    outline-offset: 3px;
}

.input-guidance {
    display: grid;
    gap: 0.35rem 1rem;
    margin-top: -0.25rem;
    color: #b9ab91;
    font: 0.85rem/1.4 Arial, sans-serif;
}

.direction-toggle {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.55rem;
    min-height: 2.75rem;
    cursor: pointer;
}

.direction-toggle input {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0;
    accent-color: #9b3427;
}

.word-count {
    white-space: nowrap;
    color: #d5c5a5;
    font-variant-numeric: tabular-nums;
}

button {
    width: 100%;
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.35rem;
    padding: 0.8rem 1.2rem;
    background: #9b3427;
    color: #fff8e8;
    font: 700 1rem Arial, sans-serif;
    cursor: pointer;
}

button:hover {
    background: #b64230;
}

.result,
.message {
    margin-top: 1.5rem;
    border-left: 0.25rem solid #ca9b54;
    padding: 1rem;
    background: #18130d;
}

.result {
    display: grid;
    gap: 0.75rem;
}

.result-title {
    font-size: 1.5rem;
}

.result textarea {
    resize: vertical;
}

.error {
    border-color: #db5c4b;
}

footer {
    display: grid;
    gap: 0.75rem 1.5rem;
    margin-top: 1.5rem;
    color: #9f927b;
    font: 0.85rem Arial, sans-serif;
}

.footer-links {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 0.5rem;
    min-width: 0;
}

.footer-link-row {
    display: block;
    width: 100%;
    text-align: left;
}

.footer-link-row-with-note {
    display: grid;
    gap: 0.35rem;
}

.download-note {
    color: #9f927b;
}

footer a {
    display: inline-block;
    max-width: 100%;
    padding-block: 0.3rem;
    color: #d5b477;
    overflow-wrap: anywhere;
    text-align: left;
    text-underline-offset: 0.2em;
}

footer a:hover,
footer a:focus-visible {
    color: #f0d39e;
}

@media (min-width: 40rem) {
    body {
        display: grid;
        place-items: center;
        padding: 2rem 1.25rem;
    }

    .translator-shell {
        width: min(52rem, 100%);
        min-height: auto;
        padding: clamp(2rem, 5vw, 3rem);
        border: 1px solid #6e512d;
        border-radius: 0.75rem;
        box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
    }

    .intro {
        margin-bottom: 2rem;
    }

    .translator-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .input-guidance {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    button {
        justify-self: start;
        width: auto;
    }

    .result,
    .message {
        margin-top: 1.75rem;
        padding: 1rem 1.25rem;
    }

    footer {
        grid-template-columns: minmax(0, auto) minmax(0, 1fr);
        align-items: end;
        margin-top: 2rem;
    }

    .footer-links {
        justify-items: end;
        margin-left: auto;
    }

    .footer-link-row {
        text-align: right;
    }

    .footer-link-row-with-note {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: baseline;
    }

    footer a {
        text-align: right;
    }
}

@media (min-width: 64rem) {
    .translator-shell {
        width: min(60rem, 100%);
    }
}

@media (max-height: 36rem) and (orientation: landscape) {
    body {
        align-items: start;
    }
}
