* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0a; font-family: 'Segoe UI', system-ui, sans-serif; color: #e0e0e0; }

.screen { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }

/* Character Select */
#screen-character-select h1 { font-size: 3rem; color: #e74c3c; margin-bottom: 0.5rem; text-shadow: 0 0 20px rgba(231,76,60,0.5); }
#screen-character-select p { margin-bottom: 1.5rem; color: #888; }
#class-cards { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; max-width: 700px; min-height: 200px; margin-bottom: 2rem; padding: 0 1rem; }
.class-card { background: #1a1a2e; border: 2px solid #333; border-radius: 12px; padding: 1.2rem; width: 150px; cursor: pointer; transition: all 0.2s; text-align: center; }
.class-card:hover { border-color: #555; transform: translateY(-2px); }
.class-card.selected { border-color: #e74c3c; box-shadow: 0 0 15px rgba(231,76,60,0.3); }
.class-card .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.class-card .name { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.5rem; }
.class-card .stats { font-size: 0.75rem; color: #999; margin-bottom: 0.5rem; }
.class-card .abilities { font-size: 0.7rem; color: #666; }
.class-card .abilities div { margin-bottom: 0.2rem; }
#btn-start { padding: 1rem 3rem; font-size: 1.2rem; background: #e74c3c; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition: background 0.2s; }
#btn-start:disabled { background: #555; cursor: not-allowed; }
#btn-start:not(:disabled):hover { background: #c0392b; }
#btn-continue {
  padding: 0.7rem 2rem;
  font-size: 1rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  margin-top: 0.5rem;
}
#btn-continue:hover { background: #2980b9; }

/* Game Screen - canvas 50vh, joystick 40vh, controls bar below */
#screen-game {
  position: relative;
  flex-direction: column;
}
#game-canvas {
  flex: 0 0 50vh;
  width: 100%;
  image-rendering: pixelated;
  touch-action: none;
}
#minimap {
  position: absolute; top: 10px; right: 10px;
  width: 120px; height: 120px;
  border: 2px solid #333; border-radius: 8px;
  background: rgba(0,0,0,0.7);
  pointer-events: none; z-index: 10;
}
#hud { position: absolute; top: 10px; left: 10px; display: flex; gap: 0.5rem; z-index: 10; }
#hud div { background: rgba(0,0,0,0.75); padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 0.85rem; font-weight: bold; white-space: nowrap; }
#hud-level { color: #f1c40f; }
#hud-hp { color: #e74c3c; }
#hud-xp { color: #3498db; }
#joystick-zone {
  flex: 0 0 35vh;
  width: 100%;
  touch-action: none;
  display: none;
}
#combat-controls {
  flex: 0 0 auto;
  display: none; gap: 8px;
  height: 64px; flex-shrink: 0; z-index: 10;
  background: rgba(0,0,0,0.6);
  justify-content: center; align-items: center; flex-wrap: wrap;
  padding: 6px 12px;
}
#screen-game.active #joystick-zone,
#screen-game.active #combat-controls {
  display: flex;
}
#combat-controls .action-btn {
  flex: 1 0 0; min-width: 60px; max-width: 140px;
  height: 48px; font-size: 0.8rem;
}
.action-btn:active { transform: scale(0.95); background: rgba(40,40,60,0.9); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.action-btn.descend { border-color: #f1c40f; color: #f1c40f; }
.action-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }

/* Game Over */
#screen-game-over { gap: 1rem; }
#result-title { font-size: 3rem; font-weight: bold; margin-bottom: 0.5rem; }
#result-sub { font-size: 1.2rem; color: #888; margin-bottom: 1rem; }
#btn-restart { padding: 1rem 3rem; font-size: 1.2rem; background: #e74c3c; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; }
#btn-restart:hover { background: #c0392b; }

/* Status Screen */
#screen-status {
  padding: 2rem;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: flex-start;
}
#status-content {
  max-width: 600px;
  width: 100%;
}
#status-content h2 {
  color: #f1c40f;
  margin: 1.5rem 0 0.5rem;
  font-size: 1.2rem;
}
#equipment-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.equip-slot {
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 0.8rem;
}
.equip-slot.equipped {
  border-color: var(--rarity-color, #bdc3c7);
}
.equip-slot .slot-name {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.equip-slot .item-name {
  font-weight: bold;
  margin: 0.2rem 0;
}
.equip-slot .item-stats {
  font-size: 0.75rem;
  color: #999;
}
.equip-slot .item-skill {
  font-size: 0.7rem;
  color: #9b59b6;
  margin-top: 0.2rem;
}
.equip-slot.empty {
  opacity: 0.4;
}
#stats-breakdown {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}
.stat-row .stat-label { color: #888; }
.stat-row .stat-value { font-weight: bold; }
.stat-row .stat-value.total { color: #f1c40f; }
.stat-row .stat-value.bonus { color: #2ecc71; }
#skills-list {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.skill-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid #222;
  font-size: 0.85rem;
}
.skill-item:last-child { border-bottom: none; }
.skill-item .skill-name { color: #e74c3c; font-weight: bold; }
.skill-item .skill-gear { color: #9b59b6; font-size: 0.7rem; margin-left: 0.3rem; }
.skill-item .skill-desc { color: #888; font-size: 0.75rem; }
.skill-item .skill-cooldown { color: #666; font-size: 0.75rem; margin-left: 0.3rem; }
#btn-close-status {
  margin-top: 1rem;
  margin-bottom: 2rem;
  padding: 0.7rem 2rem;
  background: #555;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}
#btn-close-status:hover { background: #777; }

/* Responsive */
@media (max-width: 500px) {
  .class-card { width: 130px; padding: 1rem; }
  .class-card .icon { font-size: 2rem; }
  #screen-character-select h1 { font-size: 2.2rem; }
  #minimap { width: 80px; height: 80px; top: 5px; right: 5px; }
  #hud { gap: 0.3rem; }
  #hud div { font-size: 0.7rem; padding: 0.25rem 0.4rem; }
  #combat-controls .action-btn { height: 44px; font-size: 0.6rem; min-width: 40px; }
  #screen-status { padding: 1rem; }
  #equipment-slots { grid-template-columns: 1fr; }
  #status-content h2 { font-size: 1rem; }
}
