*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Светлая тема (по умолчанию) ── */
:root {
    color-scheme: light;
    --bg:        #f3f5f9;
    --surface:   #ffffff;
    --surface-2: #f6f8fb;
    --line:      #e3e7ee;
    --text:      #0f172a;
    --text-2:    #475569;
    --text-3:    #64748b;
    --accent:    #2563eb;
    --accent-bg: #e8efff;
    --accent-2:  #7c3aed;
    --green:     #15803d;  --green-bg:  #dcfce7;  --green-solid:  #16a34a;
    --yellow:    #a16207;  --yellow-bg: #fef3c7;  --yellow-solid: #eab308;
    --red:       #b91c1c;  --red-bg:    #fee2e2;  --red-solid:    #dc2626;
    --shadow:    0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
    --radius:    16px;
}
/* ── Тёмная тема ── */
:root[data-theme=dark] {
    color-scheme: dark;
    --bg:        #0b0f17;
    --surface:   #141a24;
    --surface-2: #1b2230;
    --line:      #273042;
    --text:      #f1f5f9;
    --text-2:    #b4bfcf;
    --text-3:    #8a96a8;
    --accent:    #60a5fa;
    --accent-bg: #1c2a44;
    --accent-2:  #c084fc;
    --green:     #4ade80;  --green-bg:  #12301f;  --green-solid:  #22c55e;
    --yellow:    #facc15;  --yellow-bg: #332a0b;  --yellow-solid: #eab308;
    --red:       #f87171;  --red-bg:    #3a1515;  --red-solid:    #ef4444;
    --shadow:    0 1px 2px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme=light]) {
        color-scheme: dark;
        --bg:        #0b0f17;
        --surface:   #141a24;
        --surface-2: #1b2230;
        --line:      #273042;
        --text:      #f1f5f9;
        --text-2:    #b4bfcf;
        --text-3:    #8a96a8;
        --accent:    #60a5fa;
            --accent-bg: #1c2a44;
        --accent-2:  #c084fc;
        --green:     #4ade80;  --green-bg:  #12301f;  --green-solid:  #22c55e;
        --yellow:    #facc15;  --yellow-bg: #332a0b;  --yellow-solid: #eab308;
        --red:       #f87171;  --red-bg:    #3a1515;  --red-solid:    #ef4444;
        --shadow:    0 1px 2px rgba(0,0,0,.4);
    }
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
    min-height: 100vh;
    transition: background .2s, color .2s;
}
.num { font-variant-numeric: tabular-nums; }

/* Цвета текста (используются и в логе) */
.green  { color: var(--green); }
.yellow { color: var(--yellow); }
.red    { color: var(--red); }
.cyan   { color: var(--accent); }
.muted  { color: var(--text-3); }
.bold   { font-weight: 650; }

.wrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 40px; }

/* ── Шапка ── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: -16px -16px 16px; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -14px rgba(0,0,0,.35); }
.mini-status {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 650;
    background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.topbar.show-mini .mini-status { opacity: 1; transform: none; }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--text-3); }
.mini-status[data-state=online]  { color: var(--green);  background: var(--green-bg); }
.mini-status[data-state=partial] { color: var(--yellow); background: var(--yellow-bg); }
.mini-status[data-state=offline] { color: var(--red);    background: var(--red-bg); }
.mini-status[data-state=online]  .mini-dot { background: var(--green); }
.mini-status[data-state=partial] .mini-dot { background: var(--yellow); }
.mini-status[data-state=offline] .mini-dot { background: var(--red); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
#mini-text { overflow: hidden; text-overflow: ellipsis; }
.top-run { min-width: 0; padding: 9px 16px; height: 40px; font-size: .9rem; white-space: nowrap; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font-size: 1.15rem; cursor: pointer; box-shadow: var(--shadow);
}
.icon-btn:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Баннеры ── */
.banner {
    display: none; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px;
    font-size: .9rem; font-weight: 500;
}
#bg-banner    { background: var(--yellow-bg); color: var(--yellow); }
#audio-banner { background: var(--accent-bg); color: var(--accent); cursor: pointer; border: 0; width: 100%; text-align: left; font: inherit; font-weight: 600; }

