/* ==========================================================================
   SpeakSindarin.com — styles
   One deep-red banner at the top carries the wordmark + motto.
   A fixed footer carries the Elvish greeting.
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #000;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

/* ==========================================================================
   Top banner (nav)
   - Red background
   - Logo at left (SPEAK SINDARIN -> home)
   - Motto absolutely centered so it's centered in the viewport regardless
     of logo width
   ========================================================================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #981b1f;
    color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-height: 64px;
}

.logo {
    font-size: clamp(0.85rem, 1.1rem + 0.4vw, 1.4rem);
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.1em;
    z-index: 2;
}

.logo:hover {
    opacity: 0.9;
}

.nav-motto {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    font-style: italic;
    color: #fff;
    opacity: 0.95;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
}

/* ==========================================================================
   Main content
   ========================================================================== */
main {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    padding-top: 64px;    /* leave room for the fixed top banner */
    padding-bottom: 4rem; /* leave room for the fixed footer        */
    background-color: #fff;
}

.content-wrapper {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 2rem 2.5rem;
}

.page-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    color: #000;
}

.section-lede {
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Tabs (home page) — full-width, underline active state (not solid fill).
   Aligned to the same width as .tool-card below.
   ========================================================================== */
.tabs {
    display: flex;
    justify-content: stretch;
    gap: 0;
    width: 100%;
    margin: 0 0 0 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #f3f2f0;
    overflow: hidden;
}

.tab-button {
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 0;
    min-width: 0;
    background: #ebeae8;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: #4a4a4a;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

.tab-button + .tab-button {
    box-shadow: -1px 0 0 rgba(0, 0, 0, 0.06);
}

.tab-button:hover {
    background: #e2e0dd;
    color: #5c1014;
}

.tab-button[aria-selected="true"] {
    background: #fff;
    color: #981b1f;
    font-weight: 600;
    border-bottom-color: #981b1f;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    z-index: 1;
}

.tab-button:focus-visible {
    outline: 2px solid #8B0000;
    outline-offset: 2px;
    z-index: 2;
}

.tab-panel[hidden] {
    display: none !important;
}

/* Space under the main tab bar when the "to English" panel is active. */
#panel-to-english {
    margin-top: 2rem;
}

#panel-from-english {
    margin-top: 0;
}

/* Flush the first tool card under the main tab strip (same width as .tabs). */
#panel-from-english .tool-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top-color: rgba(0, 0, 0, 0.08);
    margin-top: -1px;
}

/* ==========================================================================
   Home page option cards
   ========================================================================== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.options-grid--two {
    grid-template-columns: repeat(2, 1fr);
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.option-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: #000;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 2rem 1.75rem;
    min-height: 220px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.option-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #8B0000;
}

.option-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.7rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #000;
}

.option-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 1.5rem;
    flex: 1;
}

.option-cta {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #8B0000;
    text-transform: uppercase;
}

/* ==========================================================================
   Generic tool UI (forms, buttons, textareas, file inputs)
   ========================================================================== */
.tool-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.tool-card + .tool-card {
    margin-top: 0;
}

