:root {
    --brand-blue: #054e9f;
    --brand-blue-strong: #043d7d;
    --brand-blue-deep: #032f62;
    --brand-blue-soft: #e8f1fb;
    --brand-lime: #d1f52e;
    --brand-lime-strong: #b9de17;
    --brand-lime-deep: #94b111;
    --brand-lime-soft: #f5fccf;

    --bg: #202122;
    --surface: #2a2d31;
    --surface-soft: #34373c;
    --border: #54595d;
    --border-soft: #6b7075;
    --text: #eaecf0;
    --muted: #c8ccd1;
    --link: var(--brand-lime);
    --link-hover: #e4ff72;
    --link-visited: #b9de17;
    --accent: var(--brand-lime);
    --accent-strong: var(--brand-lime-strong);
    --accent-deep: var(--brand-lime-deep);
    --accent-soft: #2a3116;
    --accent-contrast: #202122;
    --highlight: var(--brand-lime);
    --highlight-soft: #323a17;
    --danger: #ff7b72;
    --shadow: none;
    --search-match-bg: rgba(209, 245, 46, .30);
    --search-match-current-bg: #ffae1a;
    --search-match-current-hover-bg: #ffc24d;
    --search-match-current-text: #202122;
    --search-match-current-ring: rgba(255, 194, 77, .55);
    --article-loading-overlay: rgba(32, 33, 34, .28);
    --article-loading-shadow: rgba(0, 0, 0, .24);
    --header-offset: 0px;
    color-scheme: dark;
}

body[data-theme="light"] {
    --bg: #eaecf0;
    --surface: #ffffff;
    --surface-soft: #f8f9fa;
    --border: #a2a9b1;
    --border-soft: #c8ccd1;
    --text: #202122;
    --muted: #54595d;
    --link: var(--brand-blue);
    --link-hover: var(--brand-blue-strong);
    --link-visited: var(--brand-blue-deep);
    --accent: var(--brand-blue);
    --accent-strong: var(--brand-blue-strong);
    --accent-deep: var(--brand-blue-deep);
    --accent-soft: var(--brand-blue-soft);
    --accent-contrast: #ffffff;
    --highlight: var(--brand-lime);
    --highlight-soft: var(--brand-lime-soft);
    --danger: #b32424;
    --shadow: 0 1px 0 rgba(0,0,0,.04);
    --search-match-bg: rgba(209, 245, 46, .42);
    --search-match-current-bg: #ffbf47;
    --search-match-current-hover-bg: #ffd166;
    --search-match-current-text: #202122;
    --search-match-current-ring: rgba(255, 191, 71, .45);
    --article-loading-overlay: rgba(255, 255, 255, .34);
    --article-loading-shadow: rgba(32, 33, 34, .12);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
body.modal-open { overflow: hidden; }
a {
    color: var(--link);
    text-decoration-thickness: .08em;
    text-underline-offset: .12em;
}
a:hover,
a:focus-visible { color: var(--link-hover); }
a:visited { color: var(--link-visited); }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.page-shell {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}

.layout-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
    gap: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow);
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
    background: var(--surface-soft);
    border-right: 1px solid var(--border);
}

.sidebar-scroll {
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header {
    text-align: center;
    padding: 16px 14px 14px;
}

.help-header {
    position: relative;
}

.header-help-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    border-radius: 999px;
}

.header-jump-btn {
    left: auto;
    right: 10px;
}

.mobile-jump-panel {
    position: relative;
}

.mobile-jump-btn,
.mobile-jump-bottom-btn {
    display: none;
}

.mobile-only-jump-btn {
    display: none !important;
}

.brand-logo {
    display: block;
    width: min(160px, 82%);
    margin: 0 auto 10px;
}

.eyebrow,
.label {
    margin: 0 0 4px;
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.brand-subline,
.muted,
.small-text { color: var(--muted); }
.brand-subline { margin: 8px 0 12px; line-height: 1.35; }

.btn,
.mode-select,
.theme-menu-btn,
.icon-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 0;
}

.btn {
    padding: 8px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

a.btn,
a.btn:visited,
a.btn:hover {
    color: inherit;
    text-decoration: none;
}

.btn:hover,
.theme-menu-btn:hover,
.icon-btn:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.link-btn:hover {
    color: var(--link-hover);
    text-decoration: underline;
    background: transparent;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent-strong);
    color: var(--accent-contrast);
}
body[data-theme="dark"] .btn-primary { color: var(--accent-contrast); }
.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-deep);
    color: var(--accent-contrast);
}
body[data-theme="dark"] .btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-deep);
    color: var(--accent-contrast);
}
.play-launch-btn { width: 100%; }
.article-back-btn { white-space: nowrap; }

