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

html, body {
  width: 100%;
  height: 100%;
}

body {
  background: #111;
  color: #e8e8e8;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  position: fixed;
  inset: 0;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: #0b0f14;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}


.hidden {
  display: none !important;
}

.panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
}

.panel-window {
  width: min(1180px, 96vw);
  max-height: 90vh;
  background: rgba(12, 16, 22, 0.96);
  border: 1px solid #4a5568;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(0,0,0,0.45);
  display: grid;
  gap: 18px;
  padding: 18px;
}

.inventory-window {
  grid-template-columns: 260px 1fr;
}

.chest-window {
  grid-template-columns: 1fr;
  width: min(820px, 94vw);
}

.panel-column h2, .panel-column h3 {
  margin-bottom: 10px;
  color: #ffd166;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#inventory-capacity {
  color: #cbd5e1;
  font-size: 14px;
}

.equipment-slots, .inventory-grid {
  display: grid;
  gap: 10px;
}

.equipment-slots {
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}

.inventory-grid {
  grid-template-columns: repeat(4, minmax(84px, 1fr));
}

.slot-btn {
  background: #1a2230;
  border: 1px solid #475569;
  color: #e5e7eb;
  border-radius: 10px;
  min-height: 84px;
  padding: 8px;
  cursor: pointer;
  position: relative;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.slot-btn.empty {
  cursor: default;
  opacity: 0.72;
}

.slot-btn:hover:not(.empty), .slot-btn.selected {
  border-color: #ffd166;
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.25);
}

.slot-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
}

.slot-name {
  font-size: 13px;
  line-height: 1.3;
}

.slot-stack {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 12px;
  color: #ffd166;
}

.rarity-common { border-color: #6b7280; }
.rarity-uncommon { border-color: #22c55e; }
.rarity-rare { border-color: #3b82f6; }
.rarity-epic { border-color: #a855f7; }
.rarity-legendary { border-color: #f59e0b; }

.item-details {
  min-height: 280px;
  background: #121a25;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.item-details.empty {
  color: #94a3b8;
}

.item-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-actions {
  margin-top: 14px;
  min-height: 52px;
  align-items: center;
}

.floating-item-card {
  position: fixed;
  z-index: 45;
  width: min(340px, calc(100vw - 24px));
  max-width: 340px;
  border-radius: 14px;
  border: 1px solid rgba(255, 209, 102, 0.38);
  background: rgba(10, 14, 20, 0.78);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  overflow: hidden;
}

.floating-item-card.compare {
  border-color: rgba(96, 165, 250, 0.45);
}

.floating-item-card-content {
  padding: 12px 14px 13px;
}

.floating-item-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 9px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.14);
  color: #ffe08a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floating-item-card.compare .floating-item-badge {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
}

.floating-item-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
}

.floating-item-meta {
  margin: 0 0 10px;
  color: #cbd5e1;
  font-size: 12px;
}

.floating-item-description {
  margin: 0 0 10px;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.4;
}

.floating-item-lines {
  display: grid;
  gap: 6px;
}

.floating-item-line {
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.35;
}

.floating-item-empty {
  color: #94a3b8;
}

.floating-rarity-common { border-color: rgba(107, 114, 128, 0.55); }
.floating-rarity-uncommon { border-color: rgba(34, 197, 94, 0.55); }
.floating-rarity-rare { border-color: rgba(59, 130, 246, 0.6); }
.floating-rarity-epic { border-color: rgba(168, 85, 247, 0.62); }
.floating-rarity-legendary { border-color: rgba(245, 158, 11, 0.7); }

.action-btn, .small-btn {
  border: 1px solid #64748b;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.action-btn:hover, .small-btn:hover {
  border-color: #ffd166;
}

.stats-box {
  background: #121a25;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
}

.stats-list {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.item-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.item-meta {
  color: #94a3b8;
  margin-bottom: 10px;
}

.item-stat-line {
  color: #e2e8f0;
}


#game {
  touch-action: none;
}


#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud-panel {
  background: rgba(7, 11, 16, 0.56);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(4px);
}

#hud-top-left {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  min-width: 286px;
  width: min(388px, calc(100vw - 132px));
  padding: 9px 10px;
  pointer-events: none;
}

.hud-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.hud-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 209, 102, 0.34);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hud-level-badge span {
  color: #ffd166;
  font-size: 15px;
}

