:root {
  --wf-bg: #0a0a0a;
  --wf-box-bg: rgba(48, 48, 48, 0.44);
  --wf-border: #818181;
  --wf-border-subtle: #555555;
  --wf-slot-bg: #505050;
  --wf-slot-empty: rgba(48, 48, 48, 0.25);
  --wf-gold: #ddaf7a;
  --wf-gold-rgb: 221, 175, 122;
  --wf-gold-accent: #ddaf7aa6;
  --wf-gold-hover: #ddaf7ada;
  --wf-gold-bright: #ffcb8a;
  --wf-gray-btn: #646464;
  --wf-gray-btn-hover: #7a7a7a;
  --wf-text: #ededed;
  --wf-text-muted: #9ca3af;
  --wf-overlay-dark: rgba(22, 19, 15, 0.7);
  --wf-modal-bg: rgba(20, 18, 16, 0.95);
  /* Bestiary affinity ledger: bone = the enemy is hardened, ember = the opening you exploit.
     Deliberately not the danger red (reset actions, imposed omens) and not the app gold. */
  --wf-resist: #cbc3b2;
  --wf-resist-bright: #eee7d8;
  --wf-vulnerable: #e8834f;
  --wf-vulnerable-bright: #ffb98f;
  --wf-font: Arial, Helvetica, sans-serif;
}

[x-cloak] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: scroll;
}

body {
  background-color: var(--wf-bg);
  background-image: url('/images/wf-bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--wf-text);
  font-family: var(--wf-font);
  min-height: 100vh;
  padding-top: 3.5rem;
  display: flex;
  flex-direction: column;
}

main.container {
  flex: 1 0 auto;
}

/* Texture overlay effect */
.texture-box {
  position: relative;
  background: var(--wf-box-bg);
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  overflow: hidden;
}
.texture-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('/images/texture-transparent.webp');
  background-size: cover;
  opacity: 0.20;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

.texture-box > * {
  position: relative;
  z-index: 1;
}

.container {
  width: 100%;
  max-width: 1536px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem 1rem;
  position: relative;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 2rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: 6rem;
    padding-right: 6rem;
  }
}

/* Fixed Header & Navbar */
.navbar-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0.5rem 1.5rem;
  background-color: rgba(26, 26, 26, 0.733);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(129, 129, 129, 0.2);
  transition: background-color 0.15s ease-in-out;
}

.navbar-fixed.sidebar-open {
  background-color: #1a1a1a;
}

.navbar-container {
  width: 100%;
  max-width: 1536px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  z-index: 51;
}

.burger-bar {
  display: block;
  width: 1.5rem;
  height: 2px;
  background-color: #ffffff;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  transform-origin: center;
}

.burger-bar.bar-top-open {
  transform: translateY(7.5px) rotate(45deg);
}

.burger-bar.bar-mid-open {
  opacity: 0;
}

