/* UdesQuake — Sismik İstihbarat Paneli
   Dark-first, mobile-first operasyonel panel stil katmanı.
   Mevcut udesquake.com.tr sayfalarından bağımsızdır; hiçbir global stili ezmez. */

:root {
  --bg-0: #070a10;
  --bg-1: #0c111a;
  --bg-2: #111827;
  --bg-3: #18202f;
  --line: #1f2a3c;
  --line-soft: #16202e;
  --txt-0: #e8eef7;
  --txt-1: #9fb0c6;
  --txt-2: #64748b;
  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --ok: #22c55e;
  --warn: #f59e0b;
  --crit: #ef4444;
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .55);
  --glass: rgba(17, 24, 39, .72);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --header-h: 56px;
  --rail-h: 52px;
}

:root[data-theme="light"] {
  --bg-0: #eef2f7; --bg-1: #ffffff; --bg-2: #f5f8fc; --bg-3: #e8eef6;
  --line: #d3dceb; --line-soft: #e3eaf4;
  --txt-0: #0f172a; --txt-1: #475569; --txt-2: #7b8798;
  --glass: rgba(255, 255, 255, .86);
  --shadow: 0 18px 45px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--bg-0); color: var(--txt-0);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }

.app {
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  width: 100%; height: 100vh; height: 100dvh;
  min-width: 0; min-height: 0;
  overflow: hidden;
}

/* ─────────── Header ─────────── */
.hdr {
  display: flex; align-items: center; gap: 14px;
  min-width: 0; overflow: hidden;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--line);
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(34, 211, 238, .6); animation: pulse 2.4s infinite;
}
.brand small { color: var(--txt-2); font-weight: 600; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,211,238,.55); }
  70% { box-shadow: 0 0 0 11px rgba(34,211,238,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,211,238,0); }
}

.hdr-stats { display: flex; flex: 1 1 auto; min-width: 0; gap: 8px; margin-left: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.hdr-stats::-webkit-scrollbar { display: none; }
.kpi {
  display: flex; flex: 0 0 auto; flex-direction: column; gap: 1px;
  min-width: 0; max-width: 180px;
  padding: 5px 11px; border-radius: var(--radius-sm);
  background: var(--bg-3); border: 1px solid var(--line-soft); white-space: nowrap;
}
.kpi b { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi span { font-size: 9.5px; color: var(--txt-2); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.kpi.crit b { color: var(--crit); }
.kpi.warn b { color: var(--warn); }
.kpi.ok b { color: var(--ok); }

.hdr-right { margin-left: auto; display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg-3); border: 1px solid var(--line-soft);
  color: var(--txt-1); font-size: 15px; transition: .16s;
}
.icon-btn:hover { color: var(--txt-0); border-color: var(--accent-dim); transform: translateY(-1px); }
.icon-btn.on { color: var(--accent); border-color: var(--accent-dim); background: rgba(34,211,238,.1); }

.live-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: var(--ok);
}
.live-pill.stale { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.35); color: var(--warn); }
.live-pill.down { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35); color: var(--crit); }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }

/* ─────────── Body ─────────── */
.body {
  position: relative; display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 358px;
  min-width: 0; min-height: 0;
  overflow: hidden;
}

.panel {
  position: relative;
  min-width: 0; min-height: 0; height: 100%;
  background: var(--bg-1); border-right: 1px solid var(--line);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.panel::-webkit-scrollbar { width: 7px; }
.panel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.panel.right { border-right: 0; border-left: 1px solid var(--line); }

.sec { border-bottom: 1px solid var(--line-soft); }
.sec-h {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; font-size: 10.5px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase; color: var(--txt-2);
}
.sec-h:hover { color: var(--txt-1); }
.sec-h .chev { margin-left: auto; transition: transform .2s; font-size: 9px; }
.sec.collapsed .chev { transform: rotate(-90deg); }
.sec.collapsed .sec-b { display: none; }
.sec-b { padding: 0 14px 15px; display: flex; flex-direction: column; gap: 11px; }

.lbl { font-size: 10.5px; font-weight: 700; color: var(--txt-2); text-transform: uppercase; letter-spacing: .6px; display: flex; justify-content: space-between; align-items: center; }
.lbl b { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 11.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
  background: var(--bg-3); border: 1px solid var(--line-soft); color: var(--txt-1); transition: .14s;
}
.chip:hover { border-color: var(--accent-dim); color: var(--txt-0); }
.chip.on { background: rgba(34,211,238,.14); border-color: var(--accent); color: var(--accent); }
.chip .n { opacity: .6; font-size: 10px; margin-left: 3px; font-variant-numeric: tabular-nums; }

.range { display: flex; align-items: center; gap: 9px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 3px;
  background: var(--bg-3); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-1); cursor: grab;
  box-shadow: 0 1px 6px rgba(0,0,0,.5);
}
input[type=range]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg-1); cursor: grab;
}

