/* ==========================================================================
   GamerVets.com - Precision Arcade Telemetry / Editorial Pro-Gaming Reference
   Est. 2011. Obsidian canvas, hairline architecture, signal-chartreuse accent.
   Geometry: 0-3px radii. No gradients-as-decoration, no heavy shadows.
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. Tokens
   -------------------------------------------------------------------------- */
:root {
  --bg: #090a0d;
  --bg-2: #101217;
  --bg-3: #161922;
  --bg-4: #1c202b;
  --line: #20242e;
  --line-hi: #343b4a;
  --line-max: #4a5366;
  --fg: #f2f4f8;
  --fg-2: #8d96a8;
  --fg-3: #6f7889;
  --ac: #c8ff2e;
  --ac-hi: #d9ff6a;
  --ac-lo: #a6d916;
  --ac-ink: #090a0d;
  --ac-wash: rgba(200, 255, 46, 0.08);
  --ac-wash-2: rgba(200, 255, 46, 0.16);
  --ok: #3ddc84;
  --warn: #ffb020;
  --bad: #ff5a52;
  --info: #5cc8ff;
  --font-head: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1240px;
  --r: 2px;
  --t: 140ms ease;
  --hd-h: 52px;
}

/* --------------------------------------------------------------------------
   02. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  color-scheme: dark;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-padding-top: calc(var(--hd-h) + 12px);
  scrollbar-color: var(--line-hi) var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg);
  font-feature-settings: 'cv11', 'ss01';
}

::selection { background: var(--ac); color: var(--ac-ink); }

a {
  color: var(--fg);
  text-decoration: none;
  transition: color var(--t), border-color var(--t), background-color var(--t);
}
a:hover { color: var(--ac); }

img { max-width: 100%; height: auto; display: block; }

button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { text-wrap: balance; }

:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* --------------------------------------------------------------------------
   03. Header - compact sticky rail (52px desktop / 48px mobile)
   -------------------------------------------------------------------------- */
.hd {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-hi);
}

.hd-in {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  height: var(--hd-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}
.brand:hover { color: var(--fg); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--ac);
  color: var(--ac-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0;
  border-radius: 1px;
  transition: background-color var(--t);
}
.brand:hover .brand-mark { background: var(--ac-hi); }

.brand span em { font-style: normal; color: var(--ac); }

.nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-2);
  border: 0 solid transparent;
  border-top-width: 2px;
  border-bottom-width: 2px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.nav a:hover,
.nav a.active {
  color: var(--fg);
  background: var(--bg-2);
  border-color: transparent;
  border-bottom-color: var(--line-max);
}
.nav a.active {
  color: var(--ac);
  border-bottom-color: var(--ac);
}
.nav a:focus-visible { outline-offset: -3px; }

/* --------------------------------------------------------------------------
   04. Main
   -------------------------------------------------------------------------- */
main { flex: 1; padding: 14px 0 56px; }

/* --------------------------------------------------------------------------
   05. Breadcrumbs
   -------------------------------------------------------------------------- */
.bc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.bc a { color: var(--fg-2); }
.bc a:hover { color: var(--ac); }

/* --------------------------------------------------------------------------
   06. Command Search Strip
   -------------------------------------------------------------------------- */
.cmd-bar {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  padding: 16px 16px 14px;
  margin-bottom: 18px;
}
/* top-left signal rule */
.cmd-bar::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 72px;
  height: 2px;
  background: var(--ac);
}
/* bottom-right registration corner */
.cmd-bar::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-right: 1px solid var(--ac);
  border-bottom: 1px solid var(--ac);
  pointer-events: none;
}

.cmd-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cmd-top h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--fg);
}

