/* Строгая блокировка горизонтального расползания во время замера на реальных смартфонах */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

.layout-wrapper,
.layout-content,
.layout-content > .card {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.st-hero-stage {
    overflow: hidden;
    max-width: 100%;
}

/* ==========================================================================
   XIP.SU SPEEDTEST MODULE — SYMMETRIC ZERO-SHIFT DASHBOARD
   ========================================================================== */
html {
    scrollbar-gutter: stable;
}

.st-hero-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 6px 0 12px;
    margin-bottom: 6px;
}

/* Круглая кнопка строго по геометрическому центру карточки */
.st-orb-wrap {
    position: relative;
    width: 132px;
    height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-orb-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.st-orb-track {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
    opacity: 0.45;
}

.st-orb-prog {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    transition: stroke-dashoffset 0.2s linear;
    filter: drop-shadow(0 0 6px var(--accent-color));
}

.st-orb-btn {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.94em;
    letter-spacing: 0.07em;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.14);
    padding: 0;
    margin: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .st-orb-btn:hover {
        background: var(--accent-color);
        color: var(--bg-color);
        box-shadow: 0 0 24px var(--accent-color);
    }
}

.st-orb-btn.is-running {
    animation: stOrbPulse 1.6s ease-in-out infinite;
}

@keyframes stOrbPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.2); }
    50%      { box-shadow: 0 0 24px var(--accent-color); }
}

/* Док иконок справа на абсолютном позиционировании — НЕ смещает круглую кнопку от центра! */
.st-mode-dock {
    position: absolute;
    left: calc(50% + 84px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.st-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    opacity: 0.65;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    outline: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.st-icon-btn.active {
    opacity: 1;
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.28);
}

/* Тултип ТОЛЬКО для настоящей мыши на ПК (всплывает аккуратно СВЕРХУ, не перекрывая кнопку и не расширяя сайт вправо!) */
@media (hover: hover) and (pointer: fine) {
    .st-icon-btn:hover {
        opacity: 1;
        border-color: var(--accent-color);
        color: var(--accent-color);
    }
    .st-icon-btn.active:hover {
        color: var(--bg-color);
    }
    .st-icon-btn::after {
        content: attr(data-tip);
        position: absolute;
        bottom: calc(100% + 8px);
        right: 0;
        background: var(--card-bg);
        color: var(--accent-color);
        border: 1px solid var(--accent-color);
        padding: 4px 9px;
        border-radius: 4px;
        font-size: 11.5px;
        font-weight: bold;
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.14s ease;
        z-index: 35;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
    }
    .st-icon-btn:hover::after {
        opacity: 1;
        visibility: visible;
    }
}

/* Строка статуса фиксированной высоты (не прыгает при смене текста) */
.st-status-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 20px;
    font-size: 0.8em;
    opacity: 0.88;
    margin-bottom: 10px;
    font-family: monospace;
    overflow: hidden;
}

#st-status-text {
    flex: 1 1 0%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#st-pct-label {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Показатели в одну ровную линию */
.st-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.st-metric-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 9px 6px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.st-metric-card.active-phase {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.st-metric-title {
    font-size: 0.7em;
    font-weight: 700;
    opacity: 0.7;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.st-metric-num {
    font-size: 1.55em;
    font-weight: 800;
    line-height: 1.1;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.st-metric-unit {
    font-size: 0.7em;
    opacity: 0.6;
    margin-top: 2px;
}

/* График скорости */
.st-chart-box {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 12px;
    height: 116px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.st-chart-canvas {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px) !important;
    height: calc(100% - 16px) !important;
    max-width: 100%;
    display: block;
}

/* Компактная плашка серверов и клиента под графиком */
.st-footer-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 12px;
    padding: 10px 12px;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.84em;
}

.st-info-cell {
    min-width: 0;
}

.st-info-lbl {
    display: block;
    font-size: 0.72em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 2px;
}

.st-info-val {
    display: block;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-info-val.accent {
    color: var(--accent-color);
}

.st-multi-box { margin-bottom: 12px; display: none; }
.st-multi-box.show { display: block; }
.st-badge-ok   { color: #10b981; font-weight: 700; }
.st-badge-warn { color: #f59e0b; font-weight: 700; }
.st-badge-bad  { color: #ef4444; font-weight: 700; }

/* Мобильная адаптация без единого наложения и скролла */
@media (max-width: 680px) {
    .page-desc.st-desc-compact {
        font-size: 0.8em;
        margin-bottom: 6px;
        line-height: 1.35;
    }
    .st-hero-stage {
        min-height: 118px;
        padding: 2px 0 8px;
    }
    .st-orb-wrap {
        width: 112px;
        height: 112px;
    }
    .st-orb-btn {
        width: 90px;
        height: 90px;
        font-size: 0.84em;
    }
    .st-mode-dock {
        left: calc(50% + 70px);
        gap: 8px;
    }
    .st-icon-btn {
        width: 36px;
        height: 36px;
    }
    .st-metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    .st-metric-card {
        padding: 7px 3px;
    }
    .st-metric-title { font-size: 0.6em; }
    .st-metric-num   { font-size: 1.15em; }
    .st-metric-unit  { font-size: 0.6em; }
    .st-chart-box {
        height: 88px;
        padding: 6px;
        margin-bottom: 10px;
    }
    .st-footer-info {
        grid-template-columns: repeat(2, 1fr);
        padding: 8px 10px;
        gap: 6px 10px;
        font-size: 0.76em;
    }
    .custom-details > summary.st-log-sum {
        font-size: 0.82em;
        padding: 9px 12px;
    }
}
/* Блокируем внутренний горизонтальный скролл .card (из base.css:25) во время пульсации фаз */
.layout-content > .card {
    overflow-x: hidden !important;
}
.st-metrics-grid > .st-metric-card {
    min-width: 0 !important;
    overflow: hidden;
}
