:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1b1f2b;
  --muted: #5b6275;
  --border: #dde1ea;
  --accent: #e2483d;
  --accent-ink: #b8322a;
  --link: #2f56c9;
  --c4: #b3261e; --c4-bg: #fbd9d6;
  --c2: #1f7a3a; --c2-bg: #d3f0dc;
  --c1: #5b6275; --c1-bg: transparent;
  --c05: #a4460c; --c05-bg: #fde5cf;
  --c025: #7a3208; --c025-bg: #f7c9a3;
  --c0: #ffffff; --c0-bg: #2b2f3a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141c;
    --surface: #191d28;
    --surface-2: #222736;
    --text: #e8eaf1;
    --muted: #a0a7b8;
    --border: #2d3344;
    --accent: #ff6a5c;
    --accent-ink: #ff8a7e;
    --link: #8fb0ff;
    --c4: #ffb4ab; --c4-bg: #5c1a15;
    --c2: #9be3b0; --c2-bg: #173d24;
    --c1: #a0a7b8;
    --c05: #ffc899; --c05-bg: #4a2a12;
    --c025: #ffd9b8; --c025-bg: #5e3312;
    --c0: #11141c; --c0-bg: #d7dae3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

/* type colors — dark enough for white text */
.t-normal { --t: #7a7a5c; } .t-fire { --t: #d0501b; } .t-water { --t: #3b6bd6; }
.t-electric { --t: #a07c00; } .t-grass { --t: #3f8c22; } .t-ice { --t: #2e8f91; }
.t-fighting { --t: #b02a22; } .t-poison { --t: #8a3a8a; } .t-ground { --t: #9a7428; }
.t-flying { --t: #6d5bc4; } .t-psychic { --t: #d23566; } .t-bug { --t: #6e8214; }
.t-rock { --t: #8c7a2e; } .t-ghost { --t: #5b4788; } .t-dragon { --t: #5530d8; }
.t-dark { --t: #574436; } .t-steel { --t: #62627e; } .t-fairy { --t: #bd4585; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); margin: 0 0 .4rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: 0; }
small { color: var(--muted); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* header */
.site-header { background: #1f2433; color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-size: 1.2rem; display: inline-flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.brand b { color: #ff8a7e; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#d0501b 0 33%, #3b6bd6 0 66%, #3f8c22 0); box-shadow: inset 0 0 0 5px #1f2433; outline: 2px solid #fff; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #d8dcea; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }

main { padding-bottom: 48px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 16px; }
.crumbs a { color: var(--muted); }
.hero { padding: 28px 0 16px; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 760px; margin: 0; }
.lede.answer { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card-foot { margin: 12px 0 0; }
.section { margin-top: 12px; }
.prose { max-width: 780px; }
.prose.narrow { margin-top: 8px; }
.prose h1 { margin-top: 24px; }
.note { color: var(--muted); font-size: .9rem; }
.none { color: var(--muted); font-size: .92rem; }

/* chips */
.chip { display: inline-block; background: var(--t, #777); color: #fff; border: 0; border-radius: 999px; padding: 3px 12px; font: 600 .86rem/1.5 var(--font); text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.chip-sm { padding: 1px 9px; font-size: .78rem; }
a.chip:hover { filter: brightness(1.12); }
.chip-row { line-height: 2.2; }

/* calculator */
.calc { margin-top: 4px; }
.calc-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.mode { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.mode-btn { border: 0; background: transparent; color: var(--muted); font: 600 .92rem var(--font); padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.mode-btn small { font-weight: 400; }
.mode-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search input { width: 100%; font: 1rem var(--font); padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pk-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 340px; overflow: auto; }
.pk-results li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.pk-results li[aria-selected="true"], .pk-results li:hover { background: var(--surface-2); }
.pk-results .no-hit { color: var(--muted); cursor: default; }
.calc-hint { margin: 16px 0 8px; color: var(--muted); font-size: .92rem; }
.type-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick { cursor: pointer; padding: 7px 8px; opacity: .45; transition: opacity .12s, transform .12s; text-align: center; }
.pick:hover { opacity: .8; }
.pick[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--t); }
.result { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; min-height: 220px; }
.result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.result-head h3 { font-size: 1.25rem; }
.typing { margin-left: 6px; vertical-align: 2px; }
.more { font-size: .92rem; font-weight: 600; }
.empty { color: var(--muted); }

/* multiplier rows */
.mult-rows { margin: 0; display: grid; gap: 6px; }
.mrow { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 9px; background: var(--surface-2); }
.mrow dt { font-weight: 700; }
.mrow dt small { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.mrow dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.m-4 { background: var(--c4-bg); } .m-4 dt { color: var(--c4); }
.m-2 { background: var(--c2-bg); } .m-2 dt { color: var(--c2); }
.m-05 { background: var(--c05-bg); } .m-05 dt { color: var(--c05); }
.m-025 { background: var(--c025-bg); } .m-025 dt { color: var(--c025); }
.m-0 dt { color: var(--text); }
.m-0 { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text); }
.is-attack .m-2 { background: var(--c2-bg); }

/* tables */
.table-scroll, .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
.weak-table th, .weak-table td, .data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.weak-table td, .data-table td { line-height: 2; }
.weak-table thead th, .data-table thead th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.weak-table tbody tr:last-child > *, .data-table tbody tr:last-child > * { border-bottom: 0; }
.weak-table tbody th, .data-table tbody th { white-space: nowrap; }

.type-chart { width: auto; min-width: 100%; font-size: .82rem; }
.type-chart th, .type-chart td { border: 1px solid var(--border); text-align: center; }
.type-chart td { width: 38px; height: 34px; font-weight: 700; cursor: default; }
.type-chart .corner { font-size: .66rem; color: var(--muted); line-height: 1.2; padding: 4px; background: var(--surface); position: sticky; left: 0; z-index: 2; }
.type-chart .corner span { display: block; white-space: nowrap; }
.type-chart .row-h { position: sticky; left: 0; background: var(--surface); z-index: 1; padding: 4px 8px; text-align: left; }
.type-chart .col-h { padding: 4px 2px; }
.abbr { display: block; background: var(--t); color: #fff; text-decoration: none; border-radius: 6px; padding: 3px 0; font-weight: 700; font-size: .74rem; }
td.c2 { background: var(--c2-bg); color: var(--c2); }
td.c05 { background: var(--c05-bg); color: var(--c05); }
td.c0 { background: var(--c0-bg); color: var(--c0); }
td.hl, tr.hl td { outline: 2px solid rgba(47, 86, 201, .35); outline-offset: -2px; }
tr.hl td.hl { outline-color: var(--link); }

.key { list-style: none; padding: 0; display: grid; gap: 8px; }
.key-inline { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: .9rem; }
.kcell { display: inline-grid; place-items: center; min-width: 38px; height: 28px; border-radius: 6px; font-weight: 700; border: 1px solid var(--border); margin-right: 6px; }
.kcell.c2 { background: var(--c2-bg); color: var(--c2); }
.kcell.c1 { background: var(--surface); color: var(--c1); }
.kcell.c05 { background: var(--c05-bg); color: var(--c05); }
.kcell.c0 { background: var(--c0-bg); color: var(--c0); }

/* matchup */
.matchup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.matchup label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.matchup select { font: 1rem var(--font); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 140px; }
.vs { font-weight: 800; color: var(--muted); padding-bottom: 8px; }
.matchup-out { flex-basis: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border-radius: 9px; }
.m-big { font-size: 1.4rem; min-width: 64px; text-align: center; border-radius: 8px; padding: 4px 8px; }
.m-big.c4 { background: var(--c4-bg); color: var(--c4); } .m-big.c2 { background: var(--c2-bg); color: var(--c2); }
.m-big.c1 { background: var(--surface); color: var(--c1); } .m-big.c05 { background: var(--c05-bg); color: var(--c05); }
.m-big.c025 { background: var(--c025-bg); color: var(--c025); } .m-big.c0 { background: var(--c0-bg); color: var(--c0); }

/* type grid */
.type-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-card { display: block; background: var(--t); color: #fff; text-decoration: none; border-radius: 10px; padding: 12px 14px; font-weight: 700; }
.type-card small { display: block; color: rgba(255, 255, 255, .85); font-size: .78rem; }
.type-card:hover { filter: brightness(1.1); }

/* type & pokemon pages */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .mrow { grid-template-columns: 150px 1fr; }
.typing-line { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.dex { color: var(--muted); font-weight: 600; }
.mon-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.mon-list small { margin-left: 4px; }

/* faq */
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; max-width: 780px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; font-size: .9rem; }
.footer-types { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 10px; }
.disclaimer { color: var(--muted); font-size: .8rem; max-width: 780px; }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .mrow, .two-col .mrow { grid-template-columns: 1fr; gap: 4px; }
  .mrow dt small { display: inline; margin-left: 6px; }
  .type-picker { grid-template-columns: repeat(3, 1fr); }
  .matchup label { flex: 1 1 140px; }
  .vs { display: none; }
  .nav a { padding: 6px 8px; font-size: .88rem; }
  .header-inner { padding: 8px 16px; }
}
