/* WILDCAP app pages (dex, den, league, docs, 404). Owner: PAGES. Builds on base.css tokens. */

body.app {
  background:
    radial-gradient(1200px 420px at 50% -120px, var(--sky) 0%, transparent 70%),
    linear-gradient(var(--sky-2), var(--cream) 900px);
  min-height: 100vh;
}
.app main { padding-top: calc(var(--nav-h) + 22px); padding-bottom: 72px; }

/* ── page board: the title sticker at the top of an app page ── */
.board {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: end;
  padding: clamp(20px, 3.4vw, 34px); margin-bottom: 26px;
  background: var(--panel); border: 2px solid var(--ink); border-radius: calc(var(--radius) + 6px); box-shadow: 0 6px 0 var(--ink);
  overflow: hidden;
}
.board::before { /* soft cloud blobs */
  content: ''; position: absolute; right: -60px; top: -80px; width: 320px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--sky-2), transparent); pointer-events: none;
}
.board > * { position: relative; }
.board .h1 { margin: 8px 0 8px; }
.board .lead { margin: 0; }
.board-side { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } .board-side { justify-content: flex-start; } }

.stat {
  min-width: 108px; padding: 10px 14px; background: var(--panel-2); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink);
}
.stat b { display: block; font: 800 24px/1.05 var(--f-display); font-variant-numeric: tabular-nums; }
.stat small { display: block; margin-top: 3px; font: 800 11px/1.1 var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ── pills, filters ─────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  border: 2px solid var(--ink); background: var(--panel); font: 800 14px/1 var(--f-body); cursor: pointer; color: var(--ink);
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.pill:hover { transform: translateY(-1px); }
.pill:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.pill[aria-pressed='true'] { background: var(--sun); }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.field {
  min-height: 42px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel);
  font: 700 15px/1 var(--f-body); color: var(--ink); box-shadow: inset 0 2px 0 var(--line);
}
.field::placeholder { color: var(--muted); }
select.field { padding-right: 34px; appearance: none; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c2742' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px; cursor: pointer; }
.search { flex: 1 1 220px; min-width: 0; }
.label-sm { font: 800 12px/1 var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ── creature cards (Dex, Den) ──────────────────────── */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 20px; }
@media (max-width: 520px) { .grid-cards { grid-template-columns: 1fr 1fr; gap: 12px; } }
.ccard {
  --rc: var(--r-common);
  position: relative; display: flex; flex-direction: column; text-align: left; width: 100%; padding: 0; overflow: hidden;
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 0 6px 0 var(--ink);
  color: var(--ink); font: inherit; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
button.ccard:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: 0 9px 0 var(--ink); }
button.ccard:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.ccard[data-r='uncommon'] { --rc: var(--r-uncommon); }
.ccard[data-r='rare'] { --rc: var(--r-rare); }
.ccard[data-r='epic'] { --rc: var(--r-epic); }
.ccard[data-r='legendary'] { --rc: var(--r-legendary); }
.ccard.is-new { animation: pop 0.6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.ccard-art {
  position: relative; aspect-ratio: 1 / 0.86; display: grid; place-items: center; border-bottom: 2px solid var(--ink);
  background: radial-gradient(circle at 50% 70%, rgba(255,255,255,.9) 0 28%, transparent 29%), linear-gradient(160deg, var(--isl-a, var(--sky-2)), var(--isl-b, var(--sky)));
}
.ccard-art[data-island='meadow'] { --isl-a: #e9fbd9; --isl-b: #b6f0d3; }
.ccard-art[data-island='marsh'] { --isl-a: #e7f6ea; --isl-b: #a9dcc9; }
.ccard-art[data-island='cliffs'] { --isl-a: #fff3dd; --isl-b: #ffd9a8; }
.ccard-art[data-island='peaks'] { --isl-a: #efe7ff; --isl-b: #cfd8ff; }
.ccard-art .portrait { width: 78%; height: 78%; }
.ccard-art .badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; }
.ccard-art .lv { white-space: nowrap; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: #fff; font: 800 12px/1.2 var(--f-body); }
.ccard-body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.ccard-name { font: 800 18px/1.1 var(--f-display); margin: 0; overflow-wrap: anywhere; }
.ccard-sym { font-weight: 800; color: var(--ink-2); font-size: 14px; }
.ccard-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.ccard-meta span { white-space: nowrap; }
.ccard-first { font-size: 12.5px; color: var(--muted); font-weight: 700; border-top: 2px dashed var(--line-2); padding-top: 7px; margin-top: 2px; overflow-wrap: anywhere; }
.ccard-first b { color: var(--ink); }
.ccard-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 14px; }
.ccard-actions .btn { flex: 1 1 auto; }
.stage { display: inline-flex; gap: 3px; vertical-align: middle; }
.stage i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); }
.stage i.on { background: var(--rc, var(--grass)); }
.mood { display: inline-flex; align-items: center; gap: 4px; }
.mood::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mood[data-m='hyped']::before { background: var(--coral); }
.mood[data-m='calm']::before { background: var(--grass); }
.mood[data-m='sleepy']::before { background: var(--sky-deep); }
@media (max-width: 520px) {
  .ccard-body { padding: 10px; } .ccard-name { font-size: 16px; } .ccard-meta { font-size: 12px; } .ccard-actions { padding: 0 10px 10px; }
  .ccard-actions .btn { min-height: 38px; padding: 6px 10px; font-size: 13px; }
}

/* portrait fallback blob */
.blob { width: 100%; height: 100%; }

/* skeletons */
.skel { pointer-events: none; }
.skel .ccard-art { background: var(--panel-2); }
.skel .bar { height: 12px; border-radius: 6px; background: var(--line); animation: shimmer 1.2s ease-in-out infinite alternate; }
@keyframes shimmer { from { opacity: 0.5; } to { opacity: 1; } }

/* ── empty / error states ───────────────────────────── */
.empty {
  display: grid; justify-items: center; text-align: center; gap: 10px; padding: clamp(28px, 6vw, 56px) 20px;
  background: var(--panel); border: 2px dashed var(--ink); border-radius: var(--radius); grid-column: 1 / -1;
}
.empty .egg { width: 86px; height: 104px; }
.empty .h3 { margin: 6px 0 0; }
.empty p { margin: 0; max-width: 46ch; color: var(--ink-2); }
.empty .btn { margin-top: 8px; }

/* ── drawer (Dex detail) ────────────────────────────── */
dialog.drawer {
  margin: 0 0 0 auto; height: 100%; max-height: 100dvh; width: min(520px, 100%); max-width: 100%; padding: 0;
  border: 0; border-left: 2px solid var(--ink); background: var(--cream); color: var(--ink); overflow: auto; overscroll-behavior: contain;
}
dialog.drawer[open] { animation: slidein 0.28s cubic-bezier(.2, .9, .3, 1); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog.drawer::backdrop { background: rgba(28, 39, 66, 0.35); backdrop-filter: blur(2px); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; background: var(--cream); border-bottom: 2px solid var(--ink); }
.drawer-body { padding: 18px; display: grid; gap: 18px; }
.drawer .ccard-art { border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 0 6px 0 var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 15px; }
.kv dt { color: var(--muted); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; padding-top: 2px; }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--panel); border: 2px solid var(--ink); border-radius: 14px; font-weight: 700; font-size: 14px; }
.history li span:last-child { color: var(--muted); white-space: nowrap; }

/* ── tables ─────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--panel); box-shadow: 0 4px 0 var(--ink); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 2px solid var(--line); vertical-align: top; }
.tbl th { font: 800 12px/1.2 var(--f-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); background: var(--panel-2); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td b { font-weight: 800; }
.tbl tr.me td { background: #fff6d6; }
@media (max-width: 520px) { .tbl { font-size: 14px; } .tbl th, .tbl td { padding: 9px 10px; } }

/* ── notices ────────────────────────────────────────── */
.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--ink); border-radius: var(--radius-sm);
  background: #fff6d6; font-weight: 700; font-size: 15px;
}
.note.info { background: #e4f3ff; }
.note.ok { background: #dcf7e8; }
.note.warn { background: #ffe4df; }
.note svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.note p { margin: 0; }
.lock-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--ink); color: #fff; font: 800 12px/1.2 var(--f-body); }

/* generic two-col layout */
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 18px; }
.card h2.h3, .card h3.h3 { margin-bottom: 10px; }
.sec-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin: 34px 0 14px; }
.sec-title .h2 { margin: 0; }

