  :root {
    --bg: #0f1221;
    --panel: #1b1f2e;
    --accent: #d4b66a;
    --muted: #9aa0b3;
    --slot-size: 72px;
    --gutter: 12px;
    --inventory-columns: 5;
    --wood: linear-gradient(180deg, #2c2418 0%, #1f170e 100%);
  }

  .inventory-app {
    margin: 0;
    /* background: radial-gradient(circle at 10% 10%, rgba(212, 182, 106, 0.06), transparent), var(--bg); */
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    /* color: #e6eef8; */
  }

  .inventory-wrap {
    /* max-width: 1200px; */
    padding: 20px;
    display: grid;
    /* three column layout for equip and details panels */
    /* grid-template-columns: 320px 1fr; */
    gap: 20px;
  }

  .panel {
    /* background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.12)); */
    border: 2px solid rgba(212, 182, 106, 0.12);
    border-radius: 12px;
    padding: 14px;
    /* box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6); */
  }

  /* Equipment column */
  .char-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 420px;
    position: relative;
    background: var(--wood);
    padding: 18px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.3)
  }

  .char-silhouette {
    width: 160px;
    height: 200px;
    background: linear-gradient(180deg, #0b1220, #132033);
    border-radius: 8px;
    /* box-shadow: inset 0 -20px 40px rgba(0, 0, 0, 0.6); */
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.06);
    font-size: 80px
  }

  .equip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    margin-top: 6px;
  }

  .equip-slot {
    height: 56px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.14));
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 8px;
    border: 2px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    position: relative;
    user-select: none;
  }

  .equip-slot .slot-name {
    font-size: 12px;
    color: var(--muted);
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em
  }

  .equip-slot .slot-item {
    min-width: 44px;
    height: 44px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }

  .equip-slot.empty {
    opacity: 0.6
  }

  .equip-slot.highlight {
    box-shadow: 0 0 18px rgba(212, 182, 106, 0.25);
    transform: translateY(-2px)
  }

  /* Inventory center */
  .inventory-panel {
    display: flex;
    flex-direction: column;
  }

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

  .inventory-title {
    font-size: 18px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.06em
  }

  .inventory-grid {
    display: grid;
    grid-template-columns: repeat(var(--inventory-columns), minmax(0, 1fr));
    gap: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.12));
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    min-height: 400px;
  }

  #inv-count {
    flex: 1;
    align-items: end;
    justify-content: end;
    display: flex;
  }

  .inv-slot {
    /* height: var(--slot-size); */
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.18));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    user-select: none;
    max-height: 256px;
  }

  .inv-slot.empty::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.01) 0 2px, transparent 2px 8px);
    opacity: 0.06
  }

  .item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: grab;
    width: 100%;
    height: 100%;
    padding: 6px;
    box-sizing: border-box;
    border-radius: 6px;
    text-align: center;
    color: wheat;

  }

  .item .icon {
    font-size: 26px;
    line-height: 1
  }

  .item .name {
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden
  }

  .item .qty {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 12px;
    color: #fff
  }

  .item.rare {
    box-shadow: 0 6px 18px rgba(132, 94, 64, 0.12);
    border: 1px solid rgba(212, 182, 106, 0.18)
  }

  .item.epic {
    box-shadow: 0 8px 26px rgba(107, 44, 132, 0.12);
    border: 1px solid rgba(130, 80, 190, 0.18)
  }

  .inv-slot.highlight,
  .equip-slot.drop-target {
    outline: 3px solid rgba(212, 182, 106, 0.18);
    transform: translateY(-2px)
  }

  /* Details/Actions */
  .details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 420px;
  }

  .card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.08));
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.02)
  }

  .item-preview {
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .item-preview .big {
    font-size: 48px;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center
  }

  .item-stats {
    font-size: 13px;
    color: #dfe9ff
  }

  .actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }

  button.btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 0;
    background: linear-gradient(180deg, #2a7a4b, #1b4f33);
    color: white;
    cursor: pointer;
    font-weight: 600
  }

  button.btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-weight: 600
  }

  button.btn.warn {
    background: linear-gradient(180deg, #b55b2b, #8a3516)
  }

  .log {
    font-size: 13px;
    color: var(--muted);
    min-height: 80px;
    overflow: auto;
    padding: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.01)
  }

  /* modal */
  .modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 60
  }

  .modal .box {
    width: 420px;
    background: var(--panel);
    padding: 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03)
  }

  .form-row {
    display: flex;
    gap: 8px;
    margin-top: 8px
  }

  input[type="text"],
  input[type="number"] {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    color: inherit
  }

  /* small */
  .muted {
    color: var(--muted);
    font-size: 13px
  }

  @media (max-width:960px) {
    .wrap {
      grid-template-columns: 1fr;
      padding: 12px
    }

    .char-panel,
    .details {
      order: 2
    }
  }

  /* inventory item rarities */
  /* TODO: better color scheme for rarirties */
  /* use all existing rare types, add a few more */
  /* add a style for .equipped and .equippable */
  /* Rarity borders and glows */
  .common {
    border: 3px solid #a0a0a0;
    box-shadow: 0 0 6px rgba(160, 160, 160, 0.4);
  }

  .uncommon {
    border: 3px solid #00ff22;
    box-shadow: 0 0 8px rgba(0, 255, 34, 0.5);
  }

  .rare {
    border: 3px solid #0070ff;
    box-shadow: 0 0 10px rgba(0, 112, 255, 0.6);
  }

  .epic {
    border: 3px solid #b400ff;
    box-shadow: 0 0 12px rgba(180, 0, 255, 0.7);
  }

  .legendary {
    border: 3px solid #ff9900;
    box-shadow: 0 0 14px rgba(255, 153, 0, 0.8);
  }

  .mythic {
    border: 3px solid #ff0033;
    box-shadow: 0 0 16px rgba(255, 0, 51, 0.9);
  }

  .exotic {
    border: 3px solid #00ffee;
    box-shadow: 0 0 14px rgba(0, 255, 238, 0.8);
  }

  .artifact {
    border: 3px solid #ffd700;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
  }

  /* Equipped & equippable states */
  .equipped {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.7);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  }

  .equippable {
    cursor: pointer;
    opacity: 0.95;
    transition: opacity 0.2s ease;
  }

  .equippable:hover {
    opacity: 1;
    filter: brightness(1.15);
  }

  /* Optional: make equipped items "pulse" */
  @keyframes equipped-pulse {
    0% {
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    50% {
      box-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
    }

    100% {
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
  }

  .equipped {
    animation: equipped-pulse 2s infinite ease-in-out;
  }

  .inventory-filters {
    display: flex;
    gap: 8px;
  }

  .sort-direction {
    padding: 0px;
    margin: 0px;
    border: none;
  }