.cmd-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.cmd-meta strong { color: var(--ac); font-weight: 700; }

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-row .inp {
  flex: 1 1 180px;
  min-width: 0;
  height: 44px;
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23C8FF2E' stroke-width='1.6' stroke-linecap='square'%3E%3Cpath d='M4 3.5 8.5 8 4 12.5'/%3E%3Cpath d='M9.5 12.5H13'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px 50%;
  background-size: 16px 16px;
}
.search-row .sel {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  height: 44px;
}
.search-row .btn {
  flex: 0 0 auto;
  height: 44px;
  padding-left: 18px;
  padding-right: 18px;
}

/* --------------------------------------------------------------------------
   07. Form controls
   -------------------------------------------------------------------------- */
.inp, .sel {
  width: 100%;
  min-height: 40px;
  background-color: var(--bg);
  border: 1px solid var(--line-hi);
  color: var(--fg);
  padding: 9px 12px;
  font-size: 0.95rem;
  line-height: 1.3;
  border-radius: var(--r);
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.inp:hover, .sel:hover { border-color: var(--line-max); }
.inp:focus, .sel:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 1px var(--ac);
}
.inp::placeholder { color: var(--fg-3); opacity: 1; }

.sel {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%238D96A8' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}
.sel option { background: var(--bg-2); color: var(--fg); }

/* --------------------------------------------------------------------------
   08. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line-hi);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  border-radius: var(--r);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  transition: color var(--t), background-color var(--t), border-color var(--t), transform var(--t);
}
.btn:hover { border-color: var(--ac); color: var(--ac); background: var(--bg-4); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-ac {
  background: var(--ac);
  color: var(--ac-ink);
  border-color: var(--ac);
}
.btn-ac:hover {
  background: var(--ac-hi);
  border-color: var(--ac-hi);
  color: var(--ac-ink);
}
.btn-ac:active { background: var(--ac-lo); border-color: var(--ac-lo); }
.btn-ac:focus-visible { outline-color: var(--fg); }

.btn-sm {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.btn.active {
  background: var(--ac);
  color: var(--ac-ink);
  border-color: var(--ac);
}
.btn.active:hover { background: var(--ac-hi); color: var(--ac-ink); }

/* --------------------------------------------------------------------------
   09. Instant results + quick links
   -------------------------------------------------------------------------- */
.cmd-results {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.cmd-results.open {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
}

.res-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px 9px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-hi);
  border-radius: var(--r);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--fg);
  transition: border-color var(--t), background-color var(--t), color var(--t);
}
.res-item:hover {
  border-color: var(--line-max);
  border-left-color: var(--ac);
  background: var(--bg-3);
  color: var(--fg);
}

.res-tag {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--line-hi);
  border-radius: 1px;
}
.res-item:hover .res-tag { color: var(--ac); border-color: var(--ac); }

.quick-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}
.q-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 1px;
  color: var(--fg-2);
  white-space: nowrap;
}
.q-link:hover {
  border-color: var(--ac);
  color: var(--ac);
  background: var(--ac-wash);
}

/* --------------------------------------------------------------------------
   10. Section headers
   -------------------------------------------------------------------------- */
.sec-hd {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-hi);
}
.sec-hd::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 48px;
  height: 1px;
  background: var(--ac);
}
.sec-hd h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sec-hd h2::before {
  content: '';
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  background: var(--ac);
}
.sec-hd a {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ac);
  border-bottom: 1px solid transparent;
}
.sec-hd a:hover { color: var(--ac-hi); border-bottom-color: var(--ac-hi); }

