/* Світло Кропивницький
   Ідея: сторінка сама «вмикається» і «гасне» разом зі світлом вашої черги.
   Жовтий — світло є, нічний індиго — світла немає. Ці два кольори означають одне й те саме всюди. */

:root {
  --lamp: #FFC93C;        /* світло є */
  --lamp-soft: #FFE38A;
  --night: #201D47;       /* світла немає */
  --night-2: #2C2862;
  --alert: #E8552B;       /* зміни в графіку */

  --bg: #FFF4C7;
  --surface: #FFFBEA;
  --ink: #201D47;
  --muted: #5E5A85;
  --line: rgba(32, 29, 71, .14);
  --off-seg: var(--night);
  --on-seg: var(--lamp);

  --f-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --max: 1060px;
  color-scheme: light;
}

body[data-state="off"] {
  --bg: #1A1840;
  --surface: #24215A;
  --ink: #F3F0FF;
  --muted: #ABA6DA;
  --line: rgba(243, 240, 255, .14);
  --off-seg: #0F0D2B;
  color-scheme: dark;
}
body[data-state="none"] { --bg: #F5F1E4; --surface: #FFFDF5; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 500 1rem/1.55 var(--f-body);
  color: var(--ink);
  background: var(--bg);
  transition: background-color .6s ease, color .6s ease;
  min-height: 100vh;
}
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

