:root {
    --screen-bg: #07111f;
    --screen-panel: rgba(8, 24, 44, 0.82);
    --screen-panel-strong: rgba(10, 30, 55, 0.94);
    --screen-line: rgba(105, 190, 255, 0.24);
    --screen-line-strong: rgba(105, 190, 255, 0.42);
    --screen-text: #e8f5ff;
    --screen-muted: #8fb7d6;
    --screen-accent: #42d7ff;
    --screen-accent-2: #1c7dff;
    --screen-warning: #ff8358;
    --screen-success: #63f4c7;
    --screen-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    color: var(--screen-text);
    background:
        radial-gradient(circle at 15% 18%, rgba(42, 119, 255, 0.24), transparent 28%),
        radial-gradient(circle at 80% 20%, rgba(52, 209, 255, 0.18), transparent 26%),
        radial-gradient(circle at 48% 74%, rgba(10, 80, 140, 0.22), transparent 34%),
        linear-gradient(180deg, #08101d 0%, #040a12 100%);
    overflow: hidden;
}

body {
    font-family: "DIN Alternate", "Bahnschrift", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background-image:
        linear-gradient(rgba(89, 170, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(89, 170, 255, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 85%);
}

body::after {
    background: linear-gradient(180deg, rgba(82, 172, 255, 0.12), transparent 16%, transparent 84%, rgba(82, 172, 255, 0.08));
}

a {
    color: inherit;
    text-decoration: none;
}

.screen-app {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

.screen-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px 18px;
}

.screen-header {
    display: grid;
    grid-template-columns: minmax(340px, 1.3fr) minmax(360px, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 86px;
    padding: 12px 16px;
    border: 1px solid var(--screen-line);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(9, 26, 47, 0.92), rgba(5, 15, 28, 0.82));
    box-shadow: var(--screen-shadow);
}

.screen-header__eyebrow {
    font-size: 13px;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: #66deff;
}

.screen-header__title {
    margin: 6px 0 8px;
    font-size: 32px;
    line-height: 1;
    letter-spacing: 0.06em;
}

.screen-header__subline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--screen-muted);
    font-size: 13px;
}

.screen-header__subline span {
    position: relative;
    padding-left: 12px;
}

.screen-header__subline span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--screen-accent);
    box-shadow: 0 0 12px rgba(66, 215, 255, 0.75);
}

.screen-header__center {
    display: flex;
    justify-content: center;
    gap: 14px;
}

.screen-chip {
    min-width: 180px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(90, 172, 255, 0.2);
    background: linear-gradient(180deg, rgba(13, 38, 69, 0.82), rgba(7, 20, 36, 0.72));
}

.screen-chip__label {
    display: block;
    font-size: 12px;
    color: var(--screen-muted);
}

.screen-chip__value {
    display: block;
    margin-top: 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.screen-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.screen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid rgba(103, 190, 255, 0.28);
    background: linear-gradient(180deg, rgba(10, 31, 55, 0.85), rgba(7, 18, 33, 0.85));
    color: var(--screen-text);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.screen-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(103, 190, 255, 0.58);
    box-shadow: 0 10px 26px rgba(10, 94, 165, 0.24);
}

.screen-btn--primary {
    background: linear-gradient(135deg, rgba(47, 102, 255, 0.9), rgba(72, 226, 255, 0.86));
    color: #04111f;
    font-weight: 700;
}

.screen-btn--fullscreen {
    position: relative;
    min-width: 108px;
    overflow: hidden;
}

.screen-btn--fullscreen.is-emphasis {
    border-color: rgba(128, 233, 255, 0.72);
    box-shadow:
        0 0 0 1px rgba(126, 232, 255, 0.18),
        0 0 18px rgba(72, 226, 255, 0.34),
        0 10px 28px rgba(24, 116, 255, 0.34);
    animation: fullscreen-btn-breathe 2.2s ease-in-out infinite;
}

.screen-btn--fullscreen.is-emphasis::before {
    content: "";
    position: absolute;
    inset: -1px;
    background: linear-gradient(120deg, transparent 18%, rgba(255, 255, 255, 0.42) 46%, transparent 72%);
    transform: translateX(-140%);
    animation: fullscreen-btn-sheen 3.2s ease-in-out infinite;
    pointer-events: none;
}

