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

html,
body {
  width: 100%;
  min-height: 100%;
  background: #111827;
  color: #e5e7eb;
  font-family: Arial, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#app {
  width: min(1400px, 100%);
}

.screen {
  border: 1px solid #334155;
  background: #0b1220;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  position: relative;
}

.screen-game {
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.screen-title {
  font-size: 32px;
  margin-bottom: 10px;
}

.screen-subtitle {
  color: #94a3b8;
  margin-bottom: 20px;
}

.class-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.class-list .class-card {
  flex: 0 0 260px;
  width: 260px;
}

.class-card {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  background: #111a2d;
}

.class-card-selected {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.class-card h3 {
  margin-bottom: 6px;
  font-size: 20px;
}

.class-card p {
  color: #9ca3af;
  font-size: 14px;
}

.compact-stats-list {
  margin-top: 10px;
  gap: 6px;
}

.compact-stats-list li {
  padding: 4px 6px;
  font-size: 12px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: #334155;
  color: #e2e8f0;
}

.btn-primary {
  background: #22c55e;
  color: #052e16;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #1e293b;
}

.controls-row {
  display: flex;
  gap: 10px;
}

.loadout-group {
  margin-bottom: 18px;
}

.loadout-group-title {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.loadout-group-title span {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 400;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr) minmax(220px, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.game-canvas {
  width: 100%;
  height: 100%;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #020617;
}

.play-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.game-side p {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 8px;
}

.hp-block {
  margin-bottom: 12px;
}

.hp-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid #334155;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.hp-value {
  margin-top: 6px;
  color: #fecaca;
  font-size: 13px;
  text-align: right;
}

.stats-group {
  margin-top: 12px;
}

.stats-group h4 {
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 13px;
}

.progression-line {
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 4px;
}

.xp-block {
  margin-bottom: 10px;
}

.xp-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid #334155;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%);
}

.xp-value {
  margin-top: 6px;
  color: #bfdbfe;
  font-size: 13px;
  text-align: right;
}

.stat-value-with-upgrade {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-total-value {
  color: #86efac;
}

.stat-total-neutral {
  color: #e2e8f0;
}

.stat-preview-up {
  color: #86efac;
}

.stat-preview-down {
  color: #fca5a5;
}

.stat-preview-value {
  color: #fde047;
}

.upgrade-inline-btn {
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.1;
}

.run-log {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  color: #cbd5e1;
}

.inventory-panel {
  min-height: 0;
  overflow: auto;
}

.inventory-tip {
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 10px;
}

.slot-item strong {
  display: block;
  text-align: right;
}

.slot-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

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

.slot-name {
  text-transform: capitalize;
}

.slot-equipped-card {
  width: 100%;
  min-height: 54px;
  height: auto;
  flex: 0 0 auto;
  cursor: default;
  padding: 4px 6px;
}

.slot-empty-card {
  opacity: 0.65;
}

.slot-item-name {
  text-align: left;
}

.item-bonus {
  color: #86efac;
  font-size: 11px;
  margin-left: 8px;
  white-space: normal;
  display: block;
  text-align: right;
  line-height: 1.15;
}

.bag-title {
  margin-top: 12px;
  margin-bottom: 8px;
}

.bag-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.bag-icon {
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 20px;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.bag-icon:hover {
  border-color: #22c55e;
}

.slot-equipped-card:hover {
  border-color: #22c55e;
}

.bag-icon-glyph {
  line-height: 1;
}

.bag-icon-bonus {
  font-size: 9px;
  color: #e2e8f0;
  line-height: 1;
}

.bonus-up {
  color: #86efac;
}

.bonus-down {
  color: #fca5a5;
}

.bonus-eq {
  color: #e2e8f0;
}

.empty-bag {
  color: #94a3b8;
  font-size: 13px;
}

.build-badge {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  color: #64748b;
}

.mobile-controls {
  display: none;
}

@media (max-width: 900px) {
  .screen-game {
    height: auto;
    padding-bottom: 70px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-canvas {
    height: 46vh;
  }

  .inventory-panel {
    max-height: 35vh;
  }

  .mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
  }

  .mobile-move-btn {
    width: 56px;
    height: 56px;
    padding: 0;
    font-size: 22px;
    background: #1f2937;
    color: #e2e8f0;
    border: 1px solid #334155;
  }

  .mobile-up {
    grid-column: 2;
    grid-row: 1;
  }

  .mobile-left {
    grid-column: 1;
    grid-row: 2;
  }

  .mobile-down {
    grid-column: 2;
    grid-row: 2;
  }

  .mobile-right {
    grid-column: 3;
    grid-row: 2;
  }
}
