/* ============================================================
   Pokémon Rejuvenation Fan Guide — Pokemon-style theme
   Colors: Poké Ball red #ee1515, white, navy #3b4cca, gold #ffde00
   ============================================================ */
:root {
  --pk-red: #ee1515;
  --pk-red-dark: #b31212;
  --pk-navy: #3b4cca;
  --pk-navy-dark: #2a37a5;
  --pk-gold: #ffde00;
  --pk-gold-dark: #ccb100;
  --pk-bg: #f5f6fa;
  --pk-card: #ffffff;
  --pk-text: #22263a;
  --pk-muted: #6b7280;
  --pk-border: #e5e7eb;
  --pk-green: #22c55e;
  --pk-orange: #f97316;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(34, 38, 58, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--pk-bg);
  color: var(--pk-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Poké Ball decorative background ---------- */
body::before {
  content: "";
  position: fixed;
  top: -140px;
  right: -140px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(238, 21, 21, 0.08) 0%, rgba(238, 21, 21, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Header / Nav ---------- */
.site-header {
  background: linear-gradient(135deg, var(--pk-red) 0%, var(--pk-red-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(179, 18, 18, 0.35);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  color: #fff;
  text-decoration: none;
}
.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand-name small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  opacity: 0.85;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* CSS Poké Ball logo */
.pokeball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #fff 0%, #fff 46%, #222 46%, #222 54%, var(--pk-red) 54%, var(--pk-red) 100%);
  border: 2.5px solid #222;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15);
}
.pokeball::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 11px;
  height: 11px;
  background: #fff;
  border: 2.5px solid #222;
  border-radius: 50%;
}
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.main-nav a {
  display: block;
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.2s;
}
.main-nav a:hover,
.main-nav a.active {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- Layout ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  flex: 1;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Hero (home) */
.hero {
  background: linear-gradient(135deg, var(--pk-navy) 0%, var(--pk-navy-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 48px 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 222, 0, 0.25), rgba(255, 222, 0, 0) 70%);
}
.hero h1 {
  font-size: 2.3rem;
  line-height: 1.2;
  margin-bottom: 10px;
}
.hero h1 .accent { color: var(--pk-gold); }
.hero p {
  max-width: 720px;
  font-size: 1.05rem;
  opacity: 0.92;
  margin-bottom: 8px;
}
.hero .badge-row { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.badge.gold { background: var(--pk-gold); color: #222; border-color: var(--pk-gold); }

/* Page title (inner pages) */
.page-head {
  margin-bottom: 28px;
}
.page-head h1 {
  font-size: 2rem;
  color: var(--pk-navy);
  margin-bottom: 6px;
}
.page-head .sub {
  color: var(--pk-muted);
  font-size: 1rem;
  max-width: 760px;
}

/* ---------- Cards / Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}
.card {
  background: var(--pk-card);
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(34,38,58,0.14); }
.card h2, .card h3 {
  color: var(--pk-navy);
  margin-bottom: 8px;
  font-size: 1.15rem;
}
.card h3 { font-size: 1.05rem; }
.card p { color: var(--pk-text); font-size: 0.95rem; margin-bottom: 8px; }
.card a { color: var(--pk-red); }

/* ---------- Typography sections ---------- */
section { margin-bottom: 34px; }
h2.section-title {
  font-size: 1.5rem;
  color: var(--pk-navy);
  padding-left: 14px;
  border-left: 5px solid var(--pk-red);
  margin-bottom: 14px;
}
h3.sub-title { color: var(--pk-navy); margin: 18px 0 8px; font-size: 1.15rem; }

p { margin-bottom: 10px; }
ul, ol { margin: 8px 0 14px 22px; }
li { margin-bottom: 6px; }
strong { color: var(--pk-navy-dark); }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--pk-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 14px 0 20px;
  font-size: 0.93rem;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--pk-border);
  vertical-align: top;
}
th {
  background: linear-gradient(135deg, var(--pk-navy), var(--pk-navy-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: #f9fafc; }

/* ---------- Alerts / callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
  border-left: 5px solid;
  font-size: 0.95rem;
}
.callout.info { background: #eef2ff; border-color: var(--pk-navy); }
.callout.warn { background: #fff7e6; border-color: var(--pk-orange); }
.callout.danger { background: #ffecec; border-color: var(--pk-red); }
.callout.success { background: #ecfdf3; border-color: var(--pk-green); }
.callout strong { display: block; margin-bottom: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--pk-red);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
  transition: background 0.2s, transform 0.15s;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { background: var(--pk-red-dark); transform: translateY(-1px); }
.btn.navy { background: var(--pk-navy); }
.btn.navy:hover { background: var(--pk-navy-dark); }
.btn.gold { background: var(--pk-gold); color: #222 !important; }
.btn.gold:hover { background: var(--pk-gold-dark); }
.btn.ghost { background: transparent; border: 2px solid var(--pk-red); color: var(--pk-red) !important; }
.btn.ghost:hover { background: var(--pk-red); color: #fff !important; }

/* ---------- Keyword chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chip {
  background: #fff;
  border: 1.5px solid var(--pk-red);
  color: var(--pk-red);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #1c1f33;
  color: #c9cde0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.site-footer a { color: var(--pk-gold); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero { padding: 34px 22px; }
  .hero h1 { font-size: 1.7rem; }
  .page-head h1 { font-size: 1.6rem; }
  .header-inner { padding: 0 14px; }
  .main-nav a { font-size: 0.82rem; padding: 6px 9px; }
  .grid { grid-template-columns: 1fr; }
  table { font-size: 0.85rem; }
}

/* ============================================================
   V2 additions — breadcrumb, hub cards, FAQ, TOC, stat grid
   ============================================================ */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--pk-muted);
  margin: 4px 0 18px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: 10px;
  display: inline-block;
}
.breadcrumb a { color: var(--pk-red); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 7px; opacity: 0.5; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin: 20px 0;
}
.hub-card {
  background: var(--pk-card);
  border: 1px solid var(--pk-border);
  border-left: 5px solid var(--pk-navy);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s;
  display: block;
  color: inherit;
  text-decoration: none;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(34,38,58,0.14); }
.hub-card .hub-icon { font-size: 1.7rem; display: block; margin-bottom: 6px; }
.hub-card h3 { color: var(--pk-navy); margin-bottom: 6px; font-size: 1.1rem; }
.hub-card p { font-size: 0.92rem; color: var(--pk-text); margin-bottom: 0; }
.hub-card .go { color: var(--pk-red); font-weight: 700; font-size: 0.88rem; display: block; margin-top: 8px; }

.toc {
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 0 22px;
  display: inline-block;
  min-width: 280px;
}
.toc strong { display: block; margin-bottom: 6px; color: var(--pk-navy); }
.toc ol { margin: 0 0 0 20px; }
.toc li { margin-bottom: 3px; font-size: 0.9rem; }
.toc a { color: var(--pk-navy); text-decoration: none; }
.toc a:hover { text-decoration: underline; color: var(--pk-red); }

.faq details {
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(34,38,58,0.05);
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--pk-navy-dark);
  font-size: 0.98rem;
  list-style: none;
  position: relative;
  padding-right: 26px;
}
.faq summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  top: 0;
  font-size: 1.2rem;
  color: var(--pk-red);
  font-weight: 800;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 10px 0 0; font-size: 0.94rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.stat-card {
  background: linear-gradient(135deg, var(--pk-navy), var(--pk-navy-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 1.6rem; font-weight: 800; color: var(--pk-gold); display: block; }
.stat-card .lbl { font-size: 0.82rem; opacity: 0.92; margin-top: 2px; display: block; }

.data-note {
  font-size: 0.8rem;
  color: var(--pk-muted);
  margin-top: 10px;
  font-style: italic;
}

.img-frame {
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  margin: 14px 0;
  text-align: center;
}
.img-frame svg { max-width: 100%; height: auto; }

.related {
  background: #eef2ff;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 34px;
}
.related h2 { color: var(--pk-navy); font-size: 1.2rem; margin-bottom: 10px; }
.related ul { margin: 0 0 0 20px; columns: 2; column-gap: 30px; }
.related li { margin-bottom: 6px; font-size: 0.93rem; break-inside: avoid; }
.related a { color: var(--pk-red); text-decoration: none; font-weight: 600; }
.related a:hover { text-decoration: underline; }
@media (max-width: 768px) { .related ul { columns: 1; } }

.version-badge {
  display: inline-block;
  background: var(--pk-gold);
  color: #222;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

/* ============================================================
   V3 — images, sprites, avatars, galleries, rich tables
   ============================================================ */
img { max-width: 100%; height: auto; }

/* Hero media (cover art on index / download) */
.hero-media {
  display: flex;
  gap: 26px;
  align-items: center;
  margin-top: 22px;
  flex-wrap: wrap;
}
.hero-media .media-art {
  flex: 0 0 300px;
  max-width: 300px;
}
.hero-media .media-art img {
  border-radius: 12px;
  border: 3px solid rgba(255,255,255,0.35);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  display: block;
  width: 100%;
}
.hero-media .media-side { flex: 1 1 320px; min-width: 260px; }
@media (max-width: 768px) {
  .hero-media .media-art { flex: 0 0 200px; max-width: 200px; margin: 0 auto; }
  .hero-media { justify-content: center; }
}

/* Figure / image frame for content images */
.img-frame {
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  margin: 14px 0;
  text-align: center;
}
.img-frame img {
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  max-height: 460px;
}
.img-frame figcaption {
  font-size: 0.8rem;
  color: var(--pk-muted);
  margin-top: 8px;
  font-style: italic;
}

/* Floating media: image beside text */
.media-wrap {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 16px 0;
  flex-wrap: wrap;
}
.media-wrap .media-img {
  flex: 0 0 260px;
  max-width: 260px;
}
.media-wrap .media-img img {
  border-radius: 10px;
  border: 1px solid var(--pk-border);
  box-shadow: var(--shadow);
  display: block;
  width: 100%;
}
.media-wrap .media-text { flex: 1 1 320px; min-width: 240px; }
.media-wrap .media-text p:last-child { margin-bottom: 0; }
@media (max-width: 768px) {
  .media-wrap .media-img { flex: 0 0 100%; max-width: 100%; }
}

/* Small sprite (table cells / cards) */
.sprite {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  display: inline-block;
  vertical-align: middle;
}
.sprite-sm { width: 40px; height: 40px; }

/* Circular character avatar */
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--pk-navy);
  background: #fff;
  display: inline-block;
  vertical-align: middle;
}
.avatar-sm { width: 44px; height: 44px; border-width: 2px; }

/* Gallery row */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.gallery figure {
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  margin: 0;
}
.gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.gallery figcaption {
  font-size: 0.82rem;
  color: var(--pk-muted);
  padding: 8px 4px 2px;
  text-align: center;
  font-style: italic;
}

/* Type badges (Pokemon types) */
.type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1px;
  white-space: nowrap;
}
.t-normal { background: #a8a878; }
.t-fire { background: #f08030; }
.t-water { background: #6890f0; }
.t-grass { background: #78c850; }
.t-electric { background: #f8d030; color: #333; }
.t-ice { background: #98d8d8; color: #333; }
.t-fighting { background: #c03028; }
.t-poison { background: #a040a0; }
.t-ground { background: #e0c068; color: #333; }
.t-flying { background: #a890f0; }
.t-psychic { background: #f85888; }
.t-bug { background: #a8b820; }
.t-rock { background: #b8a038; }
.t-ghost { background: #705898; }
.t-dragon { background: #7038f8; }
.t-dark { background: #705848; }
.t-steel { background: #b8b8d0; color: #333; }
.t-fairy { background: #ee99ac; }

/* Tier badges (tier lists) */
.tier-badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
}
.tier-s { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #222; }
.tier-a { background: #22c55e; }
.tier-b { background: #3b82f6; }
.tier-c { background: #f97316; }
.tier-d { background: #9ca3af; color: #222; }

/* Avatar + name cell */
.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.name-cell img { flex-shrink: 0; }
.name-cell .nm { font-weight: 700; color: var(--pk-navy-dark); }
.name-cell .sub2 { display: block; font-size: 0.78rem; font-weight: 500; color: var(--pk-muted); }

/* Table cell with sprite + name */
.poke-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.poke-cell img { flex-shrink: 0; }

/* Table responsive wrapper */
.table-wrap { overflow-x: auto; margin: 14px 0 20px; }
.table-wrap table { margin: 0; }

/* Key-value info table (compact game facts) */
table.info-table td:first-child {
  font-weight: 700;
  color: var(--pk-navy-dark);
  background: #f2f4ff;
  width: 34%;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .gallery img { height: 110px; }
  .sprite { width: 44px; height: 44px; }
  .avatar { width: 50px; height: 50px; }
}

/* ============================================================
   V2.1 — hero download grid (large version picker)
   ============================================================ */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 22px 0 4px;
}
.dl-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 14px 16px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  transition: transform 0.18s;
}
.dl-card:hover { transform: translateY(-3px); }
.dl-card .platform {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--pk-navy-dark);
}
.dl-card .ver {
  display: block;
  font-size: 0.78rem;
  color: var(--pk-muted);
  margin: 3px 0 12px;
}
.dl-card a.btn { display: block; width: 100%; padding: 10px 6px; font-size: 0.95rem; }
.dl-note { margin-top: 12px; font-size: 0.85rem; opacity: 0.85; }
.dl-note a { color: var(--pk-gold); font-weight: 700; text-decoration: underline; }
.dl-note a:hover { color: #fff; }
@media (max-width: 768px) { .dl-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   SEO and accessibility refinements
   ============================================================ */
html { -webkit-tap-highlight-color: rgba(238, 21, 21, 0.2); }

.content-meta {
  color: var(--pk-muted);
  font-size: 0.84rem;
  margin: -12px 0 22px;
}
.content-meta time,
.footer-meta time { font-variant-numeric: tabular-nums; }

.source-list {
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}
.source-list li { margin-bottom: 8px; }

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .brand {
    min-width: 0;
    padding: 8px 0;
  }
  .brand-name {
    font-size: 0.9rem;
    white-space: nowrap;
  }
  .brand-name small { display: none; }
  .main-nav {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .main-nav ul {
    flex-wrap: nowrap;
    gap: 2px;
    width: max-content;
  }
  .main-nav a {
    align-items: center;
    display: flex;
    min-height: 44px;
    padding: 10px 12px;
    white-space: nowrap;
  }
  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
