:root {
    --monitor-bg: #070b16;
    --monitor-panel: rgba(11, 17, 33, .92);
    --monitor-panel-soft: rgba(14, 23, 43, .82);
    --monitor-line: rgba(61, 149, 211, .3);
    --monitor-line-soft: rgba(72, 112, 157, .19);
    --monitor-blue: #45c5f5;
    --monitor-cyan: #19e6c5;
    --monitor-green: #20e6a4;
    --monitor-red: #ff5c70;
    --monitor-amber: #ffab3d;
    --monitor-text: #e7f3ff;
    --monitor-muted: #7e91ac;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--monitor-bg); touch-action: manipulation; }
body, button { font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.monitor-screen {
    width: 100vw;
    min-width: 320px;
    height: 100vh;
    min-height: 640px;
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 52%, rgba(25, 105, 151, .08), transparent 34%),
        linear-gradient(180deg, #080c18 0%, #070b16 100%);
    color: var(--monitor-text);
}

.monitor-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(53, 115, 156, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(53, 115, 156, .025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.monitor-grid::before,
.monitor-grid::after {
    content: "";
    position: absolute;
    width: 72vw;
    height: 1px;
    left: -20vw;
    top: 25%;
    opacity: .35;
    background: linear-gradient(90deg, transparent, rgba(25, 230, 197, .65), transparent);
    transform: rotate(24deg);
    animation: monitor-scan 8s linear infinite;
}

.monitor-grid::after {
    top: 66%;
    left: auto;
    right: -22vw;
    background: linear-gradient(90deg, transparent, rgba(69, 197, 245, .5), transparent);
    transform: rotate(-22deg);
    animation-delay: -4s;
}

@keyframes monitor-scan {
    0% { opacity: 0; translate: -8% -20px; }
    20%, 70% { opacity: .4; }
    100% { opacity: 0; translate: 16% 20px; }
}

.monitor-map-layer { position: fixed; inset: 0; z-index: 1; }
.monitor-map { width: 100%; height: 100%; opacity: 0; transition: opacity .7s ease; }
.monitor-map.is-ready { opacity: 1; }

.map-loading {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #7691ad;
    font-size: 12px;
    transform: translate(-50%, -50%);
    transition: opacity .3s ease, visibility .3s ease;
}
.map-loading.is-hidden { opacity: 0; visibility: hidden; }
.map-loading[hidden] { display: none; }
.map-loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(69, 197, 245, .18);
    border-top-color: var(--monitor-blue);
    border-radius: 50%;
    animation: monitor-spin .8s linear infinite;
}
@keyframes monitor-spin { to { transform: rotate(360deg); } }

.map-location-state {
    position: absolute;
    left: 50%;
    bottom: 74px;
    max-width: 360px;
    padding: 5px 12px;
    border: 1px solid rgba(64, 137, 187, .18);
    background: rgba(6, 12, 26, .72);
    color: #66829e;
    font-size: 11px;
    text-align: center;
    transform: translateX(-50%);
}

.monitor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 62px;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto minmax(330px, 1fr);
    align-items: center;
    gap: 22px;
    padding: 0 28px;
    background: linear-gradient(180deg, rgba(7, 11, 22, .98) 0%, rgba(7, 11, 22, .72) 72%, transparent 100%);
}

.monitor-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--monitor-blue);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    text-shadow: 0 0 22px rgba(69, 197, 245, .35);
}
.monitor-brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-brand-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    align-content: center;
    gap: 3px;
    filter: drop-shadow(0 0 8px rgba(69, 197, 245, .35));
}
.monitor-brand-icon i {
    width: 27px;
    height: 6px;
    position: relative;
    display: block;
    border: 1px solid currentColor;
    border-radius: 2px;
    background: rgba(69, 197, 245, .15);
}
.monitor-brand-icon i::after {
    content: "";
    position: absolute;
    top: 1px;
    right: 3px;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: -5px 0 currentColor;
}

.monitor-refresh {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid rgba(69, 197, 245, .28);
    border-radius: 18px;
    background: rgba(15, 32, 55, .8);
    color: #93abc4;
    font-size: 12px;
    cursor: pointer;
}
.monitor-refresh:hover { border-color: rgba(69, 197, 245, .62); color: var(--monitor-text); }
.monitor-refresh:focus-visible,
.monitor-control:focus-visible,
.monitor-home:focus-visible { outline: 2px solid var(--monitor-blue); outline-offset: 2px; }
.monitor-refresh-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--monitor-cyan);
    box-shadow: 0 0 9px var(--monitor-cyan);
    animation: monitor-pulse 1.6s ease-in-out infinite;
}
.monitor-refresh.is-refreshing .monitor-refresh-dot { animation-duration: .5s; }
@keyframes monitor-pulse { 50% { opacity: .35; transform: scale(.75); } }