.burger-bar.bar-bot-open {
  transform: translateY(-7.5px) rotate(-45deg);
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 16rem;
  background: #1a1a1a;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}
.sidebar-drawer.translate-x-0 {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 30;
}

.sidebar-link {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: 0.375rem;
  color: #f3f4f6;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar-link:hover {
  background: var(--wf-gold-accent);
  color: #ffffff;
}
.sidebar-link.active {
  background: var(--wf-gold-accent);
  color: #ffffff;
}

/* Page Logo */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}
.page-logo {
  max-width: 360px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Buttons */
.btn-gray {
  background: var(--wf-gray-btn);
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-gray:hover {
  background: var(--wf-gray-btn-hover);
}
.btn-gray.btn-danger:hover {
  background: #dc2626;
}
.btn-gray.btn-active {
  background: var(--wf-gold-accent);
}

.btn-generate {
  background: var(--wf-gold-accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-generate:hover {
  background: var(--wf-gold-hover);
}
.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Slot Stagger Indices for Wave Animation */
#slot-primaryWeapon   { --slot-index: 0; }
#slot-secondaryWeapon { --slot-index: 1; }
#slot-demonicWeapon   { --slot-index: 2; }
#slot-meleeWeapon     { --slot-index: 3; }
#slot-relic           { --slot-index: 4; }
#slot-fetish          { --slot-index: 5; }
#slot-ring            { --slot-index: 6; }
#slot-lightSpell      { --slot-index: 7; }
#slot-heavySpell      { --slot-index: 8; }
#slot-bead1           { --slot-index: 9; }
#slot-bead2           { --slot-index: 10; }
#slot-bead3           { --slot-index: 11; }
#slot-bead4           { --slot-index: 12; }
#slot-bead5           { --slot-index: 13; }

/* Animations */
@keyframes glow-pulse {
  0% { 
    border-color: #ddaf7a40;
    box-shadow: 0 0 0 0 rgba(221, 175, 122, 0.1);
  }
  80% { 
    border-color: #ffcb8aff; 
    box-shadow: 0 0 20px 4px rgba(255, 203, 138, 0.7);
  }
  100% {
    border-color: #ddaf7a40;
    box-shadow: 0 0 0 0 rgba(221, 175, 122, 0.1);
  }
}

/* GPU-accelerated opacity animations */
@keyframes white-fill-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes white-fill-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Volatile occult energy charging shake */
@keyframes slot-charge-shake {
  0%, 25% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  30% { transform: translate3d(-0.35px, 0.3px, 0) rotate(-0.08deg); }
  38% { transform: translate3d(0.4px, -0.3px, 0) rotate(0.08deg); }
  46% { transform: translate3d(-0.55px, -0.4px, 0) rotate(-0.12deg); }
  54% { transform: translate3d(0.6px, 0.4px, 0) rotate(0.12deg); }
  62% { transform: translate3d(-0.75px, 0.55px, 0) rotate(-0.18deg); }
  70% { transform: translate3d(0.85px, -0.6px, 0) rotate(0.2deg); }
  78% { transform: translate3d(-0.95px, -0.65px, 0) rotate(-0.22deg); }
  85% { transform: translate3d(1.05px, 0.7px, 0) rotate(0.25deg); }
  92% { transform: translate3d(-1.1px, 0.75px, 0) rotate(-0.26deg); }
  96% { transform: translate3d(1.15px, -0.8px, 0) rotate(0.27deg); }
  100% {
    transform: translate3d(-1.05px, 0.7px, 0) rotate(-0.25deg);
  }
}

/* Sustained peak energy hum for cards waiting their turn in the reveal wave */
@keyframes slot-peak-shake {
  0% { transform: translate3d(-1.05px, 0.7px, 0) rotate(-0.25deg); }
  25% { transform: translate3d(1.15px, -0.8px, 0) rotate(0.27deg); }
  50% { transform: translate3d(-1.1px, 0.75px, 0) rotate(-0.26deg); }
  75% { transform: translate3d(1.05px, 0.7px, 0) rotate(0.25deg); }
  100% { transform: translate3d(-1.05px, 0.7px, 0) rotate(-0.25deg); }
}

/* Snappy release pop when the veil breaks */
@keyframes slot-reveal-pop {
  0% {
    transform: scale(0.98) translate3d(0, 0, 0) rotate(0deg);
  }
  35% {
    transform: scale(1.026) translate3d(0, -0.75px, 0) rotate(0deg);
  }
  70% {
    transform: scale(0.996) translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    transform: scale(1) translate3d(0, 0, 0) rotate(0deg);
  }
}

.animate-glow-pulse {
  animation: glow-pulse 1.3s ease-in-out infinite, slot-charge-shake 1.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
  transition: none;
  will-change: box-shadow, border-color, transform;
}
.shadow-glow {
  box-shadow: 0 0 10px 2px rgba(221, 175, 122, 0.4);
}
.white-fill-in {
  animation: white-fill-in 850ms cubic-bezier(0.4, 0, 0.2, 1) both;
}
.white-fill-out {
  animation: white-fill-out 300ms ease-out both;
  animation-delay: calc(var(--slot-index, 0) * 50ms);
}

/* Golden glow dissipate animation for graceful reveal finish */
@keyframes glow-dissipate {
  0% {
    border-color: #ffcb8aff;
    box-shadow: 0 0 20px 4px rgba(255, 203, 138, 0.7), 0 0 10px 2px rgba(221, 175, 122, 0.4);
  }
  40% {
    border-color: #ffcb8aff;
    box-shadow: 0 0 18px 4px rgba(255, 203, 138, 0.6), 0 0 8px 2px rgba(221, 175, 122, 0.35);
  }
  100% {
    border-color: var(--wf-border);
    box-shadow: 0 0 0 0 rgba(221, 175, 122, 0);
  }
}

.slot-box.glow-dissipating {
  animation: 
    glow-dissipate 300ms cubic-bezier(0.25, 1, 0.5, 1) calc(var(--slot-index, 0) * 50ms) both,
    slot-peak-shake 80ms linear infinite,
    slot-reveal-pop 300ms cubic-bezier(0.2, 0.9, 0.3, 1) calc(var(--slot-index, 0) * 50ms) forwards;
  transition: none;
  will-change: box-shadow, border-color, transform;
  z-index: 5;
}

.slot-white-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 0.5rem;
  pointer-events: none;
  z-index: 15;
  background: radial-gradient(ellipse at center, #ffffff 0%, #ffffff 68%, rgba(248, 244, 236, 0.97) 88%, rgba(235, 222, 200, 0.92) 100%);
  box-shadow: inset 0 0 10px rgba(255, 220, 175, 0.35);
  opacity: 0;
  will-change: opacity;
}

.slot-box.locked.animate-glow-pulse,
.slot-box.locked.glow-dissipating {
  animation: none !important;
  box-shadow: none !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .animate-glow-pulse,
  .slot-box.glow-dissipating {
    animation: none !important;
  }
  .white-fill-in,
  .white-fill-out {
    animation: none !important;
  }
}

/* Slots Layout */
.slots-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.slot-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 136px;
  height: 136px;
  border-radius: 0.5rem;
  border: 1px solid var(--wf-border);
  background-color: var(--wf-slot-bg);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  overflow: hidden;
}

.slot-box.empty {
  background-color: var(--wf-slot-empty);
  border: 1px solid var(--wf-border);
}

.slot-box:hover:not(.locked) {
  border-color: var(--wf-gold-accent);
}

.slot-box.locked {
  border: 2px solid #7f1d1d;
}
.slot-box.locked:hover {
  border-color: #991b1b;
}

.slot-icon-area {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.5rem;
}

.slot-icon-square {
  position: relative;
  width: 86px;
  height: 86px;
  background-color: #000;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slot-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slot-name-label {
  font-size: 0.75rem;
  text-align: center;
  padding: 0 0.25rem;
  margin-top: auto;
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.slot-name-label.locked-text,
.slot-box.locked .slot-name-label {
  color: #b91c1c !important;
  font-weight: 600;
}

.slot-info-btn {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--wf-gold);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s;
}
.slot-info-btn:hover {
  background: #e9b87e;
}

.slot-element-dot {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 9999px;
  z-index: 5;
}

/* Hover Popup */
.item-card-popup {
  width: 22rem;
  background-color: #1A1A1A;
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.85);
}

.item-card-popup.floating-popup {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  transition: opacity 0.1s ease-out;
}

/* Active elements indicator */
.active-elements-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.active-element-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
}

.active-element-pill.active {
  background: #646464;
  color: #ffffff;
}

.active-element-pill.inactive {
  background: rgba(48, 48, 48, 0.44);
  color: #9ca3af;
  opacity: 0.5;
}

.dot-indicator {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
}

.element-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.element-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* Stat Requirements Table */
.bead-requirements-box {
  background-color: #2a2a2a;
  border: 1px solid #555;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
  width: 100%;
}

.requirements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.requirement-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background-color: #1a1a1a;
  border: 1px solid #444;
  border-radius: 0.375rem;
}

