:root {
  --page-bg: #0f171f;
  --page-bg-soft: #172331;
  --panel: #f6f2ea;
  --panel-strong: #ece6d9;
  --panel-muted: #ddd3bf;
  --ink: #1b2430;
  --muted: #535d6a;
  --line: #c7bca6;
  --line-dark: rgba(255, 255, 255, 0.14);
  --nav: #0b1118;
  --nav-soft: #131d29;
  --gold: #a9823d;
  --gold-light: #d2b66f;
  --brown: #60492e;
  --blue: #315a72;
  --blue-dark: #1d3547;
  --success: #2f6841;
  --warn: #8b5a20;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(10, 16, 23, 0.76), rgba(10, 16, 23, 0.86)),
    url("images/ui/Fondo.jpg") center / cover fixed no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(184, 149, 75, 0.18), transparent 380px),
    linear-gradient(180deg, rgba(16, 24, 33, 0.12), rgba(16, 24, 33, 0.38));
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  color: #101820;
  background: rgba(209, 178, 107, 0.72);
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(209, 178, 107, 0.58);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px clamp(14px, 3vw, 34px);
  color: #efe9db;
  background: rgba(11, 17, 24, 0.96);
  border-bottom: 1px solid var(--line-dark);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #17130d;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border: 1px solid #ecd89b;
  border-radius: 4px;
  font-size: 0.84rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 3px;
  color: #d5d0c4;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
}

.nav-links a:hover {
  color: #fff;
  background: var(--nav-soft);
}

.nav-links a.active {
  color: #17130d;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
}

.nav-links a[href="materiales.html"],
.nav-links a[href="market.html"],
.nav-links a[href="leaderboard.html"] {
  border: 1px solid rgba(209, 178, 107, 0.2);
}

main {
  width: min(1180px, calc(100% - 24px));
  margin: 22px auto 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  min-height: 0;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(32, 57, 75, 0.08), transparent),
    var(--panel);
  border-bottom: 1px solid var(--line);
}

.wiki-hero {
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  align-items: center;
}

.page-header {
  padding-bottom: 24px;
}

.hero-art {
  position: relative;
  min-height: 260px;
  border: 1px solid #7d705d;
  border-radius: 2px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #34495b 0%, #536d7b 47%, #253f50 48%, #172d39 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.image-slot {
  position: relative;
  display: grid;
  min-height: 180px;
  margin: 0;
  place-items: center;
  overflow: hidden;
  color: #6b604f;
  background:
    linear-gradient(135deg, rgba(184, 149, 75, 0.18), transparent),
    #ded5c3;
  border: 1px solid #7d705d;
  border-radius: 4px;
}

.image-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-slot figcaption {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 7px 8px;
  color: #f7efd9;
  font-size: 0.78rem;
  text-align: center;
  background: rgba(11, 17, 24, 0.72);
  border-radius: 2px;
}

.image-slot.is-missing::before {
  content: "Imagen pendiente";
  font-weight: 800;
}

.app-icon {
  width: 150px;
  min-height: 150px;
  align-self: start;
  aspect-ratio: 1;
}

.wiki-hero .app-icon {
  width: 84px;
  min-height: 84px;
  align-self: center;
}

.screenshot-slot {
  min-height: 560px;
  background: #c9c0ad;
}

.screenshot-slot img {
  object-fit: contain;
  background: #0e1822;
}

.video-frame {
  margin: 0;
  overflow: hidden;
  background: #0e1822;
  border: 1px solid #7d705d;
  border-radius: 3px;
}

.video-frame video {
  display: block;
  width: 100%;
  max-height: 720px;
  background: #000;
}

.video-frame figcaption {
  padding: 9px 10px;
  color: #f7efd9;
  font-size: 0.82rem;
  text-align: center;
  background: rgba(11, 17, 24, 0.92);
}

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

.frame-grid figure {
  margin: 0;
  overflow: hidden;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.frame-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #0e1822;
}

