:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --accent: #e11d48;
  --accent-hi: #be123c;
  --accent-fg: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-logo { border-radius: 6px; display: block; }
.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.main-nav a { font-size: 14px; font-weight: 500; color: var(--muted); }
.main-nav a:hover { color: var(--text); text-decoration: none; }

.hero-bar { padding: 32px 20px 16px; text-align: center; }
.hero-inner { max-width: 820px; margin: 0 auto; }
.hero-inner h1 { margin: 0 0 10px; font-size: clamp(26px, 3.6vw, 38px); line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
.lead { margin: 0 auto; font-size: 16px; color: var(--muted); max-width: 64ch; }

.tool-wrap { padding: 12px 20px 40px; }
.pk-wrap { max-width: 1180px; margin: 0 auto; }
.pk-grid-2 { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.pk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.pk-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pk-result-card {
  width: 100%;
  max-width: 460px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pk-sprite-box {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.pk-sprite-box img { width: 156px; height: 156px; object-fit: contain; }
.pk-num { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); }
.pk-name { margin: 0; font-size: 26px; color: var(--text); }
.pk-types { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pk-type {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.pk-stats { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.pk-stat-row {
  display: grid;
  grid-template-columns: 56px 34px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.pk-stat-label { color: var(--muted); font-weight: 600; text-align: left; }
.pk-stat-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; text-align: right; color: var(--text); }
.pk-bar-track { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.pk-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.pk-meta-block {
  width: 100%;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pk-meta-block strong { color: var(--text); }
.pk-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.btn-primary, .btn-secondary {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hi); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); text-decoration: none; }
.btn-secondary[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

.pk-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pk-field-title { font-size: 13px; font-weight: 700; color: var(--text); display: flex; justify-content: space-between; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chip {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.pk-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pk-select, .pk-input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.pk-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.pk-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.pk-count { font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 10px; background: var(--surface-2); border-radius: 8px; text-align: center; margin-bottom: 12px; }

.pk-team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; }
.pk-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pk-slot.is-locked { border-color: var(--accent); }
.pk-slot img { width: 96px; height: 96px; object-fit: contain; }
.pk-slot h3 { margin: 0; font-size: 16px; color: var(--text); }

.pk-analysis {
  width: 100%;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pk-an-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.pk-an-box h3 { margin: 0 0 8px; font-size: 14px; color: var(--text); }
.pk-an-box p { margin: 0; font-size: 13px; color: var(--muted); }

.pk-dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-top: 14px; }
.pk-dex-tile {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.pk-dex-tile img { width: 56px; height: 56px; object-fit: contain; filter: grayscale(1) opacity(0.45); }
.pk-dex-tile.is-caught { border-color: var(--accent); background: var(--surface-2); }
.pk-dex-tile.is-caught img { filter: none; }
.pk-dex-tile span { font-size: 12px; color: var(--text); font-weight: 600; }

.pk-quiz-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 480px; }
.pk-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 12px; max-height: 360px; overflow-y: auto; }

.seo-wrap, .doc-wrap { padding: 40px 20px 64px; border-top: 1px solid var(--border); background: var(--surface); }
.seo-inner { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }
.doc-inner { max-width: 760px; margin: 0 auto; }

.prose-block { color: var(--muted); font-size: 16px; }
.prose-block h1 { margin: 0 0 14px; font-size: 32px; color: var(--text); }
.prose-block h2 { margin: 32px 0 12px; font-size: 24px; color: var(--text); line-height: 1.25; }
.prose-block h2:first-child { margin-top: 0; }
.prose-block h3 { margin: 20px 0 8px; font-size: 18px; color: var(--text); }
.prose-block p, .prose-block ul, .prose-block ol { margin: 0 0 16px; }
.prose-block li { margin-bottom: 6px; }
.prose-block strong { color: var(--text); }
.prose-block code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 14px; font-family: 'JetBrains Mono', monospace; color: var(--accent-hi); }
.prose-block table { width: 100%; border-collapse: collapse; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.prose-block th, .prose-block td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.prose-block th { background: var(--surface-2); color: var(--text); font-weight: 700; }
.prose-block figure { margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.prose-block figure img { width: 100%; height: auto; display: block; }
.prose-block figcaption { padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }

.seo-section h2 { margin: 0 0 14px; font-size: 24px; color: var(--text); }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 18px; font-weight: 700; color: var(--accent-hi); }
.faq-item[open] summary::after { content: "-"; }
.faq-item h3 { margin: 0; font-size: 16px; color: var(--text); }
.faq-item p { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.related-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.related-card:hover { border-color: var(--accent); text-decoration: none; }
.related-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.related-card p { margin: 0; font-size: 14px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); background: var(--bg); padding: 36px 20px 24px; }
.footer-inner { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-brand strong { font-size: 16px; color: var(--text); }
.footer-brand p { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-width: 44ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.footer-links a { font-size: 14px; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { max-width: 1180px; margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

.not-found { text-align: center; padding: 48px 0; }

@media (max-width: 860px) {
  .pk-grid-2, .pk-team-grid, .pk-analysis, .related-grid { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-footer, .seo-wrap, .pk-no-print { display: none !important; }
  .pk-dex-grid { grid-template-columns: repeat(6, 1fr) !important; }
}