:root {
  --bg-deep: #101820;
  --bg-mid: #172331;
  --bg-panel: rgba(18, 28, 39, 0.96);
  --line: #32485f;
  --line-strong: #6686a2;
  --ink: #eff3f7;
  --ink-soft: #c0ced9;
  --gold: #ddb867;
  --gold-deep: #a77921;
  --wood-1: #5d4338;
  --wood-2: #49342d;
  --wood-3: #3a2924;
  --slot-1: #5a4339;
  --slot-2: #49352f;
  --slot-line: #6b5146;
  --danger: #f28f63;
  --panel-shadow: 0 0 0 2px rgba(7, 11, 16, 0.9), 0 12px 0 rgba(7, 11, 16, 0.45);
  --body-font: "Manrope", sans-serif;
  --pixel-font: "Silkscreen", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: #0d151d;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(236, 184, 90, 0.1), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(83, 62, 34, 0.18), transparent 24rem),
    linear-gradient(180deg, #192736 0%, #0d151d 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.02) 50%, rgba(255, 255, 255, 0.02) 75%, transparent 75%, transparent);
  background-size: 18px 18px;
  opacity: 0.4;
  pointer-events: none;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.topbar {
  padding: 18px 24px;
  border: 3px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(34, 51, 69, 0.98), rgba(18, 28, 39, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 24px, transparent 24px 48px);
  box-shadow: var(--panel-shadow);
}

.topbar h1 {
  margin: 0 0 10px;
  font-family: var(--pixel-font);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.1;
  color: #fff0b5;
  text-shadow: 0 3px 0 rgba(74, 45, 7, 0.8);
}

.topbar__subtitle {
  width: min(560px, 100%);
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.6;
}

.inventory-frame {
  margin-top: 18px;
}

.inventory-board {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(16, 25, 35, 0.98), rgba(12, 19, 27, 0.99));
  box-shadow: var(--panel-shadow);
}

.inventory-board__underlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 24%),
    radial-gradient(circle at 20% 0%, rgba(255, 209, 118, 0.08), transparent 28%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 24px);
  opacity: 0.55;
  pointer-events: none;
}

.inventory-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.78fr);
  gap: 16px;
  padding: 16px;
}

.pack-section {
  min-width: 0;
}

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

.bag-card {
  --accent: #7dc494;
  padding: 10px;
  border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: linear-gradient(180deg, rgba(32, 44, 58, 0.96), rgba(17, 25, 35, 0.98));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.02), 0 8px 0 rgba(4, 8, 12, 0.45);
  transition: transform 120ms steps(2), border-color 120ms steps(2);
}

.bag-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 78%, white);
}

.bag-card__header {
  margin-bottom: 8px;
}

.bag-card__title {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: 0.78rem;
  color: #f8ecc5;
}

.bag-stage {
  position: relative;
  min-height: 252px;
  padding: 10px;
  border: 2px solid #6b5146;
  background:
    linear-gradient(180deg, var(--wood-1), var(--wood-2)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 18px, transparent 18px 36px);
  box-shadow:
    inset 0 0 0 2px rgba(21, 14, 11, 0.35),
    inset 0 2px 0 rgba(255, 216, 173, 0.08),
    0 6px 0 rgba(13, 9, 8, 0.38);
}

.bag-stage::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 230, 198, 0.08);
  pointer-events: none;
}

.bag-stage__slots {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  grid-auto-rows: 68px;
  gap: 8px;
  width: 220px;
  min-height: 220px;
  margin: 0 auto;
  align-content: start;
  justify-content: center;
}

.item-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 18px 6px 8px;
  border: 2px solid var(--slot-line);
  background:
    linear-gradient(180deg, var(--slot-1), var(--slot-2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  box-shadow:
    inset 0 2px 0 rgba(255, 228, 198, 0.07),
    inset 0 -2px 0 rgba(35, 23, 18, 0.35),
    0 2px 0 rgba(32, 21, 16, 0.4);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 120ms steps(2),
    border-color 120ms steps(2),
    box-shadow 120ms steps(2);
}

.item-slot:hover,
.item-slot:focus-visible,
.item-slot.is-selected {
  transform: translateY(-2px);
  outline: none;
}

.item-slot:hover::after,
.item-slot:focus-visible::after,
.item-slot.is-selected::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 243, 205, 0.22);
  pointer-events: none;
}

.item-slot--common {
  border-color: #735a4e;
}

.item-slot--uncommon {
  border-color: #668f6b;
}

.item-slot--rare {
  border-color: #6a86b9;
}

.item-slot--epic {
  border-color: #c29143;
}

.item-slot__icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}

.item-slot__icon-frame {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
}

.item-slot__badge {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  min-height: 14px;
  padding: 1px 4px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 239, 205, 0.14);
  background: rgba(33, 23, 18, 0.72);
  color: #f7e8ba;
  font-family: var(--pixel-font);
  font-size: 0.42rem;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

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

.inspect-panel {
  align-content: start;
}

.inspect-panel__eyebrow {
  margin: 0 0 8px;
  font-family: var(--pixel-font);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #98b2c6;
}

.inspect-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(27, 39, 53, 0.97), rgba(18, 28, 40, 0.99));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.02);
}

.inspect-card__icon-wrap {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 2px solid #6b5146;
  background: linear-gradient(180deg, var(--wood-1), var(--wood-3));
  box-shadow: inset 0 2px 0 rgba(255, 228, 198, 0.08);
}

.inspect-card__icon {
  width: 56px;
  height: 56px;
}

.inspect-card__group {
  margin: 0 0 8px;
  font-family: var(--pixel-font);
  font-size: 0.72rem;
  color: #8ab3d5;
  text-transform: uppercase;
}

.inspect-card h2 {
  margin: 0 0 10px;
  font-family: var(--pixel-font);
  font-size: 1rem;
  color: #fff1b6;
  line-height: 1.4;
}

.inspect-card__detail {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.65;
}

.inspect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.inspect-tag {
  padding: 7px 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 18, 25, 0.66);
  color: #d7e4ef;
  font-size: 0.84rem;
}

.inspect-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--gold-deep);
  background: linear-gradient(180deg, #ebc86e, #b88628);
  color: #2b1a06;
  font-family: var(--pixel-font);
  font-size: 0.72rem;
  text-decoration: none;
  box-shadow: 0 4px 0 rgba(66, 37, 4, 0.5);
}

.inspect-link:hover,
.inspect-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.footer-note {
  margin-top: 16px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  background: rgba(16, 24, 34, 0.86);
}

.footer-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.footer-note a {
  color: #ffe3a7;
}

.noscript-banner {
  width: min(1240px, calc(100% - 24px));
  margin: 16px auto;
  padding: 12px 16px;
  border: 2px solid var(--danger);
  background: rgba(86, 34, 20, 0.92);
  color: #ffe8d9;
}

.inventory-error {
  padding: 24px;
  border: 2px solid var(--danger);
  background: rgba(78, 31, 19, 0.92);
  color: #ffe5d4;
}

.inventory-error p {
  margin: 8px 0 0;
}

@media (max-width: 1100px) {
  .inventory-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 12px, 100%);
    padding-top: 12px;
  }

  .topbar,
  .inventory-layout {
    padding: 12px;
  }

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

  .inspect-card {
    grid-template-columns: 1fr;
  }

  .inspect-card__icon-wrap {
    width: 92px;
  }
}
