/*!
 * Nabd — internet speed test (speed.doniaweb.com)
 * Copyright (c) 2026 Mahmoud Ali — doniaweb.com. All rights reserved.
 * Created: 2026-10-13
 */
/* ===== Page layouts (structure). Colors come from the active palette's variables. ===== */
html:not([data-layout="classic"]) #view-test .hero { display: none; }
.alt-hero { position: relative; z-index: 1; padding-top: 24px; }
.alt-hero svg { width: 22px; height: 22px; }
.alt-hero .err { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.alt-hero button { font: inherit; color: inherit; cursor: pointer; }
.alt-hero button:disabled { cursor: default; }

/* ================= 1. BENTO ================= */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(120px, auto); gap: 14px; }
.bento .tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-align: start; min-width: 0; }
.bento .tl { font-size: .85rem; color: var(--muted); font-weight: 500; }
.bento .num { font-family: var(--num-font); font-size: 2.3rem; font-weight: 700; line-height: 1.15; }
.bento .txt { font-size: 1.05rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bento small { color: var(--muted); font-size: .8rem; }
.bento .cta { grid-column: span 2; flex-direction: row; align-items: center; justify-content: space-between; background: var(--text); color: var(--bg); border: 0; padding: 22px 24px; }
.bento .cta b { font-size: 1.6rem; display: block; }
.bento .cta small { color: color-mix(in srgb, var(--bg) 70%, var(--text)); }
.bento .cta-ic { width: 60px; height: 60px; border-radius: 50%; background: var(--c1); display: grid; place-items: center; flex: none; }
.bento .cta-ic svg { stroke: #fff; stroke-width: 2.4; }
[dir=ltr] .bento .cta-ic svg { transform: scaleX(-1); }
.bento .cta.busy { flex-direction: column; align-items: stretch; gap: 14px; }
.cta-prog { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--bg) 25%, transparent); overflow: hidden; }
.cta-prog i, .chat .bar i { display: block; height: 100%; width: 0; background: var(--c1); border-radius: 99px; transition: width .3s; }
.bento .dl { grid-column: span 2; grid-row: span 2; justify-content: space-between; }
.bento .tl-row { display: flex; justify-content: space-between; align-items: center; }
.bento .pill { font-size: .75rem; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c1) 14%, transparent); color: var(--c1); font-weight: 600; }
.bento .big { display: flex; align-items: baseline; gap: 8px; }
.bento .big span { font-family: var(--num-font); font-size: clamp(4rem, 9vw, 6.5rem); font-weight: 700; line-height: 1; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.bento .bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bento .bars i { flex: 1; height: 6%; border-radius: 3px; background: var(--track); transition: height .25s; }
.bento .bars i.on { background: var(--c1); }
.bento .grade-tile { grid-column: span 2; flex-direction: row; align-items: center; gap: 14px; }
.bento .gl { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-size: 1.6rem; font-weight: 700; flex: none; background: var(--ok); }
.bento .g-C .gl { background: #d97706; } .bento .g-D .gl { background: #ea580c; } .bento .g-F .gl { background: #dc2626; } .bento .g-B .gl { background: #16a34a; }
.bento .uses { grid-column: span 2; }
.use-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.use { border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--track); text-align: center; }
.use .ui svg { width: 20px; height: 20px; }
.use b { font-size: .82rem; }
.use.great { background: color-mix(in srgb, var(--ok) 14%, transparent); } .use.great small, .use.great svg { color: var(--ok); }
.use.ok { background: color-mix(in srgb, var(--warn) 16%, transparent); } .use.ok small, .use.ok svg { color: #b45309; }
.use.poor { background: color-mix(in srgb, var(--bad) 14%, transparent); } .use.poor small, .use.poor svg { color: var(--bad); }
.bento .share { background: color-mix(in srgb, var(--c1) 12%, var(--card)); color: var(--c1); border: 0; }
.bento .share .tl { color: var(--c1); }
.bento .err { grid-column: 1 / -1; color: var(--bad); }
html[data-layout="bento"] #results .grid-2 { gap: 14px; }
@media (max-width: 860px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .bento .dl { grid-row: auto; }
  .bento .big span { font-size: 4.5rem; }
}
@media (max-width: 600px) {
  /* backdrop-filter would make the fixed nav position relative to the top bar instead of the screen */
  html[data-layout="bento"] .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  html[data-layout="bento"] .nav a { padding: 10px 4px; font-size: .82rem; border-radius: 14px; }
  html[data-layout="bento"] .nav { position: fixed; bottom: 12px; left: 12px; right: 12px; z-index: 40; width: auto; background: var(--card-solid); border: 1px solid var(--line); border-radius: 20px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
  html[data-layout="bento"] .nav a { flex: 1; text-align: center; }
  html[data-layout="bento"] body { padding-bottom: 86px; }
}

/* ================= 2. PULSE ================= */
.pulse { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 720px; margin: 0 auto; }
.pulse .sub { color: var(--muted); font-size: .95rem; }
.orb { position: relative; width: min(380px, 84vw); aspect-ratio: 1; margin-top: 18px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.orb .halo { position: absolute; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--c1) 25%, transparent); }
.orb .h1 { inset: 0; } .orb .h2 { inset: 8%; border-color: color-mix(in srgb, var(--c1) 40%, transparent); } .orb .h3 { inset: 16%; border-width: 2px; border-color: color-mix(in srgb, var(--c1) 60%, transparent); }
.orb .core { position: relative; width: 56%; aspect-ratio: 1; border-radius: 50%; background: var(--c1); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 24px 60px color-mix(in srgb, var(--c1) 35%, transparent); transition: transform .2s; }
.orb:not(:disabled):hover .core { transform: scale(1.04); }
.orb .core b { font-family: 'Reem Kufi', var(--num-font); font-size: clamp(2.6rem, 11vw, 4.4rem); line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.orb .core small { font-size: .9rem; margin-top: 6px; opacity: .92; }
.orb.live .halo { animation: orbPulse 1.6s ease-out infinite; }
.orb.live .h2 { animation-delay: .25s; } .orb.live .h3 { animation-delay: .5s; }
@keyframes orbPulse { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.08); opacity: .25; } }
.pulse .steps { display: flex; gap: 8px; margin-top: 18px; }
.pulse .steps i { width: 30px; height: 6px; border-radius: 99px; background: var(--track); }
.pulse .steps i.on { background: var(--text); }
.pulse .sum { font-family: 'Reem Kufi', var(--font); font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.35; margin-top: 26px; max-width: 560px; }
.trio { width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); margin-top: 28px; }
.trio div { padding: 16px 0; display: flex; flex-direction: column; gap: 2px; }
.trio div + div { border-inline-start: 1px solid var(--line); }
.trio span, .trio small { color: var(--muted); font-size: .82rem; }
.trio b { font-family: var(--num-font); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.verdicts { list-style: none; width: 100%; max-width: 560px; margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.verdicts li { display: flex; justify-content: space-between; font-size: 1.02rem; }
.verdicts .great { color: var(--ok); } .verdicts .ok { color: #b45309; } .verdicts .poor { color: var(--bad); }
.pulse .acts { width: 100%; max-width: 560px; margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pulse .acts .btn { width: 100%; justify-content: center; padding: 16px; font-size: 1.05rem; background: var(--text); color: var(--bg); border: 0; border-radius: 99px; }
.pulse .link { background: none; border: 0; color: var(--c1); padding: 8px; font-weight: 500; }
html[data-layout="pulse"] .card { box-shadow: none; }

/* ================= 3. EDITORIAL ================= */
.paper { max-width: 1040px; margin: 0 auto; }
.dateline { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--text); }
.masthead { text-align: center; padding: 12px 0 10px; border-bottom: 4px double var(--text); }
.masthead b { display: block; font-family: 'Amiri', serif; font-size: clamp(2.6rem, 8vw, 4.4rem); line-height: 1; }
.masthead small { color: var(--muted); letter-spacing: 1px; font-size: .8rem; }
.paper .cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 36px; margin-top: 22px; }
.paper .kicker { color: var(--c1); font-weight: 700; font-size: .8rem; }
.paper h1 { font-family: 'Amiri', serif; font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.3; margin-top: 6px; }
.paper .lede { font-size: 1.05rem; line-height: 1.8; color: color-mix(in srgb, var(--text) 80%, var(--muted)); margin-top: 10px; }
.paper h2 { font-family: 'Amiri', serif; font-size: 1.5rem; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--text); }
.means { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .95rem; }
.means td { padding: 9px 0; border-bottom: 1px dotted var(--line); }
.means td:last-child { text-align: end; font-weight: 700; }
.means .poor { color: var(--c1); }
.paper blockquote { margin-top: 18px; padding: 14px 18px; background: var(--bg2); font-family: 'Amiri', serif; font-size: 1.2rem; line-height: 1.7; }
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; border-top: 1px solid var(--text); }
.figures .cell { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.figures .cell:nth-child(odd) { border-inline-end: 1px solid var(--line); padding-inline-end: 14px; }
.figures .cell:nth-child(even) { padding-inline-start: 14px; }
.figures span, .figures small { font-size: .78rem; color: var(--muted); }
.figures b { font-family: 'Amiri', serif; font-size: clamp(2.4rem, 6vw, 3.4rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.figures .hot b { color: var(--c1); }
.byline { grid-column: 1 / -1; padding-top: 12px; font-size: .85rem; color: var(--muted); font-style: italic; }
.press { display: flex; gap: 10px; margin-top: 26px; }
.press .ink, .press .outline { flex: 1; text-align: center; padding: 15px; font-weight: 700; font-size: 1rem; }
.press .ink { background: var(--text); color: var(--bg); border: 0; }
.press .outline { border: 1px solid var(--text); color: var(--text); }
html[data-layout="editorial"] .card { border-radius: 0; box-shadow: none; border-width: 1px 0 0; border-color: var(--text); background: transparent; padding-inline: 0; }
html[data-layout="editorial"] .card h3 { font-family: 'Amiri', serif; font-size: 1.45rem; }
html[data-layout="editorial"] .topbar { border-bottom: 1px solid var(--text); }
@media (max-width: 760px) {
  .paper .cols { grid-template-columns: 1fr; gap: 18px; }
  .figures { order: -1; }
}

/* ================= 4. HUD ================= */
.hud { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }
.hud-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.hud-top b { font-size: 1.3rem; font-weight: 800; letter-spacing: 1px; }
.hud-top em { font-style: normal; color: var(--c1); }
.hud-top .st { font-size: .8rem; color: var(--c1); border: 1px solid var(--c1); padding: 3px 10px; letter-spacing: 1px; }
.hud-top .st.run { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hud .frame { position: relative; border: 1px solid var(--line); background: var(--card); padding: 16px 18px; }
.hud .c { position: absolute; width: 16px; height: 16px; border: 0 solid var(--c1); }
.hud .c.tl { top: -1px; left: -1px; border-top-width: 3px; border-left-width: 3px; } .hud .c.tr { top: -1px; right: -1px; border-top-width: 3px; border-right-width: 3px; }
.hud .c.bl { bottom: -1px; left: -1px; border-bottom-width: 3px; border-left-width: 3px; } .hud .c.br { bottom: -1px; right: -1px; border-bottom-width: 3px; border-right-width: 3px; }
.hud .main-frame { grid-row: span 2; display: flex; flex-direction: column; justify-content: center; padding: 22px; }
.hud .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); letter-spacing: 1px; }
.hud .mega { font-family: var(--num-font); font-size: clamp(4.5rem, 13vw, 8rem); font-weight: 800; line-height: 1; color: var(--c1); text-shadow: var(--num-glow); margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.hud .segs { display: flex; gap: 3px; }
.hud .segs i { flex: 1; height: 26px; background: var(--track); transition: background .15s; }
.hud .segs i.on { background: var(--c1); box-shadow: 0 0 10px color-mix(in srgb, var(--c1) 50%, transparent); }
.hud .scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: 4px; }
.hgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hbox { border: 1px solid var(--line); background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; }
.hbox span { font-size: .72rem; color: var(--muted); letter-spacing: .5px; }
.hbox b { font-family: var(--num-font); font-size: 2rem; font-weight: 700; color: var(--c2); line-height: 1.2; font-variant-numeric: tabular-nums; }
.hbox small { color: var(--muted); font-size: .72rem; }
.hbox.hot { border-color: color-mix(in srgb, var(--bad) 60%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--card)); }
.hbox.hot b { color: var(--bad); }
.hud .risk { display: flex; align-items: center; gap: 14px; }
.hud .risk .g { width: 54px; height: 54px; border: 2px solid currentColor; display: grid; place-items: center; font-size: 1.7rem; font-weight: 800; flex: none; }
.hud .risk strong { display: block; } .hud .risk small { color: var(--muted); }
.hud .risk.high { border-color: var(--bad); color: var(--bad); } .hud .risk.high strong { color: var(--text); }
.hud .risk.mid { border-color: var(--warn); color: var(--warn); } .hud .risk.mid strong { color: var(--text); }
.hud .risk.low { border-color: var(--ok); color: var(--ok); } .hud .risk.low strong { color: var(--text); }
.hud .srv { grid-column: 1 / -1; display: flex; flex-direction: column; }
.hud .srv .lbl { margin-bottom: 6px; }
.srow { display: flex; justify-content: space-between; padding: 10px 0; border: 0; border-bottom: 1px solid var(--track); background: none; text-align: start; font-size: .95rem; color: var(--muted) !important; }
.srow:last-child { border-bottom: 0; }
.srow.on { color: var(--c1) !important; }
.hud .fire { grid-column: 1 / -1; background: var(--c1); color: var(--bg) !important; border: 0; padding: 18px; font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; box-shadow: 0 0 30px color-mix(in srgb, var(--c1) 35%, transparent); }
.hud .fire:disabled { opacity: .6; }
.hud .err { grid-column: 1 / -1; }
html[data-layout="hud"] .card { border-radius: 0; box-shadow: 0 0 0 1px var(--line); }
html[data-layout="hud"] .card h3 { text-transform: uppercase; letter-spacing: 1px; color: var(--c1); }
@media (max-width: 760px) {
  .hud { grid-template-columns: 1fr; }
  .hud .main-frame { grid-row: auto; }
}

/* ================= 5. CHAT ================= */
.chat { max-width: 760px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--card-solid); }
.chat-head .av { width: 44px; height: 44px; border-radius: 50%; background: var(--c1); display: grid; place-items: center; flex: none; }
.chat-head .av svg { stroke: #fff; stroke-width: 2.4; }
.chat-head b { display: block; font-size: 1.1rem; }
.chat-head small { color: var(--ok); font-size: .82rem; }
.thread { background: var(--bg); padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; max-height: min(640px, 70vh); min-height: 260px; overflow-y: auto; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 11px 16px; font-size: 1rem; line-height: 1.65; border-radius: 20px; }
.msg.bot { align-self: flex-start; background: var(--card-solid); border-end-start-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--c1); color: #fff; border-end-end-radius: 6px; }
.msg .live { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.msg .live b { font-family: var(--num-font); font-size: 2.6rem; color: var(--c1); line-height: 1; font-variant-numeric: tabular-nums; }
.msg .live small { color: var(--muted); }
.chat .bar { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 8px; }
.msg.card { width: 88%; max-width: 420px; box-shadow: var(--shadow); padding: 16px; }
.cbig { display: flex; align-items: baseline; gap: 6px; }
.cbig b { font-family: var(--num-font); font-size: 3.4rem; line-height: 1; color: var(--c1); font-weight: 800; }
.cbig small { color: var(--muted); }
.cmini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.cmini div { background: var(--track); border-radius: 14px; padding: 8px; text-align: center; }
.cmini span { display: block; font-size: .75rem; color: var(--muted); }
.cmini b { font-size: 1.25rem; }
.cmini .hot { background: color-mix(in srgb, var(--bad) 12%, transparent); } .cmini .hot b { color: var(--bad); }
.chat .chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--line); }
.chat .chips button { padding: 9px 16px; border-radius: 99px; background: var(--card-solid); border: 1.5px solid var(--c1); color: var(--c1) !important; font-weight: 600; font-size: .92rem; }
.chat .chips button:hover { background: var(--c1); color: #fff !important; }
.ask { display: flex; gap: 8px; padding: 12px 14px; background: var(--card-solid); border-top: 1px solid var(--line); }
.ask input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; outline: none; }
.ask input:focus { border-color: var(--c1); }
.ask button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--c1); display: grid; place-items: center; flex: none; }
.ask button svg { stroke: #fff; stroke-width: 2.2; }
[dir=ltr] .ask button svg { transform: scaleX(-1); }
html[data-layout="chat"] #results .res-card { display: none; }
@media (max-width: 600px) {
  .chat { border-radius: 20px; }
  .msg { max-width: 90%; }
}

/* Nav labels never wrap onto two lines */
.nav a { white-space: nowrap; }
@media (max-width: 380px) { .nav a { padding: 8px 6px; font-size: .82rem; } }
.bento .txt { unicode-bidi: plaintext; text-align: start; }