/* ── Den slots ──────────────────────────────────────── */
.slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 420px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slot {
  position: relative; display: grid; align-content: start; gap: 6px; min-height: 196px; padding: 10px; text-align: center;
  border: 2px dashed var(--ink-2); border-radius: var(--radius-sm); background: rgba(255,255,255,.55);
}
.slot.filled { border-style: solid; border-color: var(--ink); background: var(--panel); box-shadow: 0 4px 0 var(--ink); }
.slot .slot-n { position: absolute; top: 6px; left: 8px; font: 800 11px/1 var(--f-body); color: var(--muted); }
.slot .slot-art { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); }
.slot .slot-art .portrait { width: 86%; height: 86%; }
.slot .slot-empty { display: grid; place-items: center; aspect-ratio: 1; color: var(--muted); font-weight: 800; font-size: 13px; }
.slot b { font: 800 14px/1.15 var(--f-display); overflow-wrap: anywhere; }
.slot small { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.slot .btn { min-height: 32px; padding: 4px 10px; font-size: 12.5px; box-shadow: 0 2px 0 var(--ink); }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .tiers { grid-template-columns: 1fr; } }
.tier { padding: 12px 14px; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--panel-2); }
.tier.you { background: var(--sun); box-shadow: 0 4px 0 var(--ink); }
.tier b { font: 800 17px/1.1 var(--f-display); display: block; }
.tier small { color: var(--ink-2); font-weight: 700; font-size: 13px; display: block; }
.tier ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; font-weight: 700; }
.big-eth { font: 800 clamp(30px, 4vw, 40px)/1 var(--f-display); font-variant-numeric: tabular-nums; }