.screen-btn--fullscreen.is-emphasis:hover {
    box-shadow:
        0 0 0 1px rgba(126, 232, 255, 0.24),
        0 0 24px rgba(72, 226, 255, 0.44),
        0 14px 34px rgba(24, 116, 255, 0.42);
}

.screen-btn--fullscreen > span,
.screen-btn--fullscreen {
    position: relative;
    z-index: 1;
}

@keyframes fullscreen-btn-breathe {
    0%,
    100% {
        transform: translateY(0);
        box-shadow:
            0 0 0 1px rgba(126, 232, 255, 0.18),
            0 0 18px rgba(72, 226, 255, 0.34),
            0 10px 28px rgba(24, 116, 255, 0.34);
    }
    50% {
        transform: translateY(-1px);
        box-shadow:
            0 0 0 1px rgba(126, 232, 255, 0.26),
            0 0 26px rgba(72, 226, 255, 0.46),
            0 14px 34px rgba(24, 116, 255, 0.42);
    }
}

@keyframes fullscreen-btn-sheen {
    0%,
    55% {
        transform: translateX(-140%);
    }
    80%,
    100% {
        transform: translateX(140%);
    }
}

.screen-btn--link {
    background: transparent;
}

.screen-main {
    display: grid;
    grid-template-columns: minmax(310px, 22%) minmax(620px, 1fr) minmax(310px, 24%);
    grid-template-rows: minmax(228px, 0.92fr) minmax(212px, 0.8fr) minmax(246px, 0.98fr);
    grid-template-areas:
        "overview map trend"
        "top-countries map ranking"
        "status reports detail";
    flex: 1;
    min-height: 0;
    gap: 14px;
}


.screen-column {
    min-height: 0;
    display: contents;
}

.screen-panel {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--screen-line);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(10, 29, 53, 0.9), rgba(5, 16, 29, 0.88)),
        linear-gradient(90deg, rgba(66, 215, 255, 0.08), transparent 35%);
    box-shadow: var(--screen-shadow);
}

.screen-panel--overview {
    grid-area: overview;
}

.screen-panel--top-countries {
    grid-area: top-countries;
}

.screen-panel--status {
    grid-area: status;
}

.screen-panel--map {
    grid-area: map;
}

.screen-split-group--reports {
    grid-area: reports;
    min-height: 0;
    display: flex;
    gap: 12px;
}

.screen-panel--reports {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}

.screen-panel--name-ranking {
    flex: 0 0 34%;
    display: flex;
    flex-direction: column;
}

.screen-panel--trend {
    grid-area: trend;
}

.screen-panel--ranking {
    grid-area: ranking;
    display: flex;
    flex-direction: column;
}

.screen-panel--detail {
    grid-area: detail;
}

.screen-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 20px;
    border: 1px solid rgba(94, 203, 255, 0.08);
}

.screen-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px 10px;
}

.screen-panel__title {
    position: relative;
    padding-left: 14px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.screen-panel__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 18px;
    border-radius: 99px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #59efff, #1b7cff);
    box-shadow: 0 0 12px rgba(66, 215, 255, 0.55);
}

.screen-panel__meta {
    font-size: 12px;
    color: var(--screen-muted);
    white-space: nowrap;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 4px 16px 16px;
}

.screen-panel--overview .overview-grid {
    height: calc(100% - 54px);
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.overview-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(101, 176, 255, 0.18);
    background:
        linear-gradient(160deg, rgba(13, 40, 73, 0.92), rgba(8, 22, 40, 0.82)),
        radial-gradient(circle at 100% 0, rgba(74, 196, 255, 0.16), transparent 38%);
}

.overview-card--fault {
    background:
        linear-gradient(160deg, rgba(64, 24, 27, 0.92), rgba(32, 12, 15, 0.82)),
        radial-gradient(circle at 100% 0, rgba(255, 119, 88, 0.22), transparent 38%);
}

.overview-card__label {
    color: var(--screen-muted);
    font-size: 13px;
}

