.test-room-panel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(7, 8, 10, 0.52);
  pointer-events: auto;
}

.test-room-panel.active {
  display: flex;
}

.test-room-window {
  width: min(560px, 92vw);
  max-height: min(74vh, 560px);
  padding: 18px;
  border: 4px solid #2f3438;
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.96);
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.32);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.test-room-window * {
  touch-action: pan-y;
}

.test-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.test-room-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.test-room-copy {
  margin: 10px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.test-room-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.test-room-grid-section {
  display: contents;
}

.test-room-spawn-button {
  min-height: 92px;
  padding: 12px 10px;
  border: 3px solid #1c1c1c;
  border-radius: 6px;
  background: #31363d;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.42);
  color: #f4f0de;
  font-weight: 900;
  text-align: left;
  touch-action: pan-y;
}

.test-room-spawn-button.elite {
  border-color: #5a2424;
  background: #3a3131;
}

.test-room-spawn-button.chest {
  border-color: #4a3824;
  background: #332d26;
}

.test-room-spawn-button.chest.rare {
  border-color: #28536a;
  background: #27343d;
}

.test-room-spawn-button.chest.epic {
  border-color: #57316f;
  background: #332a3e;
}

.test-room-spawn-button.chest.mythic {
  border-color: #2f6a5f;
  background: #253936;
}

.test-room-spawn-button.chest.legendary {
  border-color: #8a6720;
  background: #3f3420;
}

.test-room-spawn-button span {
  display: block;
  margin-bottom: 6px;
  color: #ffffff;
  font-size: 0.96rem;
}

.test-room-spawn-button small {
  display: block;
  color: #c8c3b0;
  line-height: 1.45;
  font-size: 0.78rem;
  word-break: keep-all;
}

.inventory-panel {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(7, 8, 10, 0.58);
  pointer-events: auto;
}

.inventory-panel.active {
  display: flex;
}

.inventory-window {
  width: min(980px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 4px solid #1b1511;
  border-radius: 4px;
  background:
    linear-gradient(rgba(25, 23, 20, 0.96), rgba(16, 17, 18, 0.98)),
    repeating-linear-gradient(0deg, #28251f 0 8px, #22201c 8px 16px);
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.38), inset 0 0 0 3px rgba(255, 231, 163, 0.04);
  overflow: hidden;
}

.inventory-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inventory-header strong {
  font-size: 1.05rem;
}

.inventory-tabs {
  display: flex;
  gap: 8px;
  margin-right: auto;
}

.inventory-tab {
  min-height: 34px;
  padding: 0 14px;
  border: 3px solid #1b1b1b;
  border-radius: 4px;
  background: #2d2a25;
  color: #d7d0b8;
  font-weight: 900;
}

.inventory-tab.active {
  background: #c9a45c;
  color: #16110a;
}

.inventory-content {
  min-height: 0;
  display: none;
}

.inventory-content.active {
  display: block;
}

.rune-workspace.inventory-content.active {
  display: block;
}

.rune-workspace {
  --bag-panel-w: min(430px, 43vw);
  --detail-panel-w: min(232px, 25vw);
  position: relative;
  min-height: 0;
  height: min(390px, calc(100vh - 106px));
}

.rune-workspace.inventory-content {
  display: none;
}

.rune-workspace.inventory-content.active {
  display: block;
}

.weapon-rune-workspace {
  min-height: 0;
  position: relative;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 10px;
}

.weapon-rune-workspace.active {
  display: grid;
}

.hiyu-workspace {
  min-height: 0;
  height: min(390px, calc(100vh - 106px));
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 3px solid #18130f;
  border-radius: 4px;
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 208, 76, 0.08), transparent 22%),
    linear-gradient(rgba(38, 36, 31, 0.9), rgba(20, 21, 21, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 7px, transparent 7px 14px);
  overflow: hidden;
}

.hiyu-workspace.active {
  display: grid;
}

.inventory-codex-workspace {
  min-height: 0;
  height: min(390px, calc(100vh - 106px));
  grid-template-rows: auto minmax(0, 1fr);
  border: 3px solid #18130f;
  border-radius: 4px;
  background:
    radial-gradient(circle at 12% 16%, rgba(183, 140, 255, 0.08), transparent 22%),
    linear-gradient(rgba(38, 36, 31, 0.9), rgba(20, 21, 21, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 7px, transparent 7px 14px);
  overflow: hidden;
}

.inventory-codex-workspace.active {
  display: grid;
}

.inventory-codex-tabs {
  border-bottom: 2px solid rgba(247, 241, 208, 0.12);
}

.inventory-codex-body {
  min-height: 0;
}

.hiyu-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(247, 241, 208, 0.12);
}

.hiyu-panel-header strong {
  color: #ffffff;
  font-size: 1.18rem;
}

.hiyu-panel-header span {
  color: #b8b29a;
  font-size: 0.78rem;
  font-weight: 900;
}

.hiyu-stat-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 2px 4px 8px 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.hiyu-stat-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 72px;
  padding: 9px;
  border: 2px solid rgba(24, 19, 15, 0.96);
  border-left-color: var(--stat-accent);
  border-radius: 4px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--stat-accent) 12%, transparent), transparent 44%),
    rgba(16, 16, 15, 0.72);
  box-shadow: inset 0 0 0 1px rgba(247, 241, 208, 0.05);
}

