.gc-equip-anim {
  animation: gc-equip-flash 0.5s cubic-bezier(.2,.8,.2,1);
}

@keyframes gc-equip-flash {
  0% {
    box-shadow: 0 0 0 0 #7fff7f, 0 0 24px var(--tier-glow);
    transform: scale(1.08);
    border-color: #7fff7f;
  }
  60% {
    box-shadow: 0 0 16px 8px #7fff7f, 0 0 32px var(--tier-glow);
    transform: scale(1.04);
    border-color: #7fff7f;
  }
  100% {
    box-shadow: 0 0 0 0 #7fff7f, 0 0 24px var(--tier-glow);
    transform: scale(1);
    border-color: var(--accent);
  }
}
:root {
  --panel-bg: rgba(17, 20, 30, 0.96);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-muted: rgba(255, 255, 255, 0.65);
  --accent: #ffb347;
}

body {
  background: radial-gradient(circle at 20% -10%, rgba(247, 160, 15, 0.18), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(110, 110, 255, 0.15), transparent 55%),
    #04050b;
  color: #f8fbff;
  position: relative;
}

.content {
  flex: 1;
  padding: 2.5rem clamp(1.5rem, 5vw, 3.25rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
}

.inventory-shell {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.inventory-header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.1rem;
  margin: 0;
  text-transform: uppercase;
}

/* VIP Equip Best Button */
.equip-best-btn {
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.2), rgba(247, 160, 15, 0.1));
  border: 1px solid rgba(247, 160, 15, 0.5);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

.equip-best-btn:hover {
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.35), rgba(247, 160, 15, 0.2));
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(247, 160, 15, 0.3);
  transform: translateY(-1px);
}

.equip-best-btn:active {
  transform: translateY(0);
}

.equip-best-btn.locked {
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.2), rgba(80, 80, 80, 0.1));
  border-color: rgba(150, 150, 150, 0.4);
  color: rgba(150, 150, 150, 0.7);
  cursor: not-allowed;
}

.equip-best-btn.locked:hover {
  transform: none;
  box-shadow: none;
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.25), rgba(80, 80, 80, 0.15));
}

.equip-best-btn .lock-icon {
  margin-right: 0.25rem;
  font-size: 0.7rem;
}

.inventory-shell > .panel {
  width: 100%;
}

.panel {
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  padding: clamp(1.2rem, 3vw, 1.65rem);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

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

.panel-header h2 {
  margin: 0;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 1.05rem;
}

.panel-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.loadout-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.loadout-top {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.loadout-side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.loadout-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(6, 1fr);
}

.loadout-figure {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.1), rgba(8, 10, 18, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 200px;
  min-width: 200px;
  padding: 1rem;
}

.character-coming-soon {
  width: 140px;
  height: 180px;
  background: #000;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.character-coming-soon span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Class picture styles */
.character-class-picture {
  width: 180px;
  height: 200px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.class-picture-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  filter: drop-shadow(0 12px 30px rgba(255, 179, 71, 0.25));
  transition: transform 0.3s ease;
}

.class-picture-img:hover {
  transform: scale(1.02);
}

.loadout-figure > img:not(.companion-photo) {
  width: 140px;
  filter: drop-shadow(0 12px 30px rgba(255, 179, 71, 0.35));
}

.companion-frame {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 70px;
  height: 70px;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  font: inherit;
  transition: transform 0.2s ease;
}

.companion-frame:focus-visible {
  outline: 2px solid rgba(247, 160, 15, 0.8);
  outline-offset: 3px;
}

.companion-frame:active {
  transform: translateY(2px);
}

.companion-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 35px rgba(0, 0, 0, 0.55));
  position: relative;
  z-index: 1;
}

.companion-overlay {
  position: absolute;
  inset: -8px;
  border-radius: 22px;
  background: rgba(4, 6, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.45);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 2;
}

.companion-frame:hover .companion-overlay,
.companion-frame:focus-within .companion-overlay {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.companion-badge {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.companion-overlay h4 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.companion-rank {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.companion-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.35rem;
}

.companion-stat {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.4rem 0.35rem;
  text-align: center;
}

.companion-stat span {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.15rem;
}

.companion-stat strong {
  display: block;
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.companion-frame {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 70px;
  height: 70px;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  font: inherit;
  transition: transform 0.2s ease;
}

.companion-frame:focus-visible {
  outline: 2px solid rgba(247, 160, 15, 0.8);
  outline-offset: 3px;
}

.companion-frame:active {
  transform: translateY(2px);
}

.companion-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 35px rgba(0, 0, 0, 0.55));
  position: relative;
  z-index: 1;
}

.companion-overlay {
  position: absolute;
  inset: -8px;
  border-radius: 22px;
  background: rgba(4, 6, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.45);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 2;
}

.companion-frame:hover .companion-overlay,
.companion-frame:focus-within .companion-overlay {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.companion-badge {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.companion-overlay h4 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.companion-rank {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.companion-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.35rem;
}

.companion-stat {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.4rem 0.35rem;
  text-align: center;
}

.companion-stat span {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.15rem;
}

.companion-stat strong {
  display: block;
  font-size: 0.95rem;
}

.companion-tip {
  margin: 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.slot-card {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 11, 18, 0.9);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: center;
  justify-content: space-between;
  min-height: 180px;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}

.loadout-panel .slot-card {
  min-height: 160px;
}

.slot-card[data-equipped="true"] {
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(9, 11, 18, 0.95));
  color: #fff;
}

.slot-card[data-equipped="false"] {
  border-style: dashed;
  color: var(--text-muted);
  opacity: 0.5;
  filter: grayscale(1);
}

.slot-image {
  width: 100%;
  max-width: 110px;
  aspect-ratio: 1/1;
  margin: 0 auto 0.15rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
}

.slot-image img {
  width: 80%;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
  opacity: 0.95;
}

.slot-card[data-equipped="false"] .slot-image {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.02);
}

.slot-card[data-equipped="false"] .slot-image img {
  filter: grayscale(1);
  opacity: 0.45;
}

.slot-card[data-equipped="true"] .slot-image {
  border-color: rgba(255, 255, 255, 0.3);
  background: radial-gradient(circle at 35% 20%, rgba(255, 255, 255, 0.18), rgba(9, 11, 18, 0.95));
}

.slot-card[data-equipped="true"] .slot-image img {
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.55));
  opacity: 1;
}