.hud-status-icons {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.hud-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(100, 116, 139, 0.34);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}

.hud-status-pill .status-turns {
  color: #94a3b8;
  font-size: 10px;
}

.hud-status-empty {
  opacity: 0.5;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.hud-bar-card {
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.64);
  border: 1px solid rgba(100, 116, 139, 0.28);
}

.hud-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.hud-label,
.hud-chip-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffd166;
}

.hud-value {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
}

.hud-bar-track {
  position: relative;
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.hud-bar-track-thin {
  height: 6px;
}


#low-hp-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.18s ease;
  background:
    radial-gradient(circle at center,
      rgba(255, 40, 40, 0) 46%,
      rgba(255, 40, 40, 0.06) 64%,
      rgba(160, 0, 0, 0.16) 82%,
      rgba(70, 0, 0, 0.34) 100%);
  mix-blend-mode: screen;
}

#low-hp-vignette.is-danger {
  background:
    radial-gradient(circle at center,
      rgba(255, 40, 40, 0) 42%,
      rgba(255, 40, 40, 0.08) 60%,
      rgba(170, 0, 0, 0.22) 80%,
      rgba(80, 0, 0, 0.42) 100%);
}

#low-hp-vignette.is-critical {
  background:
    radial-gradient(circle at center,
      rgba(255, 40, 40, 0) 38%,
      rgba(255, 60, 60, 0.1) 56%,
      rgba(190, 0, 0, 0.28) 78%,
      rgba(90, 0, 0, 0.5) 100%);
}

.hud-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.16s ease, left 0.16s ease, opacity 0.16s ease;
}

.hp-track {
  position: relative;
}

.hp-shield-fill {
  position: absolute;
  top: 1px;
  height: calc(100% - 2px);
  left: 0%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(203,213,225,0.85), rgba(148,163,184,0.98));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22), 0 0 8px rgba(226,232,240,0.16);
  opacity: 0;
  z-index: 2;
}

.hp-fill {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.mana-fill {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.xp-fill {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.compact-info {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.30);
  background: rgba(15, 23, 42, 0.50);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
}

#hud-top-right {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(136px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  padding: 8px;
  pointer-events: auto;
}

.hud-button-dock {
  align-items: center;
}

.hud-icon-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background:
    linear-gradient(180deg, rgba(51, 65, 85, 0.98), rgba(15, 23, 42, 0.96));
  color: #f8fafc;
  cursor: pointer;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 10px 18px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.hud-btn-icon {
  font-size: 22px;
}

.hud-icon-btn:hover {
  border-color: #ffd166;
  background:
    linear-gradient(180deg, rgba(71, 85, 105, 0.98), rgba(30, 41, 59, 0.98));
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 12px 22px rgba(0, 0, 0, 0.28);
}

.hud-icon-btn.is-disabled {
  opacity: 0.75;
}

.hud-btn-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.34);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#inventory-button.is-full .hud-btn-badge {
  border-color: rgba(248, 113, 113, 0.7);
  color: #fecaca;
}

#hud-quickbar {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 10px;
  padding: 10px;
  pointer-events: auto;
}

.quick-slot {
  position: relative;
  min-width: 86px;
  min-height: 96px;
  padding: 10px 9px 11px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.94));
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 12px 24px rgba(0,0,0,0.22);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.quick-slot:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 14px 28px rgba(0,0,0,0.28);
}

.quick-slot-label {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.quick-slot-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.30));
}

.quick-slot-name {
  width: 100%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  color: #e2e8f0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-slot-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.34);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.quick-slot.is-empty {
  border-color: rgba(100, 116, 139, 0.28);
}

.quick-slot.is-empty .quick-slot-icon,
.quick-slot.is-empty .quick-slot-name,
.quick-slot.is-empty .quick-slot-badge {
  filter: grayscale(1);
  opacity: 0.56;
}

.quick-slot.is-ready.quick-slot-accessory {
  border-color: rgba(168, 85, 247, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 1px rgba(168, 85, 247, 0.10),
    0 14px 28px rgba(0,0,0,0.24);
}

.quick-slot.is-cooldown.quick-slot-accessory {
  border-color: rgba(250, 204, 21, 0.72);
}

.quick-slot-health:not(.is-empty) {
  border-color: rgba(239, 68, 68, 0.55);
}

.quick-slot-mana:not(.is-empty) {
  border-color: rgba(59, 130, 246, 0.55);
}

.quick-slot-health .quick-slot-badge {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
}

.quick-slot-mana .quick-slot-badge {
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.45);
}