.requirement-badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Stat requirement & utility badge colors */
.bg-green-900 {
  background-color: #14532d !important;
}

.text-green-200 {
  color: #bbf7d0 !important;
}

.bg-red-900 {
  background-color: #7f1d1d !important;
}

.text-red-200 {
  color: #fecaca !important;
}

.text-gray-500 {
  color: #6b7280;
}

.text-white {
  color: #ffffff;
}

.bg-green-600 {
  background-color: #16a34a !important;
}

/* Element Preferences Box */
.element-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.element-pref-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: 1px solid #374151;
  background-color: rgba(48, 48, 48, 0.44);
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
}

.element-pref-btn:hover {
  background-color: #646464;
  border-color: var(--wf-gold-accent);
}

.element-pref-btn.selected {
  background-color: #505050;
  border-color: var(--wf-gold-accent);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(221, 175, 122, 0.4);
}

/* Toggle Switch */
.switch-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  position: relative;
  z-index: 1;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.5rem;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #4b5563;
  border-radius: 9999px;
  transition: 0.2s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 1.25rem;
  width: 1.25rem;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}
input:checked + .slider {
  background-color: var(--wf-gold-accent);
}
input:checked + .slider:before {
  transform: translateX(1.25rem);
}

/* Exclude Items Section */
.exclude-section {
  position: relative;
  background-color: #292929;
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  overflow: hidden;
  margin-bottom: 2rem;
}

