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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
    background: #f0eef8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.phone-wrap {
    width: 100%;
    max-width: 100%;
    background: #f0eef8;
    min-height: 100vh;
    padding-bottom: 80px;
}

@media (min-width: 600px) {
    body {
        background: #e6e2f5;
    }

    .phone-wrap {
        max-width: 780px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .header {
        border-radius: 0 0 18px 18px;
    }

    .backup-routes {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .backup-row {
        border-bottom: 1px solid #f3f0fb !important;
        border-right: 1px solid #f3f0fb;
    }

    .backup-row:nth-child(odd):last-child {
        grid-column: span 2;
    }

    .contact-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .phone-wrap {
        max-width: 1100px;
    }

    .content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 20px;
        align-items: start;
    }

    .section-label {
        grid-column: span 2;
    }

    .main-route {
        grid-column: span 2;
    }

    .backup-section {
        grid-column: span 1;
    }

    .right-col {
        grid-column: span 1;
        display: flex;
        flex-direction: column;
        gap: 0;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, #3d1a6e 0%, #6b3fa0 50%, #4a2080 100%);
    padding: 18px 16px 22px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.header::after {
    content: '';
    position: absolute;
    right: 30px;
    bottom: -40px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.official-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
}

.official-badge svg {
    width: 14px;
    height: 14px;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 72px;
    height: 72px;
    /*background: linear-gradient(135deg, #2a0d5e, #5c2d91);*/
    border-radius: 50%;
    /*border: 3px solid #d4a843;*/
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    /*color: #f5c842;*/
    position: relative;
    flex-shrink: 0;
    /*box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.3);*/
    letter-spacing: -1px;
}

.logo-crown {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
}

.header-text h1 {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    line-height: 1.1;
}

.header-text h1 span {
    color: #f5c842;
}

.header-text p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.header-text p em {
    font-style: normal;
    margin: 0 6px;
    opacity: 0.5;
}

/* Notice bar */
.notice-bar {
    background: rgba(245, 200, 66, 0.15);
    border: 1px solid rgba(245, 200, 66, 0.4);
    border-radius: 20px;
    margin: 12px 16px 0;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f5c842;
    font-size: 13px;
}

.notice-bar .star {
    font-size: 14px;
}

/* Content */
.content {
    padding: 14px 12px;
}

/* Section label */
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #3d1a6e;
    margin-bottom: 10px;
}

.section-label svg {
    width: 16px;
    height: 16px;
    color: #7c4bc0;
}

/* Main route card */
.main-route {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    position: relative;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.08);
    overflow: hidden;
}

.main-route-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f5a623, #e8820c);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 4px 5px 0 0;
}

.main-route-badge svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.main-route-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.route-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #5c2d91, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.route-icon svg {
    width: 26px;
    height: 26px;
    color: #fff;
}

.route-info {
    flex: 1;
}

.route-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.route-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.tag.ok {
    background: #e6f9f0;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.tag.slow {
    background: #fff7ed;
    color: #ea8c1a;
    border: 1px solid #fed7aa;
}