.hiyu-stat-visual {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.hiyu-stat-icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.hiyu-stat-name {
  min-width: 0;
  color: #d8d1b8;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.18;
  word-break: keep-all;
}

.hiyu-stat-value {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

.weapon-rune-left-column {
  min-height: 0;
  display: grid;
  grid-template-rows: 64px minmax(138px, 1fr) minmax(124px, auto);
  gap: 8px;
}

.rune-board-panel,
.rune-list-panel,
.rune-detail-panel,
.weapon-rune-list-panel,
.weapon-owned-panel,
.weapon-info-panel,
.weapon-slots-panel {
  min-height: 0;
  border: 3px solid #18130f;
  border-radius: 4px;
  background:
    linear-gradient(rgba(38, 36, 31, 0.9), rgba(26, 27, 27, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 7px, transparent 7px 14px);
  padding: 10px;
}

.rune-board-panel {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--bag-panel-w);
  display: grid;
  grid-template-rows: auto 70px minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
}

.rune-list-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
}

.rune-detail-panel {
  position: absolute;
  z-index: 4;
  top: 38px;
  right: 0;
  bottom: 0;
  width: var(--detail-panel-w);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.rune-list-panel[aria-hidden="true"] {
  display: none;
}

.rune-detail-panel[aria-hidden="true"] {
  display: none;
}

.weapon-rune-list-panel,
.weapon-owned-panel,
.weapon-info-panel,
.weapon-slots-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
}

.weapon-rune-list-panel {
  grid-row: 1 / span 3;
  grid-column: 2;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.weapon-owned-panel,
.weapon-info-panel,
.weapon-slots-panel {
  grid-column: 1;
}

.weapon-owned-panel {
  grid-row: 1;
  padding: 8px;
  overflow: hidden;
}

.weapon-info-panel {
  grid-row: 2;
  grid-template-rows: minmax(0, 1fr);
  padding: 8px;
}

.weapon-info-panel > .rune-section-title {
  display: none;
}

.weapon-slots-panel {
  grid-row: 3;
  grid-template-rows: auto minmax(0, 1fr);
  padding-bottom: 10px;
  align-self: end;
  min-height: 124px;
}

.rune-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #f7f1d0;
  font-weight: 900;
}

.rune-list-panel > .rune-section-title {
  position: absolute;
  z-index: 2;
  top: 2px;
  left: calc(var(--bag-panel-w) + 18px);
  right: calc(var(--detail-panel-w) + 18px);
  justify-content: center;
  pointer-events: none;
}

.rune-section-title span {
  color: #b8b29a;
  font-size: 0.82rem;
}

.bag-synergy-bar {
  min-width: 0;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px 6px 8px;
  border: 2px solid rgba(24, 19, 15, 0.94);
  border-radius: 4px;
  background:
    linear-gradient(rgba(18, 17, 15, 0.9), rgba(28, 24, 20, 0.88)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 5px, transparent 5px 10px);
  box-shadow:
    inset 0 0 0 1px rgba(247, 241, 208, 0.08),
    inset 0 -8px 0 rgba(0, 0, 0, 0.16);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}

.bag-synergy-empty {
  color: rgba(247, 241, 208, 0.48);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.bag-synergy-chip {
  --synergy-color: #d6b48c;
  flex: 0 0 auto;
  width: 64px;
  height: 55px;
  display: grid;
  grid-template-rows: 30px 19px;
  place-items: center;
  border: 2px solid rgba(247, 241, 208, 0.18);
  border-radius: 5px;
  background: rgba(16, 16, 15, 0.76);
  color: rgba(247, 241, 208, 0.48);
  filter: grayscale(1) saturate(0.12) brightness(0.66);
  touch-action: manipulation;
}

.bag-synergy-chip.active {
  border-color: var(--synergy-color);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 0 10px color-mix(in srgb, var(--synergy-color) 42%, transparent);
  color: #ffffff;
  filter: grayscale(0) saturate(1.08) brightness(1);
}

.bag-synergy-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid #111116;
  border-radius: 4px;
  background: color-mix(in srgb, var(--synergy-color) 52%, #23201c);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.bag-synergy-label {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
}

.bag-synergy-name {
  min-width: 0;
  overflow: hidden;
  color: currentColor;
  font-size: 0.53rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bag-synergy-icon img,
.item-synergy-token-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
}

.bag-synergy-count {
  color: currentColor;
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.item-synergy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 4px;
}

.item-synergy-token {
  --synergy-color: #d6b48c;
  width: 48px;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  touch-action: manipulation;
}

.item-synergy-token.compact {
  width: 36px;
  gap: 2px;
}

.item-synergy-token.compact .item-synergy-token-icon {
  width: 21px;
  height: 21px;
  border-width: 1px;
}

.item-synergy-token.compact .item-synergy-token-name {
  font-size: 0.49rem;
}

.item-synergy-token-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid #111116;
  border-radius: 4px;
  background: color-mix(in srgb, var(--synergy-color) 62%, #24211c);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.item-synergy-token-name {
  max-width: 100%;
  color: rgba(247, 241, 208, 0.78);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  word-break: keep-all;
}

.floor-synergy-list {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 5px;
  pointer-events: none;
}

.synergy-info-popup {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.42);
}

.synergy-info-popup.active {
  display: grid;
}

.synergy-info-card {
  width: min(420px, 88vw);
  max-height: min(78vh, 430px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 4px solid #17110d;
  border-radius: 6px;
  background:
    linear-gradient(rgba(38, 34, 28, 0.98), rgba(18, 18, 17, 0.98)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 6px, transparent 6px 12px);
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.38), inset 0 0 0 2px rgba(247, 241, 208, 0.08);
  color: #f7f1d0;
}

.synergy-info-close {
  justify-self: end;
}

.synergy-info-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.synergy-info-icon {
  --synergy-color: #d6b48c;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid #111116;
  border-radius: 5px;
  background: color-mix(in srgb, var(--synergy-color) 48%, #23201c);
  font-weight: 900;
}

.synergy-info-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
}

.synergy-info-heading strong {
  display: block;
  color: #ffffff;
  font-size: 1.05rem;
  line-height: 1.1;
}

.synergy-info-heading span {
  display: block;
  margin-top: 4px;
  color: rgba(247, 241, 208, 0.62);
  font-size: 0.68rem;
  font-weight: 900;
}

.synergy-info-text {
  margin: 0;
  color: rgba(247, 241, 208, 0.78);
  font-size: 0.78rem;
  line-height: 1.45;
}

.synergy-info-thresholds {
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow-y: auto;
  padding-right: 4px;
}

.synergy-info-thresholds div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 2px solid rgba(247, 241, 208, 0.08);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
}