a.game-link.is-disabled-nav {
    pointer-events: none;
    cursor: progress;
    opacity: .72;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--link);
    cursor: pointer;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.compact-panel { padding: 10px 12px; }
.info-line { margin: 4px 0; line-height: 1.35; }
.section-title-row,
.archive-details-head,
.route-target-topline,
.modal-head,
.archive-toolbar,
.article-header-tools,
.inline-actions,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mode-chip {
    padding: 2px 8px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    font-size: .75rem;
}

.sidebar-highscore-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-score-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid var(--border-soft);
}
.sidebar-score-item:first-child { border-top: 0; padding-top: 0; }
.sidebar-rank {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    font-size: .75rem;
}
.sidebar-score-name { display: block; font-size: .92rem; }
.sidebar-score-meta,
.sidebar-score-empty { font-size: .82rem; color: var(--muted); line-height: 1.35; }

.rules-panel ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.45;
}

.sidebar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.win-panel h3 { margin: 0 0 6px; font-family: Georgia, serif; }

.sidebar-bottom-actions {
    margin-top: auto;
    position: relative;
    display: grid;
    gap: 8px;
    padding-top: 2px;
    align-items: center;
    justify-items: center;
}

.sidebar-bottom-main-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.sidebar-bottom-legal-row {
    display: flex;
    justify-content: center;
    width: 100%;
}
.sidebar-bottom-btn {
    flex: 0 0 auto;
    min-width: 110px;
}
.theme-menu {
    position: absolute;
    left: 118px;
    bottom: calc(100% + 8px);
    display: grid;
    min-width: 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    z-index: 20;
}
.theme-menu-btn { padding: 8px 10px; text-align: left; cursor: pointer; }
.theme-menu-btn.is-active { background: var(--accent-soft); }

.article-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 0;
}

.article-header {
    position: sticky;
    top: 0;
    z-index: 15;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-route-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
}
.route-block {
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    padding: 8px 10px;
    min-width: 0;
}
.route-block-target {
    position: relative;
    padding-right: 54px;
}
.route-block h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 1.45vw, 1.2rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.route-arrow {
    align-self: center;
    text-align: center;
    font-size: 1.05rem;
    color: var(--muted);
}
.article-header-tools {
    margin-top: 0;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}
.article-search-wrap {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 0 1 240px;
}
.article-search-field {
    position: relative;
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    width: 100%;
}
.article-search-input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 108px 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
}
.article-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.article-search-nav {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 1px;
}
.article-search-count {
    min-width: 1.7em;
    text-align: right;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.article-search-nav-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .72rem;
    line-height: 1;
    border-radius: 999px;
    cursor: pointer;
}
.article-search-nav-btn:hover:not(:disabled),
.article-search-nav-btn:focus-visible:not(:disabled) {
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    color: var(--text);
    outline: none;
}
.article-search-nav-btn:disabled {
    cursor: default;
    opacity: .4;
}
.article-search-clear-btn {
    font-size: .82rem;
    font-weight: 600;
}
.article-search-input::placeholder {
    color: var(--muted);
}
.article-search-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.counter-card {
    min-width: 76px;
    padding: 7px 9px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    text-align: center;
}
.counter-card span { display: block; font-size: .75rem; color: var(--muted); }
.counter-card strong { display: block; font-size: 1.15rem; }

.article-content-shell {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
}

.article-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px 24px 48px;
    overflow: auto;
    line-height: 1.6;
    font-size: 1rem;
    transition: filter .28s ease, opacity .24s ease, transform .32s ease;
    will-change: filter, opacity, transform;
}

.article-content-shell.is-loading .article-content {
    filter: blur(5px);
    opacity: .4;
    transform: scale(.992);
    pointer-events: none;
    user-select: none;
}

.article-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: rgba(20, 21, 22, .22);
    transition: opacity .24s ease, visibility .24s ease;
}

body[data-theme="light"] .article-loading-overlay {
    background: rgba(255, 255, 255, .22);
}

.article-content-shell.is-loading .article-loading-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.article-loading-spinner {
    position: relative;
    box-sizing: border-box;
    width: 188px;
    height: 188px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    border-radius: 50%;
    background: rgba(12, 14, 16, .88);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 20px 44px rgba(0, 0, 0, .42);
    backdrop-filter: blur(4px);
}

body[data-theme="light"] .article-loading-spinner {
    background: rgba(255, 255, 255, .96);
    border-color: rgba(5, 78, 159, .16);
    box-shadow: 0 18px 36px rgba(32, 33, 34, .16);
}