.slot-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.slot-card h3 {
  margin: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.slot-card p {
  margin: 0;
}

.slot-card[data-equipped="true"] {
  border-color: rgba(255, 179, 71, 0.4);
  box-shadow: 0 0 25px rgba(255, 179, 71, 0.2);
}

.slot-power {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-attributes {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 16, 25, 0.92);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hero-attributes {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 16, 25, 0.92);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attribute-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.element-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.element-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.attribute-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
}

.attr-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.attr-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.attribute-card strong {
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.inventory-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inventory-toolbar .panel-subtitle {
  max-width: 360px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.filter-row.secondary {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.5);
}

.slot-filters,
.element-filters,
.level-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.slot-filters button,
.element-filters button,
.level-filters button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #fff;
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.slot-filters button[data-active="true"],
.element-filters button[data-active="true"],
.level-filters button[data-active="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 179, 71, 0.12);
}

.element-filters button {
  min-width: 36px;
  text-align: center;
}

.level-filters button {
  font-family: 'Orbitron', sans-serif;
}

.inventory-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.inventory-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.inventory-scroll::-webkit-scrollbar {
  width: 6px;
}

.inventory-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.gear-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 9, 16, 0.92);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 140px;
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1),
              border-color 0.2s ease,
              box-shadow 0.2s cubic-bezier(.2,.8,.2,1);
  font-size: 0.85rem;
  cursor: pointer;
}

.gear-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: hsla(38, 90%, 65%, 0.5);
  box-shadow: 
    0 14px 32px rgba(0, 0, 0, 0.4),
    0 0 16px hsla(38, 90%, 65%, 0.2);
}

.gear-card:active {
  transform: translateY(-2px) scale(0.99);
}

.gear-card[data-equipped="true"] {
  border-color: rgba(255, 179, 71, 0.8);
  box-shadow: 0 0 18px rgba(255, 179, 71, 0.15);
}

.gear-image {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.35rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gear-image img {
  width: 60%;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}

/* Stack count badge */
.gear-stack-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.95), rgba(255, 180, 50, 0.9));
  color: #000;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.gear-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gear-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.gear-title {
  font-family: 'Orbitron', 'Inter', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.gear-tier-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.1rem;
}

.gear-level {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(247, 160, 15, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.05rem;
}

.gear-stars {
  font-size: 0.75rem;
  color: #ffd700;
  letter-spacing: -0.05rem;
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.gear-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gear-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.gear-tag {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.1rem 0.5rem;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.gear-tag[data-variant="status"] {
  border-color: rgba(255, 179, 71, 0.6);
  color: var(--accent);
}

.rare-panel h2 {
  margin-bottom: 0.3rem;
}

.rare-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.rare-total {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.resource-tabs {
  display: flex;
  gap: 0.35rem;
}

.resource-tab {
  padding: 0.4rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.resource-tab:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.resource-tab[data-active="true"] {
  border-color: var(--accent);
  background: rgba(255, 179, 71, 0.12);
  color: var(--accent);
}

.resource-content {
  margin-top: 0.75rem;
}

/* Resource Box Grid - Item-like display for resources */
.resource-box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.resource-box {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 9, 16, 0.92);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1),
              border-color 0.2s ease,
              box-shadow 0.2s cubic-bezier(.2,.8,.2,1);
  cursor: default;
}

.resource-box:hover {
  transform: translateY(-3px);
  border-color: hsla(38, 90%, 65%, 0.4);
  box-shadow: 
    0 10px 24px rgba(0, 0, 0, 0.35),
    0 0 12px hsla(38, 90%, 65%, 0.15);
}

.resource-box-image {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.15) 100%);
  padding: 0.5rem;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.resource-box-image img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.resource-box-image .resource-emoji {
  font-size: 2rem;
}

/* Amount badge in corner */
.resource-box-amount {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.95), rgba(255, 180, 50, 0.9));
  color: #000;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.resource-box-label {
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.2rem;
}

/* Legacy rare-grid styles (can be removed later) */
.rare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.rare-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.7rem;
}

.rare-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.25));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.rare-icon span {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.rare-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.rare-body .stat-meta {
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rare-body strong {
  font-size: 0.95rem;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(8px);
  z-index: 10;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-variant="error"] {
  border-color: rgba(255, 75, 75, 0.6);
}

.toast[data-variant="success"] {
  border-color: rgba(64, 255, 156, 0.6);
}

/* =====================================================
   GEAR CARD - Tier-based color system
   ===================================================== */

.gc {
  --tier-primary: #6b7280;
  --tier-secondary: #4b5563;
  --tier-glow: rgba(107, 114, 128, 0.4);
  --tier-text: #9ca3af;
  
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  
  width: 100%;
  aspect-ratio: 0.88;
  padding: 0;
  overflow: visible; /* Allow tier badge to overflow */
  margin-top: 12px; /* Space for tier badge */
  
  background: linear-gradient(
    180deg, 
    color-mix(in srgb, var(--tier-secondary) 15%, rgba(20, 22, 30, 0.98)) 0%, 
    rgba(12, 14, 20, 0.99) 100%
  );
  border: 2px solid var(--tier-primary);
  border-radius: 10px;
  
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gc:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.5),
    0 0 24px var(--tier-glow),
    0 0 40px color-mix(in srgb, var(--tier-glow) 50%, transparent);
}

.gc[data-equipped="true"] {
  border-color: var(--accent);
  box-shadow: 
    0 0 0 2px rgba(247, 160, 15, 0.2),
    0 4px 20px rgba(247, 160, 15, 0.2);
}

/* ─────────────────────────────────────────────────────
   TIER BADGE - Floats above card (Roman numeral)
   ───────────────────────────────────────────────────── */
.gc-tier {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 8px;
  
  background: linear-gradient(135deg, var(--tier-primary) 0%, var(--tier-secondary) 100%);
  border: 1px solid color-mix(in srgb, var(--tier-primary) 80%, white 20%);
  border-radius: 4px;
  
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 12px var(--tier-glow);
}

.gc-tier-num {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: #000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  letter-spacing: 0;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────
   TIER CHANGE RIBBON - Shows +2/-2 element boost
   ───────────────────────────────────────────────────── */
.gc-tier-ribbon {
  position: absolute;
  top: -10px;
  right: -6px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: .3px;
  pointer-events: none;
}
.gc-tier-ribbon.bonus {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: 1px solid #4ade80;
  color: #fff;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
  animation: gc-ribbon-pulse 1.5s ease-in-out infinite;
}
.gc-tier-ribbon.penalty {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 1px solid #f87171;
  color: #fff;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.5);
}

/* Upgraded / Downgraded card border glow */
.gc.gc-upgraded {
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.5), inset 0 0 8px rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.6) !important;
}
.gc.gc-downgraded {
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.5), inset 0 0 8px rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.6) !important;
}