.quick-slot-accessory .quick-slot-badge {
  color: #e9d5ff;
  border-color: rgba(192, 132, 252, 0.48);
}

#hud-log {
  position: absolute;
  left: calc(14px + env(safe-area-inset-left));
  bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: min(560px, calc(100vw - 28px));
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.88);
  pointer-events: none;
}

#log {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 2px 0;
}

.log-entry {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-weight: 700;
}

.log-entry.log-oldest {
  opacity: 0.30;
}

.log-entry.log-older {
  opacity: 0.48;
}

.log-entry.log-recent {
  opacity: 0.72;
}

.log-entry.log-current {
  opacity: 1;
}

.log-entry.log-kind-neutral {
  color: #f8fafc;
}

.log-entry.log-kind-loot {
  color: #fcd34d;
}

.log-entry.log-kind-progress {
  color: #86efac;
}

.log-entry.log-kind-danger {
  color: #fca5a5;
}

.log-entry.log-kind-info {
  color: #93c5fd;
}


#hud-top-center {
  display: none;
}

.run-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.run-cards-header-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  padding: 0;
}

.run-cards-header-btn:hover .run-cards-title,
.run-cards-header-btn:hover .run-cards-count {
  filter: brightness(1.08);
}

.run-cards-open-mini {
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


.run-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.run-cards-title,
.run-cards-count {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.run-cards-title { color: #ffd166; }
.run-cards-count { color: #cbd5e1; }

.run-cards-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.run-card-empty {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.30);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.36);
}

.run-card-chip {
  position: relative;
  min-width: 110px;
  min-height: 58px;
  padding: 8px 9px 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
  color: #f8fafc;
  text-align: left;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-areas:
    "icon name"
    "icon meta";
  column-gap: 8px;
  row-gap: 3px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 16px rgba(0,0,0,0.16);
}

.run-card-chip:hover,
.run-card-chip.is-selected {
  border-color: rgba(255, 209, 102, 0.72);
  transform: translateY(-1px);
}

.run-card-chip-icon {
  grid-area: icon;
  align-self: center;
  justify-self: center;
  font-size: 23px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.28));
}

.run-card-chip-name {
  grid-area: name;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-card-chip-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.run-card-chip-level,
.run-card-chip-tags {
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
}

.run-card-chip-level {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
}

.run-card-chip-tags {
  opacity: 0.82;
}

.run-card-popup {
  width: min(360px, calc(100vw - 24px));
  max-width: 360px;
}

.card-detail-tags,
.card-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.card-tag,
.card-meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}

.card-detail-section-title {
  margin: 10px 0 6px;
  color: #ffd166;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-detail-list {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #e2e8f0;
}

.card-detail-note {
  margin-top: 10px;
  color: #93c5fd;
  font-size: 12px;
  line-height: 1.4;
}


.run-cards-panel-window {
  width: min(1020px, 96vw);
  max-height: 90vh;
  grid-template-columns: 1fr;
}

.run-cards-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
}

.run-card-panel-item {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(8, 11, 18, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 32px rgba(0,0,0,0.18);
  padding: 14px;
}

.run-card-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.run-card-panel-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255,255,255,0.06);
}

.run-card-panel-name-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.run-card-panel-name {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
}

.run-card-panel-level {
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
}

.run-card-panel-item .card-detail-meta,
.run-card-panel-item .card-detail-tags {
  margin-bottom: 8px;
}

.run-cards-panel-empty {
  min-height: 160px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-weight: 700;
  background: rgba(15,23,42,0.42);
}


.statue-offer-window {
  width: min(1080px, 96vw);
  grid-template-columns: 1fr;
}

.statue-offer-subtitle {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 14px;
}

.statue-offer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.statue-offer-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: linear-gradient(180deg, rgba(18, 26, 37, 0.96), rgba(10, 14, 20, 0.96));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.26);
}

.statue-offer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.statue-offer-icon {
  font-size: 30px;
}