.exclude-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.exclude-tabs {
  display: flex;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #444;
  gap: 0.25rem;
}

.exclude-tab-btn {
  padding: 0.5rem 1rem;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
}
.exclude-tab-btn:hover {
  color: #ffffff;
}
.exclude-tab-btn.active {
  color: #ffffff;
  border-bottom: 2px solid var(--wf-gold-accent);
}

.exclude-search-box {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin-bottom: 1.25rem;
}
.exclude-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  background-color: rgba(48, 48, 48, 0.44);
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
}
.exclude-search-input:focus {
  border-color: var(--wf-gold-accent);
}

.exclude-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  position: relative;
  margin-top: 0.5rem;
}
@media (min-width: 640px) {
  .exclude-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .exclude-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1024px) {
  .exclude-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.exclude-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  background-color: #303030;
  border: 1px solid var(--wf-border);
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
  user-select: none;
}
.exclude-card:hover {
  background-color: #474747;
  border-color: var(--wf-gold-accent);
}
.exclude-card.excluded {
  opacity: 0.5;
  background-color: rgba(48, 48, 48, 0.25);
  border-color: var(--wf-border);
}
.exclude-card.excluded:hover {
  border-color: var(--wf-gold-accent);
}

.exclude-card-icon-box {
  width: 4rem;
  height: 4rem;
  margin-bottom: 0.5rem;
  background-color: #000;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.exclude-card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.375rem;
}
.exclude-card-name {
  font-size: 0.75rem;
  text-align: center;
  color: #ededed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.exclude-card.excluded .exclude-card-name {
  color: #9ca3af;
}

.exclude-info-btn {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background-color: var(--wf-gold);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.15s;
}
.exclude-info-btn:hover {
  background-color: #e9b87e;
}

.exclude-element-dot {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  z-index: 5;
}

/* Wiki Page Full-Width Cards */
.wiki-filter-box {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.search-input-wrapper {
  position: relative;
  margin-bottom: 1.25rem;
}

.wiki-search-input {
  width: 100%;
  padding: 0.55rem 2.25rem 0.55rem 0.85rem;
  background-color: rgba(48, 48, 48, 0.44);
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}
.wiki-search-input:focus {
  border-color: var(--wf-gold-accent);
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--wf-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.15s;
}
.search-clear-btn:hover {
  color: #ffffff;
}

.wiki-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.results-counter {
  font-size: 0.95rem;
  color: #ffffff;
  font-weight: 500;
}

.filter-reset-btn {
  font-size: 0.8rem;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  padding: 0.3rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.filter-reset-btn:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
}

.filter-section-title {
  font-size: 1rem;
  color: #fff;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.filter-secondary-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--wf-border);
}

.filter-secondary-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-secondary-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--wf-text-muted);
}

/* The one dropdown style for every wiki page. Replaces the three ad-hoc class names
   (custom-select, wiki-sort-select) that had no rules at all, plus Arcana's inline style. */