.tag.checking {
    background: #eff6ff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

.tag.down {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.tag .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.tag.ms {
    background: #f3f0ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.btn-enter {
    background: linear-gradient(135deg, #5c2d91, #7c4bc0);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 14px rgba(92, 45, 145, 0.35);
    letter-spacing: 0.5px;
}

.btn-enter:active {
    transform: scale(0.97);
}

/* Backup routes */
.backup-routes {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.08);
}

.backup-row {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    gap: 12px;
    border-bottom: 1px solid #f3f0fb;
    transition: background 0.15s;
}

.backup-row:last-child {
    border-bottom: none;
}

.backup-row:active {
    background: #faf8ff;
}

.route-icon-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #7c4bc0, #a78bfa);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.route-icon-sm svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.backup-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    min-width: 52px;
}

.backup-status {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.backup-ms {
    font-size: 13px;
    color: #888;
    min-width: 40px;
    text-align: right;
}

.btn-visit {
    border: 1.5px solid #7c4bc0;
    color: #7c4bc0;
    background: transparent;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.btn-visit:hover {
    background: #7c4bc0;
    color: #fff;
}

.btn-wait {
    border: 1.5px solid #d1d5db;
    color: #9ca3af;
    background: transparent;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    white-space: nowrap;
}

.btn-switch {
    border: 1.5px solid #7c4bc0;
    color: #7c4bc0;
    background: #f5f0ff;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Info card */
.info-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.08);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-text {
    flex: 1;
}

.info-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.info-title svg {
    width: 16px;
    height: 16px;
    color: #3b82f6;
}

.info-list {
    list-style: none;
}

.info-list li {
    font-size: 13px;
    color: #555;
    padding: 3px 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.info-list li::before {
    content: '•';
    color: #7c4bc0;
    font-size: 16px;
    line-height: 1;
}

.info-list a {
    color: #7c4bc0;
    font-weight: 600;
    text-decoration: none;
}

.shield-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shield-icon svg {
    width: 32px;
    height: 32px;
    color: #7c4bc0;
}

/* Contact card */
.contact-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.08);
}

.contact-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.contact-title svg {
    width: 18px;
    height: 18px;
    color: #7c4bc0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #faf8ff;
    border-radius: 10px;
    border: 1px solid #ede9fe;
}

.contact-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.contact-ico.qq {
    background: #e8f4fd;
}

.contact-ico.wx {
    background: #e6f9ee;
}

.contact-ico.ww {
    background: #fff3e0;
}

.contact-ico.tg {
    background: #e8f0fe;
}

.contact-info {
    font-size: 12px;
}

.contact-info .label {
    color: #888;
    margin-bottom: 1px;
}

.contact-info .val {
    color: #1a1a2e;
    font-weight: 600;
    font-size: 13px;
}

/* Footer nav */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #ede9fe;
    display: flex;
    padding: 10px 0 16px;
    justify-content: center;
}

.footer-nav-inner {
    display: flex;
    width: 100%;
    max-width: 420px;
}

@media (min-width: 600px) {
    .footer-nav-inner {
        max-width: 780px;
    }
}

@media (min-width: 1024px) {
    .footer-nav-inner {
        max-width: 1100px;
    }
}

.footer-nav-inner {
    display: flex;
    width: 100%;
}

.footer-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #7c4bc0;
    font-weight: 500;
    border-right: 1px solid #ede9fe;
    cursor: pointer;
}

.footer-nav-item:last-child {
    border-right: none;
}

.footer-nav-item svg {
    width: 18px;
    height: 18px;
}

.row-hidden {
    display: none;
}

.more-routes-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px;
    background: #fff;
    border-radius: 0 0 14px 14px;
    border-top: 1px solid #f3f0fb;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #7c4bc0;
    margin-top: -14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.08);
    transition: background 0.15s;
}

.more-routes-btn:hover {
    background: #faf8ff;
}

.more-routes-btn svg {
    transition: transform 0.25s;
    flex-shrink: 0;
}

/* Status badge extra styles */
.status-badge.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ms-normal {
    color: #16a34a;
}

.ms-slow {
    color: #ea8c1a;
}

.ms-error {
    color: #dc2626;
}

.ms-checking {
    color: #9ca3af;
}

#stats-container {
    display: none;
}

#stats-container.visible {
    display: block;
}

#last-checked-time {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.stats-row {
    display: flex;
    gap: 16px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #3d1a6e;
}

.stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.icon-check {
    color: #16a34a;
    margin-right: 4px;
}

.icon-times {
    color: #dc2626;
    margin-right: 4px;
}

.icon-clock {
    color: #7c4bc0;
    margin-right: 4px;
}

/* Checking animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.tag.checking {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Ping animation for ok dot */
@keyframes ping {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.ping-wrap {
    position: relative;
    width: 6px;
    height: 6px;
    display: inline-flex;
}

.ping-wrap .ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #16a34a;
    animation: ping 1.2s ease-in-out infinite;
    opacity: 0.6;
}

.ping-wrap .dot-inner {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
}