:root {
    --bg: #0b0f14;
    --panel: rgba(255, 255, 255, 0.04);
    --text: #e6edf3;
    --muted: rgba(230, 237, 243, 0.6);
    --border: rgba(255, 255, 255, 0.12);
    --accent: #3ddc97;
    --accent-2: #2ea3ff;
    --danger: #ff6b6b;
    --warning: #ffb454;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 50% -200px, rgba(61, 220, 151, 0.25), transparent 60%),
        radial-gradient(900px 420px at 110% 10%, rgba(46, 163, 255, 0.2), transparent 60%),
        var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    width: 92%;
    max-width: 520px;
    background: var(--panel);
    padding: 36px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
    backdrop-filter: blur(12px);
    animation: fadeUp 0.45s ease-out;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.loading-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='40' stroke='%233ddc97' stroke-width='8' fill='none' stroke-dasharray='63 188' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='360 50 50' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.safe-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='%233ddc97'/%3E%3Cpath d='M30 50 L45 65 L70 35' stroke='white' stroke-width='8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    display: none;
    box-shadow: 0 8px 22px rgba(61, 220, 151, 0.25);
}

.safe-text {
    font-size: 20px;
    font-weight: 800;
    margin: 10px 0 6px;
    color: var(--text);
}

.safe-subtext {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
    line-height: 1.6;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
    margin: 18px 0 22px;
}

.progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.5s ease;
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(61, 220, 151, 0.3);
}

.route-buttons {
    margin-top: 8px;
}

.route-btn {
    display: block;
    width: 100%;
    padding: 14px 16px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.route-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.route-btn.fastest {
    background: rgba(61, 220, 151, 0.12);
    border-color: rgba(61, 220, 151, 0.45);
    color: #b9ffe2;
    box-shadow: 0 6px 18px rgba(61, 220, 151, 0.18);
}

.route-btn.fast {
    background: rgba(46, 163, 255, 0.12);
    border-color: rgba(46, 163, 255, 0.45);
    color: #cde6ff;
}

.route-btn.normal {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.route-btn.timeout {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.45);
    color: #ffd3d3;
}

/* 语言切换器 */
.language-switcher {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
}

.lang-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    outline: none;
    backdrop-filter: blur(10px);
}

.lang-toggle-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

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

.globe-icon {
    width: 18px;
    height: 18px;
    color: var(--text);
    animation: rotate-globe 18s linear infinite;
}

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

.lang-toggle-btn:hover .globe-icon {
    animation-duration: 3s;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    background: #10161e;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px) scale(0.98);
    transition: all 0.25s ease;
}

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

.lang-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: #10161e;
    transform: rotate(45deg);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.lang-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.lang-option .flag {
    font-size: 18px;
    display: flex;
    align-items: center;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 20px;
}

.lang-option.active {
    background: rgba(61, 220, 151, 0.14);
    color: #b9ffe2;
}

.lang-option.active::after {
    content: '✓';
    position: absolute;
    right: 14px;
    font-weight: bold;
}

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

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

html[dir="rtl"] .language-switcher {
    right: auto;
    left: 18px;
}

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

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

html[dir="rtl"] .route-btn {
    text-align: center;
}

html[dir="rtl"] .container {
    direction: rtl;
}

/* 阿拉伯语字体优化 */
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: 768px) {
    .container {
        width: 94%;
        padding: 30px 22px;
    }

    .safe-text {
        font-size: 18px;
    }

    .route-btn {
        font-size: 13px;
        padding: 12px 14px;
    }

    .language-switcher {
        top: 12px;
        right: 12px;
    }

    .lang-toggle-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 8px;
    }

    .globe-icon {
        width: 16px;
        height: 16px;
    }

    .lang-dropdown-menu {
        min-width: 150px;
    }

    .lang-option {
        padding: 10px 12px;
        font-size: 12px;
    }

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

    html[dir="rtl"] .language-switcher {
        right: auto;
        left: 12px;
    }
}
