:root {
  --bg: #080d1a;
  --bg-elevated: #0f172a;
  --panel: rgba(20, 30, 54, 0.88);
  --panel-2: #182542;
  --panel-hover: #213258;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(245, 183, 49, 0.48);
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  --gold: #f5b731;
  --gold-soft: rgba(245, 183, 49, 0.16);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.18);
  --evo: #a855f7;
  --evo-soft: rgba(168, 85, 247, 0.2);
  --hero: #38bdf8;
  --hero-soft: rgba(56, 189, 248, 0.2);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.18);
  --red: #f43f5e;
  --red-soft: rgba(244, 63, 94, 0.18);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 14px 36px rgba(2, 6, 23, 0.5);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at top center, #14244b 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
}

img, svg, canvas, video {
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ==================== TOPBAR ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 13, 26, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.35);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-row-nav {
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 7px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-crown {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #f5b731, #d97706);
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(245, 183, 49, 0.35);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.16s ease;
}

.nav-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(168, 85, 247, 0.24));
  border-color: rgba(96, 165, 250, 0.55);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.18);
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.player-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.player-pill:hover {
  border-color: var(--gold);
}

.lang-select {
  width: auto !important;
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.patch-switch {
  display: inline-flex;
  flex-shrink: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.patch-opt {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  white-space: nowrap;
  transition: 0.15s;
}

.patch-opt.active {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #0b1120;
}

/* ==================== PATCH ALERT BANNER ==================== */
.patch-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(59, 130, 246, 0.12), rgba(244, 63, 94, 0.14));
  border-bottom: 1px solid rgba(245, 183, 49, 0.28);
}

.patch-banner-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 20px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: #fde68a;
}

/* ==================== LAYOUT ==================== */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 60px;
  overflow-x: clip;
}

.tab-panel {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.tab-panel.active {
  display: block;
}

.panel-card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.grid-2col {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.grid-2col > *,
.dex-layout-grid > *,
.analyzer-summary-grid > *,
.meta-stats-grid > * {
  min-width: 0;
  max-width: 100%;
}

.dex-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.analyzer-summary-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}

.meta-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.deck-8-mini-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1080px) {
  .grid-2col,
  .dex-layout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    padding: 5px 8px 4px;
    gap: 4px;
  }
  .topbar-row-main {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar-row-main::-webkit-scrollbar {
    display: none;
  }
  .brand {
    gap: 5px;
    flex-shrink: 0;
  }
  .brand-crown {
    width: 22px;
    height: 22px;
    font-size: 12px;
    border-radius: 6px;
  }
  .brand-title {
    font-size: 12px;
    letter-spacing: -0.03em;
  }
  .brand-sub {
    display: none;
  }
  .topbar-controls {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
  }
  .topbar-controls .player-pill {
    padding: 3px 7px;
    font-size: 10.5px;
    gap: 4px;
    max-width: 100px;
    flex-shrink: 0;
  }
  .topbar-controls .dot-live {
    width: 6px;
    height: 6px;
  }
  .topbar-controls .patch-switch {
    padding: 2px;
    border-radius: 7px;
  }
  .topbar-controls .patch-opt {
    padding: 3px 5px;
    font-size: 10px;
  }
  .topbar-controls .lang-select {
    padding: 3px 5px;
    font-size: 10.5px;
    border-radius: 7px;
  }
  .topbar-row-nav {
    padding-top: 4px;
  }
  .nav-btn {
    padding: 4px 8px;
    font-size: 11.5px;
  }
}

/* ==================== BUTTONS & CONTROLS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--panel-hover);
  border-color: rgba(148, 163, 184, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: rgba(129, 140, 248, 0.6);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-gold {
  background: linear-gradient(135deg, #f5b731, #d97706);
  border-color: rgba(253, 224, 71, 0.7);
  color: #0b1120;
}

.btn-gold:hover {
  filter: brightness(1.06);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.input, .select, .textarea {
  width: 100%;
  background: #0d1527;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}

.chip:hover {
  border-color: rgba(148, 163, 184, 0.5);
}

.chip.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: #fff;
}

.chip.active-gold {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: #fde68a;
}

.chip.active-red {
  background: var(--red-soft);
  border-color: var(--red);
  color: #fda4af;
}

/* ==================== CR CARD PORTRAIT TILE ==================== */
.cr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, #192542 0%, #0f172a 100%);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 5px 4px 5px;
  user-select: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  cursor: pointer;
  overflow: hidden;
}