.synergy-info-thresholds strong {
  color: #ffffff;
  font-size: 0.76rem;
}

.synergy-info-thresholds span {
  color: rgba(247, 241, 208, 0.84);
  font-size: 0.76rem;
  line-height: 1.35;
}

.rune-board {
  --bag-w: 390;
  --bag-h: 260;
  position: relative;
  width: min(100%, 368px);
  aspect-ratio: var(--bag-w) / var(--bag-h);
  margin: 0 auto;
  border: 5px solid #120f0d;
  border-radius: 6px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 232, 166, 0.08), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 38%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 3px, transparent 3px 12px),
    #201a14;
  box-shadow:
    inset 0 0 0 4px rgba(201, 164, 92, 0.12),
    inset 0 -16px 0 rgba(0, 0, 0, 0.16);
  touch-action: none;
}

.rune-board::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(247, 241, 208, 0.14);
  border-radius: 4px;
  pointer-events: none;
}

.rune-piece {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: none;
  user-select: none;
  transform-origin: 50% 50%;
}

.rune-piece.placed,
.rune-piece.preview {
  position: absolute;
}

.rune-item-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.rune-piece.preview {
  z-index: 4;
  pointer-events: none;
  opacity: 0.72;
}

.rune-piece.preview.invalid {
  filter: grayscale(0.35) sepia(0.6) hue-rotate(315deg) brightness(0.82);
}