@keyframes gc-ribbon-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(74, 222, 128, 0.5); }
  50% { box-shadow: 0 0 16px rgba(74, 222, 128, 0.8); }
}

/* Upgraded / downgraded slot glow in WavePrep */
.wp2-gear-slot.upgraded { box-shadow: 0 0 14px rgba(74, 222, 128, 0.4); }
.wp2-gear-slot.downgraded { box-shadow: 0 0 14px rgba(248, 113, 113, 0.4); }

/* ─────────────────────────────────────────────────────
   ELEMENT ICON - Only visible on hover
   ───────────────────────────────────────────────────── */
.gc-element {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  
  font-size: 2rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8));
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gc:hover .gc-element {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ─────────────────────────────────────────────────────
   ZONE 1: Header - Stars centered
   ───────────────────────────────────────────────────── */
.gc-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 24px 8px 6px;
  
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Stars - tier colored (shows subtier 1-5) */
.gc-stars {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.gc-stars .star {
  font-size: 0.95rem;
  line-height: 1;
  transition: all 0.15s ease;
}

.gc-stars .star.lit {
  color: var(--tier-text);
  text-shadow: 
    0 0 6px var(--tier-glow),
    0 0 12px var(--tier-glow),
    0 1px 3px rgba(0, 0, 0, 0.5);
  filter: drop-shadow(0 0 3px var(--tier-primary));
}

.gc-stars .star.dim {
  color: rgba(255, 255, 255, 0.1);
}

/* ─────────────────────────────────────────────────────
   ZONE 2: Visual - Item with element color overlay
   ───────────────────────────────────────────────────── */
.gc-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  
  background: radial-gradient(
    ellipse 80% 70% at center 50%,
    var(--tier-glow) 0%,
    transparent 65%
  );
}

.gc-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.gc-img {
  max-width: 90%;
  max-height: 68px;
  object-fit: contain;
  opacity: 0.75;
  
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6))
    drop-shadow(0 6px 16px var(--tier-glow));
  
  transition: transform 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.gc:hover .gc-img {
  opacity: 1;
}

/* Element-based color effects on image */
/* Fire - Red tint, no glow */
.gc[data-element="fire"] .gc-img {
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6))
    sepia(0.5) saturate(2) hue-rotate(-20deg) brightness(1.05);
}

/* Water - Blue tint */
.gc[data-element="water"] .gc-img {
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6))
    drop-shadow(0 6px 16px rgba(66, 165, 245, 0.4))
    sepia(0.2) saturate(1.3) hue-rotate(180deg);
}

/* Earth - White/bright (like old air) */
.gc[data-element="earth"] .gc-img {
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6))
    drop-shadow(0 6px 16px rgba(200, 200, 220, 0.4))
    brightness(1.15) contrast(0.95) saturate(0.7);
}

/* Air - Greyscale/silver tint */
.gc[data-element="air"] .gc-img {
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6))
    grayscale(0.8) brightness(1.15) contrast(1.05);
}

.gc:hover .gc-img {
  transform: scale(1.08) translateY(-2px);
}

/* Fire hover - stronger red, no glow */
.gc[data-element="fire"]:hover .gc-img {
  filter: 
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7))
    sepia(0.5) saturate(2.2) hue-rotate(-20deg) brightness(1.15);
}

/* Water hover */
.gc[data-element="water"]:hover .gc-img {
  filter: 
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7))
    drop-shadow(0 10px 24px rgba(66, 165, 245, 0.5))
    sepia(0.2) saturate(1.4) hue-rotate(180deg) brightness(1.1);
}

/* Earth hover - brighter white */
.gc[data-element="earth"]:hover .gc-img {
  filter: 
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7))
    drop-shadow(0 10px 24px rgba(200, 200, 220, 0.5))
    brightness(1.25) contrast(0.95) saturate(0.7);
}

/* Air hover - greyscale silver */
.gc[data-element="air"]:hover .gc-img {
  filter: 
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7))
    grayscale(0.7) brightness(1.25) contrast(1.1);
}

/* Default (no element) hover */
.gc[data-element="none"]:hover .gc-img {
  filter: 
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7))
    drop-shadow(0 10px 24px var(--tier-glow))
    brightness(1.08);
}

