* {
  box-sizing: border-box;
}

:root {
  --bg-gradient: radial-gradient(circle at top, #131820 0%, #0a0d12 42%, #06080b 100%);
  --text-main: #e8edf4;
  --subtitle: #aab7c8;
  --card-bg: rgba(15, 22, 31, 0.88);
  --card-border: #2c3a4f;
  --input-bg: #121a24;
  --input-border: #364861;
  --panel-bg: #0f1620;
  --panel-border: #2f4056;
  --chip-bg: #182231;
  --chip-border: #32455f;
  --muted: #9ba9bd;
}

body[data-theme="light"] {
  --bg-gradient: linear-gradient(180deg, #1a1a1a, #000000);
  --text-main: #0f172a;
  --subtitle: #334155;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(148, 163, 184, 0.8);
  --input-bg: #ffffff;
  --input-border: #94a3b8;
  --panel-bg: #f8fafc;
  --panel-border: #cbd5e1;
  --chip-bg: #e2e8f0;
  --chip-border: #94a3b8;
  --muted: #475569;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-main);
  background: var(--bg-gradient);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  letter-spacing: 0.2px;
}

.kid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(83, 232, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 80% 70%, rgba(255, 79, 216, 0.1), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(255, 241, 95, 0.06), transparent 60%);
}

@media (prefers-reduced-motion: reduce) {
  .bg-pal-sticker,
  .confetti-piece,
  .hero-icon {
    animation: none !important;
  }
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  opacity: 0.95;
  animation-name: confettiDrop;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  animation-fill-mode: forwards;
}

@keyframes confettiDrop {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.95;
  }
  100% {
    transform: translateY(220px) rotate(540deg);
    opacity: 0;
  }
}

.bg-pal-sticker {
  position: absolute;
  border-radius: 10px;
  opacity: 0.18;
  filter: saturate(1.4) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px rgba(83, 232, 255, 0.35);
  animation-name: stickerFloat;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  mix-blend-mode: screen;
}

@keyframes stickerFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}

.container {
  width: min(980px, 94vw);
  margin: 4.7rem auto 3rem;
  position: relative;
  z-index: 2;
}

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  background: rgba(8, 12, 18, 0.92);
  border-bottom: 1px solid #26364a;
  backdrop-filter: blur(6px);
}

.nav-inner {
  width: min(1100px, 96vw);
  margin: 0 auto;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.brand {
  font-weight: 700;
  color: #f1f5f9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.nav-link-btn {
  background: transparent;
  color: #c7d2e0;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 0.87rem;
  text-decoration: none;
}

.nav-link-btn.is-active,
.tool-link-btn.is-active {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes floatOrb {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
}

header h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #f8fafc;
  font-size: clamp(1.7rem, 2.3vw, 2.2rem);
}

.subtitle {
  margin-top: 0;
  color: var(--subtitle);
  max-width: 64ch;
}

.route-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  background: #243246;
  border: 1px solid #3b506b;
  color: #dbe6f4;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-strip {
  margin: 0.2rem 0 0.75rem;
  min-height: 62px;
  border: 1px solid #2f4258;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(31, 45, 66, 0.9), rgba(18, 27, 40, 0.9));
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.hero-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #4b6281;
  object-fit: cover;
  flex: 0 0 auto;
  background: #0b1220;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-btn {
  margin-top: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f8d451, #eab308);
  color: #201700;
}

.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.65rem 0 0.15rem;
}

.tool-link-btn {
  color: #f5f7fb;
  font-size: 0.82rem;
  background: #1a2433;
  border: 1px solid #33465e;
  border-radius: 999px;
  padding: 0.26rem 0.62rem;
  margin: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.database-panel {
  color: var(--subtitle);
  line-height: 1.5;
  font-size: 0.94rem;
}

.database-caption {
  margin: 0.25rem 0 0.55rem;
}

.database-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.database-table th,
.database-table td {
  text-align: left;
  border: 1px solid #33465a;
  padding: 0.45rem 0.52rem;
  font-size: 0.88rem;
}

.database-table th {
  background: #182230;
}

.database-list {
  margin: 0.25rem 0 0;
  padding-left: 1.05rem;
}

.route-seo-blurb {
  margin-top: 0.5rem;
}

.route-seo-blurb p,
#aboutSite p {
  line-height: 1.65;
  color: var(--subtitle);
}

.seo-content h3 {
  margin-bottom: 0.35rem;
}

