/* ═══════════════════════════════════════════════
   MOBILE TERMINAL — virexel.ru
   Full mobile-first stylesheet
   ═══════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #0d0d0f;
    --bg2:         #111114;
    --bg3:         #16161a;
    --border:      #1e1e24;
    --border-hi:   #2a2a34;
    --text:        #c8c8d4;
    --text-dim:    #5a5a70;
    --accent:      #7c6aff;
    --accent2:     #ff4d6d;
    --accent3:     #00e5ff;
    --green:       #00ff9d;
    --yellow:      #ffcc00;
    --header-h:    44px;
    --footer-h:    48px;
    --quickbar-h:  36px;
    --botnav-h:    56px;
    --radius:      8px;
    --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
    --font-title:  'Unbounded', sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* ── NOISE / SCANLINES ────────────────────────── */
.scanlines {
    pointer-events: none; position: fixed; inset: 0; z-index: 9998;
    background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,.04) 2px, rgba(0,0,0,.04) 4px);
}
.noise {
    pointer-events: none; position: fixed; inset: 0; z-index: 9997; opacity: .018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px;
}

/* ── LAYOUT (vertical stack) ──────────────────── */
body {
    display: flex;
    flex-direction: column;
}

/* ── HEADER ───────────────────────────────────── */
.m-header {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-h); padding: 0 14px;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    flex-shrink: 0; z-index: 50;
}
.m-header-left { display: flex; align-items: center; gap: 2px; }
.m-logo-bracket { color: var(--accent); font-family: var(--font-title); font-size: 13px; font-weight: 900; }
.m-logo-text    { color: var(--text); font-family: var(--font-title); font-size: 13px; font-weight: 900; letter-spacing: 2px; }
.m-header-center{ flex: 1; text-align: center; }
.m-header-title { font-family: var(--font-title); font-size: 9px; letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.m-header-right { text-align: right; }
.m-clock { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

/* ── MAIN CONTENT ─────────────────────────────── */
.m-main {
    flex: 1;
    display: flex; flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* ── TERMINAL BODY ────────────────────────────── */
.terminal-body {
    flex: 1; padding: 10px 12px; overflow-y: auto;
    overflow-x: hidden; scrollbar-width: thin;
    scrollbar-color: var(--border-hi) transparent;
    display: flex; flex-direction: column; gap: 2px;
    -webkit-overflow-scrolling: touch;
}
.terminal-body::-webkit-scrollbar { width: 3px; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }

.ascii-art { display: none; }

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

.out-line  { display: flex; gap: 6px; align-items: baseline; margin-top: 8px; }
.out-prompt{ color: var(--accent3); font-size: 10px; white-space: nowrap; flex-shrink: 0; }
.out-cmd   { color: var(--text); font-weight: 500; word-break: break-all; font-size: 12px; }

.out-response {
    color: var(--text); white-space: pre-wrap; word-break: break-word;
    padding: 5px 0 2px 10px; border-left: 1px solid var(--border);
    font-size: 11.5px; animation: slideIn .2s ease;
    margin-left: 2px; line-height: 1.6;
}
@keyframes slideIn { from{opacity:0;transform:translateX(-4px)} to{opacity:1;transform:translateX(0)} }

.out-response.error   { color: var(--accent2); border-left-color: var(--accent2); }
.out-response.success { color: var(--green);   border-left-color: var(--green); }
.out-response.info    { color: var(--accent3); border-left-color: var(--accent3); }
.out-response.warning { color: var(--yellow);  border-left-color: var(--yellow); }

.term-link { color: var(--accent); text-decoration: underline dotted; }

/* ── QUICK COMMANDS BAR ───────────────────────── */
.m-quick-bar {
    flex-shrink: 0;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    height: var(--quickbar-h);
    overflow: hidden;
}
.m-quick-scroll {
    display: flex; gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.m-quick-scroll::-webkit-scrollbar { display: none; }

.m-qcmd {
    flex-shrink: 0;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-mono); font-size: 11px;
    padding: 4px 12px; border-radius: 14px; cursor: pointer;
    transition: all .15s; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.m-qcmd:active { color: var(--accent); border-color: var(--accent); background: rgba(124,106,255,.1); }

/* ── INPUT BAR ────────────────────────────────── */
.terminal-input-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; background: var(--bg2);
    border-top: 1px solid var(--border); flex-shrink: 0;
    height: var(--footer-h);
}
.input-prompt {
    color: var(--accent3); font-size: 10px; white-space: nowrap; flex-shrink: 0;
}
.prompt-sep    { color: var(--text-dim); }
.prompt-dollar { color: var(--green); margin-left: 2px; }

.cmd-input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font-family: var(--font-mono); font-size: 14px;
    caret-color: var(--accent3); min-width: 0;
    -webkit-appearance: none;
}
.cmd-input::placeholder { color: var(--text-dim); opacity: .5; }
.cmd-input:disabled { opacity: .4; }

.run-btn {
    background: var(--accent); color: #fff;
    border: none; padding: 8px 14px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 14px; font-weight: 700;
    cursor: pointer; letter-spacing: 1px;
    transition: all .15s; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px; min-height: 36px;
    display: flex; align-items: center; justify-content: center;
}
.run-btn:active { background: #9880ff; }
.run-btn:disabled{ opacity: .4; cursor: not-allowed; }

/* ── BOTTOM NAV ───────────────────────────────── */
.m-bottom-nav {
    flex-shrink: 0;
    display: flex;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    height: calc(var(--botnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
}
.m-nav-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    background: transparent; border: none;
    color: var(--text-dim); cursor: pointer;
    transition: .15s;
    -webkit-tap-highlight-color: transparent;
    padding: 6px 2px;
}
.m-nav-btn:active { color: var(--accent); }
.m-nav-icon { font-size: 16px; line-height: 1; }
.m-nav-label { font-size: 8px; letter-spacing: .5px; font-family: var(--font-mono); }

/* ── MODAL PANELS ─────────────────────────────── */
.modal-panel {
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    bottom: calc(var(--footer-h) + var(--quickbar-h) + var(--botnav-h) + var(--safe-bottom));
    background: var(--bg); z-index: 20;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: var(--bg2);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-family: var(--font-title); font-size: 9px; letter-spacing: 1.5px; color: var(--accent); }
.modal-close {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-mono); font-size: 12px;
    padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: .15s;
    min-width: 36px; min-height: 36px;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.modal-close:active { color: var(--accent2); border-color: var(--accent2); }

.modal-body {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent;
    -webkit-overflow-scrolling: touch;
}
.modal-body::-webkit-scrollbar { width: 3px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }

/* ── PROGRESS BAR ─────────────────────────────── */
.progress-bar {
    width: 100%; height: 4px; background: var(--border);
    border-radius: 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 4px; transition: width .3s ease;
    box-shadow: 0 0 6px var(--accent);
}
.progress-text { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.dl-progress-wrap, .upscale-progress { display: flex; flex-direction: column; gap: 6px; }

/* ── CONV TABS ────────────────────────────────── */
.conv-tabs {
    display: flex; gap: 3px; padding: 8px 12px 0;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    flex-shrink: 0; flex-wrap: wrap;
}
.conv-tab {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-mono); font-size: 10px;
    padding: 6px 12px; border-radius: 4px 4px 0 0; cursor: pointer;
    transition: .15s; letter-spacing: .5px;
    -webkit-tap-highlight-color: transparent;
}
.conv-tab:active  { color: var(--text); border-color: var(--border-hi); }
.conv-tab.active  { color: var(--accent); background: var(--bg); border-color: var(--accent); border-bottom: none; }

.conv-tab-body { display: flex; flex-direction: column; gap: 10px; }
.conv-info-box {
    background: rgba(124,106,255,.06); border: 1px solid rgba(124,106,255,.2);
    border-radius: var(--radius); padding: 8px 12px; font-size: 11px;
    color: var(--text-dim); line-height: 1.6;
}
.converter-controls { display: flex; flex-direction: column; gap: 8px; }
.converter-format   { display: flex; flex-direction: column; gap: 6px; }
.converter-format label { font-size: 11px; color: var(--text-dim); }
.converter-format select {
    background: var(--bg3); border: 1px solid var(--border-hi);
    color: var(--text); font-family: var(--font-mono); font-size: 13px;
    padding: 8px 10px; border-radius: 4px; outline: none;
    transition: border-color .15s; width: 100%;
    -webkit-appearance: none;
}
.converter-format select:focus { border-color: var(--accent); }

/* ── CONVERTER DROP ───────────────────────────── */
.converter-drop {
    border: 1.5px dashed var(--border-hi); border-radius: var(--radius);
    padding: 18px; text-align: center; cursor: pointer;
    transition: .2s; color: var(--text-dim);
}
.converter-drop:active, .converter-drop.drag-over {
    border-color: var(--accent); background: rgba(124,106,255,.05);
}
.drop-icon { font-size: 20px; margin-bottom: 6px; }
.drop-text { font-size: 12px; line-height: 1.6; }
.drop-text span { color: var(--text-dim); font-size: 11px; }
.convert-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 20px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    cursor: pointer; letter-spacing: 1px; transition: .15s;
    min-height: 44px; width: 100%;
    -webkit-tap-highlight-color: transparent;
}
.convert-btn:active { background: #9880ff; }

/* ── UPSCALE ──────────────────────────────────── */
.upscale-panel {
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    bottom: calc(var(--footer-h) + var(--quickbar-h) + var(--botnav-h) + var(--safe-bottom));
    background: var(--bg); z-index: 20; padding: 12px;
    overflow-y: auto; gap: 10px;
    -webkit-overflow-scrolling: touch;
}
.upscale-header { display: flex; align-items: center; justify-content: space-between; }
.upscale-title  { font-family: var(--font-title); font-size: 9px; letter-spacing: 1.5px; color: var(--accent); }
.upscale-close  { background: transparent; border: 1px solid var(--border); color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: .15s; min-width: 36px; min-height: 36px; }
.upscale-close:active { color: var(--accent2); border-color: var(--accent2); }
.upscale-body   { display: flex; flex-direction: column; gap: 10px; }
.upscale-drop   { border: 1.5px dashed var(--border-hi); border-radius: var(--radius); padding: 18px; text-align: center; cursor: pointer; transition: .2s; color: var(--text-dim); }
.upscale-drop:active, .upscale-drop.drag-over { border-color: var(--accent); background: rgba(124,106,255,.05); }

.upscale-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upscale-scale-btns { display: flex; align-items: center; gap: 6px; }
.scale-label { font-size: 11px; color: var(--text-dim); }
.scale-btn {
    background: var(--bg3); border: 1px solid var(--border); color: var(--text-dim);
    font-family: var(--font-mono); font-size: 12px; padding: 6px 14px;
    border-radius: 4px; cursor: pointer; transition: .15s;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
}
.scale-btn:active, .scale-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(124,106,255,.1); }

.upscale-run-btn, .upscale-download-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 18px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    cursor: pointer; letter-spacing: 1px; transition: .15s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.upscale-run-btn:active, .upscale-download-btn:active { background: #9880ff; }
.upscale-run-btn:disabled { opacity: .4; cursor: not-allowed; }

.upscale-preview { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.preview-col { display: flex; flex-direction: column; gap: 4px; }
.preview-label { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.preview-info  { font-size: 10px; color: var(--text-dim); }
.preview-col canvas { max-width: 100%; border: 1px solid var(--border); border-radius: 4px; }

/* ── DEVELOPER TOOLS ──────────────────────────── */
.dl-url-row {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.dl-url-input {
    flex: 1; background: var(--bg3); border: 1px solid var(--border-hi);
    color: var(--text); font-family: var(--font-mono); font-size: 13px;
    padding: 10px 12px; border-radius: var(--radius); outline: none;
    transition: border-color .15s; min-width: 0; width: 100%;
    -webkit-appearance: none;
}
.dl-url-input:focus   { border-color: var(--accent); }
.dl-url-input::placeholder { color: var(--text-dim); opacity: .5; }

.dl-detect-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 16px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    cursor: pointer; letter-spacing: .5px; transition: .15s;
    white-space: nowrap; flex-shrink: 0;
    min-height: 44px; width: 100%;
    -webkit-tap-highlight-color: transparent;
}
.dl-detect-btn:active   { background: #9880ff; }
.dl-detect-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Dev sections */
.dev-domain-header {
    font-family: var(--font-title); font-size: 11px; color: var(--accent3);
    margin-bottom: 10px; letter-spacing: 1px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-hi);
}
.dev-section {
    background: var(--bg2); border: 1px solid var(--border);
    border-left: 3px solid var(--border-hi);
    border-radius: var(--radius); padding: 8px 10px;
    margin-bottom: 8px;
}
.dev-section-title {
    font-family: var(--font-title); font-size: 9px; letter-spacing: 1px;
    color: var(--text); margin-bottom: 6px;
}
.dev-section-body { font-size: 11px; color: var(--text); }

.dev-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.dev-table td { padding: 3px 5px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dev-table td:first-child { color: var(--text-dim); width: 35%; }
.dev-table td:last-child  { color: var(--text); word-break: break-all; }

.dev-tag {
    display: inline-block; font-size: 8px; padding: 1px 5px;
    border-radius: 3px; background: rgba(124,106,255,.2);
    color: var(--accent); letter-spacing: .5px; font-weight: 600;
}
.dev-tag-blue  { background: rgba(0,229,255,.15); color: var(--accent3); }
.dev-tag-green { background: rgba(0,255,157,.15); color: var(--green); }
.dev-tag-red   { background: rgba(255,77,109,.15); color: var(--accent2); }

/* ── PAGESPEED ────────────────────────────────── */
.ps-url-line {
    font-size: 10px; color: var(--text-dim); margin-bottom: 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ps-scores-row {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 8px; margin-bottom: 14px;
}
.ps-score-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ps-score-circle {
    width: 44px; height: 44px; border-radius: 50%;
    border: 3px solid; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-title); font-size: 13px; font-weight: 900;
    transition: .3s;
}
.ps-score-label { font-size: 8px; color: var(--text-dim); text-align: center; letter-spacing: .3px; }

.ps-section-title { font-size: 9px; color: var(--text-dim); letter-spacing: 1.5px; margin-bottom: 6px; }
.ps-metrics-grid  { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 12px; }

.ps-metric {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg2);
}
.ps-metric-label { font-size: 10px; color: var(--text-dim); }
.ps-metric-value { font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.ps-metric-good  .ps-metric-value { color: var(--green); }
.ps-metric-avg   .ps-metric-value { color: var(--yellow); }
.ps-metric-bad   .ps-metric-value { color: var(--accent2); }

.ps-audits-list { display: flex; flex-direction: column; gap: 5px; }
.ps-audit {
    display: flex; gap: 6px; font-size: 11px; padding: 6px 8px;
    border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--border);
    line-height: 1.5;
}
.ps-audit strong { font-weight: 600; }
.ps-audit-fail { border-left: 3px solid var(--accent2); color: var(--text); }
.ps-audit-warn { border-left: 3px solid var(--yellow); color: var(--text); }
.ps-all-good { font-size: 12px; color: var(--green); padding: 8px 0; }

.ps-strategy-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dl-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.dl-q-btn {
    background: var(--bg3); border: 1px solid var(--border); color: var(--text-dim);
    font-family: var(--font-mono); font-size: 11px; padding: 6px 14px;
    border-radius: 4px; cursor: pointer; transition: .15s;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
}
.dl-q-btn:active, .dl-q-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(124,106,255,.1); }
.dl-notice { font-size: 10px; color: var(--text-dim); padding: 6px 0; }

/* ── POLICY ───────────────────────────────────── */
.policy-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.policy-section { margin-bottom: 14px; }
.policy-title {
    font-family: var(--font-title); font-size: 9px; letter-spacing: 1.5px;
    color: var(--accent3); margin-bottom: 4px;
}
.policy-text { font-size: 12px; color: var(--text); line-height: 1.8; }

/* ── VIDEO DL ─────────────────────────────────── */
.dl-quality-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dl-info-row    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-platform-badge {
    font-size: 11px; font-weight: 700; padding: 4px 12px;
    border-radius: var(--radius); letter-spacing: .5px;
}
.dl-platform-badge.yt { background: rgba(255,0,0,.15); color: #ff4444; border: 1px solid rgba(255,0,0,.3); }
.dl-platform-badge.tt { background: rgba(0,229,255,.1); color: var(--accent3); border: 1px solid rgba(0,229,255,.2); }
.dl-platform-badge.ig { background: rgba(200,100,200,.1); color: #cc77cc; border: 1px solid rgba(200,100,200,.2); }

.dl-info-text { font-size: 11px; color: var(--text-dim); }
.dl-mp3-btn.active { color: var(--green) !important; border-color: var(--green) !important; }
.dl-start-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 12px 22px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 13px; font-weight: 700;
    cursor: pointer; letter-spacing: 1px; transition: .15s;
    min-height: 44px; width: 100%;
    -webkit-tap-highlight-color: transparent;
}
.dl-start-btn:active   { background: #9880ff; }
.dl-start-btn:disabled { opacity: .4; cursor: not-allowed; }
.dl-result { font-size: 12px; }
.dl-result-title { font-weight: 700; color: var(--green); }

/* ── SCROLLBAR ────────────────────────────────── */
::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }

/* ── SPEEDTEST ────────────────────────────────── */
.st-body {
    padding: 14px 12px !important;
    gap: 12px !important;
    align-items: stretch !important;
}

#stStartScreen {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; padding: 24px 0; flex: 1;
}
.st-tagline {
    font-size: 9px; color: var(--text-dim);
    letter-spacing: 1.5px; text-transform: uppercase;
    text-align: center;
}

#stLiveScreen {
    display: flex; flex-direction: column;
    align-items: stretch; gap: 12px;
    flex: 1; width: 100%;
}
#stErrorScreen {
    display: flex; flex-direction: column;
    align-items: flex-start; gap: 10px;
    padding: 16px 0;
}

.st-gauge-wrap {
    position: relative;
    width: 180px; height: 108px;
    margin: 0 auto;
    flex-shrink: 0;
    align-self: center;
}
.st-gauge-svg {
    width: 180px; height: 108px;
    display: block; overflow: visible;
}

.st-arc-track { stroke: var(--border-hi); }
.st-arc-fill {
    stroke: var(--accent3);
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset .3s ease, stroke .25s ease;
    filter: drop-shadow(0 0 6px currentColor);
}
.st-needle {
    stroke: var(--accent3); stroke-width: 2.5;
    transform-origin: 110px 120px;
    transform: rotate(-90deg);
    transition: transform .3s ease;
}
.st-needle-hub { fill: var(--accent3); }

.st-gauge-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -20%);
    display: flex; flex-direction: column;
    align-items: center;
    text-align: center;
    pointer-events: none;
}
.st-gauge-val {
    font-family: var(--font-title);
    font-size: 24px; font-weight: 900;
    color: var(--accent); line-height: 1;
    transition: color .3s;
    text-align: center; white-space: nowrap;
}
.st-gauge-unit {
    font-size: 10px; color: var(--text-dim);
    letter-spacing: 1px; margin-top: 2px;
    text-align: center;
}

.st-phase-row {
    display: flex; align-items: center;
    justify-content: center; gap: 6px;
    font-size: 11px; color: var(--text-dim);
}
.st-phase-icon  { font-size: 12px; }
.st-phase-label { font-size: 11px; color: var(--text-dim); }

.st-progress-outer {
    width: 100%; height: 4px;
    background: var(--border); border-radius: 4px;
    overflow: hidden;
}
.st-progress-inner {
    height: 100%; background: var(--accent3);
    border-radius: 4px;
    transition: width .3s ease, background .3s ease;
    box-shadow: 0 0 8px var(--accent3);
}

.st-live-stats {
    display: flex; gap: 0; width: 100%;
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; background: var(--bg2);
}
.st-live-stat {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    padding: 8px 4px;
    border-right: 1px solid var(--border);
}
.st-live-stat:last-child { border-right: none; }
.st-ls-icon  { font-size: 12px; }
.st-ls-val   {
    font-family: var(--font-title); font-size: 11px;
    font-weight: 700; color: var(--text); white-space: nowrap;
}
.st-ls-label { font-size: 8px; color: var(--text-dim); letter-spacing: .5px; }

.st-results {
    width: 100%; display: flex; flex-direction: column; gap: 10px;
}
.st-result-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; width: 100%;
}
.st-result-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px;
    display: flex; flex-direction: column; gap: 2px;
    border-top: 3px solid var(--border);
    transition: border-color .3s;
}
.st-card-down   { border-top-color: var(--accent3); }
.st-card-up     { border-top-color: var(--accent); }
.st-card-ping   { border-top-color: var(--accent2); }
.st-card-jitter { border-top-color: var(--yellow); }