.frame-grid figcaption {
  padding: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.sun {
  position: absolute;
  top: 36px;
  right: 34px;
  width: 58px;
  height: 58px;
  background: #b8954b;
  border: 1px solid rgba(0, 0, 0, 0.42);
  border-radius: 50%;
  opacity: 0.86;
}

.ship {
  position: absolute;
  left: 50%;
  bottom: 52px;
  width: 210px;
  height: 180px;
  transform: translateX(-50%) scale(0.84);
}

.mast {
  position: absolute;
  left: 103px;
  top: 18px;
  width: 7px;
  height: 138px;
  background: #3b271a;
  border: 1px solid rgba(0, 0, 0, 0.58);
}

.sail {
  position: absolute;
  background: #ded5c3;
  border: 1px solid rgba(0, 0, 0, 0.62);
}

.sail-main {
  left: 108px;
  top: 38px;
  width: 76px;
  height: 92px;
  clip-path: polygon(0 0, 100% 45%, 0 100%);
}

.sail-small {
  left: 32px;
  top: 52px;
  width: 76px;
  height: 74px;
  clip-path: polygon(100% 0, 100% 100%, 0 55%);
}

.hull {
  position: absolute;
  left: 22px;
  bottom: 10px;
  width: 170px;
  height: 46px;
  background: #4b3325;
  border: 1px solid rgba(0, 0, 0, 0.68);
  border-radius: 0 0 70px 70px;
}

.wave {
  position: absolute;
  left: -6%;
  width: 112%;
  height: 42px;
  background: rgba(235, 228, 213, 0.42);
  border-radius: 50%;
}

.wave-one {
  bottom: 42px;
}

.wave-two {
  bottom: 8px;
  background: rgba(235, 228, 213, 0.25);
}

.hero-copy {
  max-width: none;
  padding: 4px 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brown);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  padding-bottom: 12px;
  color: #151b22;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.03;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin-bottom: 0;
  color: #1a2430;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.5vw, 2.05rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 9px;
  color: #1b2631;
  font-size: 1.08rem;
}

p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.62;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 72ch;
  font-size: 1rem;
}