a { color: inherit; text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; border-radius: 6px; }
body[data-state="off"] :focus-visible { outline-color: var(--lamp-soft); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- Шапка ---------- */
.top {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 6px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1rem/1 var(--f-display); letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; flex: none; }
@media (max-width: 420px) { .brand { font-size: .84rem; white-space: nowrap; gap: 8px; } .brand-mark { width: 22px; height: 22px; } .queue-btn { padding: 9px 12px; } }
.bm-ring { fill: var(--lamp); stroke: var(--night); stroke-width: 2.5; }
.bm-half { fill: var(--night); }
body[data-state="off"] .bm-ring { stroke: var(--ink); }

.queue-btn {
  font: 600 .95rem/1 var(--f-body); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 10px 16px; cursor: pointer; min-height: 44px;
}
.queue-btn b { font-family: var(--f-display); font-weight: 700; margin-left: 4px; }
.queue-btn:hover { border-color: var(--ink); }

main { max-width: var(--max); margin: 0 auto; padding: 0 20px 40px; }
.page-h1 { font: 600 .95rem/1.4 var(--f-body); color: var(--muted); margin: 6px 0 18px; }
@media (min-width: 640px) { body:has(#picker:not([hidden])) .page-h1 { text-align: center; } }

/* ---------- Вибір черги ---------- */
.picker { padding: 8px 0 28px; max-width: 560px; margin: 0 auto; }
.picker-h { font: 800 clamp(2rem, 7vw, 3.2rem)/1.02 var(--f-display); letter-spacing: -.03em; margin: 0 0 12px; }
.picker-sub { margin: 0 0 24px; font-size: 1.08rem; max-width: 34em; }
.picker-grid { display: grid; gap: 10px; }
.picker-row { display: grid; grid-template-columns: 2.2rem 1fr 1fr; gap: 10px; align-items: center; }
.picker-g { font: 700 1.1rem/1 var(--f-display); color: var(--muted); text-align: center; }
.picker-btn {
  font: 700 1.35rem/1 var(--f-display); color: var(--night);
  background: var(--lamp); border: 0; border-radius: 16px;
  min-height: 64px; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(32, 29, 71, .18);
  transition: transform .12s ease, background-color .12s ease;
}
.picker-btn:hover { background: var(--lamp-soft); }
.picker-btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(32, 29, 71, .18); }
.picker-btn.is-current { background: var(--night); color: var(--lamp); }
/* багато груп (Київ — 60, Дніпро ДТЕК — 18) — компактна сітка */
.picker-flat { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.picker-flat .picker-btn { min-height: 50px; font-size: 1.02rem; border-radius: 12px; }
@media (max-width: 400px) { .picker-flat { grid-template-columns: repeat(5, 1fr); } }
/* кілька операторів в одному місті */
.picker-section + .picker-section { margin-top: 22px; }
.picker-section { display: grid; gap: 10px; }
.picker-section-h { margin: 0; font: 700 1rem/1.3 var(--f-display); }

/* посилання на інші міста (і для людей, і для пошуку) */
.cities { margin-top: 40px; max-width: 40em; }
.cities h2 { font: 700 1.1rem/1.2 var(--f-display); margin: 0 0 10px; }
.cities ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cities a { display: inline-block; padding: 9px 14px; border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: .93rem; }
.cities a:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* питання-відповіді */
.faq { margin-top: 40px; max-width: 46em; }
.faq h2 { font: 700 1.25rem/1.2 var(--f-display); margin: 0 0 10px; }
.faq details { background: var(--surface); border-radius: 14px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 8px 0 0; }

/* службові сторінки */
.doc { max-width: 44em; }
.doc h1 { margin-top: 18px; }
.doc h2 { font: 700 1.2rem/1.25 var(--f-display); margin: 28px 0 8px; }
.doc p, .doc li { line-height: 1.6; }
.doc-list { padding-left: 1.2em; }
.doc-date { color: var(--muted); font-size: .9rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* сторінка вибору міста */
.hub { max-width: 640px; }
.hub .picker-h { margin-top: 18px; }
.hub-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.hub-card { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: 18px; background: var(--lamp); color: var(--night); text-decoration: none; box-shadow: inset 0 -4px 0 rgba(32, 29, 71, .16); }
.hub-card b { font: 800 1.5rem/1.1 var(--f-display); letter-spacing: -.02em; }
.hub-card span { font-weight: 600; opacity: .8; }
.hub-card:hover { background: var(--lamp-soft); }
.hub-h { font: 700 1.15rem/1.2 var(--f-display); margin: 30px 0 0; }
.hub-list .hub-card b { font-size: 1.25rem; }
@media (min-width: 640px) { .hub { max-width: 980px; } .hub-list { grid-template-columns: repeat(3, 1fr); } }

.picker-help { color: var(--muted); font-size: .92rem; margin: 14px 0 0; max-width: 34em; }
.find { margin-top: 26px; padding: 18px; border-radius: 20px; background: var(--surface); border: 1.5px dashed var(--line); }
.find-h { margin: 0 0 4px; font: 700 1.1rem/1.25 var(--f-display); }
.find-sub { margin: 0 0 14px; font-size: .95rem; max-width: 34em; }
.find-links { display: flex; flex-wrap: wrap; gap: 10px; }
.find-btn {
  display: inline-flex; align-items: center; min-height: 46px; padding: 10px 16px; border-radius: 12px;
  background: var(--night); color: #FFF4C7; font-weight: 700; text-decoration: none;
}
.find-btn:hover { background: var(--night-2); }
.find-btn.is-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.find-btn.is-ghost:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.link-btn { margin-top: 16px; background: none; border: 0; padding: 8px 0; font: 600 1rem var(--f-body); color: var(--ink); text-decoration: underline; cursor: pointer; }

/* ---------- Мій графік ---------- */
.mine {
  display: grid; gap: 8px 40px;
  grid-template-columns: 1fr;
  grid-template-areas: "hero" "dial" "days";
}
@media (min-width: 860px) {
  .mine { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); grid-template-areas: "hero dial" "days dial"; align-items: start; }
}
.hero { grid-area: hero; padding: 4px 0 8px; }
.hero-q { margin: 0 0 6px; font-weight: 600; color: var(--muted); }
.hero-state {
  margin: 0;
  font: 800 clamp(3.1rem, 13vw, 6.4rem)/.95 var(--f-display);
  letter-spacing: -.045em;
}
body[data-state="on"] .hero-state { text-shadow: 0 0 .5em rgba(255, 201, 60, .55); }
.hero-next { margin: 16px 0 0; font: 600 clamp(1.25rem, 4.2vw, 1.6rem)/1.3 var(--f-body); max-width: 24em; }
.hero-count { display: block; font-weight: 500; color: var(--muted); font-size: .8em; margin-top: 2px; }
.hero-change {
  display: inline-block; margin: 16px 0 0; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--alert) 14%, transparent);
  border-left: 4px solid var(--alert); font-size: .95rem; max-width: 34em;
}

.dial-wrap { grid-area: dial; margin: 0; justify-self: center; width: min(100%, 380px); }
.dial { display: block; width: 100%; height: auto; overflow: visible; }
.dial-base { fill: none; stroke: var(--on-seg); }
.dial-base.is-unknown { stroke: var(--line); }
.dial-on { fill: none; stroke: var(--on-seg); stroke-linecap: butt; }
.dial-off { fill: none; stroke: var(--off-seg); stroke-linecap: butt; }
body[data-state="off"] .dial-off { stroke: #0B0A22; }
.dial-tick { stroke: var(--muted); stroke-width: 1; opacity: .55; }
.dial-tick.is-major { stroke-width: 2; opacity: 1; }
.dial-num { fill: var(--muted); font: 600 11px var(--f-body); text-anchor: middle; dominant-baseline: middle; }
.dial-hand { stroke: var(--alert); stroke-width: 3; stroke-linecap: round; }
.dial-hand-dot { fill: var(--alert); }
.dial-time { fill: var(--ink); font: 700 30px var(--f-display); text-anchor: middle; letter-spacing: -.02em; }
.dial-sub { fill: var(--muted); font: 600 12.5px var(--f-body); text-anchor: middle; }
.dial-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.days { grid-area: days; display: grid; gap: 14px; margin-top: 10px; }
@media (min-width: 600px) and (max-width: 859px) { .days { grid-template-columns: 1fr 1fr; } }
.day { background: var(--surface); border-radius: 20px; padding: 18px 18px 16px; }
.day h2 { margin: 0 0 14px; font: 700 1.15rem/1.2 var(--f-display); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.day-date { font: 600 .92rem var(--f-body); color: var(--muted); }
.day-empty { margin: 0; color: var(--muted); }
.ranges { list-style: none; padding: 0; margin: 14px 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.ranges li {
  font: 600 1.02rem/1 var(--f-body); font-variant-numeric: tabular-nums;
  padding: 9px 12px; border-radius: 10px; background: var(--off-seg); color: #F3F0FF;
}
.ranges li.is-now { box-shadow: 0 0 0 3px var(--alert); }
.ranges li.is-free { background: var(--on-seg); color: var(--night); }
.day-total { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

.tg-link {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 20px;
  background: var(--night); color: #F3F0FF; text-decoration: none;
}
body[data-state="off"] .tg-link { background: var(--lamp); color: var(--night); }
.tg-link svg { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.tg-link span { font-size: .92rem; line-height: 1.35; }
.tg-link b { display: block; font: 700 1.05rem/1.3 var(--f-display); margin-bottom: 2px; }
.tg-link:hover { filter: brightness(1.12); }

/* картка «застосунок для Android» */
.app-card {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 22px;
  text-decoration: none; color: var(--night);
  background: linear-gradient(135deg, var(--lamp) 0%, #FFD966 100%);
  box-shadow: inset 0 -4px 0 rgba(32, 29, 71, .14);
}
.picker .app-card { margin-top: 14px; }
.app-card:hover .app-btn { background: var(--night-2); }
.app-card:hover .app-phone { transform: rotate(-4deg) translateY(-2px); }
.app-phone { width: 62px; height: 100px; flex: none; transition: transform .25s ease; transform: rotate(-8deg); }
@media (prefers-reduced-motion: reduce) { .app-phone, .app-card:hover .app-phone { transition: none; } }
.ap-body { fill: var(--night); }
.ap-screen { fill: #2C2862; }
.ap-widget { fill: #FFF4C7; }
.ap-ring { fill: none; stroke: var(--lamp); stroke-width: 3.2; }
.ap-off { fill: none; stroke: var(--night); stroke-width: 3.4; }
.ap-line { fill: var(--night); }
.ap-line-alt { fill: #E8552B; }
.ap-icons rect { fill: rgba(255, 244, 199, .22); }
.app-text { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; line-height: 1.35; }
.app-text b { font: 700 1.08rem/1.25 var(--f-display); }
.app-btn {
  align-self: flex-start; display: inline-flex; align-items: baseline; gap: 8px; margin-top: 8px;
  padding: 10px 16px; border-radius: 12px; background: var(--night); color: #FFF4C7; font-weight: 700;
}
.app-btn small { font-weight: 500; opacity: .7; font-size: .8rem; }
body[data-state="off"] .app-card { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
body[data-state="off"] .app-btn { background: var(--lamp); color: var(--night); }
html.is-ios .app-card { display: none; }

/* смужка доби */
.strip {
  position: relative; height: 22px; border-radius: 6px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(100% / 24 - 1px), rgba(32, 29, 71, .16) calc(100% / 24 - 1px) calc(100% / 24)),
    var(--on-seg);
}
.strip-off { position: absolute; top: 0; bottom: 0; background: var(--off-seg); }
body[data-state="off"] .strip { box-shadow: inset 0 0 0 1.5px rgba(243, 240, 255, .28); }
body[data-state="off"] .strip-off { background: repeating-linear-gradient(135deg, #0B0A22 0 4px, #15133A 4px 8px); }
.strip-now { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: var(--alert); border-radius: 2px; }
.strip-scale { display: flex; justify-content: space-between; font: 600 .72rem var(--f-body); color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Повідомлення ---------- */
.notice { margin: 28px 0 0; padding: 14px 18px; border-radius: 16px; border-left: 4px solid var(--alert); background: var(--surface); max-width: 760px; }
.notice p { margin: 0; }
.notice-h { font-weight: 700; margin-bottom: 6px !important; }

/* ---------- Усі черги ---------- */
.all { margin-top: 44px; }
.all h2 { font: 700 clamp(1.25rem, 3.6vw, 1.6rem)/1.2 var(--f-display); letter-spacing: -.02em; margin: 0 0 4px; }
.all-asof { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.aq-wrap { overflow-x: auto; }
.aq { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.aq th, .aq td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.aq thead th { font: 600 .8rem var(--f-body); color: var(--muted); border-bottom-width: 1.5px; }
.aq tbody th { font: 700 1rem var(--f-display); width: 3.6rem; }
.aq-strip { width: 38%; min-width: 150px; }
.aq-hours { display: flex; justify-content: space-between; }
.aq-text { font-size: .93rem; }
.aq-sum { white-space: nowrap; color: var(--muted); font-weight: 600; text-align: right !important; }
.aq tr.is-mine th, .aq tr.is-mine td { background: color-mix(in srgb, var(--lamp) 30%, transparent); }
body[data-state="off"] .aq tr.is-mine th, body[data-state="off"] .aq tr.is-mine td { background: var(--night-2); }
.aq tr.is-mine th:first-child { border-radius: 10px 0 0 10px; }
.aq tr.is-mine td:last-child { border-radius: 0 10px 10px 0; }
.aq .strip { height: 16px; border-radius: 4px; }
@media (max-width: 599px) {
  .aq thead { display: none; }
  .aq, .aq tbody, .aq tr { display: block; }
  .aq tr { display: grid; grid-template-columns: 3rem 1fr auto; grid-template-areas: "q strip sum" "q text text"; gap: 6px 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
  .aq th, .aq td { border: 0; padding: 0; }
  .aq tbody th { grid-area: q; align-self: center; }
  .aq-strip { grid-area: strip; width: auto; min-width: 0; align-self: center; }
  .aq-text { grid-area: text; font-size: .88rem; color: var(--muted); }
  .aq-sum { grid-area: sum; }
  .aq tr.is-mine { border-radius: 12px; background: color-mix(in srgb, var(--lamp) 30%, transparent); }
  body[data-state="off"] .aq tr.is-mine { background: var(--night-2); }
  .aq tr.is-mine th, .aq tr.is-mine td { background: none !important; }
}

/* ---------- Про сайт і підвал ---------- */
.about { margin-top: 48px; max-width: 40em; }
.about h2 { font: 700 1.25rem/1.2 var(--f-display); margin: 0 0 10px; }
.about p { margin: 0 0 10px; }
.foot { max-width: var(--max); margin: 0 auto; padding: 22px 20px max(28px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.foot p { margin: 0 0 6px; max-width: 52em; }