.rune-piece.selected {
  z-index: 12;
  filter: drop-shadow(0 0 0 #ffffff) drop-shadow(0 0 8px rgba(255, 255, 255, 0.78));
}

.rune-piece.selected.valid {
  filter: drop-shadow(0 0 0 #ffffff) drop-shadow(0 0 7px rgba(255, 255, 255, 0.54)) drop-shadow(0 0 12px rgba(82, 255, 128, 0.82));
}

.rune-piece.selected.invalid {
  filter: drop-shadow(0 0 0 #ffffff) drop-shadow(0 0 7px rgba(255, 255, 255, 0.5)) drop-shadow(0 0 12px rgba(255, 64, 64, 0.86));
}

.rune-block {
  margin: 1px;
  border: 2px solid rgba(0, 0, 0, 0.62);
  border-radius: 4px;
  background: var(--rune-color, #ffd34d);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.15),
    inset 0 -5px 0 rgba(0, 0, 0, 0.18);
}

.rune-piece.placed {
  z-index: 3;
  pointer-events: auto;
}

.item-name-with-level,
.weapon-rune-slot-name-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  vertical-align: middle;
}

.item-name-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-level-badge {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(247, 241, 208, 0.62);
  background:
    linear-gradient(135deg, #f6e4a2, #c9a45c 52%, #8d6231);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.26),
    0 1px 0 rgba(0, 0, 0, 0.5);
  color: #17130d;
  font-size: 0.54rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: none;
  transform: rotate(45deg);
}

.item-level-badge > span {
  display: block;
  color: #17130d;
  line-height: 1;
  transform: rotate(-45deg);
}

.rune-piece-level {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: -14px;
  width: 13px;
  height: 13px;
  opacity: 0.56;
  font-size: 0.46rem;
  pointer-events: none;
  transform: translateX(-50%) rotate(calc(var(--rune-counter-rotation, 0deg) + 45deg));
}

.rune-piece.selected .rune-piece-level {
  z-index: 13;
  opacity: 0.88;
}

.rune-piece.dragging-source {
  opacity: 0.22;
}

.rune-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: grid;
  gap: 9px;
  padding-right: 4px;
}

.rune-list.floor-drop-list {
  position: absolute;
  z-index: 1;
  top: 38px;
  bottom: 0;
  left: calc(var(--bag-panel-w) + 18px);
  right: calc(var(--detail-panel-w) + 18px);
  min-height: 0;
  overflow: hidden;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.04), transparent 20%),
    radial-gradient(circle at 70% 60%, rgba(0, 0, 0, 0.1), transparent 26%);
}

.floor-drop-item {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 70px;
  min-height: 62px;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #f7f1d0;
  text-align: center;
  touch-action: manipulation;
}

.floor-drop-item:active {
  filter: brightness(1.25);
}

.floor-drop-item > span {
  max-width: 72px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.56);
  color: #e7dfc6;
  font-size: 0.62rem;
  line-height: 1.15;
  word-break: keep-all;
}