.statue-offer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.statue-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.statue-badge.rarity { background: rgba(255, 209, 102, 0.12); color: #ffe08a; }
.statue-badge.upgrade { background: rgba(96, 165, 250, 0.12); color: #93c5fd; }
.statue-badge.new { background: rgba(134, 239, 172, 0.12); color: #86efac; }
.statue-badge.max { background: rgba(244, 114, 182, 0.12); color: #f9a8d4; }

.statue-offer-name {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.statue-offer-type {
  color: #cbd5e1;
  font-size: 13px;
}

.statue-offer-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.statue-offer-button {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 209, 102, 0.36);
  background: linear-gradient(180deg, rgba(51, 65, 85, 0.96), rgba(15, 23, 42, 0.96));
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.statue-offer-button:hover {
  border-color: rgba(255, 209, 102, 0.72);
}

.statue-offer-card.rarity-common { border-color: rgba(107, 114, 128, 0.52); }
.statue-offer-card.rarity-uncommon { border-color: rgba(34, 197, 94, 0.55); }
.statue-offer-card.rarity-rare { border-color: rgba(59, 130, 246, 0.58); }
.statue-offer-card.rarity-legendary { border-color: rgba(245, 158, 11, 0.68); }

.card-synergy-callout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 215, 96, 0.08), rgba(120, 82, 0, 0.06));
  border: 1px solid rgba(255, 215, 96, 0.18);
  margin-top: 8px;
}

.card-synergy-callout.compact {
  margin-top: 4px;
}

.card-synergy-icon-box,
.statue-offer-synergy-iconbox {
  width: 34px;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 232, 163, 0.08);
  border: 2px solid rgba(255, 215, 96, 0.6);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.18), 0 0 10px rgba(255, 193, 7, 0.12);
  animation: synergyBorderPulse 1.25s ease-in-out infinite alternate;
}

.card-synergy-icon,
.statue-offer-synergy-icon {
  color: #ffe38a;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 215, 96, 0.3));
}

.card-synergy-copy,
.statue-offer-synergy-copy {
  min-width: 0;
}

.card-synergy-label,
.statue-offer-synergy-label {
  color: #ffe7a6;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-synergy-text,
.statue-offer-synergy-text {
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
}

@keyframes synergyBorderPulse {
  0% {
    border-color: rgba(255, 241, 184, 0.95);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.18), 0 0 10px rgba(255, 228, 138, 0.14);
  }
  100% {
    border-color: rgba(194, 134, 0, 0.95);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.18), 0 0 16px rgba(194, 134, 0, 0.22);
  }
}

.statue-offer-card.has-synergy {
  box-shadow: 0 18px 34px rgba(0,0,0,0.26), 0 0 0 1px rgba(255, 215, 96, 0.12), 0 0 22px rgba(255, 193, 7, 0.1);
}

.statue-offer-synergy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 215, 96, 0.09), rgba(120, 82, 0, 0.05));
  border: 1px solid rgba(255, 215, 96, 0.18);
}

@media (max-width: 900px) {
  #hud-top-left {
    width: min(340px, calc(100vw - 24px));
    min-width: 0;
  }

  .hud-status-icons {
    justify-content: flex-start;
  }

  .compact-info {
    gap: 6px;
  }

  .hud-chip {
    font-size: 11px;
  }

  #hud-log {
    max-width: calc(100vw - 24px);
    font-size: 13px;
  }
}


@media (max-width: 860px) {
  #hud-top-left {
    width: min(320px, calc(100vw - 24px));
    min-width: 0;
  }

  #hud-quickbar {
    right: 10px;
    bottom: 10px;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .quick-slot {
    min-width: 72px;
    min-height: 84px;
    padding: 8px 7px 9px;
  }

  .quick-slot-icon {
    font-size: 24px;
  }

  .quick-slot-name {
    font-size: 10px;
  }

  #hud-log {
    max-width: min(420px, calc(100vw - 24px));
    bottom: 108px;
  }
}


.hud-icon-btn,
.quick-slot,
.action-btn,
.small-btn,
.slot-btn {
  touch-action: manipulation;
}