.monitor-header-meta { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.monitor-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border: 1px solid rgba(32, 230, 164, .26);
    border-radius: 15px;
    background: rgba(32, 230, 164, .08);
    color: var(--monitor-green);
    font-size: 11px;
}
.monitor-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.monitor-status.is-error { border-color: rgba(255, 92, 112, .3); background: rgba(255, 92, 112, .08); color: var(--monitor-red); }
.monitor-clock { color: var(--monitor-blue); font: 12px Consolas, "Courier New", monospace; font-variant-numeric: tabular-nums; }
.monitor-home { color: #7188a2; font-size: 12px; text-decoration: none; }
.monitor-home:hover { color: var(--monitor-blue); }

.monitor-panels { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.monitor-panel {
    width: 280px;
    position: absolute;
    display: flex;
    flex-direction: column;
    padding: 15px 16px 14px;
    border: 1px solid var(--monitor-line);
    border-radius: 7px;
    background: var(--monitor-panel);
    box-shadow: 0 16px 45px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .018);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    transition: opacity .28s ease, transform .28s ease;
}
.monitor-panel::before,
.monitor-panel::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 8px;
    pointer-events: none;
}
.monitor-panel::before { top: -1px; left: -1px; border-top: 1px solid var(--monitor-blue); border-left: 1px solid var(--monitor-blue); }
.monitor-panel::after { right: -1px; bottom: -1px; border-right: 1px solid rgba(25, 230, 197, .65); border-bottom: 1px solid rgba(25, 230, 197, .65); }
.monitor-stats { top: 110px; left: 20px; min-height: 250px; }
.monitor-logs { left: 20px; bottom: 20px; width: 448px; height: 276px; }
.monitor-apis { top: 110px; right: 20px; min-height: 268px; }
.monitor-sources { right: 20px; bottom: 20px; min-height: 292px; }

