/* Pokédex. Colours come from the shared themes (themes.css on durpeesquid.com), so every theme works here.
   Same base as the other DurpeeSquid sites; the Pokédex's own parts are in pokedex.css. One typeface; motion respects prefers-reduced-motion. */

:root {
  /* fallbacks until the shared theme loads */
  --bg: #0a0a0b; --card: #111113; --card-hover: #151518; --tile: #1d1d21;
  --border: #232327; --border-strong: #34343a; --text: #f4f4f5; --muted: #8b8b94;
  --accent: #5eead4; --on-accent: #04201c; --danger: #f87171; --glow-a: #5eead4; --glow-b: #818cf8;
  --good: var(--s-completed, #4ade80); --bad: var(--danger); --warn: var(--s-on_hold, #fbbf24);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
[hidden] { display: none !important; }
main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px) 96px; }
a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
.muted { color: var(--muted); font-size: 0.9rem; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { letter-spacing: -0.02em; }

/* ---- header ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px;
  margin: 0 calc(-1 * clamp(16px, 3vw, 32px)) 32px; padding: 12px clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.badge {
  flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px;
  background: var(--card); border: 1px solid var(--border); border-radius: 11px;
  font-size: 0.85rem; font-weight: 700; color: var(--text);
  transition: transform 0.25s var(--ease), border-color 0.2s;
}
.badge:hover { border-color: var(--accent); transform: rotate(-6deg) scale(1.05); opacity: 1; }
.wordmark { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.02em; white-space: nowrap; }
.sep { flex: none; width: 1px; height: 16px; background: var(--border-strong); }
.handle { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.i { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 15px; border-radius: 11px;
  background: transparent; color: var(--muted); border: 1px solid transparent;
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.25s, opacity 0.2s;
}
.btn:hover { color: var(--text); background: var(--card); border-color: var(--border); transform: translateY(-1px); opacity: 1; }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.nav-active { color: var(--text); background: var(--card); border-color: var(--border-strong); box-shadow: inset 0 -2px 0 var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; padding: 10px 20px; }
.btn.primary:hover { background: var(--accent); color: var(--on-accent); filter: brightness(1.08); box-shadow: 0 8px 22px -8px var(--accent); }
.btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-disabled='true']:hover { transform: none; box-shadow: none; filter: none; }
.btn.is-done { background: color-mix(in srgb, var(--good) 16%, var(--card)); color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); opacity: 1; cursor: default; }

/* ---- page heading ---- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px 24px; margin-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s ease-out infinite; }
h1 { margin: 0; font-size: clamp(1.9rem, 4.6vw, 2.7rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
h2.section { margin: 40px 0 14px; font-size: 1.2rem; font-weight: 650; }
.statpanel { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.stat-cell { padding: 12px 20px; border-left: 1px solid var(--border); min-width: 0; }
.stat-cell:first-child { border-left: 0; }
.stat-label { display: block; margin-bottom: 2px; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---- controls ---- */
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.filters { align-items: end; margin-bottom: 24px; }
.field { display: grid; gap: 4px; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
input, select {
  font: inherit; font-size: 0.92rem; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; max-width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type='number']::-webkit-outer-spin-button, input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; margin-bottom: 20px; }
.notice { display: flex; align-items: center; gap: 12px; }

/* ---- tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile-stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 18px; min-width: 0;
  transition: transform 0.25s var(--ease), border-color 0.2s, box-shadow 0.25s;
}
.tile-stat:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.6); }
.tile-stat .stat-label { margin-bottom: 4px; }
.tile-stat .stat-value { display: block; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-stat .stat-value.small { font-size: 1rem; font-weight: 600; letter-spacing: 0; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 18px; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 18px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
th { font-size: 0.82rem; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--tile) 40%, var(--card)); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; transition: color 0.2s; }
th.sortable:hover { color: var(--text); }
th.num, td.num { text-align: right; }
tbody tr { transition: background 0.2s; animation: fade 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 18ms); }
tr.click { cursor: pointer; }
tbody tr:hover td { background: var(--card-hover); }
.meter { display: block; position: relative; height: 3px; margin-top: 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); overflow: hidden; }
.meter::after { content: ''; position: absolute; inset: 0; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--glow-a), var(--accent)); transform-origin: left; animation: grow 0.9s var(--ease) both; }
.empty { color: var(--muted); padding: 28px 0; }


/* ---- loading placeholders ---- */
.skel { border-radius: 16px; background: linear-gradient(90deg, var(--tile), color-mix(in srgb, var(--tile) 55%, var(--card)), var(--tile)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel.title { height: 44px; width: min(320px, 70%); margin-bottom: 26px; }
.skel.bar { height: 40px; width: 240px; margin-bottom: 24px; }
.skel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.skel.card { height: 128px; border-radius: 18px; }

/* ---- background, toast, footer ---- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(100px); opacity: 0.16; animation: drift 28s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { top: -18vmax; left: -12vmax; background: var(--glow-a); }
.aurora i:nth-child(2) { top: 12vmax; right: -16vmax; background: var(--glow-b); animation-duration: 34s; animation-delay: -9s; }
.aurora i:nth-child(3) { bottom: -24vmax; left: 24vw; background: var(--accent); opacity: 0.08; animation-duration: 40s; animation-delay: -15s; }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 24px) scale(0.96); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 14px; background: var(--card); color: var(--text); font-weight: 500;
  border: 1px solid var(--border-strong); box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.error { border-color: var(--danger); color: var(--danger); }
footer.foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); }

/* ---- motion ---- */
#view > *:not(.tiles) { animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.tiles > * { animation: rise 0.55s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dock { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vmax, 4vmax, 0) scale(1.15); } }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); } 50% { box-shadow: 0 0 22px -2px color-mix(in srgb, var(--accent) 55%, transparent); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
