:root {
    --bg: #080d14;
    --panel: rgba(16, 22, 31, 0.78);
    --panel-strong: rgba(19, 26, 37, 0.94);
    --text: #f7f1e6;
    --muted: rgba(229, 236, 245, 0.62);
    --dim: rgba(174, 189, 209, 0.74);
    --border: rgba(142, 160, 184, 0.22);
    --gold: #f5c879;
    --gold-soft: rgba(245, 200, 121, 0.2);
    --green: #36d783;
    --blue: #70a7ff;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    width: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    width: 100%;
    margin: 0;
    color: var(--text);
    font-family: "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    text-align: center;
    background:
        radial-gradient(circle at 50% 22%, rgba(245, 200, 121, 0.12), transparent 23%),
        radial-gradient(circle at 12% 12%, rgba(112, 167, 255, 0.1), transparent 26%),
        linear-gradient(180deg, #0b111a 0%, #070c12 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
}

.page-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0 auto;
    padding: 14px 0 12px;
    display: flex;
    flex-direction: column;
}

.topbar {
    width: min(100% - 16px, 295px);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 7px;
    color: var(--text);
    text-decoration: none;
}

.brand-name {
    color: var(--gold);
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

.brand-divider {
    width: 1px;
    height: 12px;
    background: rgba(229, 236, 245, 0.28);
}

.brand-desc {
    color: rgba(229, 236, 245, 0.8);
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

.container {
    width: min(100% - 16px, 295px);
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.hero-copy {
    margin-bottom: 10px;
}

.gateway-title {
    margin: 0 0 8px;
    color: #fffaf1;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
}

.safe-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.safe-subtext {
    max-width: 270px;
    margin: 0 auto;
    color: rgba(222, 232, 244, 0.72);
    font-size: 10px;
    line-height: 1.4;
    white-space: nowrap;
}

.gateway-visual {
    position: relative;
    height: 102px;
    margin: 0 0 10px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.map-glow {
    position: absolute;
    inset: 7px 6px 0;
    opacity: 0.86;
    background:
        radial-gradient(circle at 14% 58%, var(--gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 25% 42%, var(--gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 39% 50%, var(--gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 57% 34%, var(--gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 70% 52%, var(--gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 85% 39%, var(--gold) 0 1.5px, transparent 2px),
        linear-gradient(17deg, transparent 18%, rgba(245, 200, 121, 0.34) 18.4%, transparent 19% 44%, rgba(245, 200, 121, 0.28) 44.4%, transparent 45%),
        linear-gradient(153deg, transparent 24%, rgba(245, 200, 121, 0.22) 24.4%, transparent 25% 63%, rgba(245, 200, 121, 0.24) 63.4%, transparent 64%),
        radial-gradient(ellipse at center, rgba(112, 167, 255, 0.13), transparent 62%);
    filter: drop-shadow(0 0 8px rgba(245, 200, 121, 0.26));
}

.orbit {
    position: absolute;
    width: 178px;
    height: 52px;
    border: 1px solid rgba(245, 200, 121, 0.28);
    border-radius: 50%;
    transform: rotate(-11deg);
}

.orbit-two {
    width: 138px;
    height: 40px;
    transform: rotate(18deg);
    border-color: rgba(245, 200, 121, 0.16);
}

.shield-card {
    position: relative;
    width: 72px;
    height: 76px;
    display: grid;
    place-items: center;
    isolation: isolate;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.shield-card::before {
    content: "";
    position: absolute;
    inset: 0 7px 2px;
    z-index: 1;
    background:
        linear-gradient(145deg, rgba(255, 238, 184, 0.48), rgba(131, 101, 47, 0.36) 42%, rgba(24, 27, 30, 0.82)),
        rgba(18, 22, 26, 0.92);
    clip-path: polygon(50% 0, 90% 14%, 82% 68%, 50% 100%, 18% 68%, 10% 14%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 230, 167, 0.42),
        inset 0 12px 22px rgba(255, 238, 184, 0.1),
        0 0 34px rgba(245, 200, 121, 0.28);
    filter: saturate(1.08);
    opacity: 0.96;
    transform: perspective(90px) rotateX(2deg);
    transform-origin: 50% 40%;
}

.shield-card::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 45%;
    z-index: 2;
    width: 14px;
    height: 8px;
    background: transparent;
    border-left: 2.5px solid rgba(26, 30, 32, 0.88);
    border-bottom: 2.5px solid rgba(26, 30, 32, 0.88);
    box-shadow: -1px 1px 0 rgba(255, 230, 167, 0.22);
    transform: translate(-50%, -50%) rotate(-45deg);
}

.progress-bar {
    width: 100%;
    height: 1px;
    margin: 0 0 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
}

.progress {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    transition: width 0.5s ease;
}

.route-buttons {
    display: grid;
    gap: 7px;
}

.route-btn {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto 14px;
    align-items: center;
    gap: 8px;
    min-height: 53px;
    width: 100%;
    padding: 8px 10px;
    color: var(--text);
    text-decoration: none;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(20, 27, 38, 0.9), rgba(14, 20, 29, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.route-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(245, 200, 121, 0.55);
    background: linear-gradient(180deg, rgba(37, 32, 25, 0.94), rgba(17, 22, 30, 0.94));
}

.route-btn:active {
    transform: translateY(0);
}

.route-btn.fastest {
    border-color: rgba(245, 200, 121, 0.75);
    background: linear-gradient(180deg, rgba(42, 34, 22, 0.96), rgba(24, 22, 21, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(245, 200, 121, 0.08),
        0 10px 26px rgba(245, 200, 121, 0.09);
}

.route-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(20, 28, 40, 0.92);
    border: 1px solid rgba(137, 157, 184, 0.22);
}

.route-icon::before {
    content: "";
    width: 21px;
    height: 21px;
    display: block;
    background: rgba(133, 159, 197, 0.9);
    mask: var(--icon) center / contain no-repeat;
}

.route-icon-brand {
    border-color: rgba(245, 200, 121, 0.48);
    background: rgba(245, 200, 121, 0.11);
}

.route-icon-brand::before {
    content: "X";
    width: auto;
    height: auto;
    color: var(--gold);
    background: none;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    mask: none;
}

.route-icon-globe {
    --icon: 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.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E");
}

.route-icon-bolt {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2 4 14h7l-1 8 10-13h-7l0-7Z'/%3E%3C/svg%3E");
}

.route-icon-shield {
    --icon: 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.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z'/%3E%3C/svg%3E");
}

.route-content {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.route-title {
    color: #fff7e9;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
}

.route-desc {
    overflow: hidden;
    color: var(--dim);
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.route-status {
    color: var(--green);
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}

.route-status::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(54, 215, 131, 0.6);
    vertical-align: 1px;
}

.route-badge {
    padding: 3px 6px;
    color: var(--gold);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    border-radius: 999px;
    background: rgba(245, 200, 121, 0.11);
}

.route-btn.timeout .route-status::before {
    background: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.route-btn.timeout .route-status {
    color: #ff9a9a;
}

.route-arrow {
    width: 9px;
    height: 9px;
    border-top: 1.5px solid rgba(241, 247, 255, 0.78);
    border-right: 1.5px solid rgba(241, 247, 255, 0.78);
    transform: rotate(45deg);
}

.security-note {
    min-height: 32px;
    margin: 12px 0 0;
    padding: 8px 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(201, 214, 230, 0.74);
    font-size: 9px;
    line-height: 1.35;
    border: 1px solid rgba(74, 97, 123, 0.28);
    border-radius: 6px;
    background: rgba(13, 23, 33, 0.78);
}

.note-icon {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(54, 215, 131, 0.34);
}

.note-icon::before {
    content: "";
    display: block;
    width: 7px;
    height: 4px;
    margin: 4px auto 0;
    border-left: 1.6px solid #052416;
    border-bottom: 1.6px solid #052416;
    transform: rotate(-45deg);
}

/* 语言切换器 */
.language-switcher {
    position: relative;
    z-index: 1000;
    flex: 0 0 auto;
}

.lang-toggle-btn {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    color: rgba(245, 250, 255, 0.9);
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(142, 160, 184, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.lang-toggle-btn:hover {
    border-color: rgba(245, 200, 121, 0.38);
}

.globe-icon {
    width: 12px;
    height: 12px;
    color: rgba(245, 250, 255, 0.86);
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    min-width: 168px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.2s ease;
    border: 1px solid rgba(142, 160, 184, 0.22);
    border-radius: 10px;
    background: #111923;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.lang-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    color: rgba(236, 243, 252, 0.9);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.18s ease;
}

.lang-option:hover,
.lang-option.active {
    background: rgba(245, 200, 121, 0.1);
}

.lang-option.active::after {
    content: "";
    position: absolute;
    right: 12px;
    width: 7px;
    height: 4px;
    border-left: 1.5px solid var(--gold);
    border-bottom: 1.5px solid var(--gold);
    transform: rotate(-45deg);
}

.lang-option .flag {
    font-size: 15px;
}

/* RTL布局支持 */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    text-align: center;
}

html[dir="rtl"] .brand,
html[dir="rtl"] .route-btn,
html[dir="rtl"] .security-note {
    direction: rtl;
}

html[dir="rtl"] .route-btn {
    text-align: right;
    grid-template-columns: 16px auto minmax(0, 1fr) 40px;
}

html[dir="rtl"] .route-icon {
    grid-column: 4;
}

html[dir="rtl"] .route-content {
    grid-column: 3;
}

html[dir="rtl"] .route-meta {
    grid-column: 2;
}

html[dir="rtl"] .route-arrow {
    grid-column: 1;
    transform: rotate(-135deg);
}

html[dir="rtl"] .lang-dropdown-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .lang-option.active::after {
    right: auto;
    left: 12px;
}

/* 阿拉伯语字体优化 */
html[lang="ar-SA"] body,
html[lang="ar-SA"] .route-btn,
html[lang="ar-SA"] .safe-text,
html[lang="ar-SA"] .safe-subtext {
    font-family: "Arial", "Tahoma", sans-serif;
}

@media (max-width: 380px) {
    .page-shell {
        padding: 14px 0 12px;
    }

    .topbar {
        margin-bottom: 18px;
    }

    .brand-name {
        font-size: 17px;
    }

    .hero-copy {
        margin-bottom: 8px;
    }

    .gateway-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .safe-subtext {
        font-size: 10px;
        line-height: 1.35;
        white-space: nowrap;
    }

    .gateway-visual {
        height: 84px;
        margin: 0 0 8px;
    }

    .shield-card {
        width: 60px;
        height: 70px;
    }

    .orbit {
        width: 164px;
        height: 48px;
    }

    .orbit-two {
        width: 126px;
        height: 38px;
    }

    .progress-bar {
        display: none;
    }

    .route-buttons {
        gap: 8px;
    }

    .route-btn {
        grid-template-columns: 36px minmax(0, 1fr) auto 14px;
        gap: 8px;
        min-height: 51px;
        padding-inline: 9px;
    }

    .route-icon {
        width: 36px;
        height: 36px;
    }

    .security-note {
        min-height: 30px;
        margin-top: 12px;
        padding: 7px 8px;
        font-size: 9px;
    }
}