.wiki-select {
  -webkit-appearance: none;
  appearance: none;
  background-color: #201d19;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23ddaf7a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.7rem;
  color: #e5e7eb;
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  padding: 0.45rem 2rem 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 13rem;
  max-width: 22rem;
}

.wiki-select:hover {
  border-color: rgba(var(--wf-gold-rgb), 0.45);
}

.wiki-select:focus {
  outline: none;
  border-color: var(--wf-gold);
  box-shadow: 0 0 0 2px rgba(var(--wf-gold-rgb), 0.18);
}

.wiki-select optgroup {
  background: #17140f;
  color: var(--wf-gold);
  font-style: normal;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wiki-select option {
  background: #201d19;
  color: #e5e7eb;
}

.filter-pill-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  background-color: var(--wf-gray-btn);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.filter-pill-btn:hover {
  background-color: var(--wf-gold-accent);
}
.filter-pill-btn.active {
  background-color: var(--wf-gold-accent);
}

.wiki-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.wiki-item-card {
  display: grid;
  grid-template-columns: 210px 1fr;
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wiki-item-card:hover {
  border-color: rgba(var(--wf-gold-rgb), 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.wiki-item-portrait-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 1.1rem;
  background: radial-gradient(ellipse 70% 55% at 50% 50%,
    rgba(var(--wf-gold-rgb), 0.14) 0%,
    rgba(var(--wf-gold-rgb), 0.04) 45%,
    rgba(0, 0, 0, 0.55) 100%);
  border-right: 1px solid var(--wf-border-subtle);
}

.wiki-item-portrait-plate img {
  max-width: 90%;
  max-height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
  transition: transform 0.2s ease;
}

.wiki-item-card:hover .wiki-item-portrait-plate img {
  transform: scale(1.03);
}

.wiki-item-dossier {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.35rem;
  min-width: 0;
  gap: 0.85rem;
}

.wiki-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.wiki-item-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.wiki-item-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.equipment-category-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  background: rgba(var(--wf-gold-rgb), 0.12);
  border: 1px solid rgba(var(--wf-gold-rgb), 0.35);
  color: var(--wf-gold);
  border-radius: 0.25rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.equipment-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem 1.25rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.equipment-stat {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.equipment-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-gold);
}

.equipment-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f3f4f6;
}

.equipment-desc {
  font-size: 0.92rem;
  color: #d1d5db;
  line-height: 1.5;
  margin: 0;
}

.equipment-attr-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.equipment-attr-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-gold);
}

.equipment-attr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.equipment-chip {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--wf-border-subtle);
  color: #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  font-weight: 600;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.wiki-mysterium-section {
  position: relative;
  z-index: 1;
}

.wiki-mysterium-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.wiki-mysterium-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wiki-mysterium-level-box {
  border: 1px solid var(--wf-border-subtle);
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.wiki-mysterium-level-header {
  padding: 0.45rem 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: #e5e7eb;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.wiki-mysterium-level-header:hover {
  background: rgba(var(--wf-gold-rgb), 0.1);
  color: #ffffff;
}

.wiki-mysterium-level-body {
  padding: 0.75rem 1rem 0.85rem 1.15rem;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--wf-border-subtle);
  font-size: 0.9rem;
}

.wiki-mysterium-original-content {
  border-left: 2px solid var(--wf-border);
  padding-left: 1rem;
}

.wiki-mysterium-content-block {
  margin-bottom: 0.55rem;
}

.wiki-mysterium-content-block:last-child {
  margin-bottom: 0;
}

.wiki-mysterium-content-label {
  color: var(--wf-gold);
  font-size: 0.85rem;
  font-weight: 700;
  display: block;
}

.wiki-mysterium-content-text {
  color: #d1d5db;
  font-size: 0.92rem;
  margin: 0.2rem 0 0 0;
  line-height: 1.5;
}

.wiki-mysterium-content-list {
  padding-left: 1.25rem;
  color: #d1d5db;
  font-size: 0.92rem;
  margin: 0.2rem 0 0 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .wiki-item-card {
    grid-template-columns: 1fr;
  }

  .wiki-item-portrait-plate {
    min-height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--wf-border-subtle);
  }

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

