:root {
  --ink: #3d3d51;
  --muted: #878896;
  --panel: rgba(255, 255, 255, 0.85);
  --line: rgba(61, 61, 81, 0.18);
  --primary: #565673;
  --blue: #5693d8;
  --header-height: 60px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #dbe6f8 url("assets/ui/background.png") center top / cover fixed no-repeat;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.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; }

/* Fixed Translucent Blurred Header */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.header-inner {
  width: min(978px, 100%);
  height: 100%;
  margin: auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { width: 125px; height: 100%; display: flex; align-items: center; }
.brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.header-controls { display: flex; align-items: center; gap: 17px; }
.search-box {
  width: 288px;
  height: 32px;
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid rgba(61, 61, 81, 0.45);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}
.search-box input {
  width: 100%;
  height: 100%;
  padding: 0 38px 0 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}
.search-box input::placeholder { color: var(--muted); }
.search-box img { position: absolute; right: 12px; width: 18px; height: 18px; opacity: 0.65; pointer-events: none; }
.language-button { width: 28px; padding: 0; border: 0; color: var(--ink); background: transparent; font-size: 22px; line-height: 1; opacity: 0.8; }

/* Main Content Container (978px width standard) */
.main-content {
  width: min(978px, 100%);
  min-height: calc(100vh - var(--header-height));
  margin: auto;
  padding: 85px 20px 32px;
}

/* Panels */
.wiki-panel, .detail-panel, .evolution-panel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
  box-shadow: 0 4px 16px rgba(61, 61, 81, 0.08);
}
.wiki-panel::before, .detail-panel::before, .evolution-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.11) url("assets/ui/contain_lt_bg.png") no-repeat left top / 134px 74px;
}
.panel-content { position: relative; z-index: 1; }