.cr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.cr-card.is-evo {
  border-color: #a855f7;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.45);
  background: linear-gradient(180deg, #311456 0%, #140b24 100%);
}

.cr-card.is-hero {
  border-color: #facc15;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.42);
  background: linear-gradient(180deg, #423108 0%, #1c1505 100%);
}

.cr-rarity-bar {
  width: 100%;
  height: 3.5px;
  border-radius: 999px;
  margin-top: 4px;
  opacity: 0.95;
}

.cr-rarity-bar.rarity-common { background: #94a3b8; }
.cr-rarity-bar.rarity-rare { background: #f97316; }
.cr-rarity-bar.rarity-epic { background: #e879f9; }
.cr-rarity-bar.rarity-legendary { background: linear-gradient(90deg, #38bdf8, #818cf8, #2dd4bf); }
.cr-rarity-bar.rarity-champion { background: linear-gradient(90deg, #fb7185, #f59e0b); }

.rarity-swatch {
  display: inline-block;
  width: 11px;
  height: 4px;
  border-radius: 999px;
  vertical-align: middle;
  margin: 0 3px 1px 1px;
}
.rarity-swatch.rarity-common { background: #94a3b8; }
.rarity-swatch.rarity-rare { background: #f97316; }
.rarity-swatch.rarity-epic { background: #e879f9; }
.rarity-swatch.rarity-legendary { background: linear-gradient(90deg, #38bdf8, #818cf8, #2dd4bf); }
.rarity-swatch.rarity-champion { background: linear-gradient(90deg, #fb7185, #f59e0b); }

.chip-nerf {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.35);
}
.chip-buff {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

.cr-cap-row {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  z-index: 3;
}

.cr-cap-dot {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.cr-cap-evo { background: #9333ea; color: #faf5ff; border: 1px solid #e879f9; }
.cr-cap-hero { background: #eab308; color: #1c1917; border: 1px solid #fef08a; }
.cr-cap-champ { background: #be123c; color: #fff1f2; border: 1px solid #fda4af; }

.card-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11px;
  color: #cbd5e1;
}

.cr-card.is-locked {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.cr-card.is-excluded {
  opacity: 0.42;
  filter: grayscale(0.8);
  border-color: var(--red);
}

.cr-card.is-missing {
  opacity: 0.48;
}

.cr-card.is-swapped {
  border-color: #2dd4bf;
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.45);
}

.cr-swap-pill {
  position: absolute;
  top: 28px;
  left: 4px;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(13, 148, 136, 0.94);
  color: #f0fdfa;
  border: 1px solid #5eead4;
  z-index: 3;
}

.rec-family-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.rec-family-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 4px;
}

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.variant-tab {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.78);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 9px;
  transition: 0.14s ease;
}

.variant-tab:hover {
  border-color: rgba(148, 163, 184, 0.5);
  color: #fff;
}

.variant-tab.active {
  background: rgba(245, 183, 49, 0.18);
  border-color: #f5b731;
  color: #fde68a;
}

.variant-tab.active-swap {
  background: rgba(20, 184, 166, 0.2);
  border-color: #2dd4bf;
  color: #99f6e4;
}

.variant-diff-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.35);
  font-size: 11.5px;
  color: #ccfbf1;
}

.swap-diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 7px;
  padding: 2px 7px;
}

.swap-diff-pill del {
  color: #fda4af;
  opacity: 0.9;
}

.swap-diff-pill strong {
  color: #5eead4;
}

.cr-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;
  overflow: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-card-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.cr-elixir {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 22px;
  height: 26px;
  border: none;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='35%25' y1='8%25' x2='70%25' y2='96%25'%3E%3Cstop offset='0%25' stop-color='%23ff66f5'/%3E%3Cstop offset='48%25' stop-color='%23d91ee6'/%3E%3Cstop offset='100%25' stop-color='%237e1294'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M12 1.2 C12 1.2 21.6 11.4 21.6 17.6 C21.6 22.9 17.3 26.8 12 26.8 C6.7 26.8 2.4 22.9 2.4 17.6 C2.4 11.4 12 1.2 12 1.2 Z' fill='url(%23g)' stroke='%232e0638' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cellipse cx='8.7' cy='14.2' rx='2.2' ry='4.1' transform='rotate(-22 8.7 14.2)' fill='%23ffffff' fill-opacity='0.38'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  color: #ffffff;
  font-family: "Outfit", sans-serif;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1;
  padding-top: 5px;
  display: grid;
  place-items: center;
  z-index: 2;
  text-shadow: 0 1px 2px #1e0326, 0 0 2px #1e0326, -0.7px 0 #1e0326, 0.7px 0 #1e0326;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.cr-badge-tr {
  position: absolute;
  top: 2px;
  right: 2px;
  max-width: calc(100% - 26px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  z-index: 2;
  letter-spacing: 0.02em;
}

.cr-badge-evo { background: #7e22ce; color: #f5d0fe; border: 1px solid #e879f9; }
.cr-badge-hero { background: linear-gradient(135deg, #facc15, #ca8a04); color: #1c1917; border: 1px solid #fef08a; }
.cr-badge-lv { background: rgba(15, 23, 42, 0.88); color: #fde68a; border: 1px solid rgba(250, 204, 21, 0.4); }

.cr-patch-pill {
  position: absolute;
  bottom: 3px;
  right: 3px;
  max-width: calc(100% - 25px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  z-index: 2;
}

.cr-patch-nerf { background: rgba(225, 29, 72, 0.92); color: #fff; }
.cr-patch-buff { background: rgba(22, 163, 74, 0.92); color: #fff; }
.cr-patch-rework { background: rgba(217, 119, 6, 0.92); color: #fff; }

.cr-info-btn {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  font-size: 9.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  z-index: 3;
  padding: 0;
}

.cr-info-btn:hover {
  background: var(--blue);
  color: #fff;
}

.cr-card-name {
  width: 100%;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f1f5f9;
}

.cr-card-sub {
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
}

/* ==================== GRIDS ==================== */
.deck-8-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.deck-9-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr)) minmax(0, 0.72fr);
  gap: 6px;
  align-items: end;
}

.deck-9-grid .cr-card.is-tower-tile {
  padding: 3px;
  opacity: 0.92;
}

.deck-9-grid .cr-card.is-tower-tile .cr-card-name {
  font-size: 9.5px;
}

.card-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.empty-slot {
  aspect-ratio: 5 / 6.7;
  border: 2px dashed rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.45);
}

.slot-remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #fff;
  background: #e11d48;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  z-index: 5;
  line-height: 1;
  padding: 0;
  display: grid;
  place-items: center;
}

/* ==================== DECK RECOMMENDATION CARDS ==================== */
.rec-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rec-card {
  background: linear-gradient(180deg, #17233e 0%, #121b30 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.rec-card:hover {
  border-color: rgba(96, 165, 250, 0.45);
}

.rec-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 3px 9px;
  border-radius: 8px;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 13px;
}

.tier-Sp, .tier-S { background: linear-gradient(135deg, #f5b731, #ea580c); color: #0b1120; }
.tier-Ap, .tier-A { background: rgba(59, 130, 246, 0.25); border: 1px solid #60a5fa; color: #bfdbfe; }
.tier-B { background: rgba(148, 163, 184, 0.2); border: 1px solid #64748b; color: #e2e8f0; }

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.stat-pill {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 9px;
  font-weight: 700;
}

.rating-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.rating-box {
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
}

.rating-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.rating-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.grade-godly { color: #fde047; }
.bg-godly { background: linear-gradient(90deg, #eab308, #f59e0b); }
.grade-great { color: #38bdf8; }
.bg-great { background: linear-gradient(90deg, #0ea5e9, #3b82f6); }
.grade-good { color: #4ade80; }
.bg-good { background: linear-gradient(90deg, #22c55e, #16a34a); }
.grade-warning { color: #fbbf24; }
.bg-warning { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.grade-rip { color: #fb7185; }
.bg-rip { background: linear-gradient(90deg, #f43f5e, #be123c); }

.reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.reason-chip {
  font-size: 11.5px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--text-muted);
}

.warning-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.warning-item {
  font-size: 12px;
  padding: 8px 11px;
  border-radius: 9px;
  border-left: 3px solid;
}

.sev-danger { background: rgba(244, 63, 94, 0.14); border-color: var(--red); color: #fecdd3; }
.sev-warn { background: rgba(245, 158, 11, 0.14); border-color: var(--amber); color: #fde68a; }
.sev-info { background: rgba(59, 130, 246, 0.14); border-color: var(--blue); color: #bfdbfe; }
.sev-buff { background: rgba(34, 197, 94, 0.14); border-color: var(--green); color: #bbf7d0; }

.patch-season-stack {
  display: flex;
  flex-direction: column;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.patch-season-row {
  padding: 12px 14px;
  border-left: 3px solid transparent;
}

.patch-season-row.is-active {
  background: rgba(30, 41, 59, 0.55);
}

.patch-season-row.is-pre.is-active {
  border-left-color: #38bdf8;
}

.patch-season-row.is-post.is-active {
  border-left-color: #f59e0b;
}

.patch-season-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.patch-season-row p {
  margin: 0;
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.5;
}

.patch-season-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 14px;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.season-tag-pre {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.season-tag-post {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.account-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}

.account-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  height: 100%;
}

.account-panel-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.account-scroll-box {
  flex: 1;
  min-height: 140px;
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-battle-scroll-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 280px;
}

.account-battle-scroll {
  position: absolute;
  inset: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 960px) {
  .account-top-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .account-col {
    height: auto;
  }
  .account-battle-scroll-wrap {
    position: static;
    flex: none;
    min-height: 0;
  }
  .account-battle-scroll {
    position: static;
    inset: auto;
    max-height: 520px;
    padding-right: 0;
  }
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-shell {
  position: relative;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: #10192d;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-card-shell { max-width: 920px; }
.modal-deck-shell { max-width: 1100px; }

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
  z-index: 5;
}

.modal-close:hover {
  background: var(--red);
  border-color: var(--red);
}

/* ==================== SUBTABS & TABLES ==================== */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin: 14px 0;
}

.subtab-btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 9px;
}

.subtab-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.playbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.playbook-box {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
}

.playbook-box h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--gold);
}

.playbook-box p, .playbook-box li {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.playbook-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.matchup-row {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 10px;
}

.mini-card-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-card-strip .cr-card {
  width: 62px;
  padding: 4px 3px;
}

.mini-card-strip .cr-elixir {
  width: 18px;
  height: 21px;
  font-size: 10px;
  padding-top: 4px;
}

.mini-card-strip .cr-card-name {
  font-size: 9.5px;
}

.mini-card-strip .cr-badge-tr,
.mini-card-strip .cr-patch-pill {
  max-width: none;
  font-size: 8.5px;
  padding: 1px 4px;
  line-height: 1.15;
}

.rate-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.rate-very-favored { background: rgba(34, 197, 94, 0.25); color: #86efac; border: 1px solid #22c55e; }
.rate-favored { background: rgba(56, 189, 248, 0.22); color: #bae6fd; border: 1px solid #38bdf8; }
.rate-even { background: rgba(245, 158, 11, 0.2); color: #fde68a; border: 1px solid #f59e0b; }
.rate-unfavored { background: rgba(249, 115, 22, 0.22); color: #fed7aa; border: 1px solid #f97316; }
.rate-hard { background: rgba(244, 63, 94, 0.24); color: #fecdd3; border: 1px solid #f43f5e; }

.elix-hist {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 76px;
  padding: 8px 10px;
  background: rgba(11, 17, 32, 0.75);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.elix-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 2px;
}

.elix-bar {
  width: 100%;
  max-width: 24px;
  background: linear-gradient(180deg, #e879f9, #9333ea);
  border-radius: 4px 4px 0 0;
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ==================== MULTI-ARCHETYPE LINEUP & COMPARE TABLE ==================== */
.archetype-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.arch-pick-card {
  text-align: left;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.arch-pick-card:hover {
  border-color: rgba(96, 165, 250, 0.65);
  transform: translateY(-1px);
}

.arch-pick-card.active {
  background: rgba(37, 99, 235, 0.22);
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.pool-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 7px;
}

.lineup-compare-wrap {
  background: var(--card);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.lineup-compare-scroll {
  overflow-x: auto;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.lineup-compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(11, 17, 32, 0.78);
  font-size: 12px;
}

.lineup-compare-table th,
.lineup-compare-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  padding: 9px 10px;
  vertical-align: top;
  text-align: left;
}

.lineup-compare-table th:last-child,
.lineup-compare-table td:last-child {
  border-right: none;
}

.lineup-compare-table thead th {
  background: rgba(30, 41, 59, 0.92);
  color: #fde68a;
  font-weight: 800;
  font-size: 12.5px;
}

.lineup-compare-table tbody th {
  width: 112px;
  background: rgba(15, 23, 42, 0.9);
  color: #93c5fd;
  font-weight: 800;
  white-space: nowrap;
}

.compare-mini-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-card-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11px;
  color: #e2e8f0;
  cursor: pointer;
}

.compare-card-pill:hover {
  border-color: #60a5fa;
}

.compare-card-pill.is-special {
  border-color: rgba(232, 121, 249, 0.55);
  background: rgba(126, 34, 206, 0.2);
}

.compare-card-pill.is-hero {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(3, 105, 161, 0.22);
}

.compare-card-pill.is-picked {
  box-shadow: inset 2px 0 0 #facc15;
}

.taxonomy-guide-box {
  margin-top: 12px;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #cbd5e1;
}

/* ==================== SINGLE-DECK FOCUS & STRATEGY SWITCHER ==================== */
.strategy-switcher-bar {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.strategy-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-height: 245px;
  overflow-y: auto;
  padding-right: 4px;
}

.strategy-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 170px;
  flex: 1 1 190px;
}

.strategy-pill:hover {
  border-color: rgba(96, 165, 250, 0.65);
  background: rgba(30, 41, 59, 0.9);
}

.strategy-pill.active {
  border-color: #facc15;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.18), rgba(59, 130, 246, 0.22));
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.single-view-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(11, 17, 32, 0.85);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.single-view-opt {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 7px;
  white-space: nowrap;
  transition: 0.15s ease;
}

.single-view-opt:hover {
  color: #f8fafc;
}

.single-view-opt.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.35);
}

.strategy-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

.design-report-box {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid rgba(250, 204, 21, 0.28);
  font-size: 12px;
  color: #cbd5e1;
}

.design-report-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.5;
}

.design-report-grid .dr-label {
  color: #93c5fd;
  font-weight: 800;
}

/* ==================== CARD DEX TIER SHELVES ==================== */
.dex-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dex-tier-section {
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
}

.dex-tier-section.tier-box-Sp {
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08), rgba(11, 17, 32, 0.82));
}

.dex-tier-section.tier-box-S {
  border-color: rgba(192, 132, 252, 0.42);
}

.dex-tier-section.tier-box-A {
  border-color: rgba(96, 165, 250, 0.34);
}

.dex-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.dex-score-breakdown {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(11, 17, 32, 0.78);
  border: 1px solid rgba(96, 165, 250, 0.28);
  font-size: 12px;
}

.dex-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.dex-score-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
}

/* ==================== AD SLOTS & FOOTER ==================== */
.ad-slot-banner {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 8px 16px;
  text-align: center;
}

.ad-slot-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  background: rgba(11, 17, 32, 0.85);
  padding: 18px 20px 26px;
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.site-footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.site-footer-links a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-footer-disclaimer {
  margin: 0;
  line-height: 1.5;
  opacity: 0.9;
}

/* ==================== SEO EDITORIAL GUIDES & STATIC ARTICLES ==================== */
.seo-guide-section {
  max-width: 1440px;
  margin: 18px auto 0;
  padding: 0 20px;
}

.seo-guide-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.seo-guide-head h2 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: #fde68a;
}

.seo-guide-head p {
  margin: 0;
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.6;
  max-width: 900px;
}

.seo-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.seo-guide-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(11, 17, 32, 0.72);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: 0.15s ease;
}

.seo-guide-card:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(21, 32, 56, 0.88);
}

.seo-guide-card strong {
  font-size: 13px;
  color: #93c5fd;
}

.seo-guide-card span {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.45;
}

.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.seo-faq-list details {
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 9px;
  padding: 8px 12px;
}

.seo-faq-list summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: #e2e8f0;
}

.seo-faq-list details p {
  margin: 6px 0 2px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.55;
}

.guide-container {
  max-width: 920px;
  padding: 24px 16px 48px;
}

.guide-article {
  padding: 26px 24px;
}

.guide-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.guide-breadcrumb a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
}

.guide-article h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.3;
  color: #f8fafc;
}

.guide-article h2 {
  margin: 22px 0 8px;
  font-size: 17.5px;
  color: #fde68a;
}

.guide-article h3 {
  margin: 14px 0 6px;
  font-size: 14.5px;
  color: #93c5fd;
}

.guide-article p,
.guide-article li {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.72;
}

.guide-lead {
  font-size: 14px !important;
  color: #e2e8f0 !important;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 10px;
  padding: 12px 14px;
}

.guide-table-wrap {
  overflow-x: auto;
  margin: 10px 0 14px;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.guide-table th,
.guide-table td {
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 8px 10px;
  text-align: left;
  color: #e2e8f0;
}

.guide-table th {
  background: rgba(30, 41, 59, 0.9);
  color: #fde68a;
  font-weight: 800;
}

.guide-related {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.guide-cta-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(245, 183, 49, 0.14));
  border: 1px solid rgba(96, 165, 250, 0.42);
}

.guide-cta-box strong {
  display: block;
  font-size: 14px;
  color: #fde68a;
  margin-bottom: 4px;
}

.guide-cta-box p {
  margin: 0 0 10px;
  font-size: 12.5px;
}

/* ==================== MOBILE & NARROW VIEWPORTS ==================== */
@media (max-width: 820px) {
  .deck-8-grid,
  .deck-9-grid,
  .deck-8-mini-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 3px;
    align-items: stretch;
  }

  .deck-8-grid .cr-card,
  .deck-9-grid .cr-card,
  .deck-8-mini-grid .cr-card {
    padding: 2px;
    border-radius: 7px;
  }

  .deck-8-grid .cr-card-img-wrap,
  .deck-9-grid .cr-card-img-wrap,
  .deck-8-mini-grid .cr-card-img-wrap {
    border-radius: 5px;
  }

  .deck-8-grid .cr-elixir,
  .deck-9-grid .cr-elixir,
  .deck-8-mini-grid .cr-elixir {
    width: 15px;
    height: 18px;
    font-size: 8.5px;
    padding-top: 3px;
    top: 1px;
    left: 1px;
  }

  .deck-8-grid .cr-badge-tr,
  .deck-9-grid .cr-badge-tr,
  .deck-8-mini-grid .cr-badge-tr {
    font-size: 6.5px;
    padding: 0 2px;
    top: 1px;
    right: 1px;
    max-width: calc(100% - 14px);
    border-radius: 3px;
  }

  .deck-8-grid .cr-patch-pill,
  .deck-9-grid .cr-patch-pill,
  .deck-8-mini-grid .cr-patch-pill {
    font-size: 6.5px;
    padding: 0 2px;
    bottom: 1px;
    right: 1px;
    max-width: calc(100% - 2px);
    border-radius: 3px;
  }

  .deck-8-grid .cr-info-btn,
  .deck-9-grid .cr-info-btn,
  .deck-8-mini-grid .cr-info-btn {
    display: none;
  }

  .deck-8-grid .cr-card-name,
  .deck-9-grid .cr-card-name,
  .deck-8-mini-grid .cr-card-name {
    font-size: 8px;
    margin-top: 2px;
    line-height: 1.15;
    letter-spacing: -0.03em;
  }

  .deck-8-grid .cr-card-sub,
  .deck-9-grid .cr-card-sub,
  .deck-8-mini-grid .cr-card-sub {
    font-size: 7.5px;
    line-height: 1.1;
  }

  .deck-8-grid .cr-rarity-bar,
  .deck-9-grid .cr-rarity-bar,
  .deck-8-mini-grid .cr-rarity-bar {
    height: 2px;
    margin-top: 2px;
  }

  .deck-8-grid .empty-slot {
    border-radius: 7px;
    border-width: 1.5px;
    font-size: 8px;
    padding: 2px;
    text-align: center;
    line-height: 1.15;
  }

  .deck-8-grid .slot-remove-btn {
    top: -4px;
    right: -3px;
    width: 14px;
    height: 14px;
    font-size: 9px;
  }

  /* Secondary slim Tower Troop pill directly below the 8 battle cards */
  .deck-9-grid .cr-card.is-tower-tile {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 4px;
    border-radius: 8px;
    margin-top: 2px;
    background: rgba(15, 23, 42, 0.72);
  }

  .deck-9-grid .cr-card.is-tower-tile .cr-card-img-wrap {
    width: 22px;
    height: 26px;
    aspect-ratio: auto;
    flex-shrink: 0;
    border-radius: 4px;
  }

  .deck-9-grid .cr-card.is-tower-tile .cr-card-name {
    width: auto;
    margin-top: 0;
    font-size: 10px;
    text-align: left;
  }

  .deck-9-grid .cr-card.is-tower-tile .cr-card-sub {
    font-size: 9px;
    margin-left: 2px;
    white-space: nowrap;
  }

  .deck-9-grid .cr-card.is-tower-tile .cr-rarity-bar,
  .deck-9-grid .cr-card.is-tower-tile .cr-badge-tr,
  .deck-9-grid .cr-card.is-tower-tile .cr-patch-pill {
    display: none;
  }
}

@media (max-width: 960px), (hover: none) and (pointer: coarse) {
  .card-picker-grid .cr-info-btn,
  .deck-8-grid .cr-info-btn,
  .deck-9-grid .cr-info-btn,
  .deck-8-mini-grid .cr-info-btn {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .card-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
  }
  .card-picker-grid .cr-card {
    padding: 4px;
    border-radius: 10px;
  }
  .card-picker-grid .cr-elixir {
    width: 19px;
    height: 22px;
    font-size: 10px;
    padding-top: 4px;
  }
  .card-picker-grid .cr-card-name {
    font-size: 10px;
  }
}

@media (max-width: 720px) {
  .main-container {
    padding: 10px 10px 48px;
  }
  .panel-card,
  .rec-card {
    padding: 12px 10px;
  }
  .analyzer-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .deck-8-grid,
  .deck-9-grid,
  .deck-8-mini-grid {
    grid-template-columns: repeat(8, minmax(52px, 1fr));
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .deck-8-grid .cr-elixir,
  .deck-9-grid .cr-elixir,
  .deck-8-mini-grid .cr-elixir {
    width: 17px;
    height: 20px;
    font-size: 9.5px;
    padding-top: 4px;
  }
  .deck-8-grid .cr-card-name,
  .deck-9-grid .cr-card-name,
  .deck-8-mini-grid .cr-card-name {
    font-size: 9px;
  }
}

@media (max-width: 640px) {
  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
  }
  .cr-elixir {
    width: 19px;
    height: 22px;
    font-size: 10px;
    padding-top: 4px;
  }
  .cr-badge-tr,
  .cr-patch-pill {
    font-size: 8px;
    padding: 1px 3px;
  }
  .topbar-controls .player-pill {
    max-width: 112px;
  }
}

@media (max-width: 480px) {
  .meta-stats-grid,
  .dex-score-grid {
    grid-template-columns: 1fr;
  }
}