/* Item Detail Modal */
.detail-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}
.detail-modal-box {
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  background: var(--wf-modal-bg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
}

/* The catalog modals need more room than the randomizer's detail modal. */
.detail-modal-box.wiki-modal-box {
  max-width: 620px;
}

/* Stack equipment cards inside the detail modal */
.detail-modal-box .wiki-item-card {
  grid-template-columns: 1fr;
}

.detail-modal-box .wiki-item-portrait-plate {
  min-height: 160px;
  border-right: none;
  border-bottom: 1px solid var(--wf-border-subtle);
}

.detail-modal-box .equipment-stat-grid {
  grid-template-columns: repeat(2, 1fr);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(22, 19, 15, 0.85);
  border: 1px solid var(--wf-border);
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  z-index: 30;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.modal-close-btn:hover {
  color: var(--wf-gold);
  border-color: var(--wf-gold);
  background: rgba(45, 38, 28, 0.95);
  transform: scale(1.08);
}

/* Site Footer */
.site-footer {
  background-color: rgba(26, 26, 26, 0.733);
  border-top: 1px solid var(--wf-border-subtle);
  color: var(--wf-text-muted);
  padding: 1.25rem 1rem;
  margin-top: 3rem;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.6;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.footer-links a {
  color: var(--wf-gold);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--wf-gold-bright);
  text-decoration: underline;
}

.footer-separator {
  color: var(--wf-border);
}

/* ==========================================================================
   Wiki Sub-Navigation Tabs (same underline-tab idiom as the exclude tabs)
   ========================================================================== */
.wiki-subnav-container {
  margin-bottom: 1.5rem;
}

.wiki-subnav-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--wf-border-subtle);
}

.wiki-tab-link {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  color: #d1d5db;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.wiki-tab-link:hover {
  color: #ffffff;
}

.wiki-tab-link.active {
  color: #ffffff;
  border-bottom-color: var(--wf-gold-accent);
}

/* Shared helper for interactive catalog cards */
.is-clickable {
  cursor: pointer;
}

/* ==========================================================================
   Arcana & Prophecies Styling (Clean typography, tarot cards, dark-fantasy)
   ========================================================================== */
.arcana-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.arcana-card {
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.arcana-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--wf-gold-rgb), 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.arcana-card-header {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.arcana-icon-box {
  width: 3.25rem;
  height: 3.25rem;
  background: #000;
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  padding: 0.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arcana-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.arcana-card-title,
.enemy-card-title,
.prophecy-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.25;
}

.arcana-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.arcana-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  border-radius: 0.25rem;
  color: #d1d5db;
  font-weight: 500;
}

.arcana-desc {
  color: #d1d5db;
  font-size: 0.875rem;
  line-height: 1.45;
  margin: 0 0 0.75rem 0;
}

.arcana-effect-tier {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  border-radius: 0.35rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}

.tier-label {
  color: var(--wf-gold);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.tier-value {
  color: #f3f4f6;
  font-weight: 500;
}

/* Prophecies & Omens Grid */
.prophecy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.prophecy-card {
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.prophecy-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.prophecy-icon-box {
  width: 3.5rem;
  height: 3.5rem;
  background: #000;
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  padding: 0.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prophecy-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.omen-warning-box {
  background: rgba(127, 29, 29, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-top: 0.75rem;
}

/* ==========================================================================
   Bestiary Styling (Clean typography, vulnerability indicators, no emojis)
   ========================================================================== */
.bestiary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .bestiary-grid {
    grid-template-columns: 1fr;
  }
}

.enemy-card-dossier {
  display: flex;
  flex-direction: column;
  padding: 1.05rem 1.15rem;
  min-width: 0;
}

.enemy-stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.75rem;
  margin-bottom: 0.9rem;
}

.enemy-stat {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.enemy-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-gold);
}

.enemy-stat-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f3f4f6;
}

/* Affinity ledger: weaknesses first, then resistances. Bar length and fill opacity both
   encode magnitude, so a +100% resistance reads heavier than a +5% one. */
.enemy-affinity-ledger {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  gap: 0.5rem 0.6rem;
  align-items: start;
  margin-bottom: 0.9rem;
}