.overview-card__value {
    margin-top: 6px;
    font-size: 30px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.overview-card__value a {
    color: inherit;
}

.overview-card__sub {
    margin-top: 6px;
    font-size: 12px;
    color: #b6d4ec;
}

.chart-box {
    width: 100%;
    min-height: 0;
}

.chart-box--medium {
    height: calc(100% - 54px);
    min-height: 190px;
}

.chart-box--map {
    height: 100%;
}

.screen-panel--map {
    padding-bottom: 14px;
}

.map-stage {
    position: relative;
    height: calc(100% - 56px);
    min-height: 330px;
    padding: 0 10px 10px;
}

.map-legend {
    position: absolute;
    right: 26px;
    bottom: 22px;
    display: flex;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(5, 18, 35, 0.76);
    border: 1px solid rgba(95, 183, 255, 0.18);
    color: var(--screen-muted);
    font-size: 12px;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.map-legend__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.map-legend__dot--low {
    background: #1163ff;
}

.map-legend__dot--mid {
    background: #17b8ff;
}

.map-legend__dot--high {
    background: #7dffec;
}

.table-shell {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.screen-table-head {
    flex-shrink: 0;
}

.screen-table-body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen-table thead th {
    height: 44px;
    padding: 0 12px;
    background: rgba(24, 93, 176, 0.48);
    color: #dff6ff;
    font-size: 13px;
    text-align: left;
    font-weight: 600;
}

.screen-table tbody td {
    height: 46px;
    padding: 0 12px;
    border-bottom: 1px solid rgba(104, 188, 255, 0.1);
    color: #d2ecff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.screen-table tbody tr:nth-child(odd) td {
    background: rgba(10, 30, 55, 0.26);
}

.screen-table tbody tr:hover td {
    background: rgba(27, 102, 190, 0.22);
}

.screen-table__empty {
    text-align: center;
    color: var(--screen-muted);
}

.country-ranking-list,
.country-device-list,
.device-name-ranking-list {
    flex: 1;
    min-height: 0;
    padding: 0 14px 12px;
    overflow: auto;
}

.country-row {
    position: relative;
    display: block;
    padding: 14px 14px 12px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(100, 183, 255, 0.14);
    background: linear-gradient(160deg, rgba(11, 33, 59, 0.82), rgba(7, 19, 34, 0.8));
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.country-row:hover,
.country-row.is-active {
    transform: translateY(-1px);
    border-color: rgba(105, 190, 255, 0.44);
    background: linear-gradient(160deg, rgba(18, 51, 91, 0.9), rgba(8, 24, 44, 0.86));
}

.country-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.country-row__name {
    font-size: 15px;
    font-weight: 700;
}

.country-row__count {
    font-size: 20px;
    font-weight: 700;
    color: #7fecff;
}

.country-row__meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--screen-muted);
    font-size: 12px;
}

.country-row__bar {
    position: relative;
    height: 7px;
    margin-top: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.country-row__bar span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #186fff, #56e7ff);
}

.name-row {
    padding: 12px 12px 10px;
    margin-bottom: 10px;
    border-radius: 14px;
    border: 1px solid rgba(100, 183, 255, 0.14);
    background: linear-gradient(160deg, rgba(11, 33, 59, 0.72), rgba(7, 19, 34, 0.74));
}

.name-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.name-row__name {
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #eff9ff;
}

.name-row__count {
    flex: 0 0 auto;
    font-size: 18px;
    font-weight: 700;
    color: #7fecff;
}

.name-row__bar {
    position: relative;
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.name-row__bar span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #63f4c7, #42d7ff);
}

.device-card {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(100, 183, 255, 0.14);
    background: linear-gradient(160deg, rgba(11, 33, 59, 0.8), rgba(7, 19, 34, 0.8));
}

.device-card__name {
    font-size: 15px;
    font-weight: 700;
    color: #eff9ff;
}

.device-card__mac {
    margin-top: 10px;
    color: #7cc8ff;
    font-size: 13px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.screen-loading {
    position: fixed;
    inset: 0;
    z-index: 9;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 8, 15, 0.72);
    backdrop-filter: blur(8px);
}

.screen-loading.is-active {
    display: flex;
}

.screen-loading__box {
    min-width: 320px;
    padding: 24px 28px;
    border-radius: 18px;
    border: 1px solid rgba(104, 188, 255, 0.18);
    background: linear-gradient(180deg, rgba(10, 29, 53, 0.96), rgba(5, 16, 29, 0.96));
    box-shadow: var(--screen-shadow);
    text-align: center;
}

.screen-loading__title {
    font-size: 20px;
    font-weight: 700;
}

.screen-loading__desc {
    margin-top: 8px;
    font-size: 13px;
    color: var(--screen-muted);
}

.screen-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--screen-muted);
    font-size: 14px;
}