/* --------------------------------------------------------------------------
   11. Grids + cards
   -------------------------------------------------------------------------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg);
  transition: border-color var(--t), background-color var(--t);
}
.card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 20px;
  height: 2px;
  background: var(--line-max);
  transition: width var(--t), background-color var(--t);
}
.card:hover {
  border-color: var(--line-hi);
  background: var(--bg-3);
  color: var(--fg);
}
.card:hover::before { width: 44px; background: var(--ac); }

.card-kicker {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ac);
  letter-spacing: 0.1em;
}
.card h3 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--fg);
  transition: color var(--t);
}
a.card:hover h3,
.card h3 a:hover { color: var(--ac); }
.card p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--fg-2);
}
.card-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.card-stat strong { color: var(--fg); font-weight: 700; }

/* --------------------------------------------------------------------------
   12. KPI bar - one joined telemetry rail with hairline dividers
   -------------------------------------------------------------------------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 12px 0;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  overflow: hidden;
}
.kpi {
  position: relative;
  min-width: 0;
  padding: 12px 14px 11px;
  background: var(--bg-2);
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  width: 14px;
  height: 2px;
  background: var(--line-max);
}
.kpi:has(.kpi-val.ac)::before { background: var(--ac); }
.kpi:has(.kpi-val.ok)::before { background: var(--ok); }
.kpi:has(.kpi-val.bad)::before { background: var(--bad); }

.kpi-lbl {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-val {
  margin-top: 4px;
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kpi-val.ac { color: var(--ac); }
.kpi-val.ok { color: var(--ok); }
.kpi-val.bad { color: var(--bad); }

/* --------------------------------------------------------------------------
   13. Tables - scroll lives inside .tbl-wrap, never the page
   -------------------------------------------------------------------------- */
.tbl-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  scrollbar-width: thin;
  scrollbar-color: var(--line-hi) var(--bg-2);
}
.tbl-wrap::-webkit-scrollbar { height: 8px; }
.tbl-wrap::-webkit-scrollbar-track { background: var(--bg-2); }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--line-hi); }
.tbl-wrap::-webkit-scrollbar-thumb:hover { background: var(--line-max); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  padding-top: 8px;
  padding-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-2);
  background: var(--bg-3);
  border-bottom-color: var(--line-hi);
  white-space: nowrap;
}
td { color: var(--fg); transition: background-color var(--t); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(242, 244, 248, 0.03); }
tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--ac); }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   14. Status badges
   -------------------------------------------------------------------------- */
.bdg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid;
  border-radius: 1px;
}
.bdg::before {
  content: '';
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  background: currentColor;
}
.bdg-active, .bdg-canon {
  color: var(--ok);
  border-color: rgba(61, 220, 132, 0.4);
  background: rgba(61, 220, 132, 0.08);
}
.bdg-check, .bdg-mixed {
  color: var(--warn);
  border-color: rgba(255, 176, 32, 0.4);
  background: rgba(255, 176, 32, 0.08);
}
.bdg-expired, .bdg-filler {
  color: var(--bad);
  border-color: rgba(255, 90, 82, 0.4);
  background: rgba(255, 90, 82, 0.08);
}

/* --------------------------------------------------------------------------
   15. Code copy rows - tap-to-select code chip + chartreuse copy action
   -------------------------------------------------------------------------- */
.code-pill {
  display: inline-block;
  max-width: 100%;
  padding: 5px 10px 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  color: var(--ac);
  background: var(--bg);
  border: 1px solid var(--line-hi);
  border-left: 2px solid var(--ac);
  border-radius: 0 var(--r) var(--r) 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
  user-select: all;
  -webkit-user-select: all;
  transition: border-color var(--t), background-color var(--t);
}
tr:hover .code-pill,
.code-pill:hover {
  background: var(--ac-wash);
  border-color: var(--ac);
}
td .btn-ac { vertical-align: middle; }

/* --------------------------------------------------------------------------
   16. Anime episode tracker
   -------------------------------------------------------------------------- */
.ep-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.prog-bar {
  position: relative;
  width: 100%;
  height: 8px;
  margin: 8px 0 14px;
  background-color: var(--bg-3);
  border: 1px solid var(--line-hi);
  border-radius: 1px;
  overflow: hidden;
}
/* 10% tick marks */
.prog-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), rgba(9, 10, 13, 0.55) calc(10% - 1px), rgba(9, 10, 13, 0.55) 10%);
  pointer-events: none;
}
.prog-fill {
  width: 0%;
  height: 100%;
  background: var(--ac);
  transition: width 200ms ease;
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 4px;
}