.weapon-rune-list,
.weapon-owned-list {
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  padding-right: 4px;
}

.weapon-owned-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  min-height: 46px;
}

.weapon-rune-list {
  display: contents;
}

.weapon-rune-block {
  min-height: 0;
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr);
}

.weapon-rune-block-title {
  color: #f7f1d0;
  font-weight: 900;
  font-size: 0.9rem;
}

.weapon-rune-empty {
  padding: 10px 8px;
  border: 2px dashed rgba(247, 241, 208, 0.1);
  border-radius: 4px;
  color: #b8b29a;
  font-size: 0.76rem;
  text-align: center;
}

.weapon-rune-owned-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  touch-action: pan-y;
}

.weapon-rune-floor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  touch-action: pan-y;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.weapon-floor-rune-item {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  place-items: center;
  min-height: 66px;
  padding: 5px 4px;
  border: 3px solid #181a1e;
  border-radius: 4px;
  background: #2d2a25;
  color: #f7f1d0;
  text-align: center;
  touch-action: manipulation;
}

.weapon-floor-rune-item.active {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.rune-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 9px;
  border: 3px solid #181a1e;
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 48%),
    #2d2a25;
  color: #f7f1d0;
  text-align: left;
  touch-action: pan-y;
}

.rune-list-item.selected {
  border-color: #f7f1d0;
  box-shadow: inset 0 0 0 2px rgba(247, 241, 208, 0.18);
}

.weapon-rune-item,
.weapon-owned-button,
.weapon-rune-slot {
  display: grid;
  gap: 5px;
  min-height: 54px;
  padding: 8px;
  border: 3px solid #181a1e;
  border-radius: 4px;
  background: #2d2a25;
  color: #f7f1d0;
  text-align: left;
  touch-action: manipulation;
}

.weapon-rune-item {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  place-items: center;
  width: auto;
  min-height: 66px;
  padding: 5px 4px;
  text-align: center;
}

.weapon-rune-item.equipped {
  opacity: 0.46;
}

.weapon-rune-item.active,
.weapon-rune-slot.active {
  border-color: #ffffff;
  box-shadow:
    inset 0 0 0 2px rgba(247, 241, 208, 0.16),
    0 0 0 2px rgba(255, 255, 255, 0.12);
}

