/* Ya na rabote — common UI */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e4e8f0;
  --accent: #315efb;
  --accent-2: #2448c8;
  --accent-soft: #e9efff;
  --success: #14804a;
  --danger: #c93737;
  --warning: #9a6700;
  --shadow: 0 14px 40px rgba(24, 39, 75, .08);
  --radius: 20px;
  --radius-sm: 12px;
  --max: 1180px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #171d2a;
  --surface-2: #1e2635;
  --text: #edf1f7;
  --muted: #a7b0c0;
  --line: #2b3547;
  --accent: #7c9cff;
  --accent-2: #9ab1ff;
  --accent-soft: #222f55;
  --success: #5bc98f;
  --danger: #ff7c7c;
  --warning: #f6c85f;
  --shadow: 0 18px 45px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.container { width: min(var(--max), calc(100% - 32px)); margin-inline: auto; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 68px; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: white; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 9px 11px; border-radius: 10px; font-weight: 650; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.icon-btn:hover { border-color: var(--accent); }
.hero { padding: 72px 0 36px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 36px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 7px 11px; font-size: .88rem; font-weight: 750; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.025em; }
h1 { font-size: clamp(2.3rem, 7vw, 4.7rem); margin: 18px 0 16px; }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin: 0 0 10px; }
h3 { margin-top: 0; }
.lead { color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); max-width: 760px; }
.hero-panel, .panel, .tool-shell { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.hero-panel { padding: 24px; }
.quick-list { display: grid; gap: 12px; margin-top: 16px; }
.quick-item { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface-2); border-radius: 14px; }
.quick-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); }
.search-wrap { position: relative; margin-top: 28px; max-width: 760px; }
.search-input { width: 100%; min-height: 58px; padding: 14px 108px 14px 48px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); outline: none; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.search-icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; background: var(--surface-2); padding: 4px 8px; font-size: .78rem; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 7px 11px; font-size: .88rem; }
.section { padding: 28px 0 54px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head p { color: var(--muted); margin: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.filter-btn { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 8px 12px; }
.filter-btn.is-active { background: var(--accent); color: white; border-color: var(--accent); }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-height: 190px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; overflow: hidden; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tool-card-link { display: block; height: 100%; padding: 22px; color: inherit; text-decoration: none; }
.tool-card-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); font-size: 1.45rem; margin-bottom: 18px; }
.tool-card-icon--compact { font-size: .72rem; letter-spacing: -.04em; white-space: nowrap; }
.tool-card h3 { font-size: 1.12rem; margin: 0 42px 8px 0; }
.tool-card p { margin: 0; color: var(--muted); font-size: .94rem; }
.tool-card .tag { display: inline-flex; margin-top: 14px; color: var(--accent); font-size: .78rem; font-weight: 700; }
.fav-btn { position: absolute; top: 15px; right: 15px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); z-index: 2; }
.fav-btn.is-favorite { color: #e49b13; background: #fff3cf; }
:root[data-theme="dark"] .fav-btn.is-favorite { background: #453713; }
.empty-state { display: none; padding: 26px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.empty-state.is-visible { display: block; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.feature strong { display: block; margin-bottom: 6px; }
.feature span { color: var(--muted); }
.site-footer { padding: 30px 0 46px; color: var(--muted); }
.footer-inner { border-top: 1px solid var(--line); padding-top: 24px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Tool pages */
.tool-page { padding: 34px 0 60px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; margin-bottom: 18px; }
.breadcrumb:hover { color: var(--accent); }
.tool-hero { margin-bottom: 22px; }
.tool-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 10px 0 8px; }
.tool-hero p { color: var(--muted); max-width: 780px; margin: 0; }
.tool-shell { padding: clamp(18px, 4vw, 30px); }
.tool-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: .93rem; }
.field small, .hint { color: var(--muted); }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); padding: 11px 12px; outline: none; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.textarea { min-height: 180px; resize: vertical; font-family: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.btn { border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--text); padding: 10px 14px; font-weight: 700; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { color: var(--danger); }
.result { margin-top: 18px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 16px; }
.result:empty { display: none; }
.result-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-row:last-child { border-bottom: 0; }
.result-row code { flex: 1; overflow-wrap: anywhere; }
.check-grid { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 10px 0; }
.check { display: inline-flex; align-items: center; gap: 7px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.metric { padding: 12px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; }
.metric strong { display: block; font-size: 1.25rem; }
.metric span { color: var(--muted); font-size: .8rem; }
.notice { padding: 13px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); margin: 14px 0; }
.notice.warning { background: color-mix(in srgb, #ffc107 18%, var(--surface)); }
.notice.error { background: color-mix(in srgb, #e74747 14%, var(--surface)); color: var(--danger); }
.status-ok { color: var(--success); }
.status-error { color: var(--danger); }
.segmented { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 8px 11px; border-radius: 9px; }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.highlight-box { min-height: 130px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 14px; }
.char-lat { color: #d54848; background: color-mix(in srgb, #d54848 10%, transparent); border-radius: 3px; }
.char-cyr { color: #16844c; background: color-mix(in srgb, #16844c 9%, transparent); border-radius: 3px; }
.char-suspicious { outline: 1px solid #e6a817; outline-offset: 1px; }
.progress { height: 9px; border-radius: 999px; overflow: hidden; background: var(--line); margin: 8px 0; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .82rem; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.qr-output { min-height: 260px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 16px; background: white; padding: 20px; }
.qr-output img, .qr-output canvas { max-width: 100%; height: auto; }
.radio-stations { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 14px; }
.station-btn { text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); padding: 11px 12px; }
.station-btn:hover, .station-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
audio { width: 100%; margin-top: 12px; }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px,4vw,40px); box-shadow: var(--shadow); }
.article img { max-width: 100%; height: auto; }
.article pre, .article code { white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-list { display: grid; gap: 12px; }
.archive-item { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.archive-item h3 { margin-bottom: 6px; }
.archive-item p { color: var(--muted); margin: 0 0 10px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; max-width: min(360px, calc(100% - 36px)); padding: 12px 15px; border-radius: 12px; background: #172033; color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .hero-grid, .tool-columns { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .feature-grid { grid-template-columns: 1fr; }
  .nav a { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .container { width: min(100% - 20px, var(--max)); }
  .header-inner { min-height: 60px; }
  .brand { font-size: .96rem; }
  .brand-mark { width: 32px; height: 32px; }
  .hero { padding-top: 42px; }
  .tool-grid { grid-template-columns: 1fr; }
  .hero-panel { display: none; }
  .search-input { padding-right: 48px; }
  .kbd { display: none; }
  .tool-shell { border-radius: 16px; }
  .radio-stations { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}


/* Quick-start links */
a.quick-item {
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
a.quick-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft);
}
a.quick-item::after {
  content: "→";
  margin-left: auto;
  color: var(--accent);
  font-weight: 800;
}
.kbd {
  font-family: inherit;
  cursor: pointer;
}

.now-playing {
  margin: 14px 0 4px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 14px;
  background: var(--accent-soft);
}
.now-playing-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.now-playing strong {
  display: block;
  margin-top: 7px;
  font-size: 1.08rem;
  line-height: 1.35;
}
.live-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #e34747;
  box-shadow: 0 0 0 4px color-mix(in srgb, #e34747 16%, transparent);
}

.radio-groups { display: grid; gap: 18px; margin-top: 14px; }
.radio-group { display: grid; gap: 9px; }
.radio-group-title { margin: 0; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.radio-group-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.station-btn { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.station-name { min-width: 0; }
.station-note { flex: 0 0 auto; font-size: .72rem; color: #b26a00; background: color-mix(in srgb, #ffc107 18%, var(--surface)); border-radius: 999px; padding: 2px 7px; }
@media (max-width: 620px) { .radio-group-list { grid-template-columns: 1fr; } }

/* Quiet footer link: small, readable and keyboard-accessible. */
.footer-privacy-link {
  margin-left: auto;
  font-size: .76rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  opacity: .86;
}
.footer-privacy-link:hover,
.footer-privacy-link:focus-visible {
  opacity: 1;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Privacy document uses the shared site's existing light/dark theme. */
.privacy-document { line-height: 1.75; }
.privacy-document h2 { margin: 1.6em 0 .4em; font-size: 1.17rem; }
.privacy-document h2:first-of-type { margin-top: .8em; }
.privacy-document ul { padding-left: 1.5rem; }
.privacy-document li + li { margin-top: .2em; }
.privacy-document p { margin: .8em 0; }
.privacy-document a { color: var(--accent); }
.privacy-contact-placeholder { color: var(--muted); }

/* v8.5 — compact sticky radio player on phones/tablets */
.radio-layout { align-items: start; }
.radio-player-panel { min-width: 0; }
.radio-playback-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.radio-playback-tools #radioConnectionStatus { color: var(--muted); font-size: .8rem; }
.radio-reconnect { font-size: .8rem; padding: 6px 9px; }
.radio-reconnect:disabled { opacity: .45; cursor: not-allowed; }
.qr-color-pair { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.qr-color-input { width: 100%; height: 46px; padding: 4px; cursor: pointer; }
.qr-output canvas { display: block; max-width: 100%; height: auto; border-radius: 8px; }
@media (max-width: 900px) {
  .radio-layout { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .radio-player-panel {
    order: -1;
    position: sticky;
    top: 72px;
    z-index: 35;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
  }
  .radio-station-panel { order: 0; }
  .radio-player-panel > h3 { font-size: 1rem; margin: 0; }
  .radio-player-panel #stationUrl,
  .radio-player-panel .notice { display: none; }
  .radio-player-panel .now-playing { margin: 7px 0 0; padding: 7px 10px; }
  .radio-player-panel .now-playing strong {
    margin-top: 2px; font-size: .92rem; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .radio-player-panel .now-playing-label { font-size: .68rem; }
  .radio-player-panel #officialRadioLinkWrap { margin: 4px 0 !important; font-size: .75rem; }
  .radio-player-panel audio { margin-top: 6px; height: 44px; }
  .radio-player-panel .radio-playback-tools { margin-top: 3px; }
  .radio-player-panel .radio-playback-tools #radioConnectionStatus { font-size: .72rem; }
}
@media (max-width: 620px) {
  .radio-player-panel { top: 64px; }
  .qr-color-pair { gap: 8px; }
}

/* v8.5.1: radio player is first in HTML so mobile order works even if
   responsive rules are delayed; preserve the desktop two-column layout. */
@media (min-width: 901px) {
  .radio-layout > .radio-station-panel { grid-column: 1; grid-row: 1; }
  .radio-layout > .radio-player-panel { grid-column: 2; grid-row: 1; }
}
@media (max-width: 900px) {
  .radio-layout > .radio-player-panel { order: 0; }
  .radio-layout > .radio-station-panel { order: 1; }
}