.gc-placeholder {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* Stack badge - Orange for visibility */
.gc-stack {
  position: absolute;
  bottom: 4px;
  right: 4px;
  
  padding: 3px 8px;
  background: linear-gradient(135deg, #ff8c00 0%, #ff5500 100%);
  border-radius: 6px;
  border: 2px solid #fff;
  
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  
  box-shadow: 0 2px 8px rgba(255,85,0,0.6), 0 0 12px rgba(255,140,0,0.4);
}

/* Equipped badge */
.gc-equipped-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  
  background: var(--accent);
  border-radius: 3px;
  
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 800;
  color: #000;
  
  box-shadow: 0 0 8px rgba(247, 160, 15, 0.6);
}

/* ─────────────────────────────────────────────────────
   ZONE 3: Stats
   ───────────────────────────────────────────────────── */
.gc-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  
  padding: 6px 6px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.gc-stats[data-count="1"] { justify-content: center; }
.gc-stats[data-count="2"] .gc-stat { flex: 1; justify-content: center; }
.gc-stats[data-count="3"] .gc-stat { flex: 1; justify-content: center; }

.gc-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.gc-stat-icon {
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0.9;
}

.gc-stat-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* ─────────────────────────────────────────────────────
   Tier Theme Specifics
   ───────────────────────────────────────────────────── */

/* Grey (Tier 1-5) */
.gc[data-tier-theme="grey"] {
  background: linear-gradient(180deg, rgba(45, 50, 60, 0.95) 0%, rgba(20, 22, 28, 0.99) 100%);
}

/* Bronze (Tier 6-10) */
.gc[data-tier-theme="bronze"] {
  background: linear-gradient(180deg, rgba(50, 38, 28, 0.95) 0%, rgba(25, 18, 12, 0.99) 100%);
}
.gc[data-tier-theme="bronze"] .gc-subtier-num { color: #1a1a1a; }

/* Silver (Tier 11-15) */
.gc[data-tier-theme="silver"] {
  background: linear-gradient(180deg, rgba(55, 55, 65, 0.95) 0%, rgba(28, 28, 35, 0.99) 100%);
}
.gc[data-tier-theme="silver"] .gc-subtier-num { color: #1a1a1a; }

/* Gold (Tier 16-20) */
.gc[data-tier-theme="gold"] {
  background: linear-gradient(180deg, rgba(55, 48, 25, 0.95) 0%, rgba(30, 25, 12, 0.99) 100%);
}
.gc[data-tier-theme="gold"] .gc-subtier-num { color: #1a1a1a; }

/* Diamond (Tier 21-25) */
.gc[data-tier-theme="diamond"] {
  background: linear-gradient(180deg, rgba(35, 55, 65, 0.95) 0%, rgba(18, 28, 35, 0.99) 100%);
}
.gc[data-tier-theme="diamond"] .gc-subtier-num { color: #0a2a3a; }

/* Ruby (Tier 26-30) */
.gc[data-tier-theme="ruby"] {
  background: linear-gradient(180deg, rgba(55, 25, 35, 0.95) 0%, rgba(30, 12, 18, 0.99) 100%);
}
.gc[data-tier-theme="ruby"] .gc-subtier-num { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Emerald (Tier 31+) */
.gc[data-tier-theme="emerald"] {
  background: linear-gradient(180deg, rgba(25, 50, 38, 0.95) 0%, rgba(12, 28, 20, 0.99) 100%);
}
.gc[data-tier-theme="emerald"] .gc-subtier-num { color: #0a2a1a; }

/* ─────────────────────────────────────────────────────
   Empty Slot Card
   ───────────────────────────────────────────────────── */
.gc.gc-empty {
  opacity: 0.6;
  border-style: dashed;
}

.gc.gc-empty:hover {
  opacity: 0.85;
}

.gc-slot-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
}

.gc-img-empty {
  opacity: 0.4 !important;
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))
    grayscale(0.5) !important;
}

.gc-stat-empty .gc-stat-val {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.6rem;
}

/* ─────────────────────────────────────────────────────
   Unequip Card
   ───────────────────────────────────────────────────── */
.gc.gc-unequip {
  background: linear-gradient(180deg, rgba(60, 30, 30, 0.95) 0%, rgba(30, 15, 15, 0.99) 100%);
  border-color: #ef4444;
}

.gc.gc-unequip:hover {
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(239, 68, 68, 0.4),
    0 0 40px rgba(239, 68, 68, 0.2);
}

.gc.gc-unequip .gc-slot-label {
  color: #fca5a5;
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────
   Select Gear Panel
   ───────────────────────────────────────────────────── */
.select-gear-panel .close-btn {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.select-gear-panel .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ─────────────────────────────────────────────────────
   Inventory Grid
   ───────────────────────────────────────────────────── */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  padding-top: 4px; /* Extra space for subtier badges */
}

/* ─────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .gc {
    aspect-ratio: 0.9;
    margin-top: 10px;
  }
  
  .gc-subtier {
    min-width: 24px;
    height: 18px;
    top: -8px;
  }
  
  .gc-subtier-num {
    font-size: 0.6rem;
  }
  
  .gc-header {
    padding: 18px 6px 5px;
  }
  
  .gc-element {
    font-size: 0.75rem;
  }
  
  .gc-stars .star {
    font-size: 0.8rem;
  }
  
  .gc-img {
    max-height: 55px;
  }
  
  .gc-stats {
    padding: 5px;
  }
  
  .gc-stat-icon {
    font-size: 0.65rem;
  }
  
  .gc-stat-val {
    font-size: 0.6rem;
  }
  
  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 1200px) {
  .content {
    padding: 2rem 1.5rem 3rem;
  }

  .inventory-scroll {
    max-height: none;
  }
}

@media (max-width: 1024px) {
  .loadout-top {
    flex-direction: column;
  }
  .loadout-figure {
    width: 100%;
    min-width: auto;
    min-height: 180px;
  }
  .loadout-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .loadout-figure {
    grid-column: span 1;
    min-height: 240px;
  }

  .content {
    padding: 1.75rem 1rem 2.5rem;
  }
}

/* ============================================================================
   INVENTORY HUB - Category Selection Grid
   ============================================================================ */

.inventory-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 0 0.5rem;
}

.inventory-hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 1.5rem 2rem;
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.95) 0%, rgba(10, 13, 20, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.2, .8, .2, 1);
  position: relative;
  overflow: hidden;
  text-align: center;
  color: #fff;
  font-family: inherit;
  font-size: inherit;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  outline: none;
}

/* Gold accent top edge */
.inventory-hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, rgba(247, 160, 15, 0.45) 50%, transparent 95%);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* Shine sweep */
.inventory-hub-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.04) 45%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.04) 55%,
    transparent 60%
  );
  transform: skewX(-15deg);
  transition: left 0.5s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.inventory-hub-card:hover::after {
  left: 130%;
}