.input-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.input-method {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.input-method-title,
.tool-card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.input-method-description,
.tool-card-description {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.85rem;
}

.input-method-form,
.tool-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.sindarin-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.45;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: #fff;
    color: #000;
    resize: vertical;
    min-height: 96px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sindarin-textarea:focus {
    outline: none;
    border-color: #8B0000;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.visually-hidden,
.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    background: #fafafa;
    transition: border-color 0.2s, background-color 0.2s;
    text-align: center;
}

.file-drop:hover,
.file-drop:focus-within {
    border-color: #8B0000;
    background-color: #fff;
}

.file-drop-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.file-drop-primary {
    font-weight: 600;
    color: #000;
    font-size: 1rem;
}

.file-drop-secondary {
    color: #666;
    font-size: 0.9rem;
}

.primary-button {
    background: #981b1f;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    align-self: flex-start;
    transition: background-color 0.2s, transform 0.2s;
}

.primary-button:hover {
    background: #7a1519;
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}

.back-button {
    display: inline-block;
    background: #981b1f;
    color: #fff;
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.back-button:hover {
    background: #7a1519;
    transform: translateY(-2px);
}

/* ==========================================================================
   Mode selector (segmented radio group)
   ========================================================================== */
.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.6rem;
    background: #fff;
}

.mode-selector legend {
    padding: 0;
    margin: 0;
    /* visually-hide the legend but keep it for screen readers */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.mode-option {
    flex: 1 1 0;
    min-width: 180px;
    position: relative;
}

.mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-option label {
    display: block;
    padding: 0.65rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    background: #fff;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s, color 0.15s;
    user-select: none;
}

.mode-option:first-child label {
    border-left: none;
}

.mode-option label:hover {
    background: #faf0f0;
    color: #8B0000;
}

.mode-option input[type="radio"]:checked + label {
    background: #981b1f;
    color: #fff;
    font-weight: 600;
}

.mode-option input[type="radio"]:focus-visible + label {
    outline: 2px solid #8B0000;
    outline-offset: -2px;
}

.mode-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 0.5rem 0;
    min-height: 1.1rem;
}

/* ==========================================================================
   Image format selector (JPG vs PNG) — sub-option for Tengwar output
   ========================================================================== */
.format-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    transition: opacity 0.15s;
}

.format-row[hidden] {
    display: none !important;
}

.format-row-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.format-selector {
    display: inline-flex;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.format-selector legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.format-option {
    position: relative;
}

.format-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.format-option label {
    display: block;
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    background: #fff;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s, color 0.15s;
    user-select: none;
}

.format-option:first-child label {
    border-left: none;
}

.format-option label:hover {
    background: #faf0f0;
    color: #8B0000;
}

.format-option input[type="radio"]:checked + label {
    background: #981b1f;
    color: #fff;
}

.format-option input[type="radio"]:focus-visible + label {
    outline: 2px solid #8B0000;
    outline-offset: -2px;
}

.format-hint {
    font-size: 0.85rem;
    color: #777;
    flex-basis: 100%;
    margin: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0.75rem 1rem;
    color: rgba(0, 0, 0, 0.55);
    background-color: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1rem;
    letter-spacing: 0.01em;
    z-index: 999;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   Gate page ("Speak friend and enter.")
   ========================================================================== */
body.gate-body {
    background-color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    display: block;
}

.gate {
    /* True viewport center: fill the window and center the block vertically
       and horizontally at any size (footer is position:fixed, out of flow). */
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 2rem 1.5rem;
    /* Keep the cluster above the fixed footer band on short viewports. */
    padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 0px) + 2.5rem);
}

.gate-inner {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.gate-prompt {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.25rem;
    font-weight: 500;
    font-style: italic;
    color: #000;
    margin-bottom: 2rem;
    letter-spacing: 0.01em;
}

.gate-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.gate-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    font-family: inherit;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    background: #fff;
    color: #000;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input:focus {
    outline: none;
    border-color: #8B0000;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.12);
}

.gate-error {
    min-height: 1.25rem;
    margin-top: 0.5rem;
    color: #8B0000;
    font-size: 0.95rem;
}

.gate-input.shake {
    animation: gate-shake 0.4s ease-in-out;
    border-color: #8B0000;
}

@keyframes gate-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-6px); }
    80%      { transform: translateX(6px); }
}

/* ==========================================================================
   Translation results block (shared by both tabs)
   ========================================================================== */
/* Wrapper holds the two stacked boxes: Primary Output + Detailed Explanation.
   The wrapper itself has no visual chrome — each inner box is its own card. */
.results {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
}

.results:empty {
    margin-top: 0;
}