.txtin, select.txtin {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--bg-3); border: 1px solid var(--line-soft);
  color: var(--txt-0); font-size: 12.5px; outline: none; transition: .14s;
}
.txtin:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,211,238,.11); }
.txtin::placeholder { color: var(--txt-2); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.switch span { font-size: 12.5px; color: var(--txt-1); display: flex; align-items: center; gap: 8px; }
.switch .sw { width: 36px; height: 20px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); position: relative; transition: .18s; flex: 0 0 auto; }
.switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--txt-2); transition: .18s; }
.switch.on .sw { background: rgba(34,211,238,.22); border-color: var(--accent); }
.switch.on .sw::after { transform: translateX(16px); background: var(--accent); }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }

.btn {
  padding: 9px 13px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--txt-1); transition: .14s;
}
.btn:hover { border-color: var(--accent-dim); color: var(--txt-0); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: #04191d; border-color: transparent; }
.btn.wide { width: 100%; }
.btn-row { display: flex; gap: 7px; }
.btn-row .btn { flex: 1; }

/* ─────────── Map ─────────── */
.map-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-0); }
#map { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0; background: var(--bg-0); }
.leaflet-container { background: var(--bg-0) !important; font-family: var(--sans) !important; }
.leaflet-control-attribution {
  background: rgba(7,10,16,.78) !important; color: var(--txt-2) !important;
  font-size: 9.5px !important; backdrop-filter: blur(6px);
}
.leaflet-control-attribution a { color: var(--txt-1) !important; }
.leaflet-bar a { background: var(--bg-2) !important; color: var(--txt-0) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--bg-3) !important; }

