/* BunnyMuffins meta viewer — concept build.
   Accent + cost colours are taken from bunnymuffins.lol's own theme variables. */

:root {
  --bg: #0e1014;
  --surface: #161a21;
  --surface-2: #1d222b;
  --line: #272d38;
  --line-soft: #1f242d;
  --text: #e8eaee;
  --muted: #99a1b0;
  --faint: #6c7484;
  --accent: #ff9619;
  --accent-ink: #1a1204;

  --cost-1: #757575;
  --cost-2: #1eff0c;
  --cost-3: #0070ff;
  --cost-4: #a335ee;
  --cost-5: #ff8000;

  --tier-s: #ff4655;
  --tier-a: #ff9619;
  --tier-b: #3fb6ff;
  --tier-c: #7d8794;
  --tier-special: #b06cff;

  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.015em; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(1240px, 100% - 2rem); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- concept bar */
.concept-bar {
  background: linear-gradient(90deg, rgba(255, 150, 25, 0.14), rgba(255, 150, 25, 0.04));
  border-bottom: 1px solid rgba(255, 150, 25, 0.28);
  font-size: 0.82rem;
  color: #ffd6a1;
}
.concept-bar .wrap { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; padding: 0.5rem 0; }
.concept-bar strong { color: var(--accent); }

/* --------------------------------------------------------------------- header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 40; }
.site-head .wrap { display: flex; align-items: center; gap: 1rem; padding: 0.85rem 0; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 0.6rem; margin-right: auto; }
.brand b { font-size: 1.12rem; letter-spacing: -0.02em; }
.brand span { color: var(--faint); font-size: 0.8rem; }

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--line); background: var(--surface-2);
  padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; color: var(--muted); white-space: nowrap;
}
.pill.accent { border-color: rgba(255, 150, 25, 0.4); color: var(--accent); background: rgba(255, 150, 25, 0.08); }
.pill.warn { border-color: rgba(255, 70, 85, 0.45); color: #ff8b95; background: rgba(255, 70, 85, 0.09); }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); padding: 0.45rem 0.85rem; border-radius: 8px;
  cursor: pointer; font-size: 0.86rem; text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: #3a4252; background: #232935; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #ffa838; }
.btn.sm { padding: 0.28rem 0.55rem; font-size: 0.78rem; }

/* ----------------------------------------------------------------------- hero */
.hero { padding: 2.2rem 0 1.4rem; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.hero p { color: var(--muted); max-width: 62ch; margin: 0.7rem 0 0; }
.hero-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.1rem; }

/* -------------------------------------------------------------------- filters */
.filters {
  position: sticky; top: 57px; z-index: 30;
  background: rgba(14, 16, 20, 0.92);
  backdrop-filter: blur(8px);
  border-block: 1px solid var(--line);
  padding: 0.7rem 0;
}
.filters .wrap { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); padding: 0.3rem 0.7rem; border-radius: 999px;
  cursor: pointer; font-size: 0.82rem; transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: #3a4252; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.search { position: relative; margin-left: auto; }
.search input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.45rem 0.7rem; width: min(320px, 48vw); color: var(--text);
}
.search input::placeholder { color: var(--faint); }
.count { color: var(--faint); font-size: 0.8rem; font-family: var(--mono); }

/* ------------------------------------------------------------------ comp list */
main { padding-bottom: 4rem; }
.tier-head { display: flex; align-items: center; gap: 0.7rem; margin: 2.2rem 0 0.9rem; flex-wrap: wrap; }
.tier-badge {
  width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: 8px; font-weight: 800; font-size: 0.95rem; color: #12151a; flex: none;
}
.tier-head h2 { font-size: 1.05rem; font-weight: 650; }
.tier-head p { margin: 0; color: var(--faint); font-size: 0.83rem; flex-basis: 100%; }

.comp {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1rem; overflow: hidden;
}
.comp-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.9rem 1.1rem; flex-wrap: wrap; }
.comp-head h3 { font-size: 1.15rem; }
.comp-head .spacer { margin-left: auto; }

.tier-tag {
  font-weight: 800; font-size: 0.72rem; letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem; border-radius: 5px; color: #12151a; flex: none;
}

.variant-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.comp-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.4rem; padding: 0 1.1rem 1.1rem;
}
@media (max-width: 900px) { .comp-body { grid-template-columns: 1fr; gap: 1rem; } }

.panel { min-width: 0; }
.comp-details { min-width: 0; }
.comp-details > summary { display: none; }
/* Desktop keeps the existing always-visible detail column; mobile restores native disclosure. */
.comp-details:not([open]) > .panel { display: block; }
.panel h4 {
  font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 0.5rem; font-weight: 700;
}
.panel + .panel { margin-top: 1.2rem; }
@media (max-width: 900px) { .panel + .comp-details { margin-top: 1.2rem; } }