@media (max-width: 1680px) {
    .screen-header__title {
        font-size: 28px;
    }

    .screen-main {
        grid-template-columns: minmax(280px, 21%) minmax(560px, 1fr) minmax(280px, 24%);
        grid-template-rows: minmax(220px, 0.9fr) minmax(204px, 0.78fr) minmax(236px, 0.96fr);
    }
}

@media (max-width: 1366px) {
    html,
    body {
        overflow: auto;
    }

    .screen-shell {
        height: auto;
        min-height: 100vh;
        gap: 12px;
    }

    .screen-header {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .screen-header__center,
    .screen-header__actions {
        justify-content: flex-start;
    }

    .screen-main {
        height: auto;
        grid-template-columns: 1fr;
        grid-template-rows: none;
        grid-template-areas: none;
    }

    .screen-column {
        display: grid;
        gap: 12px;
    }

    .screen-panel,
    .screen-panel--map {
        min-height: 320px;
    }

    .screen-split-group--reports {
        flex-direction: column;
    }

    .screen-panel--name-ranking {
        flex-basis: auto;
    }
}

@media (max-height: 860px) {
    .screen-shell {
        gap: 10px;
        padding: 12px 16px 14px;
    }

    .screen-header {
        gap: 14px;
        min-height: 74px;
        padding: 10px 14px;
    }

    .screen-header__title {
        margin: 4px 0 6px;
        font-size: 28px;
    }

    .screen-header__subline {
        gap: 10px;
        font-size: 12px;
    }

    .screen-chip {
        min-width: 164px;
        padding: 10px 12px;
    }

    .screen-chip__value {
        margin-top: 4px;
        font-size: 16px;
    }

    .screen-btn {
        min-width: 84px;
        height: 38px;
        padding: 0 16px;
    }

    .screen-main {
        gap: 10px;
        grid-template-rows: minmax(252px, 1fr) minmax(168px, 0.72fr) minmax(206px, 0.84fr);
    }

    .screen-panel__header {
        padding: 12px 14px 8px;
    }

    .screen-panel__title {
        font-size: 17px;
    }

    .screen-panel__meta {
        font-size: 11px;
    }

    .overview-grid {
        gap: 10px;
        padding: 2px 14px 14px;
    }

    .screen-panel--overview .overview-grid {
        height: calc(100% - 48px);
    }

    .overview-card {
        padding: 12px;
    }

    .overview-card__label {
        font-size: 12px;
    }

    .overview-card__value {
        font-size: 26px;
    }

    .overview-card__sub {
        font-size: 11px;
        line-height: 1.25;
    }

    .chart-box--medium {
        height: calc(100% - 48px);
        min-height: 0;
    }

    .map-stage {
        height: calc(100% - 50px);
        min-height: 0;
        padding: 0 8px 8px;
    }

    .table-shell {
        flex: 1;
        min-height: 0;
        padding: 0;
    }

    .screen-split-group--reports {
        gap: 10px;
    }

    .screen-table thead th {
        height: 40px;
        font-size: 12px;
    }

    .screen-table tbody td {
        height: 40px;
        font-size: 12px;
    }

    .country-ranking-list,
    .country-device-list,
    .device-name-ranking-list {
        padding: 0 12px 12px;
    }

    .country-row {
        padding: 12px 12px 10px;
        margin-bottom: 10px;
    }

    .country-row__name {
        font-size: 14px;
    }

    .country-row__count {
        font-size: 18px;
    }

    .device-card {
        padding: 12px;
        margin-bottom: 10px;
    }

    .name-row {
        padding: 10px 10px 9px;
        margin-bottom: 8px;
    }

    .name-row__name {
        font-size: 13px;
        line-height: 1.3;
    }

    .name-row__count {
        font-size: 16px;
    }
}

@media (max-height: 760px) {
    .screen-main {
        grid-template-rows: minmax(236px, 1fr) minmax(156px, 0.68fr) minmax(194px, 0.8fr);
    }

    .screen-header__title {
        font-size: 26px;
    }

    .overview-card {
        padding: 10px 12px;
    }

    .overview-card__value {
        font-size: 24px;
    }

    .overview-card__sub {
        margin-top: 4px;
    }
}