.inventory-hub-card:hover:not(.inventory-hub-card--disabled) {
  border-color: rgba(247, 160, 15, 0.25);
  transform: translateY(-4px) scale(1.015);
  box-shadow: 
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(247, 160, 15, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.inventory-hub-card:hover:not(.inventory-hub-card--disabled)::before {
  opacity: 1;
}

.inventory-hub-card:active:not(.inventory-hub-card--disabled) {
  transform: translateY(-1px) scale(0.99);
  transition-duration: 0.1s;
}

.inventory-hub-card--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.inventory-hub-card__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 12px;
  background: rgba(247, 160, 15, 0.12);
  border: 1px solid rgba(247, 160, 15, 0.25);
  border-radius: 999px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  color: #f9b642;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.inventory-hub-card__icon-wrap {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.3s ease;
}

.inventory-hub-card:hover:not(.inventory-hub-card--disabled) .inventory-hub-card__icon-wrap {
  border-color: rgba(247, 160, 15, 0.2);
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.08), rgba(247, 160, 15, 0.02));
  box-shadow: 0 0 24px rgba(247, 160, 15, 0.06);
}

.inventory-hub-card__icon {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(.2, .8, .2, 1);
}

.inventory-hub-card:hover:not(.inventory-hub-card--disabled) .inventory-hub-card__icon {
  transform: scale(1.1);
}

.inventory-hub-card__label {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

.inventory-hub-card__desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.4);
  max-width: 220px;
}

.inventory-hub-card__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(.2, .8, .2, 1);
  margin-top: 0.5rem;
}

.inventory-hub-card:hover:not(.inventory-hub-card--disabled) .inventory-hub-card__arrow {
  color: #f9b642;
  background: rgba(247, 160, 15, 0.1);
  border-color: rgba(247, 160, 15, 0.25);
  transform: translateX(3px);
  box-shadow: 0 0 12px rgba(247, 160, 15, 0.1);
}

/* Stagger entrance animation */
@keyframes hubCardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.inventory-hub-card:nth-child(1) { animation: hubCardIn 0.35s ease both; animation-delay: 0.05s; }
.inventory-hub-card:nth-child(2) { animation: hubCardIn 0.35s ease both; animation-delay: 0.12s; }
.inventory-hub-card:nth-child(3) { animation: hubCardIn 0.35s ease both; animation-delay: 0.19s; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .inventory-hub-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 720px) {
  .inventory-hub-grid {
    padding: 0;
    max-width: none;
  }

  .inventory-hub-card {
    flex-direction: row;
    text-align: left;
    padding: 1.25rem 1.25rem;
    gap: 1rem;
    border-radius: 14px;
  }

  .inventory-hub-card__icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    flex-shrink: 0;
  }

  .inventory-hub-card__icon {
    font-size: 1.75rem;
  }

  .inventory-hub-card__label {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
  }

  .inventory-hub-card__desc {
    display: none;
  }

  .inventory-hub-card__arrow {
    margin-left: auto;
    margin-top: 0;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .inventory-hub-card__badge {
    top: 8px;
    right: 8px;
    font-size: 0.5rem;
    padding: 3px 8px;
  }

  .inventory-hub-card::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inventory-hub-card,
  .inventory-hub-card::after,
  .inventory-hub-card__icon,
  .inventory-hub-card__arrow {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================================
   CHARACTER LOADOUT - Game-themed re-skin (gold/amber fantasy)
   ============================================================================ */

.loadout-panel {
  position: relative;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(247, 160, 15, 0.08), transparent 55%),
    radial-gradient(100% 60% at 100% 100%, rgba(247, 160, 15, 0.05), transparent 55%),
    linear-gradient(160deg, rgba(20, 14, 8, 0.92) 0%, rgba(10, 8, 6, 0.96) 100%) !important;
  border: 1px solid rgba(247, 160, 15, 0.22) !important;
  border-radius: 22px !important;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(247, 160, 15, 0.18),
    inset 0 0 60px rgba(247, 160, 15, 0.025) !important;
  overflow: hidden;
}
.loadout-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 160, 15, 0.65), transparent);
  pointer-events: none;
}
.loadout-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(247, 160, 15, 0.022) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(247, 160, 15, 0.018) 31px 32px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 60%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 60%);
}
.loadout-panel > * { position: relative; z-index: 1; }