.article-loading-orbit {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-loading-circle {
    position: relative;
    width: 108px;
    height: 108px;
    animation: article-loader-spin 2.25s linear infinite;
}

.article-loading-circle-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 999px;
    background: var(--accent, #d1f52e);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 0 8px rgba(209, 245, 46, .18);
    transform: rotate(var(--angle)) translateY(-43px);
}

body[data-theme="light"] .article-loading-circle-dot {
    box-shadow: 0 0 0 1px rgba(5, 78, 159, .05), 0 0 7px rgba(5, 78, 159, .12);
}

.article-loading-circle-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 999px;
    background: var(--accent, #d1f52e);
    box-shadow: 0 0 10px rgba(209, 245, 46, .16);
}

.article-loading-svg {
    width: 120px;
    height: 120px;
    display: block;
    overflow: visible;
    transform-origin: 50% 50%;
    animation: article-loader-spin 1.25s linear infinite;
    filter: drop-shadow(0 0 18px rgba(209, 245, 46, .28));
}

body[data-theme="light"] .article-loading-svg {
    filter: drop-shadow(0 0 14px rgba(5, 78, 159, .22));
}

.article-loading-ring {
    fill: none;
    stroke: rgba(255, 255, 255, .18);
    stroke-width: 2;
}

body[data-theme="light"] .article-loading-ring {
    stroke: rgba(5, 78, 159, .18);
}

.article-loading-core {
    fill: var(--accent);
    opacity: .98;
}

.article-loading-svg-dot {
    fill: var(--accent);
    opacity: .92;
}

.article-loading-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 94px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    color: var(--text);
    font-size: .84rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

body[data-theme="light"] .article-loading-label {
    background: rgba(5, 78, 159, .08);
    color: var(--accent);
}

@keyframes article-loader-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-content,
    .article-loading-overlay,
    .article-loading-spinner,
    .article-loading-orbit,
    .article-loading-circle,
    .article-loading-svg {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .article-loading-svg,
    body[data-theme="light"] .article-loading-svg {
        filter: none;
    }

    .article-loading-svg-dot {
        opacity: 1;
    }
}

.article-content h2,
.article-content h3,
.article-content h4 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: .2em;
}

.article-content p,
.article-content ul,
.article-content ol { max-width: 950px; }
.article-content img { max-width: 100%; height: auto; }
.article-content a.game-link { text-decoration: underline; cursor: pointer; }
.article-content .article-search-mark {
    padding: 0 .08em;
    border-radius: .2em;
    background: var(--search-match-bg);
    color: inherit;
    transition: background-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.article-content .article-search-mark.is-current {
    background: var(--search-match-current-bg);
    color: var(--search-match-current-text);
    box-shadow: 0 0 0 2px var(--search-match-current-ring);
}
.article-content .article-search-mark.is-current:hover,
.article-content .article-search-mark.is-current:focus-visible {
    background: var(--search-match-current-hover-bg);
    color: var(--search-match-current-text);
}
.article-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: .95rem;
}
.article-content th,
.article-content td {
    border: 1px solid var(--border-soft);
    padding: .35rem .5rem;
    vertical-align: top;
}
.article-content .infobox {
    float: right;
    max-width: min(360px, 100%);
    margin: 0 0 1rem 1rem;
    background: var(--surface-soft);
}
.article-content .infobox caption,
.article-content .infobox th {
    background: var(--surface-soft);
}
.article-content .wikitable {
    background: var(--surface);
}