/* --------------------------------------------------------------------- traits */
.traits { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.trait {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.22rem 0.5rem; font-size: 0.8rem;
  cursor: pointer; color: var(--muted);
}
.trait:hover, .trait[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.trait img { width: 15px; height: 15px; object-fit: contain; filter: brightness(0) invert(1); opacity: 0.85; }
.trait b { color: var(--text); font-variant-numeric: tabular-nums; }
.trait.is-single { opacity: 0.5; font-size: 0.74rem; }

/* ---------------------------------------------------------------------- board */
.board-frame {
  background: radial-gradient(120% 120% at 50% 0%, #1b2130 0%, #12151c 70%);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.8rem 0.5rem 0.6rem; overflow: hidden;
}
.board-legend {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 0.5rem; padding-inline: 0.2rem;
}

/* Real hex grids interlock: each row rides up into the notch of the one above,
   which is both truthful to the arena and much shorter on a phone. */
.board { display: flex; flex-direction: column; container-type: inline-size; }
.board-row { display: flex; gap: 1.2%; }
.board-row + .board-row { margin-top: -1.9%; }
.board-row[data-row="1"], .board-row[data-row="3"] { margin-left: 7.2%; }

.hex {
  position: relative;
  flex: 1 1 0; min-width: 0;
  aspect-ratio: 1 / 1.02;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: #1a1f2a;
  transition: background 0.15s, opacity 0.15s;
}
.hex.is-filled { background: #232a38; }
.hex.is-dimmed { opacity: 0.28; }
.hex[role="button"] { cursor: pointer; }
.hex[role="button"]:hover { background: #2b3446; }

.hex-unit {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: inset 0 0 0 2px var(--cost-color);
  overflow: hidden;
  /* keep the label and items inside the hex's full-width band, out of the
     bottom taper where they would get visually pinched */
  padding-bottom: 17%;
}
.hex-art { position: absolute; inset: 0; }
.hex-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; }
.hex-art.is-summon {
  background: repeating-linear-gradient(45deg, #202632, #202632 5px, #262d3b 5px, #262d3b 10px);
}

.hex-name {
  position: relative;
  font-size: clamp(7px, 2.1cqw, 11px);
  font-weight: 600; text-align: center;
  padding: 0.1em 0.15em;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82) 45%);
  text-shadow: 0 1px 2px #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hex-star {
  position: absolute; top: 4%; left: 0; right: 0; text-align: center;
  font-size: clamp(6px, 1.7cqw, 9px); color: #ffd76a; text-shadow: 0 1px 2px #000;
}
.hex-items {
  position: relative; display: flex; justify-content: center; gap: 1px;
  padding-bottom: 4%; background: rgba(0, 0, 0, 0.55);
}
.hex-item { width: clamp(8px, 2.6cqw, 15px); aspect-ratio: 1; display: block; }
.hex-item img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 2px; }
.hex-item.is-blank { background: #39415290; border-radius: 2px; }

/* ------------------------------------------------------------- detail columns */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.7rem; font-size: 0.86rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; }

.item-build { border-top: 1px solid var(--line-soft); padding: 0.55rem 0; }
.item-build:first-of-type { border-top: 0; }
.item-build b { color: var(--text); }
.item-build .core { color: var(--text); }
.item-build .alts { color: var(--faint); font-size: 0.82rem; }

.bullets { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.88rem; }
.bullets li { margin-bottom: 0.3rem; }
.bullets li::marker { color: var(--faint); }

.stages { display: grid; gap: 0.5rem; }
.stage { background: var(--surface-2); border-left: 2px solid var(--accent); border-radius: 0 7px 7px 0; padding: 0.5rem 0.7rem; }
.stage b { display: block; font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.stage p { margin: 0.15rem 0 0; font-size: 0.87rem; color: var(--muted); }

details.fold { border: 1px solid var(--line); border-radius: 8px; margin-top: 0.7rem; background: var(--surface-2); }
details.fold > summary { cursor: pointer; padding: 0.5rem 0.75rem; font-size: 0.85rem; color: var(--muted); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸ "; color: var(--accent); }
details.fold[open] > summary::before { content: "▾ "; }
details.fold > div { padding: 0 0.75rem 0.75rem; }

.lvl-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-family: var(--mono); margin-bottom: 0.55rem; }
.lvl-table caption { text-align: left; color: var(--faint); font-size: 0.74rem; padding-bottom: 0.2rem; font-family: var(--sans); }
.lvl-table td { border: 1px solid var(--line); padding: 0.22rem 0.4rem; text-align: center; }
.lvl-table tr:first-child td { color: var(--muted); }
.lvl-table tr:last-child td { color: var(--accent); font-weight: 700; }

.table-scroll { overflow-x: auto; }

.empty { text-align: center; color: var(--faint); padding: 3rem 1rem; }

.site-foot { border-top: 1px solid var(--line); padding: 1.6rem 0 3rem; color: var(--faint); font-size: 0.82rem; }
.site-foot p { margin: 0.3rem 0; max-width: 70ch; }

.ad-slot { display: grid; place-items: center; min-height: 90px; max-width: 100%; margin: 1.6rem 0; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); color: var(--faint); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
  .hero { padding: 1.3rem 0 0.9rem; }
  .hero p { font-size: 0.9rem; }
  .concept-bar { font-size: 0.75rem; }
  .comp-head { padding: 0.75rem 0.7rem; }
  .comp-body { padding: 0 0.55rem 0.8rem; }
  .board-frame { padding: 0.6rem 0.3rem 0.45rem; }
  .comp-details { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
  .comp-details > summary { display: block; cursor: pointer; padding: 0.6rem 0.75rem; color: var(--muted); font-size: 0.85rem; list-style: none; }
  .comp-details > summary::-webkit-details-marker { display: none; }
  .comp-details > summary::before { content: "▸ "; color: var(--accent); }
  .comp-details[open] > summary::before { content: "▾ "; }
  .comp-details:not([open]) > .panel { display: none; }
  .comp-details > .panel { padding: 0 0.75rem 0.75rem; }
  .filters { padding: 0.55rem 0; }
  .site-head .wrap { padding: 0.65rem 0; }
  .ad-slot { min-height: 70px; margin: 1.1rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