/* ---- Primary Output Box — clean, prominent translated text ----------- */
.results-output {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ---- Detailed Translation Explanation Box — summary + breakdown ------ */
.results-details {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
}

.results-pending,
.results-error {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
    text-align: center;
}

.results-error { color: #8B0000; }

/* The translated text itself — intentionally plain: no colors, no
   underlines, no tooltips. Only untranslated words (rendered as <em>) are
   italicized so the reader can see which words passed through as English. */
.results-line {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    line-height: 1.45;
    color: #111;
    margin: 0;
    white-space: pre-wrap;
    text-align: center;
}

.results-line em,
.results-line .word--missing {
    font-style: italic;
    color: #111;
    text-decoration: none;
    border-bottom: none;
}

/* Small caption at the top of the Detailed Explanation box. */
.results-summary {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 0.75rem 0;
    letter-spacing: 0.01em;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Per-word breakdown list */
.results-breakdown {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 1rem;
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
    line-height: 1.35;
}

.results-breakdown .bd-term {
    font-weight: 600;
    color: #333;
    align-self: baseline;
    margin: 0;
    padding: 0.15rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.results-breakdown .bd-term:first-child {
    border-top: none;
}

.results-breakdown .bd-def {
    margin: 0;
    padding: 0.15rem 0;
    color: #222;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.6rem;
    align-items: baseline;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.results-breakdown .bd-def:nth-of-type(1) {
    border-top: none;
}

.bd-primary {
    font-weight: 600;
    color: #111;
}

.bd-pos {
    font-size: 0.82rem;
    color: #666;
    font-style: italic;
}

.bd-gloss {
    font-size: 0.85rem;
    color: #555;
}

.bd-alt {
    font-size: 0.85rem;
    color: #777;
    flex-basis: 100%;
}

.bd-alias {
    font-size: 0.78rem;
    color: #1f7a8c;
    font-style: italic;
    letter-spacing: 0.01em;
}

/* Lemmatisation note — e.g. "past of 'see'" when the user typed "saw".
   Sits between the alias badge and the inflection badge visually. */
.bd-lemma {
    font-size: 0.78rem;
    color: #2f6f3e;
    font-style: italic;
    letter-spacing: 0.01em;
}

/* Layer 4 step 1 — homograph-resolution note, e.g.
   "read as verb after \"rider\"".  Only rendered when the preceding-
   word heuristic actually broke a noun/verb tie.  Colour echoes the
   lemma note but leans purple to signal a syntactic (context) source
   rather than a morphological one. */
.bd-poshint {
    font-size: 0.78rem;
    color: #6c3f8f;
    font-style: italic;
    letter-spacing: 0.01em;
}

/* Inflection note shown after the attestation badge, e.g. "plural of mellon". */
.bd-inflect {
    font-size: 0.78rem;
    color: #5c3a97;
    font-style: italic;
    letter-spacing: 0.01em;
}

.bd-missing {
    color: #8B0000;
    font-style: italic;
}

/* Elided in Sindarin — closed-class English words Sindarin simply
   doesn't express (indefinite articles "a" / "an", etc.).  Rendered
   as a muted, italic note so it reads as "this was intentionally
   omitted" rather than "we couldn't find this". */
.bd-omitted {
    color: #6b6b6b;
    font-style: italic;
}

/* Phase B — phrase-match note.  Communicates that a multi-word span
   collapsed to a single phrase rather than being translated word by
   word; styled like .bd-alias so it reads as a provenance tag. */
.bd-phrase {
    color: #6b4f9c;
    font-style: italic;
}

/* Layer 5 step 1 — consonant mutation note.  Surfaces that the word
   was lenited (soft mutation) by a preceding trigger; styled like
   .bd-inflect so it reads as a grammar annotation. */
.bd-mutation {
    color: #4a6fa0;
    font-style: italic;
}

/* Adjective agreement (plural concord).  Surfaces when an adjective
   was pluralised to agree with a following plural noun — distinct
   hue from mutation so the user can tell the two apart at a glance. */
.bd-agreement {
    color: #2f6b52;
    font-style: italic;
}

.bd-possessive {
    color: #6b4a2f;
    font-style: italic;
}

/* Layer 6 step 1 — noun-adjective word-order swap.  Surfaces on
   adjectives that were moved from English [adj+noun] order to
   Sindarin [noun+adj+] canon.  Distinct hue from mutation/agreement
   so the structural reorder reads as a separate grammar fact. */
.bd-adjorder {
    color: #6a3f8a;
    font-style: italic;
}

/* Layer 6 step 1b — attributive past-participle re-tag.  Same
   purple family as bd-adjorder since both annotations describe
   structural reanalyses, but a slightly darker tone to read as
   "preceding step" when both fire on the same word. */
.bd-attrpp {
    color: #4a2a66;
    font-style: italic;
}

/* Attestation badges */
.bd-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
    line-height: 1.35;
    border: 1px solid transparent;
    white-space: nowrap;
}

.bd-badge--attested {
    background: #eaf3e8;
    color: #2a6b2a;
    border-color: #cfe4cc;
}

.bd-badge--neo {
    background: #efe9f7;
    color: #5c3a97;
    border-color: #ddd0ee;
}

/* Noldorin — Tolkien's 1930s precursor to Sindarin.  Stylistically
   "older" than neo: muted bronze/brown to read as "archaic" rather than
   "modern reconstruction". */
.bd-badge--noldorin {
    background: #f1e6d6;
    color: #6e4a1d;
    border-color: #d9c29a;
}

.bd-badge--conjectural {
    background: #fbefd9;
    color: #a25b00;
    border-color: #ecd6a6;
}

/* Curator note from extra-words.txt — small, greyed, sits below the
   breakdown's main line. */
.bd-note {
    display: block;
    font-size: 0.78rem;
    color: #666;
    margin-top: 0.15rem;
    font-style: italic;
}

/* Verb-stem explainer — appears beneath a verb headword ending in "-"
   to explain what the dash means.  Visually distinct from a curator
   note: non-italic, with a subtle leading marker, so it reads as
   "the tool explaining itself" rather than "somebody's note". */
.bd-stem-note {
    display: block;
    font-size: 0.78rem;
    color: #5c3a97;
    margin-top: 0.2rem;
    padding-left: 0.55rem;
    border-left: 2px solid #ddd0ee;
    line-height: 1.35;
}

/* Verb-stem annotation: explains the trailing "-" on Sindarin verb
   stems (e.g. thar-, cen-).  Same visual weight as .bd-note but uses
   a slightly warmer grey so readers register it as "info" rather than
   a citation. */
.bd-stem-note {
    display: block;
    font-size: 0.78rem;
    color: #7a6a5d;
    margin-top: 0.15rem;
    font-style: italic;
}

.results-attribution {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    color: #888;
}

.results-attribution a {
    color: #8B0000;
    text-decoration: none;
    border-bottom: 1px dotted rgba(139, 0, 0, 0.4);
}

.results-attribution a:hover {
    border-bottom-color: #8B0000;
}

/* ==========================================================================
   Placeholder blocks for tool pages not yet wired up
   ========================================================================== */
.tool-placeholder {
    text-align: center;
    padding: 3rem 1rem;
}

.tool-placeholder-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: #000;
    margin-bottom: 0.5rem;
}

.tool-placeholder-subtext {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .top-nav {
        padding: 0.75rem 1rem;
        min-height: 56px;
    }

    .logo { font-size: clamp(0.7rem, 0.6rem + 1.1vw, 1.1rem); letter-spacing: 0.08em; }

    .nav-motto { display: none; } /* motto hidden on narrow screens */

    main {
        padding-top: 56px;
    }

    .content-wrapper {
        padding: 2rem 1rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .options-grid,
    .options-grid--two,
    .input-methods {
        grid-template-columns: 1fr;
    }

    .option-card {
        min-height: auto;
    }

    .gate-prompt {
        font-size: 1.75rem;
    }

    .mode-option {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .mode-option label {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .mode-option:first-child label {
        border-top: none;
    }

    footer {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .results-output {
        padding: 1rem 1.1rem;
    }

    .results-details {
        padding: 0.85rem 1rem;
    }

    .results-line {
        font-size: 1.3rem;
    }

    .results-breakdown {
        grid-template-columns: 1fr;
        gap: 0.15rem 0;
    }

    .results-breakdown .bd-term,
    .results-breakdown .bd-def {
        border-top: none;
    }

    .results-breakdown .bd-term {
        padding-top: 0.55rem;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .results-breakdown .bd-term:first-child {
        border-top: none;
    }
}