.article-content .thumb,
.article-content .gallery,
.article-content .gallerybox,
.article-content .infobox,
.article-content figure {
    max-width: 100%;
}
.article-media-credit,
.article-attribution {
    max-width: 950px;
    font-size: .86rem;
    line-height: 1.45;
    color: var(--muted);
}
.article-media-credit {
    margin: .35rem 0 1rem;
}
.article-media-credit-label {
    font-weight: 700;
}
.article-attribution {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-soft);
}
.article-attribution h3 {
    margin: 0 0 .45rem;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    border: 0;
    padding: 0;
}
.article-source-links {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
.article-source-sep {
    color: var(--muted);
}
.article-source-link {
    color: inherit;
    text-decoration: underline;
}
.article-source-link-inline {
    white-space: nowrap;
}
.article-source-link-text {
    text-decoration: none;
}
.article-source-license,
.article-source-independent {
    margin-top: .55rem;
}
.preview-content a { pointer-events: none; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
    z-index: 50;
    opacity: 1;
    transition: opacity .52s ease;
}

.modal-overlay.is-fading-out {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    position: relative;
    width: min(980px, 100%);
    max-height: min(90vh, 940px);
    overflow: auto;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.play-modal-card { width: min(700px, 100%); }
.win-modal-card { width: min(560px, 100%); }
.target-modal-card { width: min(1100px, 100%); }
.help-modal-card { width: min(980px, 100%); }
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 34px;
    height: 34px;
    cursor: pointer;
}
body[data-theme="dark"] .modal-close-btn {
    background: var(--surface-soft);
    border-color: var(--border-soft);
    color: var(--text);
}
.modal-head { margin-bottom: 14px; align-items: flex-start; padding-right: 48px; }
.modal-head h2 { margin: 0; font-family: Georgia, serif; font-weight: 400; }
.archive-modal-head {
    flex-wrap: wrap;
    row-gap: 8px;
}
.archive-modal-head > :first-child {
    min-width: 0;
    flex: 1 1 320px;
}
.archive-modal-head .muted {
    flex: 1 1 320px;
    margin: 0;
}
.modal-lead { margin-top: 0; }
.align-right { justify-content: flex-end; }

.help-sections {
    display: grid;
    gap: 14px;
}

.help-section {
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    padding: 14px;
}

.help-section h3 {
    margin: 0 0 10px;
    font-family: Georgia, serif;
    font-weight: 400;
}

.help-section p:first-child,
.help-section ul:first-child {
    margin-top: 0;
}

.help-section p:last-child,
.help-section ul:last-child {
    margin-bottom: 0;
}

.help-section ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.5;
}

.help-section p {
    line-height: 1.55;
}

.help-links-section p {
    text-align: center;
}

.help-links-section .support-actions {
    justify-content: center;
    margin-top: 12px;
}

.play-mode-list { display: grid; gap: 10px; margin-bottom: 14px; }
.play-mode-option {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    cursor: pointer;
}
.play-mode-option p { margin: 4px 0 0; color: var(--muted); }
.play-options-block {
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    padding: 12px;
    margin-bottom: 14px;
}
.stack-field { display: grid; gap: 6px; }
.mode-select { width: 100%; padding: 8px 10px; }

.victory-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0;
}
.victory-stats > div {
    padding: 10px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
}
.victory-stats span { display: block; font-size: .8rem; color: var(--muted); }
.score-form { display: grid; gap: 8px; }
.score-form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.score-form-actions .btn { flex: 0 0 auto; min-width: 150px; }
#share-hint { margin: 0; min-height: 1.2em; }
#share-result-btn { text-align: center; white-space: nowrap; overflow: hidden; }
.score-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface);
    color: var(--text);
}
.player-name-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 58px));
    gap: 8px;
    justify-content: start;
}
.player-name-char {
    min-width: 0;
    padding: 10px 0;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.player-name-char:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.score-saved-note { color: var(--accent); }
.win-modal-card.is-busy { overflow: hidden; }
.modal-submit-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, .42);
    z-index: 4;
}
body[data-theme="light"] .modal-submit-overlay {
    background: rgba(255, 255, 255, .38);
}
.modal-submit-overlay.hidden {
    display: none;
}
.modal-submit-overlay .article-loading-viewport-card {
    width: 188px;
    height: 188px;
}

.archive-toolbar { margin-bottom: 12px; justify-content: flex-start; }
.archive-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}
.archive-day-list {
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    padding: 6px;
    display: grid;
    gap: 6px;
    grid-auto-rows: max-content;
    align-content: start;
    max-height: 60vh;
    overflow: auto;
}
.archive-day-btn {
    text-align: left;
    padding: 7px 8px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    cursor: pointer;
    display: grid;
    gap: 1px;
}
.archive-day-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.archive-day-btn strong { font-size: 1rem; }
.archive-day-btn span {
    font-size: .82rem;
    color: var(--muted);
    overflow-wrap: anywhere;
    line-height: 1.18;
}
.archive-day-btn .archive-day-date {
    color: var(--text);
    font-weight: 600;
}
.archive-day-btn .archive-day-meta {
    font-size: .77rem;
}
.archive-day-btn .archive-day-entry-count {
    font-size: .77rem;
}
.archive-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 60vh;
}
.archive-selected-meta { margin: 10px 0 14px; line-height: 1.45; }
.archive-details-head { flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.archive-details-head > div { min-width: 0; flex: 1 1 240px; }
.archive-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    flex: 0 0 auto;
}
.archive-action-buttons .btn {
    min-width: 150px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}
