* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, sans-serif; color: #1c2230; background: #f4f6fb; }
a { color: #2b6cb0; text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  background: #1f2a44; color: #fff; padding: 10px 18px;
}
header .brand { color: #fff; font-weight: 700; font-size: 16px; }
/* the way back out of the wiki to the main site */
header .site-home { font-size: 18px; text-decoration: none; margin-right: -6px; }
header .site-home:hover { filter: brightness(1.2); text-decoration: none; }
#search { flex: 1; max-width: 420px; padding: 7px 10px; border: 0; border-radius: 6px; font-size: 14px; }
#status { margin-left: auto; font-size: 12px; opacity: .85; min-width: 120px; text-align: right; }
/* hamburger + scrim: hidden on desktop, activated by the mobile media query below */
#navToggle { display: none; order: -1; background: transparent; border: 0; color: #fff; font-size: 22px; line-height: 1; padding: 2px 8px 4px; cursor: pointer; border-radius: 6px; }
#navToggle:hover { background: rgba(255,255,255,.12); }
#navScrim { display: none; }

.layout { display: flex; align-items: flex-start; }
#sidebar {
  position: sticky; top: 52px; width: 180px; flex: none; height: calc(100vh - 52px);
  overflow: auto; background: #fff; border-right: 1px solid #dde3ee; padding: 12px 0;
}
#sidebar a { display: block; padding: 7px 18px; color: #2a3656; }
#sidebar a.sub { padding-left: 32px; }
#sidebar a:hover { background: #eef2fb; text-decoration: none; }
#sidebar a.active { background: #e2eafc; font-weight: 600; border-left: 3px solid #2b6cb0; }
.nav-group { padding: 12px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8590ab; }