.wiki-hero h1 {
  margin-bottom: 6px;
  padding-bottom: 6px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.wiki-hero .hero-copy > p:not(.eyebrow) {
  max-width: 68ch;
  font-size: 0.92rem;
  line-height: 1.45;
}

.search-wrap {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.wiki-hero .search-wrap {
  gap: 5px;
  margin-top: 10px;
}

.search-wrap label {
  color: #283342;
  font-weight: 800;
}

.search-wrap input {
  width: min(100%, 520px);
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
  border: 1px solid #9e927e;
  border-radius: 3px;
  outline: none;
  background: #fffaf0;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.08);
}

.wiki-hero .search-wrap input {
  width: min(100%, 420px);
  padding: 8px 10px;
  font-size: 0.92rem;
}

.search-wrap input:focus {
  border-color: var(--gold);
  box-shadow:
    inset 0 1px 4px rgba(0, 0, 0, 0.08),
    0 0 0 3px rgba(184, 149, 75, 0.24);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
}

.quick-stats article {
  padding: 9px 14px;
  background: transparent;
  border-right: 1px solid var(--line);
}

.quick-stats article:last-child {
  border-right: 0;
}

.quick-stats span {
  display: block;
  margin-bottom: 4px;
  color: var(--brown);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-stats strong {
  color: #17212c;
  font-size: 0.9rem;
}

.section {
  padding: 28px 24px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.section.alt {
  background: #eee8dc;
  border-block: 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  max-width: none;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.card-grid,
.systems,
.guide,
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
  max-width: none;
  margin: 0;
}

.info-card,
.systems article,
.guide article,
.article-grid article,
.timeline article {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbf7ee;
}

.info-card {
  padding: 18px;
  box-shadow: none;
}

.info-card,
.article-grid article,
.priority-strip article,
.material-card,
.wiki-table-wrap,
.frame-grid figure {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  color: #17212c;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  background: #eee2c4;
  border: 1px solid #c8b37b;
  border-radius: 3px;
}

.status-badge.confirmed {
  color: #173321;
  background: #d9ead7;
  border-color: #8ab184;
}

.status-badge.observed {
  color: #1a2c3d;
  background: #dce8f2;
  border-color: #91afc7;
}

.status-badge.pending {
  color: #4d3112;
  background: #f5e0bf;
  border-color: #c99d5f;
}

.status-badge.inferred {
  color: #3b304b;
  background: #e6def0;
  border-color: #b3a0ca;
}

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

.priority-strip article {
  padding: 14px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.priority-strip strong {
  display: block;
  margin-bottom: 6px;
  color: #17212c;
}

.priority-strip p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.material-card {
  overflow: hidden;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.material-card img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 14;
  object-fit: cover;
  object-position: center;
  background: #0e1822;
  border-bottom: 1px solid var(--line);
}

.material-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 9 / 14;
  color: #173c27;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(115, 168, 111, 0.28), rgba(19, 56, 79, 0.16)),
    #dcebd8;
  border-bottom: 1px solid var(--line);
}

.material-card .material-body {
  padding: 12px;
}

.material-card h3 {
  margin-bottom: 6px;
}

.material-card p {
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.hero-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  background: #eee8dc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-filter-panel label {
  display: grid;
  gap: 6px;
  color: #283342;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-filter-panel input,
.hero-filter-panel select {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  background: #fffaf0;
  border: 1px solid #9e927e;
  border-radius: 3px;
}

.hero-filter-panel input:focus,
.hero-filter-panel select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 149, 75, 0.22);
}

.role-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.role-overview-card {
  padding: 14px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.role-overview-card h3 {
  margin: 8px 0 6px;
}

.role-overview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.role-pill,
.hero-meta .role-atk,
.hero-meta .role-def,
.hero-meta .role-sup {
  border: 1px solid transparent;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  color: #18222f;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  border-radius: 3px;
}

.role-atk,
.hero-meta .role-atk {
  color: #4b1010;
  background: #f1b2a8;
  border-color: #c85f50;
}

.role-def,
.hero-meta .role-def {
  color: #46320a;
  background: #f0d26e;
  border-color: #bb922d;
}

.role-sup,
.hero-meta .role-sup {
  color: #12391f;
  background: #a7d7a6;
  border-color: #5fa260;
}

.hero-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 240px));
  justify-content: start;
  gap: 14px;
}

.hero-profile-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  text-align: left;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.hero-profile-card.rarity-n {
  background: linear-gradient(145deg, #c9e3ff 0%, #65a9ee 55%, #347dc8 100%);
  border: 2px solid #286eb7;
  box-shadow: 0 8px 20px rgba(36, 103, 174, 0.25);
}

.hero-profile-card.rarity-r {
  background: linear-gradient(145deg, #e2c7ff 0%, #ad6de8 52%, #7834b4 100%);
  border: 2px solid #6a269f;
  box-shadow: 0 8px 22px rgba(106, 38, 159, 0.3);
}

.hero-profile-card.rarity-sr {
  background: linear-gradient(145deg, #fff2a3 0%, #f4c83e 52%, #d89408 100%);
  border: 2px solid #b87800;
  box-shadow: 0 8px 22px rgba(184, 120, 0, 0.32);
}

.hero-profile-card.rarity-ssr {
  background: linear-gradient(145deg, #ffc09a 0%, #f46b42 50%, #d83220 100%);
  border: 2px solid #b92317;
  box-shadow: 0 8px 24px rgba(185, 35, 23, 0.34);
}

.hero-profile-card.rarity-ur {
  background: linear-gradient(
    145deg,
    rgba(255, 190, 190, 0.88) 0%,
    rgba(224, 48, 61, 0.86) 42%,
    rgba(255, 105, 117, 0.9) 70%,
    rgba(132, 8, 28, 0.94) 100%
  );
  border: 2px solid #a40d25;
  box-shadow:
    0 0 0 2px rgba(255, 174, 184, 0.9),
    0 0 18px rgba(239, 34, 65, 0.46),
    0 10px 28px rgba(116, 5, 25, 0.52);
}

.hero-profile-card.rarity-ur::after {
  position: absolute;
  z-index: 2;
  top: -45%;
  left: -85%;
  width: 45%;
  height: 190%;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  transform: rotate(18deg);
  animation: ur-water-shine 4.5s ease-in-out infinite;
}

@keyframes ur-water-shine {
  0%, 55% { left: -85%; }
  82%, 100% { left: 145%; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-profile-card.rarity-ur::after {
    animation: none;
  }
}

.hero-profile-card:hover,
.hero-profile-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 12px 30px rgba(22, 28, 35, 0.18);
}

.hero-profile-card.rarity-ur:hover,
.hero-profile-card.rarity-ur:focus-visible {
  border-color: #ffe4e7;
  box-shadow:
    0 0 0 3px rgba(255, 91, 112, 0.6),
    0 14px 34px rgba(157, 8, 35, 0.54);
}

.hero-card-portrait {
  width: 100%;
  margin: 0;
  min-height: 340px;
  overflow: hidden;
  background: #101820;
  border-bottom: 1px solid var(--line);
}

.hero-card-portrait img {
  display: block;
  width: 100%;
  height: 340px;
  object-fit: cover;
  object-position: 50% 28%;
}

.hero-card-portrait .hero-portrait.placeholder {
  width: 100%;
  min-height: 340px;
  border: 0;
  border-radius: 0;
}

.hero-card-body {
  flex: 1;
  width: 100%;
  padding: 12px;
  background: rgba(251, 247, 238, 0.18);
}

.hero-card-body h3 {
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.hero-card-body p {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.hero-profile-top {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(45, 83, 109, 0.08), transparent),
    #fbf7ee;
  border-bottom: 1px solid var(--line);
}

.hero-portrait {
  min-height: 212px;
  overflow: hidden;
  background: #111923;
  border: 1px solid #7d705d;
  border-radius: 3px;
}

.hero-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.hero-portrait.placeholder {
  display: grid;
  place-items: center;
  min-height: 212px;
  color: #efe9db;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  font-weight: 800;
  background:
    linear-gradient(135deg, rgba(184, 149, 75, 0.32), transparent),
    #172332;
}

.hero-profile-card h3 {
  margin-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.hero-meta span {
  padding: 4px 7px;
  color: #233140;
  font-size: 0.72rem;
  font-weight: 800;
  background: #eee8dc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-meta .affinity-tag {
  color: #233140;
  background: #eee8dc;
  border-color: var(--line);
}

.hero-meta .role-tag {
  color: #233140;
  border-color: var(--line);
}

.hero-meta .role-atk {
  color: #5a1616;
  background: #f3c2bc;
  border-color: #c7675c;
}

.hero-meta .role-def {
  color: #4d3608;
  background: #f1dd91;
  border-color: #bf9736;
}

.hero-meta .role-sup {
  color: #173c27;
  background: #cfe8ce;
  border-color: #73a86f;
}

.hero-meta .affinity-pirate,
.hero-meta .affinity-blackbeard-pirates,
.hero-meta .affinity-whitebeard-pirates,
.hero-meta .affinity-buggy-pirates,
.hero-meta .affinity-bliking-pirates {
  color: #4a1b14;
  background: #f2c8bd;
  border-color: #c56a58;
}

.hero-meta .affinity-captain,
.hero-meta .affinity-royalty {
  color: #49310d;
  background: #f5df9f;
  border-color: #c49a3a;
}

.hero-meta .affinity-legendary,
.hero-meta .affinity-no-1-swordsman {
  color: #3c2751;
  background: #ead7f6;
  border-color: #a27abb;
}

.hero-meta .affinity-four-emperors {
  color: #2f224f;
  background: #d9cef1;
  border-color: #8670be;
}

.hero-meta .affinity-big-mom-band,
.hero-meta .affinity-baroque,
.hero-meta .affinity-donquixote,
.hero-meta .affinity-greed {
  color: #562049;
  background: #f2c8e8;
  border-color: #bf6baa;
}

.hero-meta .affinity-beasts-pirates,
.hero-meta .affinity-zoan-fruit,
.hero-meta .affinity-fish-man,
.hero-meta .affinity-wano-country {
  color: #173321;
  background: #d9ead7;
  border-color: #7dad78;
}

.hero-meta .affinity-superman-fruit,
.hero-meta .affinity-paramecia {
  color: #54264b;
  background: #f5d0ec;
  border-color: #bd72a9;
}

.hero-meta .affinity-logia-fruit,
.hero-meta .affinity-artificial-fruit,
.hero-meta .affinity-skypiea-residence,
.hero-meta .affinity-skypiea-priest {
  color: #13384f;
  background: #d4eaf5;
  border-color: #75aeca;
}

.hero-meta .affinity-marine,
.hero-meta .affinity-marine-admirals,
.hero-meta .affinity-marine-marshall,
.hero-meta .affinity-marine-science-troop,
.hero-meta .affinity-undercover,
.hero-meta .affinity-cp0,
.hero-meta .affinity-cp9 {
  color: #172e4d;
  background: #d9e2f4;
  border-color: #7892bf;
}

.hero-meta .affinity-strawhat-pirates,
.hero-meta .affinity-sun-pirates,
.hero-meta .affinity-a-s-l,
.hero-meta .affinity-thriller-bark,
.hero-meta .affinity-water-7,
.hero-meta .affinity-worst-generation,
.hero-meta .affinity-impel-down,
.hero-meta .affinity-royal-deputy,
.hero-meta .affinity-rebels,
.hero-meta .affinity-germa,
.hero-meta .affinity-gentleman,
.hero-meta .affinity-shichibukai,
.hero-meta .affinity-celestial-dragons,
.hero-meta .affinity-okama {
  color: #314226;
  background: #e8e4bd;
  border-color: #aba35c;
}

.hero-meta .affinity-sin-fruta {
  color: #34404b;
  background: #e2e5e7;
  border-color: #a7b0b7;
}

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

.hero-stat-grid div {
  padding: 7px 8px;
  color: #1d2530;
  font-size: 0.82rem;
  background: #f1eadc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-stat-grid strong {
  display: block;
  color: var(--brown);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.skill-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.skill-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.skill-card img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  background: #101820;
  border: 1px solid #7d705d;
  border-radius: 3px;
}

.skill-card h4 {
  margin: 0 0 4px;
  color: #1b2631;
  font-size: 0.98rem;
}

.skill-card p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.skill-effects {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.skill-effects li {
  padding: 5px 7px;
  color: #263445;
  font-size: 0.78rem;
  line-height: 1.35;
  background: #f1eadc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.skill-effects strong {
  color: #1b2631;
}

.skill-type {
  display: inline-block;
  margin-bottom: 5px;
  padding: 3px 6px;
  color: #17212c;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #e4d5b8;
  border-radius: 2px;
}

.hero-empty {
  padding: 18px;
  color: var(--muted);
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 12, 18, 0.72);
  backdrop-filter: blur(6px);
}

.hero-modal {
  width: min(1080px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.hero-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #efe9db;
  background: rgba(11, 17, 24, 0.96);
  border-bottom: 1px solid var(--line-dark);
}

.hero-modal-header h2 {
  margin: 0;
  color: #efe9db;
  font-size: 1.35rem;
}

.hero-modal-close {
  width: 38px;
  height: 38px;
  color: #17130d;
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border: 1px solid #ecd89b;
  border-radius: 3px;
  cursor: pointer;
}

.hero-modal-close:hover {
  filter: brightness(1.05);
}

.hero-modal-body {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.hero-modal-portrait {
  margin: 0;
  overflow: hidden;
  background: #101820;
  border: 1px solid #7d705d;
  border-radius: 3px;
}

.hero-modal-portrait img {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: cover;
  object-position: center top;
}

.hero-modal-summary {
  margin-bottom: 14px;
  padding: 14px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-modal-section {
  margin-bottom: 14px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-modal-section > h4 {
  margin: 0;
  padding: 10px 14px;
  color: #efe9db;
  font-size: 0.88rem;
  text-transform: uppercase;
  background: #1c2835;
  border-bottom: 1px solid var(--line-dark);
}

.hero-modal-section .hero-recommendation-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.hero-modal-section > .hero-empty {
  margin: 14px;
}

.modal-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-recommendation-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
  padding: 14px;
  background: #fff8e8;
  border: 1px solid #c8b37b;
  border-radius: 3px;
}

.hero-recommendation-panel h4 {
  margin: 0 0 8px;
  color: #1b2631;
  font-size: 1rem;
}

.hero-recommendation-panel p {
  margin-bottom: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.hero-recommendation-panel img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #0e1822;
  border: 1px solid #7d705d;
  border-radius: 3px;
}

.hero-recommendation-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.hero-recommendation-grid div {
  padding: 7px 8px;
  color: #1d2530;
  font-size: 0.82rem;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-recommendation-grid strong {
  display: block;
  color: var(--brown);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.source-list span {
  padding: 4px 7px;
  color: #233140;
  font-size: 0.72rem;
  font-weight: 800;
  background: #eee8dc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.link-card {
  display: block;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.link-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: #fffaf0;
  box-shadow: 0 10px 24px rgba(27, 36, 48, 0.12);
}

.role {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 8px;
  color: #f8f1df;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--blue-dark);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 2px;
}

ul {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding-left: 19px;
  color: var(--muted);
}

li::marker {
  color: var(--gold);
}

.systems article,
.guide article,
.article-grid article {
  padding: 17px;
}

.systems article {
  border-top: 4px solid var(--blue);
}

.systems article:nth-child(2) {
  border-top-color: var(--gold);
}

.systems article:nth-child(3) {
  border-top-color: var(--brown);
}

.systems article:nth-child(4) {
  border-top-color: #6d7b61;
}

.timeline {
  display: grid;
  gap: 10px;
  max-width: none;
  margin: 0;
}

.timeline article {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 15px;
  align-items: start;
  padding: 15px;
}

.timeline span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #f7efd9;
  font-size: 0.9rem;
  font-weight: 900;
  background: var(--blue-dark);
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 3px;
}

.empty-state {
  margin: 28px 24px 36px;
  padding: 17px;
  color: var(--ink);
  text-align: center;
  background: #fbf7ee;
  border: 1px dashed var(--gold);
  border-radius: 3px;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
  align-items: start;
}

.infobox {
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.infobox h2 {
  padding: 13px 15px;
  color: #f7efd9;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  background: var(--blue-dark);
  border-bottom: 1px solid var(--line);
}

.infobox dl {
  display: grid;
  grid-template-columns: 104px 1fr;
  margin: 0;
}

.infobox dt,
.infobox dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.infobox dt {
  color: var(--brown);
  font-weight: 800;
  background: var(--panel-strong);
}

.infobox dd {
  color: var(--ink);
}

.wiki-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbf7ee;
}

.wiki-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.wiki-table th,
.wiki-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.wiki-table th {
  color: #f7efd9;
  background: var(--blue-dark);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.wiki-table tbody tr:nth-child(even) {
  background: rgba(236, 230, 217, 0.62);
}

.wiki-table tbody tr:hover {
  background: #fff8e8;
}

.wiki-table tr:last-child td {
  border-bottom: 0;
}

.wiki-table td:first-child {
  color: #1b2631;
  font-weight: 800;
}

.strategy-note {
  margin: 0 0 18px;
  padding: 14px 16px;
  color: #2a2117;
  background: #fff8e8;
  border-left: 4px solid var(--brown);
  border-radius: 0 4px 4px 0;
}

.catalog-help {
  margin: -8px 0 18px;
  color: #44505d;
  font-size: 0.9rem;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.strategy-grid figure {
  margin: 0;
  overflow: hidden;
  background: #101820;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.strategy-grid figure:only-child {
  grid-column: 1 / -1;
}

.strategy-grid img {
  display: block;
  width: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #0b1118;
}

.strategy-grid figcaption {
  padding: 12px 14px;
  color: #efe4cd;
  font-size: 0.95rem;
  line-height: 1.45;
  background: #162333;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.wiki-button {
  min-height: 38px;
  padding: 9px 13px;
  color: #17130d;
  font-weight: 800;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border: 1px solid #8b682f;
  border-radius: 3px;
  cursor: pointer;
}

.wiki-button:hover {
  filter: brightness(1.04);
}

.wiki-button.secondary {
  color: #efe9db;
  background: #253746;
  border-color: #405869;
}

.formation-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.formation-guide article {
  padding: 16px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.formation-guide h3,
.formation-guide p {
  margin: 8px 0 0;
}

.formation-token,
.formation-position {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  color: #f9f4e8;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  border-radius: 3px;
}

.formation-token.front,
.formation-position.front {
  background: #74432f;
}

.formation-token.back,
.formation-position.back {
  background: #2f5574;
}

.formation-token.open {
  color: #2c251b;
  background: #e0d2b9;
}

.formation-toolbar,
.formation-card-header,
.formation-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.formation-toolbar {
  margin-bottom: 12px;
}

.formation-toolbar h2,
.formation-toolbar p,
.formation-card-header h3,
.formation-card-header p {
  margin: 0;
}

.formation-actions,
.formation-card-actions {
  flex-wrap: wrap;
}

.formation-list {
  display: grid;
  gap: 18px;
}

.formation-card {
  padding: 16px;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.formation-purpose {
  color: #51606d;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.formation-board {
  display: grid;
  gap: 14px;
  margin: 14px 0;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(29, 53, 71, 0.94), rgba(17, 29, 41, 0.96)),
    #172331;
  border: 1px solid #6e604f;
  border-radius: 4px;
}

.formation-row {
  display: grid;
  gap: 14px;
  align-items: stretch;
}

.formation-row-front {
  grid-template-columns: repeat(2, minmax(150px, 220px));
  justify-content: center;
}

.formation-row-back {
  grid-template-columns: repeat(3, minmax(130px, 190px));
  justify-content: center;
}

.formation-slot {
  position: relative;
  display: grid;
  min-height: 230px;
  overflow: hidden;
  background: #101820;
  border: 1px solid rgba(230, 202, 141, 0.6);
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.formation-slot:hover {
  border-color: var(--gold-light);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.22),
    0 0 0 3px rgba(210, 182, 111, 0.18);
}

.formation-slot:focus-visible {
  outline: 3px solid rgba(209, 178, 107, 0.68);
  outline-offset: 2px;
}

.formation-slot img {
  width: 100%;
  height: 100%;
  min-height: 230px;
  object-fit: cover;
}

.formation-slot.is-open {
  place-items: center;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.06) 10px,
      rgba(255, 255, 255, 0.02) 10px,
      rgba(255, 255, 255, 0.02) 20px
    ),
    #1a2836;
  border-style: dashed;
}

.formation-position {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.formation-empty {
  display: grid;
  gap: 5px;
  place-items: center;
  color: #d6c8ad;
  font-weight: 900;
  text-transform: uppercase;
}

.formation-empty span {
  color: #aeb9c3;
  font-size: 0.72rem;
}

.formation-hero-meta {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  color: #f8f0dc;
  background: rgba(10, 16, 23, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.formation-hero-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.formation-notes {
  padding: 12px 14px;
  color: #2f3a45;
  line-height: 1.55;
  background: #fff8e8;
  border-left: 4px solid var(--brown);
  border-radius: 0 4px 4px 0;
}

.formation-editor {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.formation-editor label {
  display: grid;
  gap: 6px;
  color: #2f3a45;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.formation-editor input,
.formation-editor select,
.formation-editor textarea {
  width: 100%;
  padding: 10px;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid #b9ab92;
  border-radius: 3px;
}

.formation-note-input {
  margin: 12px 0;
}

.formation-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 10, 16, 0.72);
  backdrop-filter: blur(8px);
}

.formation-modal {
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 18px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.formation-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.formation-modal-header h2,
.formation-modal-header p {
  margin: 0;
}

.hero-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}

.hero-picker-card {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 190px;
  padding: 7px;
  color: #17212c;
  text-align: left;
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.hero-picker-card:hover:not(:disabled),
.hero-picker-card.is-selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(169, 130, 61, 0.2);
}

.hero-picker-card:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.hero-picker-card img {
  width: 100%;
  height: 126px;
  object-fit: cover;
  background: #101820;
  border-radius: 3px;
}

.hero-picker-card span {
  min-height: 34px;
  color: #17212c;
  font-weight: 900;
  line-height: 1.15;
}

.hero-picker-card small.role-pill {
  width: fit-content;
  min-height: 22px;
  padding: 4px 7px;
  font-size: 0.68rem;
}

.hero-picker-card.is-open {
  place-content: center;
  min-height: 190px;
  text-align: center;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(29, 53, 71, 0.08),
      rgba(29, 53, 71, 0.08) 10px,
      rgba(29, 53, 71, 0.02) 10px,
      rgba(29, 53, 71, 0.02) 20px
    ),
    #f7f0e4;
}

.hero-picker-open {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  margin: 0 auto;
  color: #59462d;
  background: #e7dcc8;
  border: 1px dashed #9e8a68;
  border-radius: 50%;
}

.table-link {
  color: #244f70;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table-link:hover {
  color: var(--brown);
}

footer {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto 28px;
  padding: 18px 16px;
  text-align: center;
  background: var(--nav);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 0;
}

footer p {
  margin: 0;
  color: #c9c1b0;
  font-size: 0.92rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 840px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .nav-links {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .nav-links a {
    flex: 0 0 auto;
  }

  main,
  footer {
    width: min(100% - 18px, 1180px);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 240px;
    order: 2;
  }

  .hero-copy {
    order: 1;
  }

  .quick-stats,
  .priority-strip,
  .material-grid,
  .hero-filter-panel,
  .role-overview-grid,
  .formation-guide,
  .strategy-grid,
  .page-layout,
  .wiki-hero {
    grid-template-columns: 1fr;
  }

  .formation-toolbar,
  .formation-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .formation-row-front,
  .formation-row-back {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .app-icon {
    width: 150px;
  }

  .wiki-hero .app-icon {
    width: 78px;
    min-height: 78px;
  }

  .screenshot-slot {
    min-height: 420px;
  }

  .quick-stats article {
    padding-block: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quick-stats article:last-child {
    border-bottom: 0;
  }

  .hero-profile-top {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .hero-portrait,
  .hero-portrait.placeholder {
    min-height: 170px;
  }

  .hero-modal-body {
    grid-template-columns: 1fr;
  }

  .hero-recommendation-panel {
    grid-template-columns: 1fr;
  }

  .modal-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-modal-portrait img {
    max-height: 520px;
  }
}

@media (max-width: 520px) {
  .topbar,
  .hero,
  .section {
    padding-inline: 14px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .nav-links a {
    padding: 8px 9px;
    font-size: 0.84rem;
  }

  .ship {
    transform: translateX(-50%) scale(0.72);
  }

  .timeline article {
    grid-template-columns: 1fr;
  }

  .screenshot-slot {
    min-height: 330px;
  }

  .hero-profile-top,
  .skill-card {
    grid-template-columns: 1fr;
  }

  .formation-row-front,
  .formation-row-back {
    grid-template-columns: 1fr;
  }

  .formation-board {
    padding: 12px;
  }

  .formation-slot,
  .formation-slot img {
    min-height: 270px;
  }

  .hero-portrait,
  .hero-portrait.placeholder {
    min-height: 260px;
  }

  .hero-card-portrait,
  .hero-card-portrait img {
    height: auto;
    min-height: 210px;
  }

  .hero-modal-backdrop {
    padding: 10px;
  }

  .hero-modal-body {
    padding: 10px;
  }
}


.formation-advice {
  margin-top: 10px;
  padding: 12px 14px;
  color: #23303f;
  font-size: 0.9rem;
  line-height: 1.55;
  background: #fff7df;
  border: 1px solid #d7bc79;
  border-left: 4px solid #a87425;
  border-radius: 3px;
}

/* Responsive hardening for every wiki view. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

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

main,
footer,
.topbar,
.section,
.hero,
.info-card,
.material-card,
.formation-card,
.hero-profile-card,
.hero-modal,
.formation-modal {
  min-width: 0;
}

p,
li,
td,
th,
span,
strong,
h1,
h2,
h3,
h4,
.hero-card-body,
.hero-modal-summary,
.formation-notes,
.formation-advice {
  overflow-wrap: anywhere;
}

.nav-links {
  -webkit-overflow-scrolling: touch;
}

.wiki-table-wrap {
  max-width: 100%;
}

.wiki-table {
  min-width: 680px;
}

.hero-catalog-grid {
  justify-content: start;
}

.hero-filter-panel,
.formation-editor-grid,
.hero-picker-grid,
.card-grid,
.systems,
.guide,
.article-grid,
.priority-strip,
.material-grid,
.frame-grid,
.role-overview-grid {
  min-width: 0;
}

.hero-filter-panel input,
.hero-filter-panel select,
.formation-editor input,
.formation-editor select,
.formation-editor textarea,
.search-wrap input,
.wiki-hero .search-wrap input {
  min-width: 0;
}

.hero-modal-backdrop,
.formation-modal-backdrop {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hero-modal,
.formation-modal {
  max-height: calc(100dvh - 24px);
}

.hero-modal-body,
.hero-recommendation-panel,
.skill-card,
.formation-board,
.formation-row,
.formation-toolbar,
.formation-card-header,
.formation-card-actions,
.formation-actions {
  min-width: 0;
}

@media (max-width: 980px) {
  .topbar {
    position: sticky;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .brand {
    width: 100%;
  }

  .nav-links {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 0 6px;
    scroll-snap-type: x proximity;
  }

  .nav-links a {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  main,
  footer {
    width: calc(100% - 16px);
    margin-top: 12px;
  }

  .hero,
  .wiki-hero {
    grid-template-columns: 1fr;
  }

  .wiki-hero {
    align-items: start;
  }

  .wiki-hero .app-icon {
    width: 92px;
    min-height: 92px;
  }

  .quick-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .formation-row-front {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .formation-row-back {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .formation-slot {
    min-height: 220px;
  }

  .formation-slot img {
    min-height: 220px;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }

  .topbar {
    padding: 10px 12px;
  }

  .brand {
    font-size: 0.98rem;
  }

  main,
  footer {
    width: 100%;
    margin-top: 0;
    border-inline: 0;
  }

  .hero,
  .section {
    padding: 16px;
  }

  .wiki-hero {
    padding: 14px;
  }

  .wiki-hero h1,
  .hero-copy h1,
  .section-heading h2 {
    font-size: 2rem;
    line-height: 1.08;
  }

  .page-header {
    padding-bottom: 16px;
  }

  .hero-copy > p:not(.eyebrow),
  .wiki-hero .hero-copy > p:not(.eyebrow) {
    max-width: 100%;
  }

  .status-row,
  .formation-actions,
  .formation-card-actions {
    gap: 6px;
  }

  .status-badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
  }

  .quick-stats,
  .priority-strip,
  .card-grid,
  .systems,
  .guide,
  .article-grid,
  .material-grid,
  .role-overview-grid,
  .formation-guide,
  .strategy-grid,
  .page-layout,
  .frame-grid {
    grid-template-columns: 1fr;
  }

  .quick-stats article {
    border-right: 0;
  }

  .hero-filter-panel {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .hero-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .hero-card-body {
    padding: 12px;
  }

  .hero-card-body h3 {
    font-size: 1.08rem;
  }

  .hero-card-portrait,
  .hero-card-portrait img {
    min-height: 190px;
  }

  .hero-modal-backdrop,
  .formation-modal-backdrop {
    align-items: start;
    padding: 8px;
  }

  .hero-modal,
  .formation-modal {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 4px;
  }

  .hero-modal-header,
  .formation-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .hero-modal-body,
  .skill-card,
  .hero-recommendation-panel {
    grid-template-columns: 1fr;
  }

  .modal-stat-grid,
  .hero-stat-grid {
    grid-template-columns: 1fr;
  }

  .hero-modal-portrait img {
    max-height: 360px;
  }

  .hero-recommendation-panel img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
  }

  .formation-toolbar,
  .formation-card-header,
  .formation-card-actions,
  .formation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .formation-actions .wiki-button,
  .formation-card-actions .wiki-button {
    width: 100%;
    justify-content: center;
  }

  .formation-board {
    padding: 12px;
  }

  .formation-row-front,
  .formation-row-back {
    grid-template-columns: 1fr;
  }

  .formation-slot,
  .formation-slot img {
    min-height: 250px;
  }

  .hero-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .topbar {
    padding-inline: 10px;
  }

  .brand span:last-child {
    white-space: normal;
  }

  .nav-links a {
    padding: 8px;
    font-size: 0.8rem;
  }

  .hero,
  .section,
  .wiki-hero {
    padding-inline: 12px;
  }

  .wiki-hero h1,
  .hero-copy h1,
  .section-heading h2 {
    font-size: 1.72rem;
  }

  .wiki-hero .app-icon {
    width: 76px;
    min-height: 76px;
  }

  .search-wrap input,
  .wiki-hero .search-wrap input {
    width: 100%;
  }

  .hero-catalog-grid {
    grid-template-columns: 1fr;
  }

  .hero-card-portrait,
  .hero-card-portrait img {
    min-height: 240px;
  }

  .material-card img,
  .screenshot-slot {
    max-height: 520px;
  }

  .wiki-table {
    min-width: 560px;
  }

  .hero-picker-grid {
    grid-template-columns: 1fr;
  }
}