.archive-score-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}
.score-entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.score-entries li {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
}
.rank {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

@media (max-width: 1080px) {
    .layout-grid { grid-template-columns: 280px minmax(0, 1fr); }
}

.mobile-layout-anchor {
    height: 0;
    visibility: hidden;
    scroll-margin-top: 10px;
}

@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .sidebar {
        position: relative;
        max-height: none;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-scroll { max-height: 38vh; }
    .article-panel { border-left: 1px solid var(--border); }
    .article-header {
        top: 0;
        padding: 10px 12px;
        flex-wrap: wrap;
    }
    .article-route-card {
        grid-template-columns: 1fr;
        min-width: 100%;
    }
    .route-arrow { display: none; }
    .article-header-tools {
        width: 100%;
        justify-content: space-between;
    }
    .article-search-wrap {
        flex: 1 1 220px;
    }
    .archive-layout { grid-template-columns: 1fr; }
    .archive-details { max-height: none; }
    .archive-score-list { max-height: 40vh; }
}

@media (max-width: 680px) {
    .sidebar-scroll { padding: 10px; }
    .brand-logo { width: min(140px, 76%); }
    .article-header {
        position: sticky;
        top: 0;
        z-index: 25;
    }
    .route-block { padding: 8px 10px; }
    .route-block h2 { font-size: 1.05rem; }
    .article-header-tools { justify-content: space-between; }
    .article-search-wrap { flex: 1 1 200px; }
    .counter-card { min-width: 74px; }
    .article-content { padding: 14px 12px 36px; }
    .victory-stats { grid-template-columns: 1fr; }
    .modal-overlay { padding: 10px; }
    .modal-card { padding: 14px; }
}

.btn,
.link-btn,
.icon-btn,
.theme-toggle,
.language-toggle,
.image-toggle,
.footer-meta-link,
.modal-close-btn,
.archive-day-btn,
.play-mode-option,
a.btn {
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}

.btn:hover,
.btn:focus-visible,
.icon-btn:hover,
.icon-btn:focus-visible,
.language-toggle:hover,
.language-toggle:focus-visible,
.image-toggle:hover,
.image-toggle:focus-visible,
.modal-close-btn:hover,
.modal-close-btn:focus-visible,
a.btn:hover,
a.btn:focus-visible {
    background: var(--accent-soft);
    color: var(--text);
    border-color: var(--highlight);
}

.btn-primary:hover,
.btn-primary:focus-visible,
a.btn.btn-primary:hover,
a.btn.btn-primary:focus-visible {
    background: var(--accent-strong);
    border-color: var(--accent-deep);
    color: var(--accent-contrast);
}
body[data-theme="dark"] .btn-primary:hover,
body[data-theme="dark"] .btn-primary:focus-visible,
body[data-theme="dark"] a.btn.btn-primary:hover,
body[data-theme="dark"] a.btn.btn-primary:focus-visible {
    background: var(--accent-strong);
    border-color: var(--accent-deep);
    color: var(--accent-contrast);
}

.link-btn:focus-visible,
.footer-meta-link:focus-visible,
.theme-toggle:focus-visible,
.language-toggle:focus-visible,
.image-toggle:focus-visible,
.archive-day-btn:focus-visible,
.play-mode-option:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sidebar-bottom-actions {
    align-items: center;
    justify-content: center;
    padding-top: 6px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}

.theme-toggle-orb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: linear-gradient(90deg, #111 0 50%, #fff 50% 100%);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

body[data-theme="dark"] .theme-toggle-orb {
    background: linear-gradient(90deg, #fff 0 50%, #111 50% 100%);
}

.footer-meta-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: .7rem;
    opacity: .6;
    cursor: pointer;
    text-decoration: none;
}

.footer-meta-link:hover {
    opacity: 1;
    color: var(--text);
    background: transparent;
}

.article-header {
    justify-content: space-between;
    gap: 8px;
}

.article-route-card {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 6px;
}

.route-block {
    padding: 7px 9px;
}

.route-block h2 {
    font-size: clamp(.95rem, 1.15vw, 1.15rem);
    line-height: 1.08;
}

.route-target-topline .label,
.route-block .label {
    margin-bottom: 2px;
}

.route-target-topline {
    display: block;
    margin-bottom: 2px;
}

.route-target-topline .label {
    margin: 0;
}

.route-target-topline .icon-btn {
    position: absolute;
    top: 7px;
    right: 9px;
}

.route-arrow {
    font-size: .95rem;
}

.article-header-tools {
    gap: 8px;
    flex-shrink: 0;
}

.counter-card {
    min-width: 62px;
    padding: 6px 8px;
}

.counter-card strong {
    font-size: 1.05rem;
}

.article-back-btn {
    padding-inline: 10px;
}

.welcome-modal-card,
.legal-modal-card {
    width: min(860px, 100%);
}

.welcome-brand {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.welcome-logo {
    display: block;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
}

.welcome-brand h2,
.legal-modal-card h2 {
    margin: 0 0 8px;
    font-family: Georgia, serif;
    font-weight: 400;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.welcome-section,
.legal-section {
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    padding: 14px;
}

.welcome-section h3,
.legal-section h3,
.legal-section h4 {
    margin-top: 0;
    font-family: Georgia, serif;
    font-weight: 400;
}

.support-section {
    margin-bottom: 14px;
}

.support-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.support-actions-uniform .welcome-action-btn {
    min-width: 180px;
    min-height: 48px;
    padding: 10px 16px;
}

.support-actions-uniform {
    align-items: stretch;
}

.legal-sections {
    display: grid;
    gap: 14px;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

@media (max-width: 1200px) {
    .layout-grid { grid-template-columns: 300px minmax(0, 1fr); }
    .article-header { padding: 9px 12px; }
    .article-route-card { grid-template-columns: minmax(0, .95fr) 16px minmax(0, .95fr); }
    .route-block h2 { font-size: clamp(.9rem, 1vw, 1.05rem); }
    .counter-card { min-width: 58px; }
    .article-back-btn { font-size: .95rem; }
}

@media (max-width: 760px) {
    .welcome-brand,
    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .welcome-logo {
        max-width: 200px;
    }

    .support-actions-uniform .welcome-action-btn {
        width: 100%;
        min-width: 0;
    }
}


.sidebar-bottom-legal-row .footer-meta-link {
    margin-left: 0;
}


.language-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}

.language-toggle:hover {
    background: var(--surface-soft);
}

.language-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.language-toggle-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
    width: 74px;
    height: 26px;
    border-radius: 0;
    background: var(--surface-soft);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.language-toggle-option {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--muted);
    text-transform: uppercase;
}

.language-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(50% - 3px);
    height: calc(100% - 4px);
    border-radius: 0;
    background: var(--accent);
    transition: transform .18s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.language-toggle[data-lang="en"] .language-toggle-thumb {
    transform: translateX(100%);
}

.language-toggle[data-lang="de"] .language-toggle-option:first-child,
.language-toggle[data-lang="en"] .language-toggle-option:nth-child(2) {
    color: var(--accent-contrast) !important;
}

.image-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}

.image-toggle-glyph {
    position: relative;
    width: 20px;
    height: 16px;
    display: block;
}

.image-toggle-frame {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--text);
    border-radius: 2px;
    opacity: .92;
}

.image-toggle-sun {
    position: absolute;
    top: 2px;
    right: 3px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text);
    opacity: .92;
}

