/* Speed Test NI v3 — Happy Weather "bright sky" look: blue sky over the hero,
   a big sun as the speed dial, white cards with a warm gradient edge. */
:root {
  --sky-1: #2C95E8; --sky-2: #4FB0F0; --sky-3: #8FD0F6; --sky-4: #C4E8FB;
  --navy: #12294A; --navy-soft: #4C6488;
  --sun-1: #FFF3A6; --sun-2: #FFD93B; --sun-3: #FFB21E; --sun-hot: #FF8A1F;
  --warm-1: #FFF4DE; --warm-2: #FFE2B8; --warm-3: #FFCB91;
  --tile: #FFFFFF;
  --glass: rgba(255,255,255,0.20); --glass-edge: rgba(255,255,255,0.55);
  --white: #FFFFFF; --white-soft: rgba(255,255,255,0.9);
  --good: #1E9E62; --ok: #E08A00; --low: #D8483B;
  --good-bg: #E3F7EC; --ok-bg: #FFF1D6; --low-bg: #FDE6E3;
  --shadow: 0 14px 34px rgba(190,110,40,0.16);
  --shadow-sm: 0 4px 14px rgba(190,110,40,0.10);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--sky-1); height: auto; min-height: 100%; overflow-x: hidden; }
body {
  margin: 0; font-family: var(--font); color: var(--navy); -webkit-font-smoothing: antialiased;
  overflow-x: hidden; position: relative;
  background: linear-gradient(180deg,
    var(--sky-1) 0px, var(--sky-2) 380px, var(--sky-3) 760px, var(--sky-4) 940px,
    var(--warm-1) 1100px, var(--warm-2) 1600px, var(--warm-3) 100%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Strip behind the iPhone clock (home-screen only) */
.topstrip { display: none; }
@media (display-mode: standalone) {
  .topstrip { display: block; position: fixed; top: 0; left: 0; right: 0;
    height: calc(env(safe-area-inset-top) + 12px); background: var(--sky-1); z-index: 100; pointer-events: none; }
}

/* Soft sun glow in the top corner */
body::before {
  content: ''; position: absolute; width: 420px; height: 420px; top: -150px; right: -130px; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.85) 0%, rgba(255,240,180,0.45) 35%, transparent 70%);
  opacity: 0.55;
}

/* ═══ Hero ═══ */
.hero {
  position: relative; text-align: center; color: var(--white);
  padding: calc(env(safe-area-inset-top) + 16px) 18px 26px;
  max-width: 560px; margin: 0 auto;
}
.hero > *:not(.sky-cloud) { position: relative; z-index: 1; }
.sky-cloud {
  position: absolute; pointer-events: none; z-index: 0; opacity: 0.92;
  filter: drop-shadow(0 6px 10px rgba(30,110,190,0.16));
  animation: cloud-drift 26s ease-in-out infinite;
}
.sky-cloud.l { width: 110px; left: -46px; top: 300px; }
.sky-cloud.r { width: 124px; right: -44px; top: 190px; animation-delay: -13s; }
@keyframes cloud-drift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 4px 12px rgba(10,60,120,0.25); }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.glass-btn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: var(--white);
  background: var(--glass); border: 1.5px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.25s var(--spring);
}
.glass-btn:active { transform: scale(0.9); }
.glass-btn svg { width: 22px; height: 22px; }

.headline {
  margin: 22px 0 0; font-size: 46px; font-weight: 800; letter-spacing: -0.035em; line-height: 1;
  text-shadow: 0 3px 18px rgba(20,90,170,0.25);
  display: inline-block; padding: 0 8px 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12'%3E%3Cpath d='M4 9 Q100 1 196 6' fill='none' stroke='%23FFD93B' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") bottom center / 74% 12px no-repeat;
}
.subline { margin: 10px auto 0; max-width: 360px; text-wrap: balance; font-size: 16px; line-height: 1.4; font-weight: 500; color: var(--white-soft); }