/* ── League ─────────────────────────────────────────── */
.rank { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); font: 800 14px/1 var(--f-display); background: var(--panel); }
.rank.r1 { background: var(--sun); } .rank.r2 { background: #e6edf5; } .rank.r3 { background: #ffd9a8; }
.yes { color: var(--grass-deep); font-weight: 800; }
.no { color: var(--muted); font-weight: 800; }
.trainer { display: grid; line-height: 1.2; }
.trainer small { color: var(--muted); font-weight: 700; font-size: 12px; }
.cd { display: inline-flex; gap: 6px; }
.cd span { min-width: 50px; padding: 6px 6px 5px; text-align: center; background: var(--panel); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.cd b { display: block; font: 800 20px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.cd small { display: block; font: 800 9px/1 var(--f-body); letter-spacing: 0.12em; color: var(--muted); margin-top: 3px; }
.past { display: grid; gap: 10px; }
.past-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-sm); }
.past-row .muted { font-size: 13px; overflow-wrap: anywhere; }

/* ── Docs ───────────────────────────────────────────── */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: calc(var(--nav-h) + 18px); max-height: calc(100vh - var(--nav-h) - 36px); overflow: auto; padding: 16px; }
.toc summary { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; padding: 7px 10px; border-radius: 10px; text-decoration: none; font-weight: 800; font-size: 14.5px; color: var(--ink-2); }
.toc a:hover { background: var(--sky-2); color: var(--ink); }
.toc a.on { background: var(--sun); color: var(--ink); }
.toc ol ol { padding-left: 12px; }
.toc ol ol a { font-weight: 700; font-size: 13.5px; padding: 5px 10px; }
.doc { min-width: 0; }
.doc > section { scroll-margin-top: calc(var(--nav-h) + 16px); padding: 4px 0 34px; border-bottom: 2px dashed var(--line-2); margin-bottom: 30px; }
.doc > section:last-child { border-bottom: 0; }
.doc h2 { font: 800 clamp(26px, 3vw, 36px)/1.08 var(--f-display); margin: 0 0 14px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.doc h3 { font: 800 21px/1.2 var(--f-display); margin: 26px 0 10px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.doc p, .doc li { color: var(--ink-2); max-width: 70ch; }
.doc p b, .doc li b { color: var(--ink); }
.doc ul, .doc ol.steps { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc .tbl-wrap { margin: 12px 0 8px; }
.doc .note { margin: 14px 0; }
.doc code, .doc .k { font: 800 0.95em/1 var(--f-body); background: var(--panel); border: 2px solid var(--line-2); border-radius: 8px; padding: 1px 6px; color: var(--ink); overflow-wrap: anywhere; }
.anchor { text-decoration: none; color: var(--muted); margin-left: 6px; font-size: 0.7em; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 12px 0; }
.keys .card { padding: 16px; box-shadow: 0 4px 0 var(--ink); }
.keys .card p, .keys .card li { font-size: 15px; }
kbd { display: inline-block; min-width: 26px; padding: 2px 7px; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 8px; background: var(--panel); font: 800 13px/1.3 var(--f-body); text-align: center; color: var(--ink); }
details.faq { border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--panel); margin: 10px 0; box-shadow: 0 3px 0 var(--ink); }
details.faq summary { cursor: pointer; padding: 14px 16px; font: 800 17px/1.3 var(--f-display); list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: '+'; font-size: 22px; line-height: 1; }
details.faq[open] summary::after { content: '–'; }
details.faq > div { padding: 0 16px 14px; }
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.calc label { display: grid; gap: 6px; }
.calc .field { border-radius: 12px; width: 100%; }
.calc-out { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--sun); border: 2px solid var(--ink); border-radius: var(--radius-sm); font-weight: 800; }
.calc-out b { font: 800 28px/1 var(--f-display); }
.verify { display: grid; gap: 10px; }
.verify .row-btns { align-items: center; }
.verify output { display: block; font-size: 14px; overflow-wrap: anywhere; }
.addr { font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; gap: 18px; }
  .toc { position: static; max-height: none; padding: 0; }
  .toc summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; cursor: pointer; font: 800 16px/1 var(--f-display); list-style: none; }
  .toc summary::-webkit-details-marker { display: none; }
  .toc summary::after { content: '+'; font-size: 22px; }
  .toc[open] summary::after { content: '–'; }
  .toc ol { padding: 0 10px 12px; }
}