.image-toggle-mountain {
    position: absolute;
    bottom: 1px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid var(--text);
    opacity: .92;
}

.image-toggle-mountain-back {
    left: 3px;
}

.image-toggle-mountain-front {
    left: 8px;
    border-left-width: 5px;
    border-right-width: 5px;
    border-bottom-width: 8px;
}

.image-toggle-slash {
    position: absolute;
    top: -1px;
    left: 9px;
    width: 2px;
    height: 19px;
    background: var(--accent);
    transform: rotate(42deg);
    transform-origin: center;
    opacity: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
    transition: opacity .18s ease, transform .18s ease;
}

.image-toggle[data-images="on"] {
    background: color-mix(in srgb, var(--surface) 64%, var(--accent-soft) 36%);
    border-color: var(--highlight);
}

.image-toggle[data-images="on"] .image-toggle-frame,
.image-toggle[data-images="on"] .image-toggle-sun,
.image-toggle[data-images="on"] .image-toggle-mountain {
    color: var(--text);
}

.image-toggle[data-images="off"] {
    background: var(--surface);
}

.image-toggle[data-images="off"] .image-toggle-frame,
.image-toggle[data-images="off"] .image-toggle-sun,
.image-toggle[data-images="off"] .image-toggle-mountain {
    opacity: .5;
}

.image-toggle[data-images="off"] .image-toggle-slash {
    opacity: 1;
    transform: rotate(42deg) scale(1.02);
}

body[data-images-enabled="0"] .article-content img,
body[data-images-enabled="0"] .article-image-credit {
    display: none !important;
}

.mobile-layout-anchor,
.mobile-after-article {
    display: none;
}

#sidebar-secondary {
    display: contents;
}