.st-card-icon  { font-size: 14px; }
.st-card-val   {
    font-family: var(--font-title); font-size: 14px;
    font-weight: 900; color: var(--text); line-height: 1.2;
}
.st-card-down .st-card-val   { color: var(--accent3); }
.st-card-up   .st-card-val   { color: var(--accent); }
.st-card-ping .st-card-val   { color: var(--accent2); }
.st-card-jitter .st-card-val { color: var(--yellow); }

.st-card-label { font-size: 9px; color: var(--text-dim); letter-spacing: .5px; }
.st-card-sub   { font-size: 9px; color: var(--text-dim); }

.st-info-rows {
    display: flex; flex-direction: column; gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.st-info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.st-info-row:last-child { border-bottom: none; }
.st-info-label { color: var(--text-dim); }
.st-info-val   { color: var(--text); font-weight: 600; }

.st-rerun-btn {
    align-self: center !important;
    padding: 10px 24px !important;
    font-size: 12px !important;
    margin-top: 10px !important;
}

.speedtest-start-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 14px 32px; border-radius: var(--radius);
    font-family: var(--font-title); font-size: 13px; font-weight: 700;
    cursor: pointer; letter-spacing: 1.5px;
    transition: .2s; box-shadow: 0 0 20px rgba(124,106,255,.35);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}