/* Header — gold gradient title with Orbitron */
.loadout-panel .panel-header .eyebrow {
  color: rgba(247, 200, 120, 0.7) !important;
  letter-spacing: 0.3em;
  font-size: 0.65rem;
  text-transform: uppercase;
}
.loadout-panel .panel-header h2 {
  font-family: 'Orbitron', sans-serif !important;
  background: linear-gradient(135deg, #ffe28a 0%, #ffb347 45%, #f7a00f 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 22px rgba(247, 160, 15, 0.18);
  letter-spacing: 0.18em !important;
}
.loadout-panel .panel-subtitle {
  color: rgba(247, 200, 120, 0.55) !important;
  font-style: italic;
}

/* Character figure — ornate parchment/coin frame */
.loadout-panel .loadout-figure {
  border: 1px solid rgba(247, 160, 15, 0.32) !important;
  background:
    radial-gradient(circle at 50% 14%, rgba(247, 160, 15, 0.18), transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(247, 160, 15, 0.12), transparent 65%),
    linear-gradient(180deg, rgba(28, 20, 10, 0.95), rgba(10, 8, 6, 0.98)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(247, 160, 15, 0.08),
    inset 0 30px 60px rgba(247, 160, 15, 0.06),
    0 12px 30px rgba(0, 0, 0, 0.55);
  position: relative;
}
/* Corner ornaments */
.loadout-panel .loadout-figure::before,
.loadout-panel .loadout-figure::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(247, 160, 15, 0.55);
  pointer-events: none;
  z-index: 2;
}
.loadout-panel .loadout-figure::before {
  top: 8px;
  left: 8px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 6px;
}
.loadout-panel .loadout-figure::after {
  bottom: 8px;
  right: 8px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 6px;
}

/* Combat Stats heading already gold via inline style — boost it */
.loadout-panel .hero-attributes h3 {
  font-family: 'Orbitron', sans-serif !important;
  color: #ffb347 !important;
  text-shadow: 0 0 12px rgba(247, 160, 15, 0.4);
  border-bottom: 1px solid rgba(247, 160, 15, 0.18);
  padding-bottom: 0.4rem;
}

.loadout-panel .hero-attributes {
  background:
    linear-gradient(160deg, rgba(28, 20, 10, 0.65), rgba(14, 10, 6, 0.75)) !important;
  border: 1px solid rgba(247, 160, 15, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(247, 160, 15, 0.1);
}

/* Attribute cards — coin-style stat tiles */
.loadout-panel .attribute-card {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(247, 160, 15, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(60, 40, 18, 0.55), rgba(20, 14, 8, 0.85)) !important;
  border: 1px solid rgba(247, 160, 15, 0.28) !important;
  border-radius: 14px !important;
  padding: 0.65rem 0.8rem 0.65rem 0.7rem !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  isolation: isolate;
}
.loadout-panel .attribute-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 122, 0.75), transparent);
  pointer-events: none;
}
/* Diagonal sheen sweep */
.loadout-panel .attribute-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 230, 160, 0.08) 50%, transparent 65%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.6s ease;
  transform: translateX(-30%);
  z-index: 0;
}
.loadout-panel .attribute-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 215, 122, 0.6) !important;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(247, 160, 15, 0.28),
    inset 0 0 22px rgba(247, 160, 15, 0.08);
}
.loadout-panel .attribute-card:hover::after {
  opacity: 1;
  transform: translateX(30%);
}
.loadout-panel .attribute-card > div { position: relative; z-index: 1; }
.loadout-panel .attribute-card .attr-icon {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 230, 160, 0.55), rgba(247, 160, 15, 0.25) 45%, rgba(28, 20, 10, 0.95) 75%) !important;
  border: 1px solid rgba(255, 215, 122, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 200, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(247, 160, 15, 0.25);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
  position: relative;
  z-index: 1;
}
.loadout-panel .attribute-card .attr-label {
  color: rgba(247, 200, 120, 0.75) !important;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem !important;
  letter-spacing: 0.24em !important;
  margin-bottom: 0.1rem;
}
.loadout-panel .attribute-card strong {
  font-family: 'Orbitron', 'IBM Plex Mono', monospace !important;
  background: linear-gradient(180deg, #fff5d6 0%, #ffd87a 55%, #f7a00f 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(247, 160, 15, 0.45));
  font-size: 1.45rem !important;
  letter-spacing: 0.04em !important;
  font-weight: 800 !important;
  display: inline-block;
  line-height: 1.05;
}
/* Per-stat accent on icons + numbers */
.loadout-panel .attribute-card[data-stat="hp"] .attr-icon {
  background: radial-gradient(circle at 30% 25%, rgba(255, 200, 200, 0.6), rgba(220, 60, 60, 0.35) 45%, rgba(40, 10, 10, 0.95) 78%) !important;
  border-color: rgba(255, 130, 130, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 220, 220, 0.45), inset 0 -2px 4px rgba(0,0,0,0.45), 0 0 14px rgba(255, 80, 80, 0.35);
}
.loadout-panel .attribute-card[data-stat="hp"] strong {
  background: linear-gradient(180deg, #ffe0e0 0%, #ff8a8a 55%, #d83838 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 80, 80, 0.45));
}
.loadout-panel .attribute-card[data-stat="def"] .attr-icon {
  background: radial-gradient(circle at 30% 25%, rgba(200, 220, 255, 0.55), rgba(80, 130, 220, 0.35) 45%, rgba(10, 18, 40, 0.95) 78%) !important;
  border-color: rgba(140, 180, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(220, 235, 255, 0.45), inset 0 -2px 4px rgba(0,0,0,0.45), 0 0 14px rgba(120, 160, 255, 0.35);
}
.loadout-panel .attribute-card[data-stat="def"] strong {
  background: linear-gradient(180deg, #e0ecff 0%, #8ab4ff 55%, #3a6ed8 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(120, 160, 255, 0.45));
}
.loadout-panel .attribute-card[data-stat="crit"] .attr-icon {
  background: radial-gradient(circle at 30% 25%, rgba(255, 220, 160, 0.55), rgba(255, 100, 40, 0.4) 45%, rgba(40, 14, 6, 0.95) 78%) !important;
  border-color: rgba(255, 170, 100, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 235, 200, 0.45), inset 0 -2px 4px rgba(0,0,0,0.45), 0 0 14px rgba(255, 120, 50, 0.4);
}
.loadout-panel .attribute-card[data-stat="crit"] strong {
  background: linear-gradient(180deg, #fff0d0 0%, #ffae6a 55%, #ff5e1a 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 120, 50, 0.5));
}
/* Stat-side glow strip (left edge accent) */
.loadout-panel .attribute-card[data-stat="hp"] { box-shadow: inset 3px 0 0 rgba(255, 80, 80, 0.55); }
.loadout-panel .attribute-card[data-stat="atk"] { box-shadow: inset 3px 0 0 rgba(247, 160, 15, 0.6); }
.loadout-panel .attribute-card[data-stat="def"] { box-shadow: inset 3px 0 0 rgba(120, 160, 255, 0.55); }
.loadout-panel .attribute-card[data-stat="crit"] { box-shadow: inset 3px 0 0 rgba(255, 100, 40, 0.6); }
.loadout-panel .attribute-card[data-stat="hp"]:hover { box-shadow: inset 3px 0 0 rgba(255,80,80,0.7), 0 8px 22px rgba(0,0,0,0.55), 0 0 18px rgba(255,80,80,0.3); }
.loadout-panel .attribute-card[data-stat="atk"]:hover { box-shadow: inset 3px 0 0 rgba(247,160,15,0.8), 0 8px 22px rgba(0,0,0,0.55), 0 0 18px rgba(247,160,15,0.35); }
.loadout-panel .attribute-card[data-stat="def"]:hover { box-shadow: inset 3px 0 0 rgba(120,160,255,0.75), 0 8px 22px rgba(0,0,0,0.55), 0 0 18px rgba(120,160,255,0.3); }
.loadout-panel .attribute-card[data-stat="crit"]:hover { box-shadow: inset 3px 0 0 rgba(255,100,40,0.8), 0 8px 22px rgba(0,0,0,0.55), 0 0 18px rgba(255,100,40,0.35); }

/* Secondary stats + Elements panels (the inline-styled siblings) */
.loadout-panel .hero-attributes > div[style*="display: flex"][style*="gap: 0.5rem"] > div {
  background:
    linear-gradient(180deg, rgba(40, 28, 14, 0.55), rgba(14, 10, 6, 0.7)) !important;
  border: 1px solid rgba(247, 160, 15, 0.18) !important;
  border-radius: 12px !important;
  box-shadow: inset 0 1px 0 rgba(247, 160, 15, 0.08);
}
.loadout-panel .hero-attributes > div[style*="display: flex"][style*="gap: 0.5rem"] > div strong {
  background: linear-gradient(180deg, #fff5d6 0%, #ffd87a 50%, #f7a00f 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Orbitron', 'IBM Plex Mono', monospace !important;
  filter: drop-shadow(0 0 6px rgba(247, 160, 15, 0.4));
  font-weight: 800 !important;
  font-size: 0.75rem !important;
}
.loadout-panel .hero-attributes > div[style*="display: flex"][style*="gap: 0.5rem"] > div span {
  color: rgba(247, 200, 120, 0.7) !important;
}
/* "EQUIPPED ELEMENTS" header inside the right secondary box */
.loadout-panel .hero-attributes > div[style*="display: flex"][style*="gap: 0.5rem"] > div > div:first-child {
  font-family: 'Orbitron', sans-serif !important;
  color: rgba(247, 200, 120, 0.85) !important;
  letter-spacing: 0.18em !important;
  border-bottom: 1px solid rgba(247, 160, 15, 0.18);
  padding-bottom: 0.25rem;
}

/* Element bar tracks → forged metal look */
.loadout-panel .element-row > div[style*="background: rgba(255,255,255,0.1)"] {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.55), rgba(20,14,8,0.7)) !important;
  border: 1px solid rgba(247, 160, 15, 0.15) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  height: 7px !important;
  border-radius: 4px !important;
}
.loadout-panel .element-row > div > div {
  border-radius: 3px !important;
  box-shadow: 0 0 8px currentColor;
}
.loadout-panel .element-row[data-element="fire"] > div > div { box-shadow: 0 0 8px rgba(255, 107, 53, 0.6); }
.loadout-panel .element-row[data-element="water"] > div > div { box-shadow: 0 0 8px rgba(0, 180, 216, 0.55); }
.loadout-panel .element-row[data-element="earth"] > div > div { box-shadow: 0 0 8px rgba(205, 133, 63, 0.55); }
.loadout-panel .element-row[data-element="air"] > div > div { box-shadow: 0 0 8px rgba(224, 224, 224, 0.45); }
.loadout-panel .element-row > span:first-child {
  font-size: 0.85rem !important;
  filter: drop-shadow(0 0 4px currentColor);
}
.loadout-panel .element-row > span:last-child {
  font-family: 'Orbitron', monospace !important;
  text-shadow: 0 0 6px currentColor;
}

/* Slot grid — tighten gap so tiles feel like a forge bench */
.loadout-panel .loadout-grid {
  gap: 0.5rem !important;
  padding: 0.6rem;
  background: linear-gradient(180deg, rgba(247, 160, 15, 0.04), transparent);
  border-top: 1px solid rgba(247, 160, 15, 0.12);
  border-radius: 14px;
}



/* ═══════════════════════════════════════════════════════════════════════
   Loadout slot action popup — Unequip / Repair
   ═══════════════════════════════════════════════════════════════════════ */
.loadout-action-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  /* Allow overlay scrolling when modal taller than viewport */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  animation: loadoutModalFadeIn 0.18s ease;
}
@keyframes loadoutModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.loadout-action-modal {
  width: min(92vw, 420px);
  /* Cap height so long content scrolls inside the modal instead of pushing
     header/buttons off-screen on phones (Apr 2026 fix). */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  /* Do NOT set a height — modal hugs content unless content > max-height. */
  margin: auto;
  background: linear-gradient(180deg, rgba(28, 22, 16, 0.98) 0%, rgba(14, 11, 8, 0.99) 100%);
  border: 1px solid rgba(247, 160, 15, 0.4);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(247, 160, 15, 0.18);
  color: #f0e6d2;
  font-family: 'Inter', system-ui, sans-serif;
  /* Clip rounded corners; body handles its own scroll. */
  overflow: hidden;
  box-sizing: border-box;
  animation: loadoutModalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes loadoutModalPop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.loadout-action-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(247, 160, 15, 0.08);
  flex: 0 0 auto;
}
.loadout-action-modal-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: #ffd486;
}
.loadout-action-modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  transition: color 0.15s ease;
}
.loadout-action-modal-close:hover:not(:disabled) { color: #fff; }
.loadout-action-modal-close:disabled { opacity: 0.4; cursor: wait; }
.loadout-action-modal-body {
  padding: 16px;
  /* Body shrinks to content; only scrolls when content overflows the
     modal's max-height. flex: 0 1 auto so it does NOT stretch — without
     this, short content leaves a huge gap and the action bar floats at
     the bottom of the viewport on phones. */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.loadout-action-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 14px;
  text-transform: capitalize;
}
.loadout-action-modal-meta strong { color: #fff; font-weight: 700; }
.loadout-action-modal-actions {
  /* Sibling of .loadout-action-modal-body — pinned at bottom of modal,
     never stretches. Buttons stack on mobile, side-by-side desktop. */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}
@media (min-width: 481px) {
  .loadout-action-modal-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .loadout-action-modal-actions > .loadout-action-btn {
    flex: 1 1 calc(50% - 8px);
  }
}
.loadout-action-btn {
  /* Hard cap height so the button never stretches. !important to defeat
     any global mobile button rules from mobile-global.css. */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: auto !important;
  min-height: 46px !important;
  max-height: 56px !important;
  flex: 0 0 auto;
  padding: 10px 12px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  border: 1px solid;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  width: 100%;
}
.loadout-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.loadout-action-btn:hover:not(:disabled) { transform: translateY(-1px); }
.loadout-action-btn--unequip {
  background: linear-gradient(180deg, #4a5568, #2d3748);
  border-color: #718096;
  color: #fff;
  box-shadow: 0 0 10px rgba(113, 128, 150, 0.3);
}
.loadout-action-btn--unequip:hover:not(:disabled) {
  box-shadow: 0 0 16px rgba(113, 128, 150, 0.5);
}
.loadout-action-btn--repair {
  background: linear-gradient(180deg, #ffd86b, #d99e2b);
  border-color: #fff7c2;
  color: #1a0a00;
  box-shadow: 0 0 12px rgba(255, 216, 107, 0.45);
}
.loadout-action-btn--repair:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(255, 216, 107, 0.7);
}

/* ── Mobile tweaks for action popups (Apr 2026) ── */
@media (max-width: 480px) {
  .loadout-action-modal-backdrop {
    align-items: flex-start; /* anchor top so tall popups scroll naturally */
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .loadout-action-modal {
    width: min(100vw - 20px, 420px);
    max-height: calc(100dvh - 20px);
  }
  .loadout-action-modal-actions {
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  }
  .loadout-action-btn {
    font-size: 0.82rem !important;
    padding: 12px !important;
    min-height: 46px !important;
    max-height: 54px !important;
    width: 100% !important;
  }
  .loadout-action-modal-meta { font-size: 0.78rem; }
}

/* ── Item action popup (inventory grid) — mobile fixes ── */
@media (max-width: 480px) {
  .item-action-overlay {
    padding: 12px;
    /* Respect iOS safe-area so popup isn't hidden under notch/home bar */
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    align-items: flex-start; /* anchor to top so long popups scroll naturally */
  }
  .item-action-popup {
    min-width: 0 !important;
    width: 100% !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    margin: auto; /* still vertically centered when it fits */
    padding: 14px 14px 12px !important;
    box-sizing: border-box;
  }
  .item-action-popup__title {
    font-size: 15px !important;
    /* Ensure long item names wrap instead of pushing close button */
    word-break: break-word;
    line-height: 1.2;
  }
  .item-action-popup__sub {
    margin-bottom: 10px;
    line-height: 1.3;
  }
  .item-action-popup__actions {
    gap: 6px;
  }
  .item-action-btn {
    padding: 11px 12px !important;
    font-size: 13px !important;
    min-height: 44px;
  }
}

/* ── Per-gear stat breakdown chips inside Combat Stats cards ──
 * Added 2026-04 — shows each equipped piece's contribution to HP/ATK/DEF
 * inside its respective .attribute-card on the Equipment loadout page.
 */
.attribute-card { gap: 0.6rem; }
.attribute-card .attr-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.attribute-card .attr-breakdown {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: right;
  color: rgba(255, 255, 255, 0.72);
  max-width: 60%;
}
.attribute-card .attr-breakdown-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.3rem;
  white-space: nowrap;
}
.attribute-card .attr-breakdown-slot {
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.attribute-card .attr-breakdown-value {
  color: #ffd58a;
  font-weight: 700;
}
@media (max-width: 600px) {
  .attribute-card .attr-breakdown { font-size: 0.58rem; max-width: 55%; }
}

/* Character page mobile: remove top gap */
@media (max-width: 1024px) {
  /* Lock crafting page to viewport height — prevents empty dark space below gear block */
  body:has(.crafting-page) .th-layout {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .th-content:has(.crafting-page) {
    padding-bottom: 0 !important;
  }
  .th-content .th-page-fade {
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }
  /* Remove crafting-page's own bottom padding (from crafting.css) at this breakpoint */
  .th-content .crafting-page {
    padding-bottom: 0 !important;
  }
}
@media (max-width: 768px) {
  .th-content:has(.inventory-shell) {
    padding-top: 0.5rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }
  .th-content .crafting-page {
    padding: 0 !important;
    margin: 0 !important;
  }
  .th-content .th-page-fade {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  .th-content .inventory-shell {
    padding: 0.35rem 0.35rem 0.35rem !important;
    margin-top: 0 !important;
  }
  .th-content .inventory-header {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  /* h1 CHARACTER — slightly larger */
  .inventory-header h1 {
    font-size: 1.9rem;
  }
  /* Fix loadout panel-header: stack subtitle below h2 so it doesn't squeeze it */
  .loadout-panel .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .loadout-panel .panel-header h2 {
    letter-spacing: 0.12em !important;
  }
  /* Reduce padding chain so attribute cards have more width */
  .loadout-panel.panel {
    padding: 0.75rem !important;
    border-radius: 14px !important;
  }
  .loadout-panel .hero-attributes {
    padding: 0.5rem !important;
  }
  /* Attribute cards: breakdown back on the right, no word-breaking */
  .attribute-card {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem !important;
  }
  .attribute-card .attr-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.9rem;
    flex-shrink: 0;
  }
  .attribute-card .attr-body {
    flex: 1;
    min-width: 0;
  }
  .attribute-card .attr-breakdown {
    flex-basis: auto;
    margin-left: auto;
    max-width: 45%;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
  }
  .attribute-card .attr-breakdown-row {
    white-space: nowrap;
    word-break: normal;
    justify-content: flex-end;
    font-size: 0.55rem;
  }
  .attribute-grid {
    grid-template-columns: 60% 40%;
  }
  /* Center hero portrait - keep natural width, don't expand to full screen */
  .loadout-panel .loadout-figure {
    max-width: 215px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    min-height: 210px !important;
  }
  .loadout-panel .character-class-picture {
    margin: 0 auto;
  }
  /* Gear cards in loadout: bigger content on mobile */
  .loadout-panel .gc-header {
    padding: 28px 8px 6px;
  }
  .loadout-panel .gc-stars .star {
    font-size: 1.1rem;
  }
  .loadout-panel .gc-stats {
    padding: 8px 6px;
  }
  .loadout-panel .gc-stat__icon {
    font-size: 0.85rem;
  }
  .loadout-panel .gc-stat__val {
    font-size: 0.78rem;
  }
  .loadout-panel .gc-tier-num {
    font-size: 0.7rem;
  }
  /* Gear item images slightly larger on mobile */
  .loadout-panel .gc-img {
    max-height: 68px;
  }
}