@media (max-width: 900px) {
    .page-shell {
        max-width: none;
    }

    .layout-grid {
        display: block;
    }

    .sidebar {
        display: block;
        min-height: 0;
        background: transparent;
        border: 0;
    }

    .sidebar-scroll {
        overflow: visible;
        max-height: none;
        padding: 12px;
        gap: 12px;
    }

    .mobile-main-header {
        display: grid;
        gap: 12px;
    }

    .mobile-layout-anchor {
        display: block;
    }

    .mobile-jump-btn,
    .mobile-jump-bottom-btn {
        display: inline-flex;
    }

    .mobile-only-jump-btn {
        display: inline-flex !important;
    }

    .mobile-jump-bottom-btn {
        font-size: 1rem;
        line-height: 1;
        font-weight: 700;
    }

    .sidebar-bottom-main-actions {
        justify-content: center;
    }

    .sidebar-bottom-legal-row {
        justify-content: center;
    }

    .article-panel {
        border-left: 1px solid var(--border);
        margin: 0 12px 12px;
    }

    .article-header {
        position: sticky;
        top: 0;
        z-index: 30;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 10px 12px;
    }

    .article-route-card {
        grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
        gap: 8px;
        width: 100%;
        min-width: 0;
        align-items: stretch;
    }

    .route-arrow {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }

    .route-block {
        min-width: 0;
        overflow: hidden;
    }

    .route-block h2,
    #article-title,
    #article-target-title {
        display: block;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
        white-space: normal;
    }

    .route-target-topline {
        display: block;
        margin-bottom: 2px;
    }

    .route-target-topline .label {
        display: block;
        min-width: 0;
    }

    .article-header-tools {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
        align-items: center;
    }

    .article-search-wrap {
        order: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    .archive-action-buttons {
        width: 100%;
        align-items: stretch;
    }

    .archive-action-buttons .btn {
        width: 100%;
    }


    .article-content {
        padding: 14px 12px 34px;
    }

    .mobile-after-article {
        display: block;
        padding: 0 12px 12px;
    }

    .mobile-after-article > * {
        margin-bottom: 12px;
    }

    .mobile-after-article > *:last-child {
        margin-bottom: 0;
    }

    .sidebar-bottom-actions {
        margin-top: 0;
    }

    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    }

    .modal-card {
        width: min(980px, 100%);
        max-height: none;
        min-height: 0;
        margin: 0 auto;
    }
}

@media (max-width: 680px) {
    .sidebar-scroll,
    .mobile-after-article {
        padding-left: 10px;
        padding-right: 10px;
    }

    .article-panel {
        margin-left: 10px;
        margin-right: 10px;
    }

    .article-header {
        gap: 8px;
        padding: 10px;
    }

    .article-route-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .route-arrow {
        display: none;
    }

    .route-block h2,
    #article-title,
    #article-target-title {
        font-size: 1rem;
        line-height: 1.15;
    }

    .icon-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .article-header-tools {
        align-items: center;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .article-search-wrap {
        flex: 1 1 auto;
        min-width: 0;
    }

    .article-search-input,
    .article-back-btn {
        min-height: 40px;
    }

    .article-search-input {
        padding-right: 132px;
    }

    .article-search-nav {
        right: 6px;
        gap: 2px;
    }

    .article-search-count {
        min-width: 1.7em;
        font-size: .7rem;
    }

    .article-search-nav-btn {
        width: 30px;
        height: 30px;
        font-size: .76rem;
        touch-action: manipulation;
    }

    .counter-card {
        min-width: 62px;
        padding: 6px 6px;
    }

    .counter-card span {
        font-size: .68rem;
    }

    .counter-card strong {
        font-size: .98rem;
    }

    .article-back-btn {
        min-height: 40px;
        padding-inline: 8px;
        font-size: .88rem;
    }

    .modal-card {
        padding: 14px;
    }
}




@media (max-width: 860px) {
    .welcome-modal-card {
        max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
        overflow: auto;
    }

    .welcome-modal-card .modal-actions {
        position: sticky;
        bottom: -14px;
        margin: 14px -14px -14px;
        padding: 12px 14px max(12px, env(safe-area-inset-bottom));
        background: linear-gradient(to bottom, rgba(255,255,255,0), var(--surface) 22%);
        border-top: 1px solid var(--border-soft);
        z-index: 2;
    }

    body[data-theme="dark"] .welcome-modal-card .modal-actions {
        background: linear-gradient(to bottom, rgba(42,45,49,0), var(--surface) 22%);
    }
}

@media (max-width: 680px) {
    .route-block-target {
        position: relative;
        display: block;
        padding-right: 60px;
    }

    .route-target-topline {
        display: block;
        margin: 0 0 2px;
    }

    .route-block-target h2,
    #article-target-title {
        margin: 0;
        padding-right: 0;
    }

    .route-target-topline .icon-btn {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        margin: 0;
    }

    .welcome-brand {
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 12px;
        margin-bottom: 12px;
    }

    .welcome-logo {
        max-width: 200px;
    }

    .welcome-grid {
        gap: 10px;
        margin-bottom: 10px;
    }

    .welcome-section,
    .legal-section {
        padding: 12px;
    }

    .support-section {
        margin-bottom: 10px;
    }
}

