/* Löwe Data Attack – styles. Themes via [data-theme] on <html>; layout switches at 1024px. */
:root, [data-theme="light"] {
  --bg: #eef2f4; --surface: #ffffff; --surface2: #f6f8f9; --text: #0f1a20; --muted: #4b5a63;
  --border: #d5dde2; --accent: #0e7490; --accent-text: #ffffff; --chip-bg: #e3eef1; --chip-text: #0b5568;
  --court: #f4ecdf; --paint: #ecdfca; --line: #8f8a82; --rim: #c2410c;
  --lmade: #15803d; --lmiss: #dc2626; --omade: #1d4ed8; --omiss: #7e22ce; --to: #c2410c;
  --heat-empty: #e4e9ec; --shade: rgba(15,26,32,.45); --shadow: 0 -8px 30px rgba(0,0,0,.18);
  --logo-ring: none;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0e11; --surface: #141b20; --surface2: #1b242a; --text: #e8eef2; --muted: #9fb1bc;
  --border: #2a363e; --accent: #22b3cf; --accent-text: #04161b; --chip-bg: #173039; --chip-text: #8fe1f2;
  --court: #11181c; --paint: #172126; --line: #5b6b74; --rim: #fb923c;
  --lmade: #4ade80; --lmiss: #f87171; --omade: #60a5fa; --omiss: #c084fc; --to: #fb923c;
  --heat-empty: #1e272d; --shade: rgba(0,0,0,.6); --shadow: 0 -8px 30px rgba(0,0,0,.5);
  --logo-ring: 0 0 0 2px #e8eef2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.45 Inter, system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cond { font-family: "Barlow Condensed", Inter, sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top img { width: 42px; height: 42px; border-radius: 50%; box-shadow: var(--logo-ring); flex: none; }
.brand { flex: 1; min-width: 0; }
.brand h1 { margin: 0; font: 700 22px/1.05 "Barlow Condensed", sans-serif; letter-spacing: .02em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; min-width: 44px; min-height: 40px; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.seg.round { border-radius: 999px; }
.iconbtn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; flex: none; color: var(--text); }

/* ---------- layout ---------- */
.layout { max-width: 1440px; margin: 0 auto; padding: 14px 16px 32px; display: flex; gap: 24px; align-items: flex-start; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel { display: none; }
@media (min-width: 1024px) {
  .top { padding: 14px 28px; }
  .top img { width: 48px; height: 48px; }
  .brand h1 { font-size: 26px; }
  .brand p { font-size: 13px; }
  .layout { padding: 24px 28px 40px; }
  .panel { display: block; flex: 0 0 300px; position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px 16px 16px; }
  .filter-open-btn { display: none !important; }
}

/* ---------- toolbar, chips, legend ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; background: var(--chip-bg);
  color: var(--chip-text); font-size: 12px; font-weight: 600; }
.filter-open-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-text); font-weight: 700; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; font-weight: 500; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.scale { display: inline-flex; border-radius: 3px; overflow: hidden; }
.scale i { width: 20px; height: 12px; display: block; }

/* ---------- court ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px; }
.court-wrap { display: flex; flex-direction: column; gap: 6px; }
.court-wrap.vertical { max-width: 560px; width: 100%; margin: 0 auto; }
.attack { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.attack-row { display: flex; justify-content: space-between; }
.court svg { display: block; width: 100%; height: auto; }
.court svg .mk { cursor: help; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- stats cards and table ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { flex: 1 1 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px; }
.stat h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.nums { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.nums div { display: flex; flex-direction: column; gap: 2px; }
.nums small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nums b { font: 700 26px/1 "Barlow Condensed", sans-serif; }
.tablecard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px 6px 10px; }
.tablecard h2 { margin: 10px 10px 4px; font: 700 20px "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .03em; }
.tscroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-size: 14px; }
thead th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
th[scope="row"], thead th:first-child { text-align: left; }
tr.total th, tr.total td { font-weight: 700; }
.note { margin: 8px 10px 0; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .top { gap: 8px; padding: 10px 12px; }
  .brand h1 { font-size: 20px; }
  .seg.round button { min-width: 40px; padding: 0 8px; }
  th, td { padding: 8px 6px; font-size: 13px; }
  thead th { font-size: 10px; letter-spacing: .03em; }
  .nums b { font-size: 24px; }
}

/* ---------- filters (shared by side panel and bottom sheet) ---------- */
.fhead { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; }
.fhead h2 { margin: 0; font: 700 22px "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .03em; }
.linkbtn { border: 0; background: transparent; color: var(--accent); font-weight: 600; min-height: 44px; padding: 0 8px; }
details.fs { border-bottom: 1px solid var(--border); }
details.fs > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 4px; font-weight: 700; cursor: pointer; }
details.fs > summary::-webkit-details-marker { display: none; }
details.fs > summary .cnt { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--muted); }
details.fs > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); margin: 0 4px 0 6px; transition: transform .15s; }
details.fs[open] > summary::after { transform: rotate(45deg); }
.fbody { padding: 0 4px 12px; display: flex; flex-direction: column; }
.fbody.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.fbody label.ck { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; cursor: pointer; }
.fbody label.ck input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.fbody .sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.fbody select { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 10px; font-weight: 600; margin-bottom: 8px; }
.qbtns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.qbtns button { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; }
.qbtns button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* bottom sheet (phones / tablets) */
.sheet-shade { position: fixed; inset: 0; background: var(--shade); z-index: 40; display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow); max-height: 85vh; display: none; flex-direction: column; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet.open, .sheet-shade.open { display: flex; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--border); align-self: center; margin: 4px 0 6px; }
.sheet .sbody { overflow: auto; flex: 1; min-height: 0; }
.sheet .apply { min-height: 50px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 700; margin-top: 8px; }
@media (min-width: 1024px) { .sheet, .sheet-shade { display: none !important; } }
