/* Speed test theme helpers: toggle, dark green+blue mix accents, classic light polish. */

/* Colours read by the canvas graphs and inline notes (see stThemeColor in speedtest.php). */
:root{--st-graph-bg:rgba(255,255,255,0.03);--st-graph-grid:rgba(255,255,255,0.08);--st-note:#a9bed2;--st-note-warn:#ffcf9f}
html[data-theme="light"]{--st-graph-bg:rgba(11,45,73,0.03);--st-graph-grid:rgba(11,45,73,0.12);--st-note:#3d5671;--st-note-warn:#9a5b00;color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}

/* Toggle: right side of the page title. */
.st-theme-toggle{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 14px 0 10px;border:1px solid rgba(151,190,214,.35);border-radius:999px;background:rgba(8,28,40,.82);color:#f4f8fc;font-size:13px;font-weight:800;cursor:pointer;transition:background .2s,border-color .2s,box-shadow .2s;box-shadow:0 8px 20px rgba(0,0,0,.22);backdrop-filter:blur(8px)}
.speedtest-hero>.st-theme-toggle{position:absolute;top:0;right:clamp(8px,2vw,16px);z-index:3}
.st-theme-toggle:hover{border-color:#7df0e2}
.st-theme-toggle:focus-visible{outline:3px solid #7df0e2;outline-offset:2px}
.st-theme-icon{position:relative;display:inline-block;width:18px;height:18px}
.st-theme-sun{border-radius:50%;background:#ffd166;box-shadow:0 0 0 3px rgba(255,209,102,.25);width:12px;height:12px;margin:3px}
.st-theme-moon{display:none;border-radius:50%;box-shadow:inset -5px -2px 0 1px #0b3553}
html[data-theme="light"] .st-theme-sun{display:none}
html[data-theme="light"] .st-theme-moon{display:inline-block}
html[data-theme="light"] .st-theme-toggle{border-color:#c9d8e2;background:#fff;color:#0b2d49;box-shadow:0 4px 14px rgba(11,45,73,.08)}
html[data-theme="light"] .st-theme-toggle:hover{border-color:#00766d}
html[data-theme="light"] .st-theme-toggle:focus-visible{outline-color:#00766d}
@media(max-width:767px){
  .speedtest-hero>.st-theme-toggle{top:-2px;right:8px;padding:0;width:40px;min-height:40px;justify-content:center}
  .st-theme-label{display:none}
}
@media(prefers-reduced-motion:reduce){.st-theme-toggle{transition:none}}

html[data-theme="light"] .location-ask-button{color:#fff!important}
.st-metric-missing{font-size:14px!important;line-height:1.3!important;overflow-wrap:normal!important;word-break:keep-all!important}
html[data-theme="light"] .result-popup-footer-actions button:last-child,html[data-theme="light"] #resultPopupDone,html[data-theme="light"] .result-popup .popup-done{color:#fff!important}
html[data-theme="light"] #runSpeedTest{color:#fff!important}
/* Classic light primary buttons (teal → blue). */
html[data-theme="light"] #runSpeedTest,html[data-theme="light"] #resultPopupDone{background:linear-gradient(135deg,#0e7c72 0%,#0054eb 55%,#280fdc 100%)!important}
body.st-testing .pwa-install-notice{display:none!important}

.result-popup-quality{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px}
.result-popup-quality .quality-good-for{color:var(--st-muted);font-size:12px;font-weight:700;margin-left:4px}
.result-popup-quality .quality-uses{color:var(--st-ink);font-size:12px;font-weight:700}

/* Dark graphs: green + blue mix. Light graphs: classic blue/teal. */
:root{--st-graph-down:#5da8ff;--st-graph-down-fill:rgba(93,168,255,0.16);--st-graph-up:#3ecf8e;--st-graph-up-fill:rgba(62,207,142,0.14);--st-graph-popup-up:#7df6ed;--st-graph-popup-up-fill:rgba(125,246,237,0.17)}
html[data-theme="light"]{--st-graph-down:#1f6fe0;--st-graph-down-fill:rgba(31,111,224,0.14);--st-graph-up:#00857a;--st-graph-up-fill:rgba(0,133,122,0.14);--st-graph-popup-up:#00857a;--st-graph-popup-up-fill:rgba(0,133,122,0.14)}
body.st-testing.st-loc-bar-was-hidden #locationAskBar{display:none!important}

/* ---- Classic light theme polish (do not override speedtest-light.css palette) ---- */
html[data-theme="light"] .gauge-inner{background:radial-gradient(circle at 50% 30%,#ffffff 0%,#f4f8fb 55%,#e8f0f5 100%)!important;box-shadow:inset 0 2px 10px rgba(11,45,73,.08),0 8px 24px rgba(11,45,73,.10)!important;border:1px solid rgba(11,45,73,.08)}
html[data-theme="light"] .gauge-inner .mode-label{color:#3d5671!important}
html[data-theme="light"] .speedtest-stage::before,html[data-theme="light"] .speedtest-stage::after{opacity:.25!important}
html[data-theme="light"] .speedtest-shell .panel .panel-heading{border-bottom-color:rgba(11,45,73,.12)!important}
html[data-theme="light"] .speedtest-shell .panel{box-shadow:0 2px 10px rgba(11,45,73,.05)!important}
html[data-theme="light"]{--st-graph-bg:rgba(11,45,73,0.02)}
html[data-theme="light"] .graph-card .graph-canvas{background:rgba(11,45,73,.025)!important}
html[data-theme="light"] .speedtest-hero h1{color:#0b2d49!important}
html[data-theme="light"] .speedtest-hero p{color:#3d5671!important}
/* PWA install icon chrome follows theme. */
html[data-theme="dark"] .pwa-install-notice img{border-color:rgba(125,220,210,.3);background:#06161c;box-shadow:0 8px 22px rgba(42,180,200,.2)}
html[data-theme="light"] .pwa-install-notice img{border-color:rgba(11,45,73,.16);background:#f4f8fb;box-shadow:0 8px 22px rgba(11,45,73,.1)}
html[data-theme="light"] .pwa-install-notice{border-color:rgba(11,45,73,.16);background:linear-gradient(145deg,#fcfdfd,#eef3f7)}
html[data-theme="dark"] .pwa-install-notice{border-color:rgba(125,220,210,.28);background:linear-gradient(145deg,#143a48,#071820)}

/* Focus + layout helpers */
.speedtest-shell :is(a,button,summary,input,select):focus-visible,
.result-popup :is(a,button,summary):focus-visible,
#stThemeToggle:focus-visible{outline:3px solid #7df0e2!important;outline-offset:3px!important;border-radius:6px}
html[data-theme="light"] .speedtest-shell :is(a,button,summary,input,select):focus-visible,
html[data-theme="light"] .result-popup :is(a,button,summary):focus-visible,
html[data-theme="light"] #stThemeToggle:focus-visible{outline-color:#00766d!important}
.speedtest-shell .network-suite-link{display:inline-flex;align-items:center;min-height:44px;padding:0 6px}
.result-popup-card{max-height:calc(100vh - 24px)!important}
@supports (height:100dvh){.result-popup-card{max-height:calc(100dvh - 24px)!important}}
@media(max-height:640px){
  .result-popup-graphs canvas{height:44px!important}
  .result-popup-head{padding-top:12px!important;padding-bottom:8px!important}
}
@media(max-height:700px){.result-popup{align-items:center!important;padding:12px!important}}