.ep-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 7px 2px 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 1px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
.ep-cell:hover { border-color: var(--line-max); background: var(--bg-3); }
.ep-cell:active { background: var(--bg-4); }
.ep-cell:focus-visible { outline-offset: 1px; z-index: 1; }

.ep-cell.canon { border-top: 2px solid var(--ok); }
.ep-cell.mixed { border-top: 2px solid var(--warn); }
.ep-cell.filler {
  border-top: 2px solid var(--bad);
  color: var(--fg-3);
  background-image: repeating-linear-gradient(135deg, rgba(255, 90, 82, 0.07) 0, rgba(255, 90, 82, 0.07) 3px, transparent 3px, transparent 7px);
}

.ep-cell.watched {
  background-color: var(--ac-wash-2);
  background-image: none;
  border-color: var(--ac);
  color: var(--ac);
  font-weight: 700;
}
/* watched corner notch */
.ep-cell.watched::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 7px;
  height: 7px;
  background: linear-gradient(135deg, transparent 50%, var(--ac) 50%);
}
.ep-cell.watched:hover { background-color: rgba(200, 255, 46, 0.24); }

.ep-cell.hidden { display: none; }

/* --------------------------------------------------------------------------
   17. Pokemon type badges, picker, effectiveness matrix
   -------------------------------------------------------------------------- */