/* The sun dial */
.sun-dial { position: relative; width: min(300px, 82vw); aspect-ratio: 1; margin: 14px auto -34px; }
.dial-svg { width: 100%; height: 100%; overflow: visible; display: block; }
#rays line { stroke: var(--sun-2); stroke-width: 5; stroke-linecap: round; opacity: 0.38; transition: opacity 0.3s ease, stroke 0.3s ease; }
#rays line.lit { opacity: 1; stroke: var(--sun-1); }
.arc-bg { fill: none; stroke: rgba(255,255,255,0.28); stroke-width: 14; stroke-linecap: round; }
.arc-fg { fill: none; stroke: url(#arcGrad); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 559.3; stroke-dashoffset: 559.3; transition: stroke-dashoffset 0.18s linear;
  filter: drop-shadow(0 0 6px rgba(255,210,80,0.7)); }
#tickLabels text { fill: var(--white); font-size: 12px; font-weight: 700; opacity: 0.85; text-anchor: middle; dominant-baseline: middle; font-family: var(--font); }
.sun-core {
  position: absolute; inset: 27%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--navy);
  background: radial-gradient(circle at 36% 30%, #FFFBE0 0%, var(--sun-1) 22%, var(--sun-2) 60%, var(--sun-3) 100%);
  box-shadow: 0 0 0 7px rgba(255,240,170,0.28), 0 0 50px rgba(255,220,90,0.7), 0 0 90px rgba(255,240,190,0.45);
}
body.running .sun-core { animation: sun-breathe 1.8s ease-in-out infinite; }
@keyframes sun-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.read-value { font-size: 44px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.read-unit { font-size: 13px; font-weight: 700; margin-top: 4px; color: var(--navy-soft); }
.phase { margin-top: 6px; font-size: 18px; font-weight: 700; min-height: 24px; text-shadow: 0 2px 10px rgba(20,90,170,0.22); }

/* Start button — sunny pill with a gradient outline */
.cta {
  position: relative; margin: 16px auto 0; display: block; min-width: 230px; padding: 17px 34px;
  border: none; border-radius: 999px; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: var(--navy);
  background: linear-gradient(180deg, var(--sun-1), var(--sun-2) 55%, var(--sun-3));
  box-shadow: 0 10px 24px rgba(255,170,30,0.45), inset 0 2px 0 rgba(255,255,255,0.7);
  transition: transform 0.3s var(--spring), opacity 0.2s;
}
.cta::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 2.5px; pointer-events: none;
  background: linear-gradient(135deg, var(--white), var(--sun-hot) 50%, var(--white));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.cta:active { transform: scale(0.95); }
.cta:disabled { opacity: 0.75; cursor: default; }

.room-pick { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--white-soft); }
.room-pick select {
  appearance: none; -webkit-appearance: none; border-radius: 999px; padding: 8px 32px 8px 14px; font-weight: 700; color: var(--white);
  background: var(--glass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 11px center / 13px no-repeat;
  border: 1.5px solid var(--glass-edge);
}
.room-pick option { color: var(--navy); }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.stat-pill {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 12px; border-radius: 24px;
  background: var(--glass); border: 1.5px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 8px 22px rgba(20,90,170,0.12);
  transition: transform 0.35s var(--spring), background 0.3s;
}
.stat-pill.active { background: rgba(255,255,255,0.34); transform: scale(1.05); }
.stat-pill .pi { width: 26px; height: 26px; color: var(--sun-1); }
.ptxt { display: flex; flex-direction: column; line-height: 1.15; }
.pv { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.pv small { font-size: 13px; font-weight: 700; letter-spacing: 0; margin-left: 3px; opacity: 0.85; }
.pl { font-size: 13px; font-weight: 600; opacity: 0.9; }
.stat-sub { margin: 10px 0 0; font-size: 14px; color: var(--white-soft); min-height: 18px; }

/* ═══ Cards ═══ */
.cards { max-width: 560px; margin: 0 auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 40px); display: flex; flex-direction: column; gap: 16px; }
.card {
  position: relative; border-radius: 28px; padding: 20px; background: var(--tile); box-shadow: var(--shadow);
}
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(150deg, rgba(255,255,255,1), rgba(255,206,110,0.75) 55%, rgba(255,150,70,0.6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card-label {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  font-size: 19px; font-weight: 800; letter-spacing: -0.015em; color: var(--navy);
}
.card-label::before { content: ''; width: 4px; height: 20px; border-radius: 4px; flex-shrink: 0; background: linear-gradient(180deg, var(--sun-2), var(--sun-hot)); }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head .card-label { margin-bottom: 14px; }
.hint { margin: 0; font-size: 15px; line-height: 1.5; color: var(--navy-soft); }
.text-btn { border: none; background: none; font-weight: 700; font-size: 15px; color: var(--sun-hot); padding: 6px 4px; margin-bottom: 12px; }
.text-btn.confirm { color: var(--low); }

/* Verdict card */
.verdict {
  background:
    repeating-conic-gradient(from 195deg at 100% 0%, rgba(255,210,60,0.45) 0deg 4deg, transparent 4deg 16deg) top right / 110px 96px no-repeat,
    radial-gradient(circle at 100% 0%, rgba(255,226,120,0.9) 0%, rgba(255,236,170,0.5) 22%, transparent 42%),
    linear-gradient(160deg, #FFFFFF 0%, #FFFBEC 55%, #FFF3CC 100%);
  overflow: hidden;
}
.v-big { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; margin: 0 0 4px; }
.v-small { margin: 0 0 14px; font-size: 15px; color: var(--navy-soft); line-height: 1.45; }
.uses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.uses li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,0.75); }
.uses .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; font-weight: 900; font-size: 17px; }
.uses .good .ic { background: var(--good-bg); color: var(--good); }
.uses .ok .ic { background: var(--ok-bg); color: var(--ok); }
.uses .low .ic { background: var(--low-bg); color: var(--low); }
.uses .t { font-weight: 700; font-size: 15.5px; }
.uses .d { font-size: 13.5px; color: var(--navy-soft); margin-top: 1px; }
.dl-times { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dl-times div { padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,0.75); }
.dl-times b { display: block; font-size: 17px; letter-spacing: -0.01em; }
.dl-times span { font-size: 13px; color: var(--navy-soft); }

/* Plan card */
.plan-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; font-size: 15px; margin-bottom: 14px; }
.plan-row input {
  width: 110px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--warm-2); background: var(--warm-1);
  font-size: 18px; font-weight: 800; outline: none;
}
.plan-row input:focus { border-color: var(--sun-3); }
.plan-unit { color: var(--navy-soft); }
.meter { height: 16px; border-radius: 999px; background: var(--warm-1); overflow: hidden; margin: 10px 0 8px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sun-2), var(--sun-hot)); transition: width 0.6s var(--spring); }
.plan-big { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

/* Rooms + history bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.bar-row .name { font-weight: 700; font-size: 15.5px; }
.bar-row .name small { font-weight: 500; color: var(--navy-soft); font-size: 13px; margin-left: 6px; }
.bar-row .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.bar-row .meter { grid-column: 1 / -1; height: 12px; margin: 0; }
.bar-row.best .name::after { content: 'Best spot'; margin-left: 8px; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--sun-2); color: var(--navy); vertical-align: 2px; }
.room-tip { margin: 14px 0 0; font-size: 14.5px; color: var(--navy-soft); line-height: 1.45; }

.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 0; border-top: 1px solid var(--warm-1); }
.hist li:first-child { border-top: none; padding-top: 0; }
.hist .when { font-weight: 700; font-size: 15px; }
.hist .where { font-size: 13px; color: var(--navy-soft); }
.hist .nums { grid-row: 1 / 3; grid-column: 2; text-align: right; font-size: 14px; color: var(--navy-soft); align-self: center; font-variant-numeric: tabular-nums; }
.hist .nums b { color: var(--navy); font-size: 17px; }
.more-btn { margin-top: 10px; border: none; background: var(--warm-1); border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 14px; }

/* Connection */
.conn { margin: 0; display: flex; flex-direction: column; }
.conn div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--warm-1); }
.conn div:first-child { border-top: none; padding-top: 0; }
.conn dt { color: var(--navy-soft); font-weight: 600; }
.conn dd { margin: 0; font-weight: 700; text-align: right; }

/* Private + help */
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ticks li { position: relative; padding-left: 34px; font-size: 15.5px; line-height: 1.45; }
.ticks li::before {
  content: '✓'; position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; font-size: 13px; background: var(--good-bg); color: var(--good);
}
.help > summary { list-style: none; cursor: pointer; margin: 0; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::after { content: '›'; margin-left: auto; font-size: 26px; line-height: 1; color: var(--sun-hot); transition: transform 0.3s var(--spring); }
.help[open] > summary::after { transform: rotate(90deg); }
.help:not([open]) > summary { margin-bottom: 0; }
.explain { margin: 4px 0 0; }
.explain dt { font-weight: 800; margin-top: 12px; }
.explain dd { margin: 3px 0 0; color: var(--navy-soft); line-height: 1.5; font-size: 15px; }

.foot { text-align: center; font-size: 13px; color: var(--navy-soft); padding: 4px 0 10px; }

.version-pill {
  position: fixed; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 50;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.7); color: var(--navy-soft); pointer-events: none;
}

@media (max-width: 370px) {
  .headline { font-size: 40px; }
  .pv { font-size: 22px; }
  .read-value { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .sky-cloud, body.running .sun-core { animation: none; }
}