/* ── 404 ────────────────────────────────────────────── */
.lost { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; text-align: center; padding: calc(var(--nav-h) + 30px) var(--gutter) 60px; }
.lost .card { max-width: 560px; display: grid; justify-items: center; gap: 12px; padding: clamp(24px, 5vw, 44px); }
.lost .egg { width: 140px; height: 168px; animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wobble { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-9deg); } 80% { transform: rotate(7deg); } 90% { transform: rotate(-3deg); } }
.lost .row-btns { justify-content: center; }
dialog.card { border: 2px solid var(--ink); color: var(--ink); }
dialog.card::backdrop { background: rgba(28, 39, 66, 0.35); backdrop-filter: blur(2px); }
dialog.card p { margin: 0 0 8px; }
@media (max-width: 520px) {
  .board-side.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .stats .stat { min-width: 0; padding: 8px 10px; }
  .stats .stat b { font-size: 19px; }
  .stats .stat small { font-size: 10px; letter-spacing: 0.06em; }
}
.chip-rage { background: #ffd2cb; }
.chip-rage::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--coral-deep); }
.split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 900px) { .split.even { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .slot:not(.filled) { min-height: 0; } .slot:not(.filled) .slot-empty { aspect-ratio: auto; padding: 18px 0 4px; } }
.trainer small { white-space: nowrap; }
@media (max-width: 520px) { .hide-sm { display: none; } }
@media (max-width: 520px) { .tbl th, .tbl td { padding: 8px 8px; } .tbl th { letter-spacing: 0.04em; font-size: 11px; white-space: normal; } .tbl .chip { padding: 3px 7px; font-size: 11px; } }