.weapon-rune-swatch {
  width: 28px;
  aspect-ratio: 1;
  border: 3px solid rgba(0, 0, 0, 0.55);
  border-radius: 3px;
  background: var(--rune-color, #ffd34d);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.weapon-rune-icon-canvas {
  display: block;
  image-rendering: pixelated;
  pointer-events: none;
}

.weapon-rune-card-name {
  display: block;
  max-width: 100%;
  color: #f7f1d0;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.12;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.weapon-owned-button {
  flex: 0 0 72px;
  width: 72px;
  min-width: 72px;
  min-height: 44px;
  height: 44px;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 2px 6px;
}

.weapon-owned-button.active,
.weapon-rune-slot.filled {
  border-color: #f7f1d0;
  box-shadow: inset 0 0 0 2px rgba(247, 241, 208, 0.16);
}

.weapon-owned-button canvas {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.weapon-rune-preview-canvas {
  display: none;
}

.weapon-rune-info {
  min-height: 0;
  overflow-y: auto;
  color: #d8d1b8;
  font-size: 0.68rem;
  line-height: 1.34;
  touch-action: pan-y;
  display: grid;
  grid-template-columns: minmax(82px, 0.34fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.weapon-info-visual {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  gap: 6px;
}

.weapon-info-name {
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
  word-break: keep-all;
}

.weapon-info-icon {
  width: min(82px, 100%);
  height: auto;
  image-rendering: pixelated;
}

.weapon-info-detail {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  align-content: start;
}

.weapon-info-detail span {
  display: block;
  color: #d8d1b8;
  word-break: keep-all;
}

.weapon-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.weapon-action-button {
  min-width: 52px;
  min-height: 28px;
  padding: 4px 6px;
  border: 2px solid rgba(24, 19, 15, 0.95);
  border-radius: 3px;
  background: rgba(35, 31, 26, 0.9);
  color: #d8d1b8;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(247, 241, 208, 0.05);
  text-shadow: 0 2px 0 #000;
}

.weapon-action-button.active {
  border-color: #f7f1d0;
  background: #c9a45c;
  color: #18130f;
  text-shadow: none;
}

.weapon-action-content {
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
  display: grid;
  align-content: start;
  gap: 5px;
}

.weapon-action-title {
  color: #ffffff;
  font-size: 0.76rem;
  line-height: 1.12;
  text-shadow: 0 2px 0 #000;
}

.weapon-action-summary {
  margin: 0;
  color: #d8d1b8;
  font-size: 0.66rem;
  line-height: 1.32;
  word-break: keep-all;
}

.weapon-action-meta {
  color: #c9a45c;
  font-size: 0.61rem;
  font-weight: 900;
}

.weapon-damage-list {
  display: grid;
  gap: 5px;
}

.weapon-damage-empty {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(247, 241, 208, 0.14);
  background: rgba(12, 12, 11, 0.35);
  color: #9c9584;
  font-size: 0.62rem;
}

.weapon-damage-row {
  display: grid;
  gap: 4px;
}

.weapon-damage-button {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 2px solid rgba(20, 16, 12, 0.92);
  border-radius: 3px;
  background: rgba(12, 12, 11, 0.58);
  color: #efe9d0;
  text-align: left;
}

.weapon-damage-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d8d1b8;
  font-size: 0.61rem;
  font-weight: 800;
}

.weapon-damage-button strong {
  color: #ffe76a;
  font-size: 0.74rem;
  font-weight: 1000;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

.weapon-damage-row.show-tags .weapon-damage-button {
  border-color: #ffe76a;
  box-shadow: inset 0 0 0 1px rgba(255, 231, 106, 0.18);
}

.weapon-damage-tags {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  border-left: 2px solid rgba(255, 231, 106, 0.35);
  background: rgba(6, 6, 6, 0.36);
}

.weapon-damage-row.show-tags .weapon-damage-tags {
  display: flex;
}

.weapon-damage-tags em {
  padding: 3px 5px;
  border: 1px solid rgba(247, 241, 208, 0.18);
  background: rgba(247, 241, 208, 0.08);
  color: #f7f1d0;
  font-style: normal;
  font-size: 0.56rem;
  line-height: 1;
}

.weapon-damage-tags small {
  flex-basis: 100%;
  color: #bcb49d;
  font-size: 0.57rem;
  line-height: 1.28;
}

.weapon-rune-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.weapon-rune-slot {
  min-height: 76px;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: stretch center;
  text-align: center;
  background: #22211e;
  padding: 5px;
}

.weapon-rune-slot-frame {
  width: min(100%, 54px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 2px solid rgba(247, 241, 208, 0.08);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.2);
}

.weapon-rune-slot-name {
  display: block;
  width: 100%;
  min-height: 1.9em;
  color: #f7f1d0;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 0.95;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.weapon-rune-slot small,
.weapon-rune-item small,
.weapon-owned-button small {
  display: block;
  color: #c8c3b0;
  font-size: 0.68rem;
  line-height: 1.25;
}

.rune-list .rune-piece {
  touch-action: pan-y;
}

.rune-list-item strong,
.rune-list-item small {
  display: block;
  word-break: keep-all;
}

.rune-list-item small {
  margin-top: 3px;
  color: #c8c3b0;
  line-height: 1.35;
  font-size: 0.76rem;
}

.rune-effects {
  min-width: 0;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  margin-top: 0;
  padding: 10px;
  border: 2px solid rgba(20, 16, 12, 0.9);
  border-radius: 4px;
  background:
    linear-gradient(rgba(18, 18, 16, 0.92), rgba(11, 11, 10, 0.9)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 7px, transparent 7px 14px);
  color: #d8d1b8;
  font-size: 0.76rem;
  line-height: 1.4;
  overflow-y: auto;
  word-break: keep-all;
  touch-action: pan-y;
}

.weapon-rune-list-panel > .weapon-rune-effects {
  display: block;
  flex: 0 0 auto;
  grid-column: 1 / span 2;
}

.weapon-rune-list-panel > #weaponRuneList {
  min-height: 0;
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.rune-effects strong {
  color: #ffffff;
}

.rune-effects span {
  color: #c9a45c;
}

.rune-effects .item-level-badge > span,
.weapon-rune-card-name .item-level-badge > span,
.weapon-rune-slot-name .item-level-badge > span,
.floor-drop-item .item-level-badge > span,
.floor-item-hint .item-level-badge > span {
  color: #17130d;
}

.weapon-rune-effects-separator {
  height: 1px;
  margin: 7px 0;
  background: rgba(247, 241, 208, 0.14);
}

.use-bag-item-button {
  position: static;
  z-index: auto;
  width: 100%;
  min-height: 34px;
  display: none;
  justify-content: center;
  padding: 0 12px;
  background: rgba(239, 233, 208, 0.16);
  color: #ffffff;
  font-weight: 900;
}

.use-bag-item-button.active {
  display: flex;
}

.rune-rotate-button {
  --handle-angle: 0deg;
  position: fixed;
  z-index: 9;
  display: none;
  left: max(28px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 66px;
  height: 66px;
  min-width: 66px;
  min-height: 66px;
  padding: 0;
  border: 3px solid #111;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #262019 0 35%, transparent 36%),
    conic-gradient(from -90deg, rgba(247, 241, 208, 0.94), #c9a45c, #7d6840, #c9a45c, rgba(247, 241, 208, 0.94));
  color: transparent;
  font-weight: 1000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.48);
  pointer-events: auto;
  touch-action: none;
}

.rune-rotate-button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px solid rgba(0, 0, 0, 0.58);
  border-radius: 50%;
  background: rgba(20, 18, 15, 0.74);
}

.rune-rotate-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(82, 191, 255, 0.35);
  transform: translate(-50%, -50%) rotate(var(--handle-angle)) translateY(-25px);
  transform-origin: 50% 50%;
}

.rune-place-particle {
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: var(--particle-size, 6px);
  height: var(--particle-size, 6px);
  border: 2px solid rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  background: var(--particle-color, #ffd34d);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: runePlaceBurst 0.46s ease-out forwards;
}

@keyframes runePlaceBurst {
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.35);
  }
}

.rune-rotate-button.active {
  display: block;
}

.bag-move-joystick {
  position: fixed;
  z-index: 9;
  right: max(34px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  display: none;
  width: 104px;
  height: 104px;
  border: 3px solid rgba(10, 10, 10, 0.8);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.07) 0 23%, transparent 24%),
    rgba(23, 23, 22, 0.72);
  box-shadow: inset 0 0 0 3px rgba(247, 241, 208, 0.08), 0 4px 0 rgba(0, 0, 0, 0.42);
  pointer-events: auto;
  touch-action: none;
}

.bag-move-joystick.active {
  display: block;
}

.bag-move-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid rgba(10, 10, 10, 0.82);
  border-radius: 50%;
  background: rgba(247, 241, 208, 0.86);
  box-shadow: 0 0 0 3px rgba(82, 191, 255, 0.18);
}

.rune-drag-ghost {
  position: fixed;
  z-index: 8;
  display: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.3));
}

.rune-drag-ghost.active {
  display: block;
}