.seo-content ul {
  margin-top: 0.3rem;
  padding-left: 1.15rem;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.9rem 0 0.3rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(20, 31, 45, 0.86);
  border: 1px solid #33465f;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  color: #dce5f1;
  font-size: 0.88rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.05rem;
  margin: 1rem 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

body[data-route-view="map"] .card {
  border-color: #3f6f93;
}
body[data-route-view="map"] .hero-strip {
  border-color: #3f6f93;
  background: linear-gradient(180deg, rgba(35, 64, 92, 0.9), rgba(17, 35, 53, 0.9));
}
body[data-route-view="items"] .card {
  border-color: #6b5a3a;
}
body[data-route-view="items"] .hero-strip {
  border-color: #6b5a3a;
  background: linear-gradient(180deg, rgba(78, 61, 36, 0.92), rgba(38, 29, 16, 0.92));
}
body[data-route-view="technology"] .card {
  border-color: #506a4a;
}
body[data-route-view="technology"] .hero-strip {
  border-color: #506a4a;
  background: linear-gradient(180deg, rgba(48, 72, 44, 0.92), rgba(22, 37, 19, 0.92));
}
body[data-route-view="pals"] .card {
  border-color: #5d4c75;
}
body[data-route-view="pals"] .hero-strip {
  border-color: #5d4c75;
  background: linear-gradient(180deg, rgba(66, 50, 95, 0.92), rgba(31, 21, 46, 0.92));
}
body[data-route-view="capture"] .card {
  border-color: #7a4f4f;
}
body[data-route-view="capture"] .hero-strip {
  border-color: #7a4f4f;
  background: linear-gradient(180deg, rgba(90, 48, 48, 0.92), rgba(42, 20, 20, 0.92));
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.11);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-main);
}

select,
input,
button {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: 7px;
  padding: 0.6rem 0.7rem;
}

button {
  margin-top: 1rem;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, filter 120ms ease;
  font-weight: 700;
}

button:hover {
  border-color: #8ea7c4;
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.ghost-btn {
  background: rgba(28, 39, 56, 0.8);
  border-style: solid;
  border-color: #617993;
}

.visible-breadcrumb,
.crumbs {
  font-size: 0.88rem;
  color: var(--muted, #9fb2c8);
  margin: 0.35rem 0 0.75rem;
}

.visible-breadcrumb a,
.crumbs a {
  color: #8ec8ff;
  text-decoration: none;
}

.visible-breadcrumb a:hover,
.crumbs a:hover {
  text-decoration: underline;
}

.result,
.combos {
  margin-top: 1rem;
  padding: 0.85rem;
  border-radius: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  min-height: 58px;
}

.result-error {
  color: #ff8a8a;
  font-weight: 600;
}

.pick-for {
  margin-top: 1rem;
  min-width: 220px;
}

.load-more-pals {
  display: block;
  width: 100%;
  margin: 0.75rem 0 0;
}

.combo-list {
  margin: 0;
  padding-left: 1.1rem;
}

.pal-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pal-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 0.22rem 0.5rem 0.22rem 0.22rem;
}

.pal-image {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1f2937;
  border: 1px solid #475569;
  object-fit: cover;
}

.flow-symbol {
  color: #a5b9d3;
  font-weight: 700;
  font-size: 1.2rem;
}

.target-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.combo-item {
  margin-bottom: 0.5rem;
}

.combo-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.5rem;
}

.muted {
  color: var(--muted);
}

.arena {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.arena-card {
  width: 112px;
  border: 1px solid #3d516b;
  background: linear-gradient(180deg, #1a2638, #121a28);
  padding: 0.4rem;
  text-align: center;
  border-radius: 10px;
}

.arena-card.child {
  border-color: #f6cd5f;
  box-shadow: 0 0 0 1px rgba(246, 205, 95, 0.18);
}

.arena-card img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border: 1px solid #516885;
  border-radius: 50%;
  background: #001726;
}

.arena-name {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.pal-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.55rem;
}

.pal-grid-card {
  background: linear-gradient(180deg, #1a2638, #121b29);
  border: 1px solid #3e546e;
  border-radius: 6px;
  padding: 0.3rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.pal-grid-card:hover {
  transform: translateY(-2px);
  border-color: #8fa8c7;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.pal-grid-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #4b6281;
  border-radius: 4px;
  background: #001726;
}

.pal-grid-name {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  text-align: center;
}

.pal-power {
  width: fit-content;
  margin: 0.2rem auto 0;
  background: #0b1220;
  color: #c8d5e9;
  border: 1px solid #33465f;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.63rem;
}

@media (max-width: 640px) {
  .container {
    margin-top: 1rem;
  }

  .header-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    display: none;
  }

  .card {
    padding: 0.85rem;
  }
}