.panel-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(61, 61, 81, 0.12);
  font-size: 18px;
  font-weight: 700;
}
.panel-header h1, .panel-header h2 { margin: 0; font-size: inherit; display: flex; align-items: center; }
.panel-header h1::after, .panel-header h2::after {
  content: "";
  display: inline-block;
  width: 35px;
  height: 10px;
  margin-left: 8px;
  background: url("assets/ui/sublogo.png") center / contain no-repeat;
}
.collapse-button {
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.collapse-button.is-collapsed { transform: rotate(180deg); }

/* Filter Chips */
.filters { padding: 10px 18px 12px; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 10px; }
.filter-label { min-width: 62px; font-size: 13px; font-weight: 600; color: rgba(61, 61, 81, 0.85); }
.filter-chip {
  min-width: 62px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid rgba(61, 61, 81, 0.15);
  border-radius: 13px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
  transition: all 0.15s ease;
  user-select: none;
}
.filter-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}
.filter-chip[aria-pressed="true"] {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.filter-chip .dot {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}
.sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
}
.sort-select {
  min-width: 230px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(61, 61, 81, 0.18);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  outline: none;
}
.creatures-count { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Grid of Cards (7 columns on Desktop) */
.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 20px;
}
.creature-card {
  min-width: 0;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.creature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(61, 61, 81, 0.16);
  border-color: rgba(86, 147, 216, 0.6);
}
.creature-image {
  position: relative;
  width: 100%;
  height: 134px;
  overflow: hidden;
  background: url("assets/ui/aniimo_bg.png") center / cover no-repeat;
}
.creature-image::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}
.creature-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 4px;
}
.creature-number {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(61, 61, 81, 0.8);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.badges {
  position: absolute;
  z-index: 3;
  right: 4px;
  bottom: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.badge {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.creature-name {
  width: 100%;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}
.reset-filters-btn {
  margin-top: 10px;
  padding: 6px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* Detail View */
.detail-wrap { display: grid; gap: 10px; }
.back-row {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-radius: 20px;
  color: #ffffff;
  background: var(--primary);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(61, 61, 81, 0.15);
}
.nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffffff;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.15s ease;
}
.nav-back:hover { background: rgba(255, 255, 255, 0.3); }
.current-creature-title { font-size: 16px; letter-spacing: 0.5px; }
.nav-pair { display: flex; align-items: center; gap: 8px; }
.nav-step {
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  color: #ffffff;
  transition: background 0.15s ease;
}
.nav-step:hover { background: rgba(255, 255, 255, 0.3); }

.detail-hero {
  min-height: 350px;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(105deg, rgba(175, 215, 245, 0.85), rgba(255, 255, 255, 0.9));
}
.hero-art {
  position: relative;
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: url("assets/ui/aniimo_bg.png") center / cover no-repeat;
  padding: 16px;
}
.hero-art img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}
.hero-stage-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  color: #ffffff;
  background: rgba(61, 61, 81, 0.8);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.hero-info { padding: 26px 24px 20px; }
.hero-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 26px;
  font-weight: 800;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}
.tag-role { background: #ffffff; color: var(--ink); border: 1px solid rgba(61, 61, 81, 0.2); }
.section-title {
  margin: 0 0 8px;
  padding-left: 8px;
  border-left: 4px solid var(--blue);
  font-size: 16px;
  font-weight: 700;
}
.hero-desc { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: rgba(61, 61, 81, 0.9); }

.attributes {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(61, 61, 81, 0.12);
}
.attribute-total { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.stat {
  display: grid;
  grid-template-columns: 65px 1fr 28px;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-size: 12px;
  font-weight: 600;
}
.stat-bar { height: 7px; overflow: hidden; border-radius: 4px; background: rgba(61, 61, 81, 0.12); }
.stat-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5693d8, #3d3d51); }
.stat-val { text-align: right; color: var(--ink); }

/* Related Forms */
.forms-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(61, 61, 81, 0.08);
}
.forms-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.forms { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.form-link {
  padding: 5px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(61, 61, 81, 0.15);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.form-link:hover { color: var(--ink); border-color: var(--blue); }
.form-link.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

/* Evolution Panel */
.evolution-panel { padding-bottom: 20px; }
.evolution-path {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 135px;
  padding: 16px;
  flex-wrap: wrap;
}
.evo-node {
  width: 90px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: 10px;
  transition: transform 0.15s ease;
}
.evo-node:hover { transform: translateY(-2px); }
.evo-node.active {
  background: rgba(86, 147, 216, 0.15);
  outline: 2px solid var(--blue);
}
.evo-node img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 4px;
  border-radius: 8px;
  background: url("assets/ui/aniimo_bg.png") center / cover no-repeat;
}
.evo-name { font-size: 11px; font-weight: 700; color: var(--ink); }
.evo-stage { font-size: 10px; color: var(--muted); }
.evo-arrow { color: #8a8a9a; font-size: 22px; font-weight: 800; }

/* Habitats and Skills Info Grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(61, 61, 81, 0.06);
}
.habitats-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.habitats-list li { font-size: 13px; color: var(--ink); font-weight: 500; }
.homeland-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(86, 147, 216, 0.1);
  border: 1px solid rgba(86, 147, 216, 0.2);
}
.homeland-badge { font-size: 24px; }
.homeland-box strong { font-size: 13px; color: var(--ink); }
.homeland-box p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.skill {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid rgba(61, 61, 81, 0.1);
}
.skill:first-of-type { border-top: 0; }
.skill-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.skill-body strong { display: block; font-size: 13px; color: var(--ink); }
.skill-meta { color: var(--blue); font-size: 11px; font-weight: 600; margin: 2px 0 4px; }
.skill-desc { margin: 0; color: rgba(61, 61, 81, 0.85); font-size: 12px; line-height: 1.4; }
.trait-skill { background: rgba(61, 61, 81, 0.03); border-radius: 8px; padding: 10px 8px; }

/* Footer */
.site-footer {
  width: min(978px, 100%);
  margin: auto;
  padding: 24px 20px 32px;
  color: rgba(61, 61, 81, 0.75);
  text-align: center;
  font-size: 11px;
}
.footer-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; }
.footer-links a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }

/* Back to Top Button */
.to-top {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(61, 61, 81, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 20px;
}
.to-top:hover { transform: translateY(-2px); }
.to-top.visible { opacity: 1; pointer-events: auto; }

/* Responsive: Desktop (1440px / default: 7 cols) */
@media (min-width: 901px) {
  .grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* Responsive: Tablet (768px: 4-6 cols) */
@media (max-width: 900px) and (min-width: 601px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .info-grid { grid-template-columns: 1fr; }
}

/* Responsive: Mobile (390px: 3 cols compact) */
@media (max-width: 600px) {
  :root { --header-height: 56px; }
  .header-inner { padding: 0 12px; }
  .brand { width: 95px; }
  .header-controls { gap: 8px; }
  .search-box { width: min(45vw, 200px); height: 28px; }
  .main-content { padding: 70px 10px 24px; }
  .panel-header { padding: 0 12px; font-size: 16px; }
  .filters { padding: 8px 12px; }
  .filter-row { gap: 5px; }
  .filter-label { width: 100%; margin-bottom: 2px; }
  .sort-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .sort-select { min-width: 0; width: 100%; }
  .creatures-count { text-align: right; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 10px 14px; }
  .creature-card { height: 136px; }
  .creature-image { height: 110px; }
  .creature-name { height: 26px; font-size: 11px; }
  .detail-hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 280px; }
  .hero-info { padding: 18px 16px; }
  .info-grid { grid-template-columns: 1fr; }
  .current-creature-title { display: none; }
}