/* Event markers: size represents magnitude, fill represents depth. */
.uq-marker-label {
  width: max-content;
  padding: 2px 5px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  color: #f8fafc;
  background: rgba(4,10,18,.78);
  box-shadow: 0 1px 5px rgba(0,0,0,.65);
  font: 800 10px var(--sans);
  line-height: 1.15;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

/* The newest event receives two persistent red radar rings. CSS animation
   avoids a JavaScript interval per marker and remains active after refreshes. */
.uq-latest-event-icon { background: transparent !important; border: 0 !important; }
.uq-latest-pulse { position: relative; width: 100%; height: 100%; pointer-events: none; }
.uq-latest-pulse::before,
.uq-latest-pulse::after,
.uq-latest-pulse span,
.uq-latest-pulse i {
  content: "";
  position: absolute;
  inset: 50%;
  width: 16px;
  height: 16px;
  margin: -8px;
  border: 2px solid #ff3030;
  border-radius: 50%;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(70,0,0,.52), 0 0 14px rgba(255,35,35,.65);
}
.uq-latest-pulse::before { animation: uqLatestPulse 2.35s cubic-bezier(.12,.65,.25,1) infinite; }
.uq-latest-pulse::after { animation: uqLatestPulse 2.35s cubic-bezier(.12,.65,.25,1) .78s infinite; }
.uq-latest-pulse span { width: 9px; height: 9px; margin: -4.5px; border: 0; background: #ff3030; box-shadow: 0 0 12px #ff3030; animation: uqLatestCore 1.15s ease-in-out infinite alternate; }
.uq-latest-pulse i { display: none; }
@keyframes uqLatestPulse {
  0% { transform: scale(.75); opacity: 1; }
  76%,100% { transform: scale(4.1); opacity: 0; }
}
@keyframes uqLatestCore { from { transform: scale(.85); opacity:.7; } to { transform: scale(1.22); opacity:1; } }

.map-ov { position: absolute; z-index: 500; pointer-events: none; }
.map-ov > * { pointer-events: auto; }
.ov-tl { top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; }
.ov-tr { top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.ov-bl { bottom: 14px; left: 12px; right: 12px; }
.ov-br { bottom: 14px; right: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.glass {
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

.styles-pop { padding: 8px; display: none; grid-template-columns: repeat(2, 1fr); gap: 5px; max-width: 290px; }
.styles-pop.open { display: grid; }
.style-item { padding: 7px 9px; border-radius: 8px; font-size: 11px; font-weight: 600; color: var(--txt-1); background: var(--bg-3); border: 1px solid transparent; text-align: left; }
.style-item:hover { color: var(--txt-0); }
.style-item.on { border-color: var(--accent); color: var(--accent); background: rgba(34,211,238,.12); }

.legend { padding: 11px 13px; font-size: 10.5px; max-width: 216px; }
.legend h5 { margin: 0 0 7px; font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--txt-2); font-weight: 800; }
.legend .row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--txt-1); }
.legend .sw { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.legend .mags { display: flex; align-items: flex-end; gap: 7px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.legend .mags div { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--txt-2); font-size: 9px; }
.legend .mags i { display: block; border-radius: 50%; background: rgba(34,211,238,.28); border: 1.4px solid var(--accent); }

.scrub { padding: 9px 13px 11px; width: min(660px, 100%); max-width: 100%; display: none; }
.scrub.open { display: block; }
.scrub-top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.scrub-time { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.scrub-meta { font-size: 10.5px; color: var(--txt-2); margin-left: auto; font-variant-numeric: tabular-nums; }
.play-btn { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #04191d; display: grid; place-items: center; font-size: 12px; flex: 0 0 auto; }
.speeds { display: flex; gap: 3px; }
.speeds button { padding: 3px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; color: var(--txt-2); background: var(--bg-3); }
.speeds button.on { color: var(--accent); background: rgba(34,211,238,.14); }

.toast-wrap { position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 7px; align-items: center; pointer-events: none; }
.toast {
  padding: 9px 15px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line);
  box-shadow: var(--shadow); animation: drop .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.alert { border-color: rgba(239,68,68,.5); color: #fecaca; background: rgba(69,10,10,.85); }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(.95); } }

/* ─────────── Event list ─────────── */
.list-head { padding: 11px 14px; display: flex; min-width: 0; align-items: center; gap: 7px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg-1); z-index: 5; }
.list-head b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--txt-2); font-weight: 800; }
.list-head .cnt { flex: 0 0 auto; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: var(--txt-2); font-variant-numeric: tabular-nums; }
.list-head select { flex: 0 1 92px; min-width: 0; max-width: 92px; }

.ev {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 11px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: .12s;
}
.ev:hover { background: var(--bg-2); }
.ev.sel { background: rgba(34,211,238,.09); box-shadow: inset 3px 0 0 var(--accent); }
.ev.new { animation: flashin 2.4s ease-out; }
@keyframes flashin { 0%,18% { background: rgba(239,68,68,.24); } 100% { background: transparent; } }
.ev .mag {
  width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.ev .m { min-width: 0; }
.ev .m b { display: block; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .m span { font-size: 10.5px; color: var(--txt-2); display: flex; gap: 7px; margin-top: 2px; flex-wrap: wrap; }
.ev .t { font-size: 10px; color: var(--txt-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.src-tag { padding: 1px 5px; border-radius: 4px; background: var(--bg-3); font-size: 9px; font-weight: 700; letter-spacing: .3px; color: var(--txt-1); }
.multi-tag { color: var(--ok); background: rgba(34,197,94,.13); }

.empty { padding: 34px 18px; text-align: center; color: var(--txt-2); font-size: 12.5px; line-height: 1.7; }

/* ─────────── Detail ─────────── */
.detail { position: absolute; inset: 0; background: var(--bg-1); z-index: 20; overflow-y: auto; display: none; }
.detail.open { display: block; }
.det-hero { padding: 16px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.det-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 82% -14%, rgba(34,211,238,.15), transparent 62%); }
.det-hero > * { position: relative; }
.det-back { font-size: 11.5px; color: var(--txt-2); font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.det-back:hover { color: var(--accent); }
.det-mag { display: flex; align-items: center; gap: 13px; }
.det-mag .big { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.det-mag .lv { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.det-loc { font-size: 15px; font-weight: 700; margin-top: 11px; line-height: 1.35; }
.det-time { font-size: 11.5px; color: var(--txt-2); margin-top: 4px; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; }
.cell { min-width: 0; overflow: hidden; overflow-wrap: anywhere; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 11px; }
.cell span { font-size: 9.5px; color: var(--txt-2); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; display: block; }
.cell b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; display: block; margin-top: 3px; }
.cell small { font-size: 10px; color: var(--txt-2); font-weight: 600; }

.det-sec { padding: 0 14px 15px; }
.det-sec h4 { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--txt-2); font-weight: 800; margin: 4px 0 9px; }
.ai-box { background: linear-gradient(135deg, rgba(167,139,250,.09), rgba(34,211,238,.06)); border: 1px solid rgba(167,139,250,.25); border-radius: var(--radius-sm); padding: 12px; font-size: 12.5px; line-height: 1.68; color: var(--txt-1); }
.ai-box b { color: var(--txt-0); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--purple); margin-bottom: 7px; }
.disclaim { font-size: 10px; color: var(--txt-2); margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); line-height: 1.55; }

.bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 11.5px; }
.bar-row .nm { width: 84px; color: var(--txt-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .tr { flex: 1; height: 7px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.bar-row .fl { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .5s; }
.bar-row .vl { width: 52px; text-align: right; color: var(--txt-2); font-variant-numeric: tabular-nums; font-size: 10.5px; }

.mmi-scale { display: flex; gap: 2px; margin-top: 7px; }
.mmi-scale div { flex: 1; height: 21px; display: grid; place-items: center; font-size: 8.5px; font-weight: 800; color: rgba(0,0,0,.6); border-radius: 3px; opacity: .28; transition: .25s; }
.mmi-scale div.on { opacity: 1; transform: scaleY(1.28); box-shadow: 0 0 11px rgba(255,255,255,.22); }

/* ─────────── Charts ─────────── */
.chart-card { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px; margin-bottom: 9px; }
.chart-card h5 { margin: 0 0 9px; font-size: 10px; letter-spacing: .9px; text-transform: uppercase; color: var(--txt-2); font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.chart-card h5 em { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 11px; }
.chart-card canvas { width: 100%; display: block; }

.src-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.src-row:last-child { border-bottom: 0; }
.src-row .st { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.src-row .nm { flex: 1; font-weight: 600; }
.src-row .vl { font-size: 10.5px; color: var(--txt-2); font-variant-numeric: tabular-nums; }

/* ─────────── Mobile ─────────── */
.rail { display: none; }
.sheet-grab { display: none; }

@media (max-width: 1280px) {
  .body { grid-template-columns: 280px minmax(0, 1fr) 318px; }
  .kpi:nth-child(4), .kpi:nth-child(6) { display: none; }
}

@media (max-width: 1040px) and (min-width: 941px) {
  .body { grid-template-columns: 250px minmax(0, 1fr) 300px; }
  .hdr { gap: 9px; padding-inline: 10px; }
  .kpi { padding-inline: 8px; }
  .kpi:nth-child(3) { display: none; }
  .panel .sec-b { padding-inline: 11px; }
}

@media (max-width: 940px) {
  .app { grid-template-rows: var(--header-h) minmax(0, 1fr) var(--rail-h); }
  .body { grid-template-columns: minmax(0, 1fr); }
  .hdr-stats { display: none; }

  .panel {
    position: absolute; inset: 26px 0 0; width: 100%; height: auto; z-index: 40; border: 0;
    transform: translateY(105%); transition: transform .3s cubic-bezier(.2,.85,.3,1);
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  }
  .panel.open { transform: translateY(0); }
  .sheet-grab { display: block; width: 38px; height: 4px; border-radius: 3px; background: var(--line); margin: 9px auto 3px; }

  .rail {
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--bg-1); border-top: 1px solid var(--line); z-index: 70;
  }
  .rail button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 9px; font-weight: 700; color: var(--txt-2); letter-spacing: .3px;
  }
  .rail button i { font-size: 16px; font-style: normal; }
  .rail button.on { color: var(--accent); }

  .ov-tr { top: 10px; right: 10px; }
  .ov-tl { top: 10px; left: 10px; }
  .legend { display: none; }
  .scrub { width: 100%; }
  .scrub-top { gap: 7px; }
  .scrub-time { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .scrub-meta { display: none; }
}

@media (max-width: 560px) {
  .hdr { gap: 7px; padding-inline: 8px; }
  .brand { font-size: 13px; line-height: 1.05; }
  .brand small { font-size: 8.5px; letter-spacing: .35px; }
  .hdr-right { gap: 5px; }
  .live-pill { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .live-pill span { display: none; }
  .icon-btn { width: 32px; height: 32px; }
  #btnFocus { display: none; }
  .styles-pop { max-width: calc(100vw - 20px); grid-template-columns: 1fr; max-height: 62vh; overflow-y: auto; }
  .toast-wrap { width: calc(100vw - 20px); }
  .toast { max-width: 100%; border-radius: 12px; text-align: center; }
  .ev { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; padding: 9px 10px; }
  .ev .mag { width: 42px; height: 42px; }
  .list-head { padding-inline: 10px; }
  .list-head .cnt { max-width: 48px; }
  .grid2 { gap: 7px; padding: 10px; }
  .det-sec { padding-inline: 10px; }
}

@media (max-width: 370px) {
  .brand small { display: none; }
  .speeds button { padding-inline: 5px; }
  .scrub-time { font-size: 10px; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