.enemy-affinity-label {
  padding-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-resist);
}

.enemy-affinity-label.is-vulnerable {
  color: var(--wf-vulnerable);
}

.enemy-affinity-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.32rem 1.1rem;
}

.enemy-affinity-entry {
  display: grid;
  grid-template-columns: 3.9rem 1fr 3rem;
  align-items: center;
  gap: 0.45rem 0.5rem;
}

.enemy-affinity-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #d1d5db;
  white-space: nowrap;
}

.enemy-affinity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 6px;
}

.enemy-affinity-track {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.enemy-affinity-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 2px;
  background: var(--wf-resist);
}

.enemy-affinity-fill.is-vulnerable {
  background: var(--wf-vulnerable);
}

.enemy-affinity-value {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--wf-resist-bright);
}

.enemy-affinity-entry.is-vulnerable .enemy-affinity-value {
  color: var(--wf-vulnerable-bright);
}

.enemy-affinity-none {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--wf-text-muted);
}

.enemy-locations-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--wf-border-subtle);
}

.enemy-locations-label {
  flex: 0 0 4.75rem;
  padding-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-gold);
}

.location-chip-more {
  color: var(--wf-gold);
  border-color: rgba(var(--wf-gold-rgb), 0.35);
}

/* The overflow chip is a button: it reveals the locations the card has not shown yet.
   Must be more specific than .location-chip, which is defined later in this file. */
button.location-chip-more {
  font-family: inherit;
  cursor: pointer;
  color: var(--wf-gold);
  border-color: rgba(var(--wf-gold-rgb), 0.45);
  border-style: dashed;
  background: rgba(0, 0, 0, 0.35);
}

button.location-chip-more:hover {
  background: rgba(var(--wf-gold-rgb), 0.16);
}

.enemy-card {
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: 168px 1fr;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.enemy-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--wf-gold-rgb), 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.enemy-card-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  padding: 0.75rem;
  background: radial-gradient(ellipse 70% 55% at 50% 42%,
    rgba(var(--wf-gold-rgb), 0.14) 0%,
    rgba(var(--wf-gold-rgb), 0.04) 45%,
    rgba(0, 0, 0, 0.55) 100%);
  border-right: 1px solid var(--wf-border-subtle);
}

.enemy-card-portrait img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.65));
}

/* Narrow screens: stack the portrait above the dossier instead of squeezing both.
   Must come after the base .enemy-card rule or source order wins over the media query. */
@media (max-width: 560px) {
  .enemy-card {
    grid-template-columns: 1fr;
  }

  .enemy-card-portrait {
    min-height: 150px;
    border-right: none;
    border-bottom: 1px solid var(--wf-border-subtle);
  }

  .enemy-card-portrait img {
    max-height: 130px;
  }
}

.enemy-card-header {
  margin-bottom: 0.8rem;
}

.enemy-card-heading {
  flex-grow: 1;
  min-width: 0;
}

.enemy-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

/* Rank owns the card's top-right badge slot: the one chrome badge on the card. */
.enemy-rank-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.22rem 0.6rem;
  flex-shrink: 0;
  white-space: nowrap;
  background: rgba(var(--wf-gold-rgb), 0.12);
  border: 1px solid rgba(var(--wf-gold-rgb), 0.38);
  color: var(--wf-gold);
  border-radius: 0.25rem;
}

/* Alternate forms: labelled, so the chips cannot be mistaken for a second rank. */
.enemy-forms-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.enemy-forms-label {
  flex: 0 0 4.75rem;
  padding-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wf-gold);
}

.enemy-forms-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.enemy-form-chip {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.55rem;
  border-radius: 0.25rem;
  color: var(--wf-resist-bright);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(203, 195, 178, 0.35);
}

.rank-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  color: #d1d5db;
  border-radius: 0.25rem;
  font-weight: 500;
}

.health-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  color: #d1d5db;
  border-radius: 0.25rem;
}

/* ==========================================================================
   Wiki Modal Styling (Arcana & Bestiary - Dark Fantasy Aesthetic, No Emojis)
   ========================================================================== */
