.clearance-page {
    background: #0c1725;
    color: #e9f3fa;
}

.clearance-main {
    --clearance-accent: #8de5e1;
    --clearance-muted: #adc4d7;
    --clearance-line: #2a4154;
    --clearance-panel: #122234;
    max-width: 1280px;
    margin: auto;
    padding: 28px 24px 72px;
}

.clearance-main a { color: var(--clearance-accent); }
.clearance-main summary { cursor: pointer; }
.clearance-main :focus-visible { outline: 2px solid var(--clearance-accent); outline-offset: 4px; }

.clearance-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(16px, 3vw, 28px) 0;
    margin-block-end: 24px;
    border-block-end: 1px solid var(--clearance-line);
}

.clearance-hero-copy { min-width: 0; max-width: 740px; }
.clearance-hero h1 { margin: 0 0 10px; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.14; overflow-wrap: anywhere; }
.clearance-hero p { margin: 0; color: #c0d5e5; line-height: 1.65; }
.clearance-hero-detail { padding-block-start: 8px; }
.clearance-world {
    --border: var(--clearance-line);
    --muted: var(--clearance-muted);
    --teal: var(--clearance-accent);
    margin: 0 0 26px;
}
.clearance-world .connect-world-canvas { max-width: 1030px; }
.clearance-world .connect-world-clear { min-height: 33px; }
.clearance-catalog { scroll-margin-block-start: 18px; }
.clearance-back { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; text-decoration: none; }
.clearance-back::before, .clearance-country-arrow {
    content: '';
    width: 7px;
    height: 7px;
    border-inline-end: 1.5px solid currentColor;
    border-block-start: 1.5px solid currentColor;
    transform: rotate(45deg);
}
.clearance-back::before { transform: rotate(225deg); }
.clearance-page[dir="rtl"] .clearance-back::before { transform: rotate(-45deg); }
.clearance-page[dir="rtl"] .clearance-country-arrow { transform: rotate(-135deg); }
.clearance-destination { display: flex; align-items: center; gap: clamp(12px, 2vw, 22px); margin-block-start: 16px; }
.clearance-destination > div { min-width: 0; }
.clearance-destination h1 { margin: 0 0 5px; }
.clearance-identity span {
    display: inline-block;
    margin-inline-end: 6px;
    padding: 1px 7px;
    border: 1px solid #4c6e80;
    border-radius: 5px;
    color: #d0e4f0;
    font-size: .75em;
    font-variant-numeric: tabular-nums;
}

.clearance-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.clearance-map-open, .clearance-hero-actions .clearance-report {
    font: inherit;
    padding: 10px 14px;
    border: 1px solid #507285;
    border-radius: 10px;
    background: #132b3b;
    color: #d1f3f3;
    font-size: .9rem;
    text-decoration: none;
    cursor: pointer;
}
.clearance-map-open:hover, .clearance-report:hover { background: #214455; }

.clearance-map-dialog {
    box-sizing: border-box;
    width: min(1080px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 20px;
    overflow: auto;
    border: 1px solid #456477;
    border-radius: 20px;
    color: inherit;
    background: #0e1d2b;
    box-shadow: 0 24px 80px #0009;
}
.clearance-map-dialog::backdrop { background: #030a12c9; backdrop-filter: blur(5px); }
.clearance-map-dialog[open] { animation: clearance-map-enter .18s ease-out; }
.clearance-picker-map { margin: 0; }
.clearance-picker-map .connect-world-header { align-items: center; }
.clearance-picker-map .connect-world-canvas { margin-block: 12px 8px; }
.clearance-map-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #416175;
    border-radius: 11px;
    color: #d7ebf5;
    background: #152b3c;
    font: inherit;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}
.clearance-map-close:hover { background: #27475a; }
@keyframes clearance-map-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .clearance-map-dialog[open] { animation: none; } }

.clearance-directory-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.clearance-directory h2, .clearance-jump h2 { margin: 0; font-size: 1rem; }
.clearance-directory h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.clearance-catalog h2 { font-size: clamp(1.2rem, 2.5vw, 1.65rem); }
.clearance-directory h2 small, .clearance-count {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #335568;
    border-radius: 999px;
    background: #183548;
    color: #b4dce6;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}
.clearance-search { position: relative; flex: 0 1 360px; }
.clearance-search:has(input:not([hidden]))::before {
    content: '';
    position: absolute;
    inset-inline-start: 14px;
    inset-block-start: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    background: #91b3c7;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}
.clearance-directory input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    padding-inline-start: 38px;
    color: inherit;
    background: #101e2e;
    border: 1px solid #39566c;
    border-radius: 10px;
    font: inherit;
}
.clearance-directory input::placeholder { color: #a3bed1; }
.clearance-directory [data-country-empty] { margin-block-start: 20px; color: var(--clearance-muted); }
.clearance-directory ul { list-style: none; margin: 0; padding: 0; }
.clearance-catalog .clearance-directory-head { margin-block-end: 17px; }
.clearance-catalog ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.clearance-directory li a {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: inherit;
    text-decoration: none;
}
.clearance-catalog li a { min-height: 65px; border-color: var(--clearance-line); background: var(--clearance-panel); }
.clearance-country-name { display: grid; gap: 2px; overflow-wrap: anywhere; line-height: 1.35; }
.clearance-country-name strong { font-size: .92rem; font-weight: 650; }
.clearance-country-name small { justify-self: start; color: var(--clearance-muted); font-size: .72rem; }
.clearance-country-arrow { color: #82aabd; margin-inline-end: 4px; }
.clearance-directory li a:hover, .clearance-directory a[aria-current="page"] {
    border-color: #528395;
    background: #1b394c;
    color: #aff2e9;
}
.clearance-flag {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: minmax(0, 1fr);
    place-items: center;
    width: 36px;
    height: 27px;
    border-radius: 4px;
    background: #1b3a4b;
    box-shadow: 0 0 0 1px #a5c6da30;
    overflow: hidden;
}
.clearance-flag:not(:has(img))::before {
    content: '';
    width: 54%;
    height: 72%;
    background: #9fd9dd;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 16h18l-4-6h-4l-2 3H7l-4 3Zm1 4h16M9 7h.01m7-3h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.clearance-flag img { display: block; width: 100%; height: 100%; object-fit: contain; }
.clearance-flag:has(img + img) { gap: 1px; }
.clearance-destination .clearance-flag { flex: none; width: 64px; height: 48px; border-radius: 7px; }

.clearance-switch-panel {
    position: absolute;
    box-sizing: border-box;
    z-index: 5;
    inset-inline-end: 16px;
    inset-block-start: calc(100% - 12px);
    width: min(390px, calc(100% - 32px));
    padding: 16px;
    border: 1px solid #39566c;
    border-radius: 15px;
    background: var(--clearance-panel);
    box-shadow: 0 16px 42px #060d18b8;
}
.clearance-switch-panel .clearance-directory-head { flex-direction: column; align-items: stretch; margin-block-end: 12px; }
.clearance-switch-panel .clearance-search { flex: auto; }
.clearance-switch-panel ul { max-height: min(45vh, 360px); overflow: auto; scrollbar-width: thin; }

.clearance-layout { display: grid; grid-template-columns: minmax(180px, 224px) minmax(0, 1fr); gap: clamp(18px, 3vw, 32px); align-items: start; }
.clearance-jump {
    position: sticky;
    inset-block-start: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    scrollbar-width: thin;
    padding: 16px;
    border: 1px solid var(--clearance-line);
    border-radius: 15px;
    background: #101f30;
}
.clearance-jump h2 { margin-block-end: 12px; }
.clearance-jump ol { margin: 0; padding: 0; list-style: none; counter-reset: chapter; }
.clearance-jump li { counter-increment: chapter; }
.clearance-jump a { display: flex; gap: 9px; padding: 7px 6px; color: #bfd2e3; text-decoration: none; font-size: .88rem; line-height: 1.35; }
.clearance-jump a::before { content: counter(chapter, decimal-leading-zero); color: #8fb1c8; font-variant-numeric: tabular-nums; }
.clearance-jump a:hover { color: #aff2e9; background: #1b3349; border-radius: 6px; }

.clearance-intro {
    margin: 0 0 16px;
    padding: 12px 15px;
    border-inline-start: 3px solid #5ba4af;
    border-radius: 5px;
    background: #13283a;
    color: #c3d8e7;
    font-size: .9rem;
    line-height: 1.55;
}
.clearance-card {
    margin-block-end: 14px;
    padding: clamp(18px, 3vw, 30px);
    background: var(--clearance-panel);
    border: 1px solid var(--clearance-line);
    border-radius: 16px;
    scroll-margin-block-start: 20px;
    overflow-wrap: anywhere;
}
.clearance-card:target { border-color: #6cbabe; }
.clearance-card h2, .clearance-card h3 { margin: 0 0 9px; font-size: clamp(1.14rem, 2vw, 1.4rem); }
.clearance-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 14px; color: var(--clearance-muted); font-size: .8rem; }
.clearance-meta:empty { display: none; }
.clearance-badge { padding: 3px 9px; border-radius: 999px; background: #1c3950; }
.clearance-badge[data-level="official_online_checked"] { color: #a7e5d4; background: #1b413f; }
.clearance-badge[data-level="editorial_unverified"] { color: #ffd294; background: #3b2d21; }
.clearance-prose { color: #dceaf4; line-height: 1.8; overflow-x: auto; }
.clearance-prose > :first-child { margin-block-start: 0; }
.clearance-prose > :last-child { margin-block-end: 0; }
.clearance-prose blockquote { margin-inline: 0; padding: 8px 12px; border-inline-start: 2px solid #51768a; background: #172d40; color: #c2d7e7; }
.clearance-prose img { max-width: 100%; }
.clearance-sources, .clearance-port { border-block-start: 1px solid var(--clearance-line); margin-block-start: 16px; padding-block-start: 12px; }
.clearance-sources summary, .clearance-port summary { color: var(--clearance-accent); }
.clearance-sources { font-size: .88rem; }

@media (max-width: 740px) {
    .clearance-main { padding: 16px 14px 44px; }
    .clearance-layout { grid-template-columns: minmax(0, 1fr); }
    .clearance-jump { position: static; max-height: none; }
    .clearance-jump ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 2px 8px; }
}

@media (max-width: 560px) {
    .clearance-hero { align-items: flex-start; flex-direction: column; gap: 16px; margin-block-end: 20px; }
    .clearance-directory-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .clearance-search { flex: auto; }
    .clearance-destination .clearance-flag { width: 48px; height: 36px; }
    .clearance-map-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 12px; border-radius: 15px; }
}