/* ── Карточки ── */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ── Главный статус ── */
.hero {
    display: flex; align-items: center; gap: 18px;
    padding: 22px; margin-bottom: 14px;
    border-width: 2px; transition: background .25s, border-color .25s;
}
.hero[data-state=online]  { background: var(--green-bg);  border-color: var(--green-solid); }
.hero[data-state=partial] { background: var(--yellow-bg); border-color: var(--yellow-solid); }
.hero[data-state=offline] { background: var(--red-bg);    border-color: var(--red-solid); }
.dot {
    flex: none; width: 56px; height: 56px; border-radius: 50%;
    background: var(--text-3); position: relative;
}
.dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: inherit; animation: ping 1.8s ease-out infinite;
}
.hero[data-state=online]  .dot { background: var(--green-solid); }
.hero[data-state=partial] .dot { background: var(--yellow-solid); }
.hero[data-state=offline] .dot { background: var(--red-solid); }
.hero[data-state=offline] .dot::after { animation-duration: .9s; }
.hero[data-state=paused]  .dot::after { animation: none; }
@keyframes ping { from { transform: scale(1); opacity: .45; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot::after { animation: none; } }

.hero-main { flex: 1; min-width: 0; }
#hero-label { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.hero[data-state=online]  #hero-label { color: var(--green); }
.hero[data-state=partial] #hero-label { color: var(--yellow); }
.hero[data-state=offline] #hero-label { color: var(--red); }
#hero-hint { color: var(--text-2); font-size: .92rem; margin-top: 2px; }
.hero-dur { text-align: right; flex: none; }
#hero-dur { font-size: 1.5rem; font-weight: 700; }
#hero-since { color: var(--text-2); font-size: .82rem; }

/* ── Метрики ── */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.metric { padding: 14px 16px; position: relative; overflow: hidden; cursor: help; }
.metric::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.metric[data-tone=green]::before  { background: var(--green-solid); }
.metric[data-tone=yellow]::before { background: var(--yellow-solid); }
.metric[data-tone=red]::before    { background: var(--red-solid); }
.m-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
/* ── Значок «?» — один стиль для всех подсказок на сайте (класс .qmark), размер — переменная --q ── */
.qmark {
    --q: 16px;
    display: inline-grid; place-items: center; flex: none; box-sizing: border-box;
    width: var(--q); height: var(--q); padding: 0; border-radius: 50%;
    border: 1px solid currentColor; background: none; color: inherit;
    font-family: inherit; font-size: calc(var(--q) * .66); font-weight: 700; line-height: 1;
    letter-spacing: 0; text-transform: none; vertical-align: 1px; opacity: .6;
}
.m-info { color: var(--text-3); opacity: 1; margin-left: 3px; }
.m-verdict { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.m-verdict:empty { display: none; }
.metric[data-tone=green]  .m-verdict { background: var(--green-bg);  color: var(--green); }
.metric[data-tone=yellow] .m-verdict { background: var(--yellow-bg); color: var(--yellow); }
.metric[data-tone=red]    .m-verdict { background: var(--red-bg);    color: var(--red); }
.help { margin: -2px 0 14px; padding: 0 16px; }
.help summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--accent); font-size: .92rem; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; padding: 0 0 16px; font-size: .88rem; color: var(--text-2); }
.help-grid b { color: var(--text); }
@media (max-width: 760px) { .help-grid { grid-template-columns: 1fr; } }
.m-label { white-space: nowrap; color: var(--text-2); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.m-value { font-size: 1.75rem; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-value small { font-size: .85rem; font-weight: 500; color: var(--text-2); }
.metric[data-tone=green]  .m-value { color: var(--green); }
.metric[data-tone=yellow] .m-value { color: var(--yellow); }
.metric[data-tone=red]    .m-value { color: var(--red); }
#m-speed .m-value { font-size: 1.2rem; color: var(--text); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; white-space: normal; }
.m-sub { color: var(--text-3); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-text { animation: fade 1.2s ease-in-out infinite alternate; color: var(--accent); }
@keyframes fade { from { opacity: 1; } to { opacity: .35; } }

/* ── График и IP ── */
.row2 { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin-bottom: 14px; }
.section { padding: 16px; }
.section-title { margin: 0 0 10px; font-size: .8rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; }
#chart { width: 100%; height: 120px; display: block; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: .78rem; color: var(--text-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
#ip-addr { font-size: 1.3rem; font-weight: 700; color: var(--accent); word-break: break-all; font-variant-numeric: tabular-nums; }
#ip-meta { color: var(--text-2); font-size: .88rem; margin-top: 4px; }

/* ── Управление ── */
.ctl-label { font-size: .8rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
    border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: .88rem; font-weight: 550;
    padding: 7px 12px; border-radius: 9px; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.range-row { display: flex; align-items: center; gap: 10px; }
input[type=range] { flex: 1; min-width: 100px; accent-color: var(--accent); cursor: pointer; height: 24px; }
#interval-val { font-weight: 650; min-width: 64px; font-variant-numeric: tabular-nums; }
.run-btn {
    border: 0; border-radius: 12px; padding: 12px 22px; font: inherit; font-weight: 650; font-size: .95rem;
    cursor: pointer; color: #fff; background: var(--accent); min-width: 120px;
}
.run-btn[data-kind=stop] { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.run-btn:hover { filter: brightness(1.08); }
.run-btn[data-kind=start] { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* ── Лог ── */
.log-card { overflow: hidden; }
.log-card .section-title { padding: 16px 16px 0; }
#log-empty { padding: 4px 16px 18px; color: var(--text-3); font-size: .9rem; }
.log-entry {
    display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: baseline;
    padding: 10px 16px; border-top: 1px solid var(--line); font-size: .92rem;
}
.log-entry time { color: var(--text-3); font-size: .82rem; font-variant-numeric: tabular-nums; }
.log-icon { text-align: center; font-weight: 700; }
.log-entry.ev-lost      { background: var(--red-bg); }
.log-entry.ev-recovered { background: var(--green-bg); }
.log-entry.ev-partial   { background: var(--yellow-bg); }

.foot { text-align: center; color: var(--text-3); font-size: .8rem; margin-top: 18px; }
.foot .build { float: right; opacity: .6; }

/* ── Адаптив ── */
@media (max-width: 760px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .wrap { padding: 12px 12px 32px; }
    .hero { padding: 16px; gap: 14px; }
    .dot { width: 40px; height: 40px; }
    #hero-label { font-size: 1.35rem; }
    #hero-dur { font-size: 1.15rem; }
    .m-value { font-size: 1.45rem; }
    .brand-name { display: none; }
    .topbar { margin: -12px -12px 14px; padding: 8px 12px; gap: 8px; }
    .top-actions { gap: 6px; }
    .top-run { padding: 9px 12px; }
    .mini-status { display: none; padding: 6px 10px; font-size: .8rem; flex: 1 1 auto; }
    .topbar.show-mini .mini-status { display: flex; }
    .topbar.show-mini .brand { display: none; }
}

/* ── Шапка: заголовок и язык ── */
.titles { margin: -4px 0 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.titles .lang-select { flex: none; }
.titles h1 { font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; }
.titles p { color: var(--text-2); font-size: .92rem; }
.lang-select, .ctl-select {
    height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font: inherit; font-size: .9rem; padding: 0 10px; box-shadow: var(--shadow); cursor: pointer; max-width: 160px;
}
.ctl-select { box-shadow: none; background: var(--surface-2); max-width: none; width: 100%; }
.sub-btn {
    height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    font: inherit; font-size: .88rem; font-weight: 600; padding: 0 14px; cursor: pointer; white-space: nowrap;
}
.sub-btn:hover { border-color: var(--accent); }
.sub-btn:disabled { opacity: .5; cursor: default; }
.spin {
    display: inline-block; width: .85em; height: .85em; margin-right: 6px; vertical-align: -.1em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .run-btn[data-kind=start], .mini-status .mini-dot { animation: none !important; } }
.sub-btn[aria-pressed=true] { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl-row { display: flex; gap: 8px; align-items: center; }
.controls2 { padding: 16px; margin-bottom: 14px; columns: 2; column-gap: 14px; }
.grp { border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px 14px; margin: 0 0 14px; min-width: 0; display: grid; gap: 16px; break-inside: avoid; }
.grp:last-child { margin-bottom: 0; }
.grp-title { font-weight: 700; font-size: .95rem; padding: 0 6px; margin-left: -6px; color: var(--text); }
.ctl { min-width: 0; }
.ctl-target { color: var(--text-2); font-weight: 550; }
.ip-banner { align-items: center; gap: 12px; background: var(--accent-bg); color: var(--text); border: 1px solid var(--accent); }
.ip-banner-icon { font-size: 1.3rem; color: var(--accent); font-weight: 700; }
.ip-banner-text { flex: 1; min-width: 0; line-height: 1.4; }
.log-entry.ev-ip { background: var(--accent-bg); }
.m-err { color: var(--red); font-size: .95rem; font-weight: 650; white-space: normal; }
.m-sub.m-reason { color: var(--text-2); font-size: .78rem; white-space: normal; line-height: 1.3; }
#ip-loc { font-size: 1rem; font-weight: 600; margin-top: 8px; }
#ip-loc .flag { margin-right: 7px; vertical-align: -2px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }

/* ── SEO-текст ── */
.seo { padding: 20px; margin-top: 14px; color: var(--text-2); }
.seo h2 { color: var(--text); font-size: 1.15rem; margin: 0 0 10px; }
.seo h2 + p, .seo p + p { margin-top: 8px; }
.seo h2:not(:first-child) { margin-top: 22px; }
.seo details { border-top: 1px solid var(--line); padding: 10px 0; }
.seo summary { cursor: pointer; color: var(--text); font-weight: 600; }
.seo details p { margin-top: 6px; white-space: pre-line; }
@media (max-width: 760px) { .controls2 { columns: 1; } }

/* ── Статистика по дням ── */
.daily { padding: 16px; margin-top: 14px; }
.daily-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.daily-top .section-title { margin: 0; }
.daily-hint { color: var(--text-3); font-size: .85rem; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#daily-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#daily-table th, #daily-table td { padding: 9px 10px; text-align: right; border-top: 1px solid var(--line); }
#daily-table thead th { color: var(--text-2); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; border-top: 0; white-space: normal; vertical-align: bottom; }
#daily-table th:first-child, #daily-table td:first-child { text-align: left; padding-left: 0; }
#daily-table tbody th { font-weight: 600; color: var(--text); }
#daily-empty { color: var(--text-3); font-size: .9rem; padding: 6px 0; }
.keep ol { padding: 6px 0 4px 20px; color: var(--text-2); font-size: .9rem; }
.keep li + li { margin-top: 6px; }
.keep b { color: var(--text); }

/* Узкие карточки на телефоне: оценка переносится под название */
@media (max-width: 760px) {
    .m-head { flex-wrap: wrap; gap: 4px 6px; }
    .metric { padding: 12px 14px; }
}

/* ── Графики: подсказки при наведении, история скорости ── */
.chart-wrap { position: relative; }
#chart, #speed-chart { touch-action: pan-y; cursor: crosshair; }
#speed-chart { width: 100%; height: 140px; display: block; }
.speed-card { margin-bottom: 14px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: .9rem; text-align: center; padding: 0 16px; }
.chart-empty[hidden] { display: none; }
.chart-tip {
    position: absolute; z-index: 2; pointer-events: none;
    transform: translate(-50%, calc(-100% - 10px));
    background: var(--text); color: var(--bg); border-radius: 8px; box-shadow: var(--shadow);
    padding: 6px 9px; font-size: .8rem; line-height: 1.35; text-align: center;
    max-width: 240px; width: max-content; font-variant-numeric: tabular-nums;
}
.chart-tip.below { transform: translate(-50%, 12px); }
.chart-tip span { display: block; opacity: .75; font-size: .74rem; }
.chart-tip[hidden] { display: none; }

.ctl-note { color: var(--text-3); font-size: .8rem; margin-top: 6px; line-height: 1.35; }

@media (max-width: 420px) { .run-label { display: none; } .top-run { width: 44px; padding: 0; } }
.grp-note { margin-top: 0; color: var(--text-2); }

/* ── Кнопка звука в плавающей панели ── */
.sound-btn {
    height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .9rem;
    cursor: pointer; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.sound-btn:hover { border-color: var(--accent); }
.sound-btn[aria-pressed=false] { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.muted-note { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 8px 12px; font-size: .85rem; font-weight: 600; }

/* ── Карточка скорости: статус и управление ── */
.speed-status { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .9rem; color: var(--text-2); margin: -2px 0 8px; min-height: 1.4em; }
.speed-status b { color: var(--text); font-weight: 650; }
.speed-status .st-now { color: var(--accent); font-weight: 650; }
.speed-status .st-fail { color: var(--red); font-weight: 600; }
.speed-status .st-off { color: var(--yellow); font-weight: 600; }
.speed-ctl { display: grid; grid-template-columns: auto 1fr 1.4fr; gap: 12px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.speed-ctl .ctl-label { display: block; }
.speed-go { height: 42px; padding: 0 20px; min-width: 0; white-space: nowrap; }
.speed-go[data-busy=true] { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.speed-card .ctl-note:first-of-type { margin-top: 10px; }
#m-speed { cursor: pointer; }
@media (max-width: 760px) { .speed-ctl { grid-template-columns: 1fr 1fr; } .speed-go { grid-column: 1 / -1; } }
@media (max-width: 420px) {
    .speed-ctl { grid-template-columns: 1fr; }
    .sound-btn { width: 44px; padding: 0; justify-content: center; }
    .titles .lang-select { max-width: 110px; }
}

/* Загрузка и отдача — везде теми же цветами, что на графике */
.sp-dl { color: var(--accent); }
.sp-ul { color: var(--accent-2); }

/* Переход к блоку: не прятать его верх под плавающей панелью и подсветить по прибытии */
.card { scroll-margin-top: 76px; }
@media (max-width: 420px) { .card { scroll-margin-top: 66px; } }
.card.flash { animation: flash 2.2s ease-out; }
@keyframes flash {
    0%, 35% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); }
    100%    { box-shadow: 0 0 0 3px transparent, 0 0 0 8px transparent; }
}
@media (prefers-reduced-motion: reduce) { .card.flash { animation-duration: 3s; } }

.keep-steps code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
    cursor: copy; position: relative; word-break: break-all;
}
.keep-steps code:hover { border-color: var(--accent); }
.keep-steps code.copied { border-color: var(--green); color: var(--green); }
.keep-steps code.copied::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
    background: var(--text); color: var(--bg); font: 600 .75rem system-ui, sans-serif; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}

/* Пауза / запуск автозамера */
.m-right { display: inline-flex; align-items: center; gap: 6px; }
.m-toggle {
    width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2);
    color: var(--text-2); font-size: .8rem; line-height: 1; cursor: pointer; padding: 0; flex: none;
}
.m-toggle:hover { border-color: var(--accent); color: var(--accent); }
.m-toggle[data-on=false] { color: var(--accent); }
.speed-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.speed-top .speed-status { flex: 1; min-width: 0; }
.speed-toggle { flex: none; margin-top: -6px; white-space: nowrap; }
.speed-toggle[data-on=false] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
@media (max-width: 420px) { .speed-top { flex-direction: column; gap: 6px; } .speed-toggle { margin-top: 0; } }

/* Куда идут проверки */
.chart-targets { font-size: .78rem; color: var(--text-3); margin-top: 6px; }
.help-wide { grid-column: 1 / -1; }

/* Подсказка «?» внутри вариантов звука */
.seg button { position: relative; }
.hint { margin-left: 6px; }
.hint-tip {
    display: none; position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 30;
    width: max-content; max-width: min(280px, 80vw); white-space: normal; text-align: left;
    background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 10px;
    font-size: .82rem; font-weight: 500; line-height: 1.4; box-shadow: var(--shadow); pointer-events: none;
}
.seg button:hover .hint-tip, .seg button:focus-visible .hint-tip { display: block; }
.seg button:hover .hint { opacity: 1; }
@media (hover: none) { .seg button[aria-pressed=true]:focus .hint-tip { display: block; } }
.seg button:last-child .hint-tip { left: auto; right: 0; transform: none; }
.keep-steps .bg-keep { margin: 2px 2px; padding: 2px 10px; font-size: .85rem; vertical-align: baseline; }
.bg-keep[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }
/* Журнал событий — в своём окне со скроллом, чтобы не растягивал страницу */
#log { max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
#log.scrolls { overscroll-behavior: contain; }   /* только когда есть что прокручивать — см. syncLogScroll */
/* FAQ «Для чего использовать» — список с иконками */
.uses { list-style: none; padding: 0; margin: 10px 0 4px; display: grid; gap: 12px; }
.uses li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); font-size: .92rem; line-height: 1.5; }
.uses .use-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--line); font-size: 1.1rem; }
.uses b { color: var(--text); }
.online-when .ctl-select { width: auto; flex: 1 1 auto; min-width: 0; }
.online-when .online-mins { flex: 0 0 auto; }
.online-when .ctl-row { flex-wrap: wrap; }
/* «?» в заголовках таблицы по дням; подсказка — position: fixed, чтобы её не обрезал скролл таблицы */
.th-hint { --q: 13px; margin-left: 3px; cursor: help; }
.th-hint:hover, .th-hint:focus-visible, .th-hint[aria-expanded="true"] { opacity: 1; }
.th-tip {
    position: fixed; z-index: 60; max-width: min(280px, 80vw); white-space: normal; text-align: left;
    background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 10px;
    font-size: .82rem; font-weight: 500; line-height: 1.4; box-shadow: var(--shadow); pointer-events: none;
    text-transform: none; letter-spacing: 0;
}
.th-tip[hidden] { display: none; }
.th-last { white-space: nowrap; }   /* «?» не уезжает на отдельную строку — держится за последнее слово */

/* Колокольчик на кнопке звука: насколько он «включён» */
.bell { display: inline-block; }
.bell-half { -webkit-mask-image: linear-gradient(90deg, #000 50%, rgba(0,0,0,.3) 50%); mask-image: linear-gradient(90deg, #000 50%, rgba(0,0,0,.3) 50%); }
.bell-none { opacity: .3; }

/* Шестерёнка у кнопки звука: появляется при наведении, ведёт к настройкам сигнала */
.sound-wrap { position: relative; display: inline-flex; }
.sound-gear {
    position: absolute; right: -7px; bottom: -7px; width: 22px; height: 22px; padding: 0; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13px; line-height: 1;
    cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center;
    opacity: 0; transform: scale(.7); pointer-events: none; transition: opacity .15s, transform .15s;
}
.sound-wrap:hover .sound-gear, .sound-gear:focus-visible, .sound-btn:focus-visible + .sound-gear { opacity: 1; transform: none; pointer-events: auto; }
.sound-gear:hover { color: var(--accent); border-color: var(--accent); }
@media (hover: none) { .sound-gear { opacity: 1; transform: none; pointer-events: auto; } }   /* на тач-экранах наведения нет — показываем всегда */

/* ── Политика конфиденциальности ── */
a.brand { color: inherit; text-decoration: none; }
.legal h1 { color: var(--text); font-size: 1.6rem; margin: 10px 0 4px; }
.legal ul { margin: 8px 0 0 1.2em; padding: 0; }
.legal li + li { margin-top: 6px; }
.legal ul + p { margin-top: 8px; }
.legal a { color: var(--accent); }

/* Уведомление о cookie внизу экрана */
.cookie-note {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
    width: min(680px, calc(100% - 24px)); display: flex; align-items: center; gap: 14px;
    background: var(--surface); color: var(--text-2); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); padding: 12px 14px 12px 18px; font-size: .88rem; line-height: 1.4;
}
.cookie-note[hidden] { display: none; }
.cookie-note p { margin: 0; flex: 1; }
.cookie-note a, .foot a { color: var(--accent); }
.cookie-note .run-btn { flex: none; min-width: 72px; }
@media (max-width: 480px) { .cookie-note { flex-direction: column; align-items: stretch; bottom: 10px; } }

/* Таблица по дням: время работы под процентом и итог за все дни */
#daily-table .sub { display: block; color: var(--text-3); font-size: .78rem; font-weight: 500; margin-top: 1px; }
#daily-table tfoot th, #daily-table tfoot td { border-top: 2px solid var(--line); font-weight: 650; }
#daily-table tfoot th { color: var(--text); }