#content { flex: 1; padding: 22px 28px; max-width: 1000px; min-height: calc(100vh - 52px); }
h1 { margin: 0 0 4px; font-size: 24px; }
h2 { margin: 22px 0 8px; font-size: 17px; border-bottom: 1px solid #e1e6f0; padding-bottom: 4px; }
.muted { color: #76819c; }
.num { color: #98a2bd; font-weight: 400; }

/* list / grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.card { display: block; background: #fff; border: 1px solid #e1e6f0; border-radius: 8px; padding: 10px 12px; }
.card:hover { border-color: #2b6cb0; text-decoration: none; }
.card .nm { font-weight: 600; color: #1c2230; }

/* type / class chips */
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; color: #fff; margin-right: 4px; }
.chip.tag { background: #6b7793; }
.t-Normal{background:#9099a1}.t-Fire{background:#ff9d55}.t-Water{background:#5090d6}.t-Electric{background:#f4d23c;color:#333}
.t-Grass{background:#63bc5a}.t-Ice{background:#73cec0}.t-Fighting{background:#ce4069}.t-Poison{background:#ab6ac8}
.t-Ground{background:#d97845}.t-Flying{background:#8fa9de}.t-Psychic{background:#fa7179}.t-Bug{background:#90c12c}
.t-Rock{background:#c5b78c}.t-Ghost{background:#5269ac}.t-Dragon{background:#0b6dc3}.t-Dark{background:#5a5366}
.t-Steel{background:#5a8ea1}.t-Fairy{background:#ec8fe6}

table { border-collapse: collapse; width: 100%; background: #fff; margin: 6px 0 4px; }
th, td { border: 1px solid #e1e6f0; padding: 5px 8px; text-align: left; vertical-align: top; }
th { background: #f1f4fa; font-weight: 600; }
td input { width: 100%; border: 1px solid transparent; background: transparent; padding: 2px 4px; font: inherit; border-radius: 4px; }
td input:focus { border-color: #2b6cb0; background: #fff; outline: none; }
.statbar { background: #eef1f7; border-radius: 4px; height: 8px; margin-top: 3px; }
.statbar > span { display: block; height: 8px; border-radius: 4px; background: #2b6cb0; }

.editrow { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.editrow label { font-size: 12px; color: #76819c; }
.editrow input, .editrow textarea { padding: 5px 8px; border: 1px solid #cfd6e4; border-radius: 6px; font: inherit; }
textarea { width: 100%; min-height: 70px; }
button { background: #2b6cb0; color: #fff; border: 0; padding: 7px 16px; border-radius: 6px; cursor: pointer; font: inherit; }
button:hover { background: #245a96; }
button.sec { background: #e2e7f0; color: #2a3656; }
.saved { color: #1f9d57; } .err { color: #d23b3b; }
.route { background:#fff; border:1px solid #e1e6f0; border-radius:8px; padding:12px 16px; margin:12px 0; }
.route h3 { margin: 0 0 6px; font-size: 16px; }
.species-link { font-weight: 500; }

/* Pokémon front sprite */
img.sprite {
  image-rendering: pixelated;
  width: 120px; height: auto;
  background: #eef2fb; border: 1px solid #e1e6f0; border-radius: 8px;
  padding: 6px; margin: 8px 0;
}
.t-Nuclear { background: #6a3fb0; }

/* national-dex grid */
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin-top: 12px; }
.dex-tile { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid #e1e6f0; border-radius: 8px; padding: 6px 10px; }
.dex-tile:hover { border-color: #2b6cb0; text-decoration: none; box-shadow: 0 1px 4px rgba(43,108,176,.15); }
.dex-spr { flex: 0 0 56px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.dex-spr img.sprite { width: auto; max-width: 56px; max-height: 56px; margin: 0; padding: 2px; background: #f6f8fd; }
.dex-meta { min-width: 0; line-height: 1.35; }
.dex-meta .nm { font-weight: 600; color: #1c2230; }
.dex-types { margin-top: 2px; }
.dex-types .chip { font-size: 11px; padding: 0 6px; margin-right: 3px; }

/* gap-tracking pages (Needs Typing / Needs Moves) */
.gap-badges { margin-top: 3px; }
.gap-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 8px; margin-right: 3px; color: #fff; }
.gap-badge.gap-t { background: #c0392b; }
.gap-badge.gap-m { background: #b9770e; }
.gap-badge.gap-a { background: #7d3cc0; }

/* advanced card gallery */
.gallery-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.gallery-heading h1 { margin-bottom: 2px; }
.result-count { flex: none; min-width: 130px; text-align: right; color: #2456b8; font-size: 27px; font-weight: 750; line-height: 1; }
.result-count span { display: block; margin-top: 5px; color: #76819c; font-size: 12px; font-weight: 500; }
.advanced-filters { margin: 14px 0 10px; border: 1px solid #d8dfec; border-radius: 12px; background: #fff; overflow: hidden; }
.advanced-filters > summary { padding: 12px 15px; cursor: pointer; color: #26324d; font-weight: 700; background: #f5f7fb; border-bottom: 1px solid #e3e8f1; }
.advanced-filters:not([open]) > summary { border-bottom: 0; }
.filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; padding: 14px; }
.adv-field { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: #64708d; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.adv-select { width: 100%; min-width: 0; padding: 8px 30px 8px 9px; border: 1px solid #ccd5e5; border-radius: 7px; background: #fff; color: #25304a; font: inherit; font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.adv-select:focus { outline: 2px solid rgba(43,108,176,.2); border-color: #2b6cb0; }
.filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 0 14px 14px; }
.clear-filters { border: 1px solid #bdc9dc; background: #fff; color: #2b5cb0; border-radius: 7px; padding: 7px 12px; font-weight: 650; cursor: pointer; }
.clear-filters:hover { border-color: #2b6cb0; background: #f2f6fd; }
.active-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 9px 0 12px; }
.active-filter { border: 1px solid #c9d6ee; background: #eaf1fc; color: #294f91; border-radius: 16px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.active-filter:hover { background: #dfeafb; border-color: #8eabd8; }
.card-grid { display: grid; gap: 12px; margin-top: 8px; align-items: start; }
.card-grid.size-small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }
.card-grid.size-medium { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
.card-grid.size-large { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }
.card-empty { margin: 28px 0; padding: 32px 20px; text-align: center; border: 1px dashed #c7d0df; border-radius: 12px; background: #f8f9fc; }
.card-empty h2 { margin-top: 0; }
/* real in-game card faces (from battlecards/cardart.js) */
.wiki-card { display: block; border-radius: 10px; }
.wiki-card .wiki-face { width: 100%; height: auto; display: block; border-radius: 10px; transition: transform .1s, box-shadow .1s; }
.wiki-card:hover .wiki-face { transform: translateY(-2px); box-shadow: 0 5px 16px rgba(43,108,176,.4); }
/* single card page */
.card-page { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; }
.card-page-face .wiki-face-big { width: 340px; max-width: 82vw; height: auto; border-radius: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.18); }
.card-page-info { flex: 1; min-width: 260px; }
.card-page-meta { color: #76819c; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; margin: 2px 0 10px; }
.card-page-stats { font-weight: 700; color: #c2410c; font-size: 15px; margin-bottom: 14px; }
.card-page-rules { font-size: 15px; line-height: 1.55; background: #fff; border: 1px solid #e1e6f0; border-radius: 10px; padding: 14px 16px; }
.card-page-rules b { color: #1c2230; }
/* clickable type / tribe / school tags */
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tag-chip { display: inline-block; padding: 3px 11px; border-radius: 12px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent; }
.tag-chip:hover { text-decoration: none; filter: brightness(0.95); }
.tag-chip.type { background: #e7edfa; color: #2b5cb0; border-color: #cdd9f2; }
.tag-chip.tribe { background: #eae6f7; color: #6a3cb0; border-color: #ddd3f0; }
.tag-chip.school { background: #fbeede; color: #b9770e; border-color: #f0dcc0; }
.tag-chip.kw { background: #eef4ec; color: #2f7a3f; border-color: #d3e6d3; }
/* design-work item thumbnail (plane candidates) */
.card img.design-art { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; display: block; }
/* per-card "Art" section: the illustration on its own, no frame */
.card-art-section { margin-top: 22px; }
.card-art-section .wiki-art-solo {
  width: 360px; max-width: 82vw; height: auto; display: block; border-radius: 10px;
  image-rendering: auto; box-shadow: 0 4px 16px rgba(0,0,0,.18); border: 1px solid #e1e6f0;
}
/* keyword definition list on a card page */
.kw-defs { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.kw-def { display: flex; gap: 10px; align-items: baseline; }
.kw-def .tag-chip { flex: none; }
.kw-def .kw-text { color: #45507a; font-size: 14px; line-height: 1.4; }
.card-tile { background: #fff; border: 1px solid #e1e6f0; border-radius: 8px; overflow: hidden; }
.card-tile:hover { border-color: #2b6cb0; box-shadow: 0 2px 8px rgba(43,108,176,.15); }
.card-art { position: relative; height: 120px; background: #11151f; }
.card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cost { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: #2456b8; color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.card-nm { font-weight: 600; color: #1c2230; font-size: 13px; padding: 5px 8px 0; line-height: 1.2; }
.card-sub { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 8px 7px; }
.card-stats { font-weight: 700; color: #c2410c; }
.showmore { display: block; margin: 14px auto; padding: 7px 16px; border: 1px solid #d3dae8; background: #fff;
  color: #45507a; border-radius: 6px; cursor: pointer; }
.showmore:hover { border-color: #2b6cb0; }

@media (max-width: 720px) {
  .gallery-heading { align-items: flex-start; }
  .result-count { min-width: 92px; font-size: 23px; }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 11px; gap: 8px; }
  .filter-actions { padding: 0 11px 11px; }
  .card-grid.size-small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 7px; }
  .card-grid.size-medium { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; }
  .card-grid.size-large { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 11px; }
}
@media (max-width: 430px) {
  .gallery-heading { display: block; }
  .result-count { margin-top: 8px; text-align: left; }
  .result-count span { display: inline; margin-left: 4px; }
  .filter-fields { grid-template-columns: 1fr 1fr; }
  .advanced-filters > summary { padding: 10px 12px; }
}

/* responsive wiki shell: full nav collapses into a hamburger slide-out drawer on phones */
@media (max-width: 720px) {
  header { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  header .brand { font-size: 14px; }
  #navToggle { display: inline-flex; align-items: center; justify-content: center; }
  #search { order: 3; flex: 1 0 100%; max-width: none; width: 100%; }
  #status { min-width: 0; width: auto; white-space: nowrap; }
  .layout { display: block; min-width: 0; }
  /* off-canvas drawer: the existing vertical nav, slid in from the left */
  #sidebar {
    position: fixed; top: 0; left: 0; z-index: 40;
    width: min(80vw, 288px); height: 100dvh;
    transform: translateX(-100%); transition: transform .24s ease;
    overflow-y: auto; overflow-x: hidden; padding: 14px 0 40px;
    border-right: 1px solid #dde3ee; border-bottom: 0;
    box-shadow: 2px 0 24px rgba(15,20,35,.22); -webkit-overflow-scrolling: touch;
  }
  body.nav-open #sidebar { transform: translateX(0); }
  #navScrim {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(15,20,35,.46);
    opacity: 0; pointer-events: none; transition: opacity .24s ease;
  }
  body.nav-open #navScrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  #content { width: 100%; min-width: 0; max-width: none; padding: 16px 13px; }
}
@media (max-width: 430px) {
  #status { display: none; }
}

/* ---- Land Pools index + pool detail ---- */
.lp-pool-section { margin-top: 22px; }
.lp-pool-section:first-child { margin-top: 0; }
.lp-pool-section h2 { margin-bottom: 4px; }
.lp-pool-section > p.muted { margin: 0 0 10px; }
.lp-tier { margin-top: 4px; }
.lp-tier-head h2 { margin-bottom: 2px; }
.lp-tier-head p { margin: 0 0 10px; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 6px 0 24px; }
.lp-tile { display: flex; flex-direction: column; gap: 9px; justify-content: space-between;
  background: #fff; border: 1px solid #e1e6f0; border-radius: 10px; padding: 12px 13px;
  color: #1c2230; min-height: 72px; transition: transform .1s, box-shadow .1s, border-color .1s; }
.lp-tile:hover { border-color: #2b6cb0; text-decoration: none; box-shadow: 0 3px 12px rgba(43,108,176,.16); transform: translateY(-1px); }
.lp-tile .lp-name { font-weight: 650; font-size: 14.5px; line-height: 1.25; }
.lp-tile .lp-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lp-count { color: #76819c; font-size: 12px; font-weight: 500; white-space: nowrap; }
/* ---- Lorequest character-deck tiles ---- */
.lq-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; text-decoration: none; color: #1c2230; }
.lq-tile .lq-name { font-weight: 650; font-size: 13px; text-align: center; line-height: 1.2; }
.lq-tile .lq-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.lq-cls { color: #76819c; text-transform: capitalize; white-space: nowrap; }
.lp-detail-meta .lq-cls { font-size: 13px; }
.lq-sizectl { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.lq-sizebar { display: inline-flex; border: 1px solid #d3d9e6; border-radius: 8px; overflow: hidden; }
.lq-sizebtn { border: none; background: #fff; color: #45506a; font-weight: 700; font-size: 12.5px; width: 34px; height: 28px; cursor: pointer; border-left: 1px solid #eef1f7; }
.lq-sizebtn:first-child { border-left: none; }
.lq-sizebtn:hover { background: #eef2fb; }
.lq-sizebtn.active { background: #2b6cb0; color: #fff; }
.lp-tile.tier-basic { border-left: 3px solid #9aa7bd; }
.lp-tile.tier-mono  { border-left: 3px solid #6ba3d6; }
.lp-tile.tier-two   { border-left: 3px solid #9b72c8; }
.lp-tile.tier-three { border-left: 3px solid #d59a3c; }
/* WUBRG(C) mana pips */
.lp-pips { display: inline-flex; gap: 3px; }
.pip { width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 -1px 2px rgba(0,0,0,.12); }
.pip-W { background: #fbf7dd; } .pip-U { background: #4a8fd0; } .pip-B { background: #4b4b57; }
.pip-R { background: #e0584a; } .pip-G { background: #5aa763; } .pip-C { background: #c3c8d2; }
/* pool detail header (land face + its taps) */
.lp-back { margin: 0 0 12px; }
.lp-detail-head { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.lp-detail-face .wiki-face-big { width: 220px; max-width: 60vw; height: auto; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.lp-detail-info { flex: 1; min-width: 240px; }
.lp-detail-info h1 { margin-bottom: 6px; }
.lp-detail-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lp-taps { margin: 0; padding-left: 18px; color: #45507a; font-size: 14px; line-height: 1.5; }
.lp-taps li { margin: 2px 0; }
@media (max-width: 720px) {
  .lp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .lp-detail-face .wiki-face-big { width: 148px; }
  .lp-detail-head { gap: 16px; }
}

/* owner-only "New Version" note box on card pages (mgibbie account) */
.owner-todo { margin: 26px 0 6px; padding: 14px 16px; max-width: 720px; border: 1px solid #b9a7e6; border-radius: 12px; background: #f2eefb; }
.owner-todo h2 { margin: 0 0 10px; font-size: 16px; }
.owner-todo .todo-text { width: 100%; padding: 9px 11px; font: inherit; border: 1px solid #c9c2dd; border-radius: 8px; background: #fff; resize: vertical; }
.owner-todo .todo-text:focus { outline: 2px solid #6b4fd4; border-color: transparent; }
.owner-todo .todo-submit { padding: 8px 16px; font: inherit; font-weight: 600; color: #fff; background: #6b4fd4; border: 0; border-radius: 8px; cursor: pointer; }
.owner-todo .todo-submit:hover { background: #7d63e6; }
.owner-todo .todo-submit:disabled { opacity: .6; cursor: default; }
