/* m.track.qzq.ai — mobile-first styles. Targets iOS Safari 15+.
   Light/dark via prefers-color-scheme; safe-area aware throughout. */

:root {
  color-scheme: light dark;
  --bg: #f4f1e8;
  --card: #ffffff;
  --ink: #1d211c;
  --dim: #6d6f66;
  --line: #ddd8c9;
  --accent: #7a5b18;
  --accent-ink: #ffffff;
  --chip: #ece7d8;
  --danger: #a03b2e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --card: #181d23;
    --ink: #e8e6df;
    --dim: #96988f;
    --line: #262c33;
    --accent: #d3ab5e;
    --accent-ink: #191405;
    --chip: #20262d;
    --danger: #d97f6e;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Helvetica, Arial, sans-serif;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mark { border-radius: 6px; flex: none; }
.brand-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand { font-weight: 700; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#searchForm { display: flex; gap: 8px; }
#searchForm input {
  flex: 1; min-width: 0;
  font-size: 16px;              /* ≥16px prevents iOS focus zoom */
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  appearance: none; -webkit-appearance: none; outline-offset: 2px;
}
#searchForm button {
  font-size: 15px; font-weight: 600;
  padding: 0 18px; min-height: 44px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
}

.chips {
  display: flex; gap: 8px; margin-top: 10px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chipbtn {
  flex: none;
  font-size: 13px; padding: 8px 14px; min-height: 36px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink);
}
.chipbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.iconbtn {
  width: 44px; height: 44px; flex: none;
  font-size: 17px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}

/* ---------- feed ---------- */
.feed { padding: 12px 14px 20px; max-width: 640px; margin: 0 auto; }
.section-h {
  font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--dim); margin: 16px 2px 8px;
}
.card {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px;
  color: inherit; text-decoration: none;
  font: inherit;
}
.card:active { transform: scale(.985); }
.card .t { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.card .m { font-size: 12.5px; color: var(--dim); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: var(--chip); color: var(--dim);
}
.card .badge.acc { background: var(--accent); color: var(--accent-ink); }

.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--dim); }

.yeargrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.yearbtn {
  min-height: 52px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 16px; font-weight: 600;
}
.yearbtn small { display: block; font-size: 10px; font-weight: 400; color: var(--dim); }

.loadmore {
  display: block; width: 100%; min-height: 48px; margin: 10px 0 4px;
  border-radius: 12px; border: 1px dashed var(--line);
  background: none; color: var(--accent); font-size: 15px; font-weight: 600;
}
.empty { text-align: center; color: var(--dim); padding: 34px 10px; font-size: 14.5px; }
.statusline { font-size: 12px; color: var(--dim); margin: 8px 2px; }

.about p { font-size: 14.5px; line-height: 1.55; color: var(--ink); margin: 10px 0; }
.about a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; min-height: 50px;
  background: none; border: 0; color: var(--dim);
  font-size: 12.5px; font-weight: 600;
}
.tabbar button.on { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .card:active { transform: none; }
}

.stat { color: inherit; text-align: left; font: inherit; }
.about h1 { font-size: 18px; margin-top: 8px; }
.unavailable { font-style: italic; }
a.card:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
