/* ==========================================================================
   QBone — public site styles
   Colors, fonts, radius and logo size come from CSS variables that the admin
   "Appearance" settings write into <head>. Defaults below are fallbacks.
   ========================================================================== */

:root {
  --c-primary: #D0310C;
  --c-secondary: #FFCB05;
  --c-accent: #2A75BB;
  --c-bg: #FFF8EC;
  --c-surface: #FFFFFF;
  --c-text: #1F2433;
  --c-muted: #5F6577;
  --c-link: #1F5FA8;
  --c-header-bg: #D0310C;
  --c-header-text: #FFFFFF;
  --c-footer-bg: #1F2433;
  --c-footer-text: #E9ECF5;
  --font-heading: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --fs-base: 17px;
  --radius: 18px;
  --logo-h: 44px;

  /* Derived */
  --c-border: color-mix(in srgb, var(--c-text) 12%, transparent);
  --c-tint: color-mix(in srgb, var(--c-secondary) 14%, var(--c-bg));
  --shadow: 0 2px 0 color-mix(in srgb, var(--c-text) 8%, transparent), 0 10px 30px color-mix(in srgb, var(--c-text) 7%, transparent);
  --shadow-lift: 0 4px 0 color-mix(in srgb, var(--c-text) 10%, transparent), 0 18px 40px color-mix(in srgb, var(--c-text) 12%, transparent);
  --radius-sm: calc(var(--radius) * .55);
  --container: 1180px;

  /* Skill & energy palette */
  --lvl-beginner: #2E7D32;
  --lvl-intermediate: #9A5800;
  --lvl-advanced: #B8235A;
  --lvl-all: #5B52A6;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs-base); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-link); text-underline-offset: .18em; }
a:hover { color: var(--c-primary); }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 6px; }
.site-header :focus-visible, .site-footer :focus-visible, .hero :focus-visible, .page-hero :focus-visible, .article-header :focus-visible, .admin-bar :focus-visible { outline-color: #fff; box-shadow: 0 0 0 6px #1F2433; }
::selection { background: var(--c-secondary); color: var(--c-text); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }
.narrow { max-width: 820px; }
.muted { color: var(--c-muted); }
.small { font-size: .88rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--c-secondary); color: var(--c-text); padding: .6rem 1rem; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--c-surface);
  --btn-fg: var(--c-text);
  --btn-edge: color-mix(in srgb, var(--btn-bg) 70%, #000);
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .7em 1.35em;
  border: 0; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font: 700 1rem/1.1 var(--font-heading);
  text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 var(--btn-edge);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--btn-edge); color: var(--btn-fg); filter: brightness(1.04); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-edge); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--c-primary); --btn-fg: #fff; }