.monitor-panel-header {
    min-height: 31px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--monitor-line-soft);
}
.monitor-panel-header h2 { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--monitor-blue); font-size: 14px; font-weight: 650; }
.monitor-panel-header > span { padding-top: 2px; color: #536c88; font: 9px Consolas, monospace; }
.panel-signal,
.panel-trophy,
.panel-terminal,
.panel-pin { width: 13px; height: 13px; position: relative; display: inline-block; color: currentColor; }
.panel-signal { border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.panel-signal::after { content: ""; position: absolute; left: 2px; bottom: 3px; width: 9px; height: 6px; border-top: 2px solid currentColor; transform: skewY(-27deg); }
.panel-trophy { border: 2px solid currentColor; border-top-width: 5px; border-radius: 2px 2px 6px 6px; }
.panel-trophy::after { content: ""; position: absolute; left: 4px; bottom: -5px; width: 3px; height: 5px; background: currentColor; box-shadow: -2px 5px currentColor, 2px 5px currentColor; }
.panel-terminal::before { content: ">_"; position: absolute; top: -4px; left: 0; font: 700 14px Consolas, monospace; }
.panel-pin { width: 11px; height: 11px; border: 2px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.panel-pin::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }

.monitor-stat-list { display: grid; }
.monitor-stat-list > div {
    min-height: 31px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(86, 113, 148, .13);
}
.monitor-stat-list > div:last-child { border-bottom: 0; }
.monitor-stat-list span { color: #91a0b5; font-size: 11px; }
.monitor-stat-list strong { color: var(--monitor-blue); font: 700 17px Consolas, "Courier New", monospace; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.monitor-stat-list strong.is-green { color: var(--monitor-green); }
.monitor-stat-list strong.is-red { color: var(--monitor-red); }
.monitor-stat-list strong b { font: inherit; }
.monitor-stat-list strong small { margin-left: 2px; color: #6b819b; font-size: 9px; font-weight: 500; }

.monitor-api-list,
.monitor-source-list { min-height: 0; display: grid; gap: 6px; }
.monitor-api-item { min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-rows: 17px 4px; column-gap: 9px; align-items: center; }
.monitor-rank {
    grid-row: 1 / 3;
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: rgba(82, 107, 142, .22);
    color: #8fa1b8;
    font: 700 10px Consolas, monospace;
}
.monitor-rank.is-first { background: linear-gradient(135deg, #ff9737, #ff5c70); color: #fff; }
.monitor-rank.is-second { background: #6e7f9b; color: #fff; }
.monitor-rank.is-third { background: #bd5b13; color: #fff; }
.monitor-api-name { min-width: 0; overflow: hidden; color: #c9d8e8; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.monitor-api-count { color: var(--monitor-blue); font: 700 11px Consolas, monospace; font-variant-numeric: tabular-nums; }
.monitor-api-track { height: 3px; overflow: hidden; border-radius: 2px; background: rgba(104, 126, 155, .22); }
.monitor-api-track i { height: 100%; display: block; border-radius: 2px; background: linear-gradient(90deg, var(--monitor-cyan), var(--monitor-blue)); transition: width .5s ease; }

.monitor-log-head,
.monitor-log-item { min-width: 0; display: grid; grid-template-columns: 58px 98px minmax(0, 1fr); gap: 9px; align-items: center; }
.monitor-log-head { padding: 0 0 6px; color: #536c88; font: 9px Consolas, monospace; }
.monitor-log-list { min-height: 0; flex: 1; overflow: hidden; }
.monitor-log-item { height: 21px; border-top: 1px solid rgba(86, 113, 148, .09); color: #788da8; font: 9px Consolas, "Microsoft YaHei", monospace; animation: monitor-log-in .25s ease; }
@keyframes monitor-log-in { from { opacity: 0; transform: translateY(-4px); } }
.monitor-log-time { color: #536c88; }
.monitor-log-source,
.monitor-log-api { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-log-source { color: #7893b2; }
.monitor-log-api { color: var(--monitor-cyan); }
.monitor-log-api.is-failure { color: var(--monitor-red); }
.monitor-log-api small { margin-left: 5px; color: #526d89; font-size: 8px; }

.monitor-source-item { min-width: 0; min-height: 41px; display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid rgba(86, 113, 148, .15); }
.monitor-source-item:last-child { border-bottom: 0; }
.monitor-source-copy { min-width: 0; }
.monitor-source-copy strong,
.monitor-source-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-source-copy strong { color: #c9d8e8; font-size: 11px; font-weight: 600; }
.monitor-source-copy small { margin-top: 3px; color: #5f7690; font-size: 9px; }
.monitor-source-copy small.is-located { color: #4e9c92; }
.monitor-source-value { text-align: right; }
.monitor-source-value strong { display: block; color: var(--monitor-blue); font: 700 12px Consolas, monospace; }
.monitor-source-value small { display: block; margin-top: 2px; color: #526983; font-size: 8px; }

.monitor-empty { min-height: 90px; display: grid; place-items: center; color: #5c7189; font-size: 11px; text-align: center; }

.monitor-controls {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 8;
    height: 44px;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid rgba(64, 137, 187, .32);
    border-radius: 23px;
    background: rgba(8, 15, 31, .93);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .28);
    transform: translateX(-50%);
}
.monitor-control {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #7288a0;
    font-size: 11px;
    white-space: nowrap;
}
button.monitor-control { cursor: pointer; }
.monitor-control.active { background: rgba(29, 104, 151, .38); color: var(--monitor-blue); }
.control-pin { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.control-flow { width: 14px; height: 8px; border-top: 1px solid currentColor; border-radius: 50%; transform: rotate(-12deg); }
.control-layer { width: 12px; height: 8px; border: 1px solid currentColor; box-shadow: 2px 2px transparent, 2px 2px 0 -1px var(--monitor-bg), 3px 3px currentColor; transform: skewY(-15deg); }

/* Screen entrance sequence */
.monitor-header { animation: monitor-header-enter .58s cubic-bezier(.22, 1, .36, 1) backwards; }
.monitor-stats,
.monitor-logs { animation: monitor-panel-left-enter .66s cubic-bezier(.22, 1, .36, 1) backwards; }
.monitor-apis,
.monitor-sources { animation: monitor-panel-right-enter .66s cubic-bezier(.22, 1, .36, 1) backwards; }
.monitor-stats { animation-delay: .08s; }
.monitor-apis { animation-delay: .16s; }
.monitor-logs { animation-delay: .24s; }
.monitor-sources { animation-delay: .32s; }
.monitor-controls { animation: monitor-controls-enter .6s .4s cubic-bezier(.22, 1, .36, 1) backwards; }
@keyframes monitor-header-enter { from { opacity: 0; translate: 0 -18px; } }
@keyframes monitor-panel-left-enter { from { opacity: 0; translate: -24px 0; } }
@keyframes monitor-panel-right-enter { from { opacity: 0; translate: 24px 0; } }
@keyframes monitor-controls-enter { from { opacity: 0; translate: 0 18px; } }

.monitor-screen.panels-hidden .monitor-panel { opacity: 0; pointer-events: none; }
.monitor-screen.panels-hidden .monitor-stats,
.monitor-screen.panels-hidden .monitor-logs { transform: translateX(-18px); }
.monitor-screen.panels-hidden .monitor-apis,
.monitor-screen.panels-hidden .monitor-sources { transform: translateX(18px); }

@media (max-width: 1280px) {
    .monitor-header { grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr); padding: 0 20px; }
    .monitor-brand { font-size: 17px; }
    .monitor-panel { width: 250px; }
    .monitor-logs { width: 382px; }
    .monitor-log-head,
    .monitor-log-item { grid-template-columns: 54px 84px minmax(0, 1fr); gap: 7px; }
    .monitor-home { display: none; }
}

@media (max-width: 980px) {
    .monitor-screen { min-height: 720px; }
    .monitor-header { grid-template-columns: minmax(220px, 1fr) auto; }
    .monitor-refresh { display: none; }
    .monitor-header-meta { gap: 10px; }
    .monitor-panel { width: 236px; }
    .monitor-stats, .monitor-apis { top: 88px; }
    .monitor-stats { left: 12px; }
    .monitor-apis { right: 12px; }
    .monitor-logs { left: 12px; bottom: 12px; width: 340px; }
    .monitor-sources { right: 12px; bottom: 12px; }
    .monitor-controls { bottom: 12px; }
    .map-location-state { bottom: 62px; }
}

@media (max-width: 760px) {
    .monitor-screen { width: 100%; height: auto; min-height: 100vh; overflow-x: hidden; overflow-y: auto; }
    .monitor-grid { position: absolute; height: 560px; }
    .monitor-map-layer { position: relative; height: 510px; }
    .monitor-header {
        position: absolute;
        height: auto;
        min-height: 68px;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: 10px 14px;
    }
    .monitor-brand { gap: 9px; font-size: 15px; line-height: 1.35; }
    .monitor-brand > span:last-child { white-space: normal; }
    .monitor-brand-icon { width: 24px; height: 24px; flex-basis: 24px; }
    .monitor-brand-icon i { width: 23px; }
    .monitor-header-meta { display: none; }
    .map-location-state { bottom: 55px; width: calc(100% - 40px); }
    .monitor-panels {
        position: relative;
        inset: auto;
        z-index: 5;
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 10px 78px;
        margin-top: -24px;
    }
    .monitor-panel,
    .monitor-stats,
    .monitor-apis,
    .monitor-logs,
    .monitor-sources {
        width: 100%;
        height: auto;
        min-height: 0;
        position: relative;
        inset: auto;
        padding: 14px;
        border-radius: 6px;
        animation-name: monitor-panel-mobile-enter;
    }
    .monitor-stat-list { grid-template-columns: 1fr 1fr; column-gap: 18px; }
    .monitor-api-list { gap: 8px; }
    .monitor-log-list { max-height: 210px; }
    .monitor-source-list { grid-template-columns: 1fr 1fr; column-gap: 16px; }
    .monitor-controls { position: absolute; top: 450px; bottom: auto; height: 42px; }
    .monitor-control { padding: 0 10px; font-size: 10px; }
    .monitor-screen.panels-hidden .monitor-panel { display: none; }
}

@keyframes monitor-panel-mobile-enter { from { opacity: 0; translate: 0 22px; } }

@media (max-width: 430px) {
    .monitor-map-layer { height: 460px; }
    .monitor-controls { top: 400px; }
    .monitor-header { grid-template-columns: 1fr; }
    .monitor-brand { max-width: 100%; }
    .monitor-source-list { grid-template-columns: 1fr; }
    .monitor-log-head,
    .monitor-log-item { grid-template-columns: 52px 78px minmax(0, 1fr); gap: 6px; }
    .monitor-controls { width: calc(100% - 20px); justify-content: center; }
    .monitor-control { flex: 1; justify-content: center; padding: 0 5px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