.ptype {
  display: inline-block;
  min-width: 62px;
  padding: 3px 7px 2px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  color: #fff;
  border-radius: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.t-normal { background: #86866a; }
.t-fire { background: #d9531e; }
.t-water { background: #2f74d0; }
.t-electric { background: #e0b400; color: #090a0d; text-shadow: none; }
.t-grass { background: #3d9132; }
.t-ice { background: #4fb8cb; color: #090a0d; text-shadow: none; }
.t-fighting { background: #a62b22; }
.t-poison { background: #89348a; }
.t-ground { background: #b98f3f; color: #090a0d; text-shadow: none; }
.t-flying { background: #6f64c4; }
.t-psychic { background: #d43866; }
.t-bug { background: #7d911a; }
.t-rock { background: #8f7932; }
.t-ghost { background: #5a457c; }
.t-dragon { background: #5234d4; }
.t-dark { background: #4f4138; }
.t-steel { background: #6f7887; }
.t-fairy { background: #c45c8a; }

.type-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 4px;
  margin: 10px 0;
}
.type-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--line-hi);
  border-radius: 1px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color var(--t), background-color var(--t), color var(--t), box-shadow var(--t);
}
.type-pick:hover { border-color: var(--fg); }
.type-pick.sel-type {
  outline: 2px solid var(--ac);
  outline-offset: -2px;
  background: var(--bg-3);
  border-color: var(--ac);
  color: var(--ac);
  font-weight: 700;
  text-shadow: none;
  box-shadow: inset 0 -3px 0 var(--ac);
}

.eff-cell {
  min-width: 34px;
  padding: 6px 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  color: var(--fg-3);
  border-left: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.eff-2 { background: rgba(61, 220, 132, 0.2); color: #8ff0b8; }
.eff-05 { background: rgba(255, 90, 82, 0.2); color: #ffa9a4; }
.eff-0 { background: #05060a; color: #7c8698; }
tr:hover td.eff-2 { background: rgba(61, 220, 132, 0.3); }
tr:hover td.eff-05 { background: rgba(255, 90, 82, 0.3); }
tr:hover td.eff-0 { background: #05060a; }

/* --------------------------------------------------------------------------
   18. Tool panels + calculators
   -------------------------------------------------------------------------- */
.tool-panel {
  position: relative;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
}
.tool-panel::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 48px;
  height: 2px;
  background: var(--ac);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 10px;
}
.field { min-width: 0; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.result-box {
  margin-top: 14px;
  padding: 14px 14px 14px 16px;
  background: var(--bg);
  border: 1px solid var(--ac);
  border-left-width: 3px;
  border-radius: var(--r);
  font-size: 0.88rem;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.result-big {
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ac);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   19. Ad + affiliate slots
   -------------------------------------------------------------------------- */
.ad-slot {
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  text-align: center;
  overflow: hidden;
}
.ad-slot[data-ad-ready="false"] { display: none; }

.aff-box {
  margin-top: 26px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.aff-note {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--fg-3);
}
.aff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}
.aff-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color var(--t);
}
.aff-card:hover { border-color: var(--line-hi); }
.aff-card h4 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.25;
}
.aff-card p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--fg-2);
}
.aff-card a { margin-top: auto; }

/* --------------------------------------------------------------------------
   20. Footer
   -------------------------------------------------------------------------- */
.ft {
  margin-top: auto;
  padding: 24px 0 28px;
  background: var(--bg-2);
  border-top: 1px solid var(--line-hi);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--fg-2);
}
.ft-in {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 24px;
}
.ft-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ft-links a { color: var(--fg-2); }
.ft-links a:hover { color: var(--ac); }

/* --------------------------------------------------------------------------
   21. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  :root { --hd-h: 48px; }

  .wrap { padding: 0 12px; }
  main { padding: 10px 0 40px; }

  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 8px; }

  .hd-in { height: 48px; gap: 10px; }
  .brand { font-size: 0.92rem; gap: 7px; }
  .brand-mark { width: 22px; height: 22px; font-size: 0.76rem; }
  .nav a { padding: 0 8px; font-size: 0.7rem; letter-spacing: 0.05em; }

  .bc { margin-bottom: 8px; font-size: 0.66rem; }

  .cmd-bar { padding: 12px 12px 11px; margin-bottom: 14px; }
  .cmd-top { margin-bottom: 9px; }
  .cmd-meta { font-size: 0.64rem; }

  .search-row { flex-direction: row; gap: 6px; }
  .search-row .inp { flex-basis: 150px; }
  .search-row .btn { padding-left: 14px; padding-right: 14px; }
  .inp, .sel { font-size: 1rem; }

  .cmd-results.open { grid-template-columns: minmax(0, 1fr); }
  .quick-strip { margin-top: 9px; }

  .sec-hd { margin: 24px 0 10px; }
  .sec-hd h2 { font-size: 0.94rem; }

  .kpi { padding: 10px 12px 9px; }
  .kpi::before { left: 12px; }
  .kpi-lbl { font-size: 0.6rem; letter-spacing: 0.08em; }

  th, td { padding: 8px 10px; }
  table { font-size: 0.84rem; }
  .code-pill { font-size: 0.84rem; padding: 4px 8px 4px 7px; }

  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 3px; }
  .ep-cell { min-height: 38px; font-size: 0.72rem; }

  .type-btn-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
  .type-pick { min-height: 34px; padding: 5px 4px; font-size: 0.64rem; letter-spacing: 0.05em; }
  .eff-cell { min-width: 30px; padding: 5px 3px; font-size: 0.68rem; }
  .ptype { min-width: 56px; font-size: 0.62rem; letter-spacing: 0.06em; }

  .tool-panel { padding: 12px; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .result-box { padding: 12px 12px 12px 13px; }

  .aff-box { padding: 12px; }
  .ft { padding: 20px 0 24px; }
}

/* --------------------------------------------------------------------------
   22. Motion + contrast preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:active { transform: none; }
}

@media (forced-colors: active) {
  .btn, .inp, .sel, .ep-cell, .type-pick, .code-pill, .bdg, .ptype { border: 1px solid ButtonText; }
  .ep-cell.watched, .btn.active, .type-pick.sel-type { outline: 2px solid Highlight; }
}