.btn-secondary { --btn-bg: var(--c-secondary); --btn-fg: var(--c-text); }
.btn-accent { --btn-bg: var(--c-accent); --btn-fg: #fff; }
.btn-light { --btn-bg: #fff; --btn-fg: var(--c-text); --btn-edge: rgba(0,0,0,.18); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--c-text); --btn-edge: transparent; box-shadow: inset 0 0 0 2px var(--c-border); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px var(--c-accent); }
.btn-small { padding: .45em .95em; font-size: .88rem; }
.btn-large { padding: .9em 1.7em; font-size: 1.1rem; }

/* ---------- Admin bar & banners ---------- */
.admin-bar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; background: #11141d; color: #cfd3e1; font-size: .82rem; padding: .35rem 16px; }
.admin-bar a { color: #fff; font-weight: 700; text-decoration: none; }
.preview-banner { background: var(--c-secondary); color: var(--c-text); text-align: center; padding: .5rem 16px; font-weight: 700; }

/* ---------- Header ---------- */
.site-header { background: var(--c-header-bg); color: var(--c-header-text); position: sticky; top: 0; z-index: 50; box-shadow: 0 3px 0 color-mix(in srgb, var(--c-header-bg) 70%, #000); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand:hover { color: inherit; }
.brand-logo { height: var(--logo-h); width: auto; }
.brand-name { font: 700 1.55rem/1 var(--font-heading); letter-spacing: .01em; }
.site-nav { display: flex; align-items: center; gap: 1rem; flex: 1; justify-content: flex-end; }
.site-nav > ul { display: flex; align-items: center; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.site-nav > ul > li { position: relative; display: flex; align-items: center; }
.site-nav a { color: var(--c-header-text); text-decoration: none; font: 600 1rem var(--font-heading); padding: .5rem .75rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .4rem; }
.site-nav > ul > li > a:hover, .site-nav > ul > li > a.is-active { background: color-mix(in srgb, var(--c-header-bg) 72%, #000); }
.submenu-toggle { background: none; border: 0; color: var(--c-header-text); cursor: pointer; padding: .25rem; margin-left: -.5rem; font-size: .8rem; min-width: 28px; min-height: 28px; border-radius: 6px; }
.submenu { position: absolute; top: 100%; left: 0; min-width: 240px; list-style: none; margin: .4rem 0 0; padding: .5rem; background: var(--c-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lift); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .15s ease; z-index: 60; }
.submenu a { color: var(--c-text); display: flex; width: 100%; padding: .5rem .75rem; border-radius: 10px; font-weight: 500; }
.submenu a:hover { background: var(--c-tint); color: var(--c-text); }
.has-menu:hover > .submenu, .has-menu:focus-within > .submenu, .has-menu.open > .submenu { opacity: 1; visibility: visible; transform: none; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.header-search { display: flex; align-items: center; background: color-mix(in srgb, var(--c-header-text) 92%, transparent); border-radius: 999px; padding: .2rem .25rem .2rem .9rem; min-width: 0; }
.header-search input { border: 0; background: transparent; font: inherit; font-size: .92rem; color: var(--c-text); width: 200px; padding: .35rem 0; outline: none; }
.header-search button { border: 0; background: var(--c-secondary); color: var(--c-text); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }

.nav-toggle { display: none; margin-left: auto; background: none; border: 0; width: 44px; height: 44px; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; height: 3px; background: var(--c-header-text); border-radius: 3px; margin: 5px 0; transition: .2s; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1020px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; background: var(--c-header-bg); padding: .5rem 16px 1.25rem; box-shadow: 0 10px 20px rgba(0,0,0,.15); max-height: calc(100vh - 70px); overflow-y: auto; }
  .nav-open .site-nav { display: flex; }
  .site-nav > ul { flex-direction: column; align-items: stretch; }
  .site-nav > ul > li { flex-wrap: wrap; }
  .site-nav > ul > li > a { flex: 1; padding: .7rem .75rem; }
  .submenu-toggle { margin-left: 0; padding: .7rem 1rem; font-size: 1rem; }
  .submenu { position: static; display: none; opacity: 1; visibility: visible; transform: none; box-shadow: none; width: 100%; margin: 0 0 .5rem; }
  .has-menu:hover > .submenu, .has-menu:focus-within > .submenu { display: none; }
  .has-menu.open > .submenu { display: block; }
  .header-search { margin-top: .5rem; }
  .header-search input { width: 100%; flex: 1; }
}

/* ---------- Hero ---------- */
.hero { position: relative; background: linear-gradient(135deg, color-mix(in srgb, var(--c-primary) 92%, #000), color-mix(in srgb, var(--c-primary) 70%, #000)); color: #fff; padding: 4rem 0 6rem; overflow: hidden; }
.hero.has-image { background: linear-gradient(90deg, rgba(20,20,30,.78), rgba(20,20,30,.35)), var(--hero-img) center/cover no-repeat; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.18) 1.5px, transparent 0); background-size: 26px 26px; pointer-events: none; }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: center; }
.hero h1 { color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.15); }
.hero .lead { font-size: 1.2rem; max-width: 36em; }
.hero .btn-primary { --btn-bg: var(--c-secondary); --btn-fg: var(--c-text); }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.5rem 0; }
.hero-search { display: flex; gap: .5rem; background: #fff; border-radius: 999px; padding: .35rem; max-width: 520px; box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: .55rem .9rem; font: inherit; color: var(--c-text); }
.hero-wave { position: absolute; bottom: -1px; left: 0; width: 100%; height: 60px; fill: var(--c-bg); }
.hero-art { position: relative; height: 320px; }
.float-card { position: absolute; width: 150px; height: 210px; border-radius: 16px; background: #fff; border: 8px solid var(--c-secondary); box-shadow: 0 16px 30px rgba(0,0,0,.25); display: grid; place-items: center; font-size: 3.4rem; animation: float 6s ease-in-out infinite; }
.float-card span { width: 90px; height: 90px; border-radius: 50%; display: grid; place-items: center; background: var(--c-tint); }
.fc-1 { left: 8%; top: 30px; transform: rotate(-10deg); }
.fc-2 { left: 38%; top: 0; z-index: 2; animation-delay: -2s; border-color: #8fd3ff; }
.fc-3 { left: 66%; top: 60px; transform: rotate(9deg); animation-delay: -4s; border-color: #ffe38a; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .card:hover, .level-card:hover, .tool-tile:hover, .format-tile:hover, .steps a:hover, .btn:hover { transform: none; }
}
@media (max-width: 860px) {
  .hero { padding: 2.75rem 0 4.5rem; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero { --fc: var(--c-accent); background: linear-gradient(135deg, color-mix(in srgb, var(--fc) 72%, #000), color-mix(in srgb, var(--fc) 52%, #000)); color: #fff; padding: 3rem 0 2.6rem; position: relative; overflow: hidden; }
.page-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(255,255,255,.12); }
.page-hero h1 { color: #fff; margin-bottom: .3em; }
.page-hero .lead { font-size: 1.15rem; max-width: 44em; margin: 0; }
.page-hero a { color: #fff; }
.page-hero .btn { vertical-align: middle; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font: 700 .8rem var(--font-heading); margin-bottom: .5rem; }
.breadcrumbs { font-size: .9rem; margin-bottom: .75rem; }
.breadcrumbs a { color: inherit; }
.search-page-form { margin-top: 1rem; }

/* ---------- Sections & grids ---------- */
.section { padding: 3.25rem 0; }
.section-tint { background: var(--c-tint); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: .3rem 0 0; color: var(--c-muted); }
.grid { display: grid; gap: 1.4rem; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-featured { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid-tools { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid-formats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 400px) { .grid-cards, .grid-featured { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-link:hover { color: inherit; }
.card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--c-tint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-placeholder { --fc: var(--c-accent); display: grid; place-items: center; background: linear-gradient(135deg, var(--fc), color-mix(in srgb, var(--fc) 60%, #fff)); position: relative; overflow: hidden; }
.card-media-placeholder::before { content: ""; position: absolute; width: 180%; height: 180%; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.25) 2px, transparent 0); background-size: 22px 22px; }
.card-media-placeholder span { position: relative; width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--fc); display: grid; place-items: center; font: 700 2.1rem var(--font-heading); box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.card-body { padding: 1.1rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.18rem; margin: .5rem 0 .4rem; }
.card-excerpt { color: var(--c-muted); font-size: .95rem; margin-bottom: .75rem; flex: 1; }
.card-meta { font-size: .82rem; color: var(--c-muted); margin: 0; font-weight: 600; }

/* ---------- Badges & chips ---------- */
.badges { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.badge { display: inline-flex; align-items: center; padding: .18rem .65rem; border-radius: 999px; font: 700 .74rem/1.4 var(--font-heading); letter-spacing: .02em; background: color-mix(in srgb, var(--c-text) 8%, transparent); color: var(--c-text); text-decoration: none; white-space: nowrap; }
.page-hero .badge, .article-header .badge { background: rgba(0,0,0,.28); color: #fff; }
.badge-format { --fc: var(--c-accent); background: color-mix(in srgb, var(--fc) 16%, #fff); color: color-mix(in srgb, var(--fc) 58%, #000); }
.badge-level { color: #fff !important; }
.level-beginner.badge-level { background: var(--lvl-beginner) !important; }
.level-intermediate.badge-level { background: var(--lvl-intermediate) !important; }
.level-advanced.badge-level { background: var(--lvl-advanced) !important; }
.level-all.badge-level { background: var(--lvl-all) !important; }
.badge-tiny { font-size: .66rem; padding: .08rem .5rem; }
.page-hero .badge-format, .article-header .badge-format { background: #fff; color: color-mix(in srgb, var(--fc) 58%, #000); }

.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.chip { --fc: var(--c-accent); border: 2px solid var(--c-border); background: var(--c-surface); color: var(--c-text); padding: .4rem 1rem; border-radius: 999px; font: 600 .9rem var(--font-heading); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--fc); color: var(--c-text); }
.chip.is-active { background: var(--fc); border-color: var(--fc); color: #fff; }

.tier { display: inline-flex; align-items: center; padding: .2rem .7rem; border-radius: 8px; font: 700 .78rem var(--font-heading); background: #5B52A6; color: #fff; }
.tier-1 { background: #C02C0A; }
.tier-2 { background: #9A5800; }
.tier-3 { background: #1F5FA8; }
.tier-rogue { background: #1F2433; }
.tier-budget { background: #2E7D32; }

/* ---------- Level picker ---------- */
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.level-card { --lc: var(--lvl-beginner); position: relative; display: block; padding: 1.6rem; border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); text-decoration: none; color: var(--c-text); border-top: 8px solid var(--lc); transition: transform .18s, box-shadow .18s; }
.level-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow-lift); color: var(--c-text); }
.level-card.level-intermediate { --lc: var(--lvl-intermediate); }
.level-card.level-advanced { --lc: var(--lvl-advanced); }
.level-icon { font-size: 2.2rem; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--lc) 15%, #fff); margin-bottom: .8rem; }
.level-card p { color: var(--c-muted); }
.level-cta { font: 700 .95rem var(--font-heading); color: var(--lc); }

.level-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.level-column { --lc: var(--lvl-beginner); background: var(--c-surface); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); border-left: 6px solid var(--lc); }
.level-column.level-intermediate { --lc: var(--lvl-intermediate); }
.level-column.level-advanced { --lc: var(--lvl-advanced); }
.link-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.link-list li { padding: .5rem 0; border-bottom: 1px dashed var(--c-border); display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.link-list a { font-weight: 700; text-decoration: none; color: var(--c-text); }
.link-list a:hover { color: var(--c-primary); }
.more-link { font: 700 .92rem var(--font-heading); text-decoration: none; }

/* ---------- Tool & format tiles ---------- */
.tool-tile, .format-tile { --fc: var(--c-accent); display: flex; flex-direction: column; gap: .3rem; padding: 1.4rem; border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); text-decoration: none; color: var(--c-text); transition: transform .18s, box-shadow .18s; }
.tool-tile:hover, .format-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); color: var(--c-text); }
.tool-tile h2, .tool-tile h3, .format-tile h2, .format-tile h3 { font-size: 1.2rem; margin: .4rem 0 .1rem; }
.tool-tile p, .format-tile p { color: var(--c-muted); font-size: .94rem; margin: 0 0 .6rem; flex: 1; }
.tool-tile .badge { align-self: flex-start; }
.tool-icon { font-size: 1.8rem; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--c-secondary) 35%, #fff); box-shadow: inset 0 -4px 0 rgba(0,0,0,.06); }
.format-tile { border-bottom: 6px solid var(--fc); }
.format-icon { font-size: 1.7rem; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fc) 18%, #fff); }

/* ---------- Steps ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; counter-reset: s; }
.steps a { position: relative; display: flex; flex-direction: column; gap: .35rem; padding: 1.5rem 1.4rem; border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); text-decoration: none; color: var(--c-text); height: 100%; transition: transform .18s; }
.steps a:hover { transform: translateY(-4px); color: var(--c-text); }
.steps strong { font: 600 1.15rem var(--font-heading); }
.steps span:last-child { color: var(--c-muted); font-size: .94rem; }
.step-num { position: absolute; top: -12px; right: 16px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--c-secondary); font: 700 1rem var(--font-heading); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.step-icon { font-size: 2rem; }

/* ---------- Filters, pagination, empty ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; background: var(--c-surface); padding: 1rem 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.filter-bar label { display: flex; flex-direction: column; font: 700 .8rem var(--font-heading); text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); gap: .3rem; flex: 1 1 180px; }
select, input[type="text"], input[type="search"], input[type="number"], textarea {
  font: inherit; color: var(--c-text); background: var(--c-surface);
  border: 2px solid var(--c-border); border-radius: 12px; padding: .55rem .75rem; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--c-accent); }
.filter-bar select { text-transform: none; letter-spacing: 0; font-weight: 600; }
.clear-filters { font-weight: 700; font-size: .9rem; padding-bottom: .6rem; }
.result-count { color: var(--c-muted); font-weight: 700; font-size: .9rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2.5rem; font-weight: 700; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--c-muted); }
.empty-state > span { font-size: 3rem; display: block; margin-bottom: .5rem; }
.empty-state h1, .empty-state h2 { color: var(--c-text); }
.empty-state.big { padding: 5rem 1rem; }
.empty-state .hero-search { margin: 1.5rem auto; box-shadow: var(--shadow); }

/* ---------- Article ---------- */
.article-header { --fc: var(--c-accent); background: linear-gradient(135deg, color-mix(in srgb, var(--fc) 72%, #000), color-mix(in srgb, var(--fc) 52%, #000)); color: #fff; padding: 2.75rem 0 2.5rem; }
.article-header h1 { color: #fff; margin: .7rem 0 .4rem; }
.article-header .lead { font-size: 1.15rem; }
.article-meta { font-size: .9rem; margin: 0; }
.article-hero { margin: -1.5rem auto 0; }
.article-hero img { border-radius: var(--radius); box-shadow: var(--shadow-lift); width: 100%; }
.article-body { padding: 2.25rem 0 1rem; }
.author-box { background: var(--c-surface); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin: 1rem 0 3rem; }
.author-box p { margin: .3rem 0 0; color: var(--c-muted); }

/* ---------- Prose (rendered content) ---------- */
.prose { font-size: 1.05rem; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--c-primary); font-weight: 700; }
.prose blockquote { margin: 1.5em 0; padding: 1rem 1.25rem; border-left: 6px solid var(--c-secondary); background: color-mix(in srgb, var(--c-secondary) 13%, var(--c-surface)); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { background: color-mix(in srgb, var(--c-text) 7%, transparent); padding: .12em .4em; border-radius: 6px; }
.prose pre { background: #1F2433; color: #E9ECF5; padding: 1rem 1.25rem; border-radius: var(--radius-sm); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius-sm); margin: 1.5em auto; }
.prose hr { border: 0; height: 4px; background: repeating-linear-gradient(90deg, var(--c-border) 0 10px, transparent 10px 18px); margin: 2.5em 0; }
.prose mark { background: color-mix(in srgb, var(--c-secondary) 60%, transparent); padding: 0 .2em; border-radius: 4px; }
.prose .embed-wrap { position: relative; aspect-ratio: 16 / 9; margin: 1.5em 0; }
.prose .embed-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius-sm); }
.prose figure { margin: 1.5em 0; }
.prose figcaption { text-align: center; color: var(--c-muted); font-size: .9rem; }
.prose .ql-align-center, .prose [style*="text-align: center"] { text-align: center; }
.table-wrap { overflow-x: auto; margin: 1.25em 0 1.5em; border-radius: var(--radius-sm); box-shadow: 0 0 0 2px var(--c-border); background: var(--c-surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top; }
th { background: color-mix(in srgb, var(--c-secondary) 22%, var(--c-surface)); font-family: var(--font-heading); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.compare { margin-top: 3rem; }
.callout { background: color-mix(in srgb, var(--c-accent) 10%, var(--c-surface)); border: 2px solid color-mix(in srgb, var(--c-accent) 30%, transparent); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin: 1rem 0; }

/* ---------- Deck lists ---------- */
.decklist { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin: 1.5em 0; font-size: .95rem; }
.decklist-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 3px solid var(--c-secondary); padding-bottom: .6rem; margin-bottom: 1rem; }
.decklist-title { margin: 0; font-size: 1.25rem; }
.decklist-total { font: 700 .85rem var(--font-heading); background: var(--c-secondary); padding: .2rem .7rem; border-radius: 999px; }
.decklist-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem 1.5rem; }
.decklist-col h4 { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .4rem; display: flex; justify-content: space-between; }
.decklist-col h4 span { color: var(--c-muted); }
.decklist-pokemon h4 { color: #C23A1A; }
.decklist-trainer h4 { color: #1F5FA8; }
.decklist-energy h4 { color: #8A6A00; }
.decklist ul { list-style: none; padding: 0; margin: 0; }
.decklist li { display: flex; gap: .55rem; align-items: baseline; padding: .22rem 0; border-bottom: 1px dashed var(--c-border); }
.dl-qty { font: 700 .95rem var(--font-heading); min-width: 1.4em; text-align: right; color: var(--c-primary); }
.dl-name { flex: 1; font-weight: 600; }
.dl-set { font-size: .75rem; color: var(--c-muted); white-space: nowrap; }
.decklist-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.deck-card { border-top: 6px solid var(--fc); }
.deck-card .card-link { padding: 1.2rem 1.3rem; }
.deck-card-top { display: flex; gap: .4rem; flex-wrap: wrap; }
.deck-split { display: flex; gap: .5rem; margin-bottom: .7rem; }
.deck-split span { flex: 1; text-align: center; background: var(--c-tint); border-radius: 10px; padding: .35rem .2rem; font-size: .76rem; color: var(--c-muted); line-height: 1.2; }
.deck-split strong { display: block; font: 700 1.15rem var(--font-heading); color: var(--c-text); }
.tier-heading { margin: 2rem 0 1rem; display: flex; align-items: center; gap: .75rem; }
.tier-heading::after { content: ""; flex: 1; height: 3px; background: var(--c-border); border-radius: 3px; }
.deck-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.deck-main .decklist { margin-top: 0; }
.deck-side { display: grid; gap: 1.25rem; position: sticky; top: 90px; }
.side-box { background: var(--c-surface); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.side-box h2 { font-size: 1.2rem; }
.key-cards, .matchups { list-style: none; padding: 0; margin: 0; }
.key-cards li, .matchups li { padding: .6rem 0; border-bottom: 1px dashed var(--c-border); }
.key-cards li:last-child, .matchups li:last-child { border: 0; }
.key-cards span { display: block; color: var(--c-muted); font-size: .9rem; }
.matchup-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.matchups p { margin: .3rem 0 0; color: var(--c-muted); font-size: .9rem; }
.rating { font: 700 .72rem var(--font-heading); padding: .15rem .55rem; border-radius: 999px; color: #fff; background: #5F6577; white-space: nowrap; }
.rating-favored { background: #1E7B3A; }
.rating-slightly-favored { background: #4A7A1C; }
.rating-even { background: #5F6577; }
.rating-slightly-unfavored { background: #9A5800; }
.rating-unfavored { background: #B8235A; }
@media (max-width: 900px) { .deck-layout { grid-template-columns: 1fr; } .deck-side { position: static; } }

/* ---------- Search results ---------- */
.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.search-results a { display: block; padding: 1.15rem 1.35rem; border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); text-decoration: none; color: var(--c-text); transition: transform .15s; }
.search-results a:hover { transform: translateX(4px); color: var(--c-text); }
.search-results h2 { font-size: 1.2rem; margin: .35rem 0; }
.search-results p { color: var(--c-muted); margin: 0 0 .5rem; font-size: .95rem; }
.result-type { font: 700 .7rem var(--font-heading); text-transform: uppercase; letter-spacing: .1em; color: var(--c-primary); }
.type-deck { color: #7B4FB8; }
.type-glossary { color: #A04A17; }
.type-tool { color: #2E7D32; }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-footer-bg); color: var(--c-footer-text); padding: 3.5rem 0 1.5rem; margin-top: 0; }
.site-footer a { color: var(--c-footer-text); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer a:hover { color: var(--c-secondary); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2rem; }
.footer-grid h3 { font-size: 1rem; color: var(--c-secondary); text-transform: uppercase; letter-spacing: .08em; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: .2rem 0; font-size: .94rem; }
.footer-brand p { margin-top: .75rem; }
.footer-brand .brand { opacity: 1; }
.social { display: flex !important; flex-wrap: wrap; gap: .5rem; }
.social a { display: inline-block; padding: .3rem .8rem; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--c-footer-text) 25%, transparent); font-size: .85rem; }
.footer-legal { border-top: 1px solid color-mix(in srgb, var(--c-footer-text) 15%, transparent); margin-top: 2.5rem; padding-top: 1.25rem; font-size: .8rem; opacity: .88; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ==========================================================================
   Tools
   ========================================================================== */
.card-panel { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.field-row { margin-bottom: 1rem; }
.field-row label, .field-label { display: block; font: 700 .85rem var(--font-heading); margin-bottom: .3rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }

/* Deck checker */
.checker-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .checker-layout { grid-template-columns: 1fr; } }
#dc-list { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; line-height: 1.5; resize: vertical; }
.dc-summary { display: flex; align-items: center; gap: 1rem; background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.dc-status { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; flex-shrink: 0; }
.dc-status.ok { background: #E5F6E8; } .dc-status.bad { background: #FDECEA; } .dc-status.warn { background: #FFF4CC; }
.dc-summary h2 { margin: 0; font-size: 1.3rem; }
.dc-summary p { margin: 0; color: var(--c-muted); }
.dc-issues { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.dc-issues li { padding: .7rem .9rem; border-radius: 12px; display: flex; gap: .6rem; font-size: .94rem; background: var(--c-surface); box-shadow: var(--shadow); border-left: 5px solid #8A8FA3; }
.dc-issues li.error { border-color: #D6336C; } .dc-issues li.warn { border-color: #E8A20C; } .dc-issues li.ok { border-color: #2E9B4F; } .dc-issues li.info { border-color: var(--c-accent); }
.dc-bars { display: grid; gap: .8rem; margin-bottom: 1rem; }
.dc-bar-label { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; margin-bottom: .25rem; }
.dc-bar-label span { color: var(--c-muted); font-weight: 600; }
.dc-track { position: relative; height: 16px; background: var(--c-tint); border-radius: 999px; overflow: hidden; }
.dc-range { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, #2E9B4F 25%, transparent); }
.dc-fill { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--c-primary); }
.dc-fill.trainer { background: var(--c-accent); } .dc-fill.energy { background: #E8A20C; }

/* Probability */
.prob-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.calc h2 { font-size: 1.25rem; margin-bottom: .2rem; }
.calc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .8rem; margin: 1rem 0; }
.calc-fields label { font: 700 .8rem var(--font-heading); display: flex; flex-direction: column; gap: .25rem; color: var(--c-muted); }
.calc-result { border-top: 2px dashed var(--c-border); padding-top: 1rem; }
.calc-big { display: flex; align-items: baseline; gap: .6rem; }
.calc-big strong { font: 700 2.6rem var(--font-heading); color: var(--c-primary); line-height: 1; }
.calc-big span { color: var(--c-muted); font-weight: 600; font-size: .9rem; }
.meter { height: 12px; border-radius: 999px; background: var(--c-tint); overflow: hidden; margin: .6rem 0 .8rem; }
.meter > div { height: 100%; background: linear-gradient(90deg, var(--c-secondary), var(--c-primary)); border-radius: 999px; transition: width .3s; }
.calc table { font-size: .85rem; }
.calc th, .calc td { padding: .35rem .6rem; }
.small-print { font-size: .95rem; }

/* Glossary */
.glossary-controls { position: sticky; top: 70px; z-index: 5; background: var(--c-bg); padding: 1rem 0 .5rem; }
.glossary-controls .chip-row { margin: .8rem 0 .5rem; }
.alpha-nav { display: flex; flex-wrap: wrap; gap: .15rem; }
.alpha-nav a, .alpha-nav span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; font: 700 .8rem var(--font-heading); text-decoration: none; }
.alpha-nav a { background: var(--c-surface); color: var(--c-text); box-shadow: 0 2px 0 var(--c-border); }
.alpha-nav a:hover { background: var(--c-secondary); }
.alpha-nav span { color: var(--c-muted); opacity: .55; }
.glossary { margin: 1rem 0; }
.gl-section dl { margin: 0; }
.gl-letter { font-size: 1.6rem; color: var(--c-primary); margin: 1.5rem 0 .5rem; scroll-margin-top: 240px; }
.gl-entry { background: var(--c-surface); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin-bottom: .6rem; box-shadow: var(--shadow); scroll-margin-top: 240px; }
.gl-entry:target { box-shadow: 0 0 0 3px var(--c-secondary), var(--shadow); }
.gl-entry dt { font: 600 1.15rem var(--font-heading); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.gl-entry dd { margin: .3rem 0 0; color: var(--c-muted); }
.gl-entry dd p:last-child { margin: 0; }

/* Rules cheat sheet */
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.rule-box { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.rule-box.wide { grid-column: 1 / -1; }
.rule-box h2 { font-size: 1.25rem; }
.rule-box ol, .rule-box ul { padding-left: 1.3em; margin: 0; }
.rule-box li { margin: .3em 0; }
.turn-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.turn-flow > div { background: var(--c-tint); border-radius: var(--radius-sm); padding: .9rem; display: flex; flex-direction: column; gap: .25rem; position: relative; }
.turn-flow strong { font: 600 1.05rem var(--font-heading); color: var(--c-primary); }
.turn-flow span { font-size: .92rem; }
.check-list { list-style: none; padding: 0 !important; }
.check-list li::before { content: "①"; color: var(--c-primary); font-weight: 800; margin-right: .5rem; }
.kv { list-style: none; padding: 0 !important; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--c-border); }
.kv strong { font-family: var(--font-heading); color: var(--c-primary); }

/* Print */
@media print {
  .site-header, .site-footer, .admin-bar, .page-hero .btn, .hero-search { display: none !important; }
  .page-hero { background: none !important; color: #000; padding: 0 0 1rem; }
  .page-hero h1, .page-hero a { color: #000; }
  .rule-box, .card, .side-box { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  body { background: #fff; }
}