.welcome-modal-card {
    width: min(720px, 100%);
}

.welcome-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    text-align: center;
}

.welcome-head-copy h2 {
    margin: 0;
    line-height: 1;
}

.welcome-logo {
    display: block;
    width: 200px;
    max-width: 200px;
    margin: 0 auto;
}

.welcome-game-text {
    margin: 0 0 10px;
    line-height: 1.45;
    text-align: center;
}

.welcome-links-card,
.welcome-links-card-solo {
    padding: 14px;
    margin-bottom: 12px;
}

.welcome-links-card p,
.welcome-links-card-solo p {
    margin: 0;
    line-height: 1.5;
    text-align: center;
}

.welcome-links-card p + p,
.welcome-links-card-solo p + p {
    margin-top: 6px;
}

.welcome-links-card .support-actions,
.welcome-links-card-solo .support-actions {
    margin-top: 12px;
    gap: 8px;
    justify-content: center;
}

.support-actions-uniform .welcome-action-btn {
    min-width: 0;
    min-height: 42px;
    padding: 9px 14px;
    flex: 1 1 180px;
    color: var(--accent-contrast);
}

@media (max-width: 760px) {
    .welcome-modal-card {
        width: min(640px, 100%);
    }

    .welcome-logo {
        width: 200px;
        max-width: 200px;
    }
}

@media (max-width: 520px) {
    .welcome-modal-card {
        width: 100%;
    }

    .welcome-links-card .support-actions,
    .welcome-links-card-solo .support-actions {
        flex-direction: column;
    }

    .support-actions-uniform .welcome-action-btn {
        width: 100%;
        flex-basis: auto;
    }
}


.btn-primary,
.btn-primary:visited,
.btn-primary:hover,
.btn-primary:focus-visible,
a.btn.btn-primary,
a.btn.btn-primary:visited,
a.btn.btn-primary:hover,
a.btn.btn-primary:focus-visible,
body[data-theme="dark"] .btn-primary,
body[data-theme="dark"] .btn-primary:hover,
body[data-theme="dark"] .btn-primary:focus-visible,
body[data-theme="dark"] a.btn.btn-primary,
body[data-theme="dark"] a.btn.btn-primary:visited,
body[data-theme="dark"] a.btn.btn-primary:hover,
body[data-theme="dark"] a.btn.btn-primary:focus-visible {
    color: var(--accent-contrast) !important;
}


.welcome-modal-card .modal-actions {
    justify-content: center;
}

#welcome-start-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: min(100%, 320px);
    min-width: 220px;
    min-height: 50px;
    margin-inline: auto;
    padding: 12px 24px;
}

@media (max-width: 520px) {
    #welcome-start-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Permanent legal page */
.legal-home-icon {
    text-decoration: none;
}

.legal-sidebar-panel {
    text-align: left;
}

.legal-sidebar-title-row {
    margin-bottom: 8px;
}

.legal-sidebar-title {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    line-height: 1.05;
}

.legal-sidebar-lead,
.legal-sidebar-note {
    max-width: 38ch;
}

.legal-sidebar-actions {
    margin-top: 12px;
}

.legal-page-panel {
    min-height: 100vh;
}

.legal-page-header {
    align-items: center;
}

.legal-route-arrow {
    font-size: 1.2rem;
    font-weight: 700;
}

.legal-route-links {
    padding-right: 10px;
}

.legal-anchor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.legal-anchor-btn {
    min-width: 140px;
    text-align: center;
    text-decoration: none;
}

.legal-header-tools {
    flex: 0 0 auto;
}

.legal-page-content {
    display: grid;
    gap: 14px;
}

.legal-page-section {
    scroll-margin-top: 88px;
}

.legal-page-section h2:first-child,
.legal-page-section h3 {
    margin-top: 0;
}

.legal-page-section p:last-child {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .legal-page-panel {
        min-height: 0;
    }

    .legal-anchor-actions {
        width: 100%;
    }

    .legal-anchor-btn {
        min-width: 0;
        flex: 1 1 220px;
    }
}

@media (max-width: 900px) {
    .legal-page-header {
        position: static;
        top: auto;
    }

    .legal-route-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-route-arrow {
        display: none;
    }

    .legal-header-tools {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .legal-anchor-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .legal-anchor-btn {
        width: auto;
        flex: 0 1 auto;
        min-height: 0;
        min-width: 0;
    }

    .legal-sidebar-actions .btn,
    .legal-back-btn,
    .legal-header-tools .btn {
        width: auto;
    }
}