@media (max-width: 760px) {
  .floating-item-card {
    width: min(340px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-width: min(340px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .panel-actions {
    margin-top: 10px;
  }
}

@media (pointer: coarse) {
  .hud-icon-btn {
    width: 56px;
    height: 56px;
  }

  .quick-slot {
    min-width: 90px;
    min-height: 102px;
  }
}

@media (max-width: 980px) {
  .inventory-window {
    grid-template-columns: 1fr 1.15fr;
  }
}

@media (max-width: 760px) {
  .panel-overlay {
    align-items: flex-start;
    overflow: auto;
  }

  .panel-window {
    width: min(96vw, 620px);
    max-height: none;
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 14px;
    gap: 14px;
  }

  .inventory-window,
  .chest-window {
    grid-template-columns: 1fr;
  }

  .inventory-grid {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    gap: 8px;
  }

  .slot-btn {
    min-height: 72px;
  }

  #hud-top-left {
    top: calc(8px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    width: min(286px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    padding: 7px 8px;
  }

  .hud-level-badge {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .hud-level-badge span {
    font-size: 15px;
  }

  .hud-bar-card {
    margin-top: 5px;
    padding: 6px 8px;
  }

  .hud-value {
    font-size: 11px;
  }

  .hud-chip {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11px;
  }

  #hud-top-right {
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(112px + env(safe-area-inset-bottom));
    gap: 6px;
    padding: 6px;
  }

  #hud-quickbar {
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, minmax(58px, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .quick-slot {
    min-width: 58px;
    min-height: 68px;
    padding: 6px 5px 7px;
    border-radius: 13px;
  }

  .quick-slot-label {
    font-size: 8px;
  }

  .quick-slot-icon {
    font-size: 20px;
  }

  .quick-slot-name {
    font-size: 8px;
  }

  .quick-slot-badge {
    min-width: 18px;
    height: 18px;
    font-size: 8px;
    top: 5px;
    right: 5px;
    padding: 0 5px;
  }

  #hud-log {
    left: calc(8px + env(safe-area-inset-left));
    bottom: calc(92px + env(safe-area-inset-bottom));
    max-width: min(300px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    font-size: 12px;
  }
}


@media (pointer: coarse) {
  .panel-window {
    max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .panel-header-row {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 8px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, rgba(12, 16, 22, 0.98), rgba(12, 16, 22, 0.88));
    backdrop-filter: blur(4px);
  }

  .item-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 10px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(18, 26, 37, 0.20), rgba(18, 26, 37, 0.95));
    backdrop-filter: blur(4px);
  }

  .floating-item-card {
    width: min(360px, calc(100vw - 18px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-width: min(360px, calc(100vw - 18px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .action-btn,
  .small-btn {
    min-height: 46px;
    font-size: 15px;
    padding: 11px 16px;
  }

  .slot-btn {
    min-height: 82px;
  }

  .item-details {
    min-height: 220px;
  }
}

@media (max-width: 680px) {
  #hud-top-left {
    width: min(244px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .compact-info {
    gap: 5px;
  }

  .hud-chip {
    font-size: 10px;
    padding: 5px 7px;
  }

  #hud-top-right {
    gap: 8px;
    bottom: calc(106px + env(safe-area-inset-bottom));
  }

  .hud-icon-btn {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  #hud-quickbar {
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
    padding: 6px;
    border-radius: 18px;
    background: rgba(7, 11, 16, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.24);
  }

  .quick-slot {
    min-width: 60px;
    min-height: 72px;
    padding: 6px 5px 7px;
  }

  .quick-slot-icon {
    font-size: 20px;
  }

  .quick-slot-name {
    font-size: 8px;
  }

  .quick-slot-label {
    font-size: 8px;
  }

  .quick-slot-badge {
    min-width: 18px;
    height: 18px;
    font-size: 8px;
    top: 5px;
    right: 5px;
    padding: 0 5px;
  }

  #hud-log {
    bottom: calc(106px + env(safe-area-inset-bottom));
    max-width: min(280px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
}

@media (max-width: 520px) {
  .panel-overlay {
    padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  }

  .panel-window {
    width: min(100vw - 8px - env(safe-area-inset-left) - env(safe-area-inset-right), 560px);
    padding: 12px;
    gap: 12px;
    border-radius: 12px;
  }

  .inventory-grid {
    grid-template-columns: repeat(4, minmax(58px, 1fr));
    gap: 7px;
  }

  .slot-btn {
    min-height: 76px;
    padding: 7px;
  }

  .slot-name {
    font-size: 12px;
  }

  .item-title {
    font-size: 16px;
  }

  .item-details {
    font-size: 14px;
  }
}


@media (max-width: 1180px) {
  #hud-top-center {
    width: min(440px, calc(100vw - 360px));
  }
}

@media (max-width: 980px) {
  #hud-top-center {
    width: min(360px, calc(100vw - 300px));
  }

  .statue-offer-grid {
    grid-template-columns: 1fr;
  }

  .statue-offer-card {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  #hud-top-center {
    top: calc(8px + env(safe-area-inset-top));
    width: min(280px, calc(100vw - 168px));
    min-width: 0;
    padding: 7px 8px 8px;
  }

  .run-card-chip {
    min-width: 92px;
    min-height: 52px;
    padding: 7px 8px 7px 9px;
  }

  .run-card-chip-icon { font-size: 20px; }
  .run-card-chip-name { font-size: 11px; }
  .run-card-chip-level, .run-card-chip-tags { font-size: 9px; }
  .card-synergy-text, .statue-offer-synergy-text { font-size: 11px; }

  .run-card-popup {
    width: min(340px, calc(100vw - 18px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-width: min(340px, calc(100vw - 18px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
}

@media (max-width: 680px) {
  #hud-top-center {
    width: min(240px, calc(100vw - 156px));
  }

  .run-card-empty {
    min-height: 48px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  #hud-top-center {
    width: min(210px, calc(100vw - 150px));
    padding: 6px 7px 7px;
  }

  .run-cards-title,
  .run-cards-count {
    font-size: 10px;
  }
}


@media (max-width: 720px) {
  .run-cards-open-mini {
    padding: 5px 8px;
    font-size: 9px;
  }
  .run-cards-panel-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* Inventory tabs and responsive HUD refinements */
.inventory-window.inventory-window-tabs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(1180px, 96vw);
}

.inventory-window-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.inventory-window-header h2 {
  margin: 0 0 4px;
  color: #ffd166;
}

.inventory-window-subtitle {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
}

.inventory-tabbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inventory-tab-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.78);
  color: #cbd5e1;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: 140ms ease;
}

.inventory-tab-btn:hover,
.inventory-tab-btn.active {
  color: #0f172a;
  background: linear-gradient(180deg, #ffd166, #f59e0b);
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.18);
}

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

.inventory-tab-panel.active {
  display: block;
}

.inventory-items-layout {
  display: grid;
  grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
}

.compact-panel-header h2 {
  margin: 0;
}

.inventory-status-layout,
.inventory-cards-layout {
  min-height: 0;
}

.inventory-status-box {
  min-height: 420px;
}

.inventory-cards-count {
  color: #ffd166;
  font-size: 13px;
  font-weight: 800;
}

.inventory-cards-grid {
  min-height: 420px;
  max-height: 62vh;
  overflow: auto;
  padding-right: 4px;
}

#hud-top-right {
  top: auto;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(154px + env(safe-area-inset-bottom));
}

#hud-top-center {
  z-index: 18;
}

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

  .inventory-status-box,
  .inventory-cards-grid {
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 760px) {
  #hud-top-center {
    top: auto;
    bottom: calc(148px + env(safe-area-inset-bottom));
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    transform: none;
    width: auto;
    min-width: 0;
    padding: 7px 8px 8px;
  }

  #hud-top-right {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(106px + env(safe-area-inset-bottom));
  }

  .inventory-window.inventory-window-tabs {
    width: min(980px, 96vw);
    max-height: min(92vh, 92dvh);
  }

  .inventory-window-header {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-tabbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .inventory-tab-btn {
    font-size: 11px;
    padding: 10px 8px;
  }

  .inventory-items-layout {
    gap: 12px;
  }

  #inventory-grid {
    grid-template-columns: repeat(3, minmax(84px, 1fr));
  }
}

@media (max-width: 520px) {
  #hud-top-center {
    bottom: calc(144px + env(safe-area-inset-bottom));
  }

  #hud-top-right {
    bottom: calc(102px + env(safe-area-inset-bottom));
  }

  .inventory-tabbar {
    grid-template-columns: 1fr;
  }

  #inventory-grid {
    grid-template-columns: repeat(2, minmax(84px, 1fr));
  }
}


.hp-card.is-low .hp-track {
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.15), 0 0 16px rgba(239, 68, 68, 0.12);
}

.hp-card.is-danger .hp-track {
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.22), 0 0 18px rgba(239, 68, 68, 0.2);
}

.hp-card.is-critical .hp-track {
  box-shadow: 0 0 0 1px rgba(252, 165, 165, 0.28), 0 0 22px rgba(239, 68, 68, 0.28);
}

.hp-card.is-low .hud-value,
.hp-card.is-danger .hud-value,
.hp-card.is-critical .hud-value {
  color: #ffe4e6;
}