.wiki-modal-container {
  padding: 1.5rem;
  position: relative;
}

.wiki-modal-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--wf-border);
  padding-right: 2.25rem; /* clearance for modal-close-btn */
}

.wiki-modal-header-info {
  flex-grow: 1;
  min-width: 0;
}

.wiki-modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.wiki-modal-title {
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

/* Sections are separated by a single hairline, like .wiki-desc-section. */
.wiki-modal-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--wf-border);
}

.wiki-modal-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.wiki-modal-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.5rem 0;
}

/* Quoted lore / overview text: one shared note treatment. */
.wiki-note-box {
  border-left: 2px solid var(--wf-border);
  padding-left: 0.85rem;
  font-size: 0.95rem;
  color: #d1d5db;
}

/* Arcana Modal Specifics */
.arcana-modal-icon-frame {
  width: 5.5rem;
  height: 5.5rem;
  background: #000;
  border: 1px solid var(--wf-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arcana-modal-icon-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.7));
}

.arcana-modal-icon-fallback {
  font-size: 2.25rem;
  color: var(--wf-gold);
}

.arcana-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.arcana-lore-text {
  color: #f3f4f6;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
  font-style: italic;
}

.arcana-scaling-effect {
  font-size: 1rem;
  font-weight: 600;
  color: var(--wf-gold-bright);
}

/* Enemy Modal Specifics */
.enemy-modal-portrait-frame {
  width: 5.5rem;
  height: 5.5rem;
  background: #000;
  border: 1px solid rgba(var(--wf-gold-rgb), 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  border-radius: 0.5rem;
  padding: 0.2rem;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.enemy-modal-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.375rem;
}

.enemy-modal-portrait-fallback {
  font-size: 2.25rem;
  color: var(--wf-gold);
}

.enemy-modal-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.variant-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: rgba(var(--wf-gold-rgb), 0.12);
  border: 1px solid rgba(var(--wf-gold-rgb), 0.35);
  color: var(--wf-gold);
  border-radius: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.enemy-modal-combat-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.enemy-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem;
  border-radius: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  color: #d1d5db;
}

.enemy-stat-chip.health-chip {
  color: #fff;
}

.enemy-stat-chip.attack-chip {
  color: var(--wf-gold-bright);
}

.stat-chip-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.stat-chip-value {
  font-weight: 700;
}

.enemy-overview-text {
  color: #e5e7eb;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.resistance-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.res-card {
  border-radius: 0.375rem;
  padding: 0.55rem 0.4rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.res-card-name {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.15rem;
}

.res-card-value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: #e5e7eb;
}

.res-card-status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Vulnerable state (weakness - muted coral) */
.res-card.res-vulnerable {
  border-color: rgba(248, 113, 113, 0.4);
}
.res-card.res-vulnerable .res-card-name {
  color: #fca5a5;
}
.res-card.res-vulnerable .res-card-value {
  color: #f87171;
}
.res-card.res-vulnerable .res-card-status {
  color: #f87171;
}

/* Resistant state (shielded - muted slate) */
.res-card.res-resistant {
  border-color: rgba(148, 163, 184, 0.4);
}
.res-card.res-resistant .res-card-name {
  color: #cbd5e1;
}
.res-card.res-resistant .res-card-value {
  color: #94a3b8;
}
.res-card.res-resistant .res-card-status {
  color: #94a3b8;
}

/* Neutral state (muted gray) */
.res-card.res-neutral {
  border-color: var(--wf-border-subtle);
}
.res-card.res-neutral .res-card-name {
  color: #6b7280;
}
.res-card.res-neutral .res-card-value {
  color: #9ca3af;
}
.res-card.res-neutral .res-card-status {
  color: #6b7280;
}

.physical-res-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.physical-res-pill {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.physical-res-label {
  font-size: 0.78rem;
  color: #9ca3af;
  font-weight: 500;
}

.physical-res-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e5e7eb;
}

.locations-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.location-chip {
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--wf-border-subtle);
  color: #d1d5db;
  padding: 0.25rem 0.55rem;
  border-radius: 0.25rem;
}