.speedtest-start-btn:active   { background: #9880ff; box-shadow: 0 0 28px rgba(124,106,255,.55); }
.speedtest-start-btn:disabled { opacity: .4; cursor: not-allowed; }

.st-error-msg {
    font-size: 12px; color: var(--accent2); font-weight: 600;
    padding: 10px 12px; background: rgba(255,77,109,.08);
    border: 1px solid rgba(255,77,109,.2); border-radius: var(--radius);
    width: 100%;
}
.st-error-hint {
    font-size: 11px; color: var(--text-dim); line-height: 1.8;
}
.st-error-hint code {
    background: var(--bg3); padding: 1px 5px;
    border-radius: 3px; color: var(--accent3); font-size: 11px;
}

/* ── WEATHER WIDGET ──────────────────────────── */
.weather-widget {
    display: flex; flex-direction: column; gap: 6px;
}
.weather-btn {
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-mono);
    font-size: 10px; padding: 5px 8px; border-radius: var(--radius);
    cursor: pointer; transition: .15s; width: 100%;
    letter-spacing: .5px;
}
.weather-btn:active { background: var(--border-hi); color: var(--text); border-color: var(--accent); }
.weather-data { display: flex; flex-direction: column; gap: 3px; }
.weather-city { font-size: 10px; font-weight: 700; color: var(--accent); letter-spacing: .5px; margin-bottom: 2px; }
.weather-row { display: flex; justify-content: space-between; font-size: 10px; line-height: 1.4; }
.weather-row span:first-child { color: var(--text-dim); }
.weather-row span:last-child  { color: var(--text); font-weight: 500; }
.weather-desc { font-size: 9px; color: var(--text-dim); font-style: italic; margin-top: 2px; }
.weather-error { font-size: 10px; color: var(--accent2); }

/* ── LANDSCAPE TWEAKS ─────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
    .m-header { height: 36px; }
    .m-quick-bar { height: 30px; }
    .m-quick-scroll { padding: 4px 10px; gap: 4px; }
    .m-qcmd { padding: 2px 10px; font-size: 10px; }
    .terminal-input-bar { height: 40px; padding: 4px 8px; }
    .m-bottom-nav { height: calc(44px + var(--safe-bottom)); }
    .m-nav-label { display: none; }
    .m-nav-icon { font-size: 18px; }
    .st-gauge-wrap, .st-gauge-svg { width: 140px; height: 84px; }
    .st-gauge-val { font-size: 18px; }
}

/* ── VERY SMALL SCREENS ───────────────────────── */
@media (max-width: 340px) {
    :root { font-size: 11px; }
    .m-logo-text { font-size: 11px; }
    .m-header-title { font-size: 8px; }
    .m-qcmd { font-size: 10px; padding: 3px 10px; }
    .cmd-input { font-size: 13px; }
    .st-gauge-val { font-size: 20px; }
}
