/* ========================================
   HERO AWAKENING - Cyberpunk Anime Theme
   ======================================== */

:root {
  --bg-deep: #06060e;
  --bg-dark: #0a0b14;
  --bg-panel: #0f1019;
  --bg-card: #141520;
  --bg-card-hover: #1a1b2e;
  --bg-input: #12131f;

  --primary: #00d4ff;
  --primary-dim: #00a5cc;
  --primary-glow: rgba(0, 212, 255, 0.25);
  --secondary: #ff006e;
  --secondary-glow: rgba(255, 0, 110, 0.25);
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.2);
  --gold: #ffd700;
  --gold-dim: #b8970a;
  --success: #00ff88;
  --danger: #ff4444;
  --warning: #ff9500;

  --text: #e8e8f0;
  --text-dim: #8888aa;
  --text-dark: #555570;
  --border: #222240;
  --border-light: #2a2a50;

  --font-display: 'Orbitron', sans-serif;
  --font-heading: 'Rajdhani', sans-serif;
  --font-body: 'Exo 2', sans-serif;

  --radius: 8px;
  --radius-lg: 12px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ---- Animated Background ---- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}

.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 8s infinite ease-in-out;
}

@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  20% { opacity: 0.6; }
  80% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-20px) scale(1); }
}

/* ---- Screens ---- */
.screen {
  display: none;
  height: 100vh;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ---- Auth Screen ---- */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  gap: 2rem;
}

.logo-section {
  text-align: center;
  animation: fadeSlideDown 0.8s ease;
}

.logo-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 30px var(--primary));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 30px var(--primary)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 50px var(--primary)) drop-shadow(0 0 80px var(--secondary)); }
}

.logo-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: white;
  text-shadow: 0 0 40px var(--primary-glow);
}
.logo-title .accent {
  color: var(--primary);
}

.logo-sub {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 12px;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  animation: fadeSlideUp 0.8s ease 0.2s both;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-tab:hover {
  color: var(--text);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 1rem;
}
.auth-form.active {
  display: flex;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.input-group label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
}

input[type="text"],
input[type="password"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ---- Buttons ---- */
.btn-primary {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 4px 20px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--primary-glow), 0 0 60px var(--primary-glow);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-wide { width: 100%; }

.btn-small {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  min-height: 1.2rem;
  margin-top: 0.5rem;
}

/* ---- Character Select ---- */
.select-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.select-header h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-tag {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.character-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.char-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}
.char-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-accent, var(--primary));
}
.char-card:hover {
  border-color: var(--card-accent, var(--primary));
  background: var(--bg-card-hover);
  transform: translateX(4px);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.char-icon {
  font-size: 2.2rem;
  width: 50px;
  text-align: center;
}
.char-info {
  flex: 1;
}
.char-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.char-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  gap: 1rem;
  margin-top: 0.2rem;
}
.char-meta .accent { color: var(--primary); font-weight: 600; }

.char-delete {
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  transition: color 0.2s;
}
.char-delete:hover { color: var(--danger); }

/* ---- Character Creation ---- */
.create-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}
.create-container h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 3px;
}

.back-btn {
  align-self: flex-start;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.class-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}
.class-card:hover {
  border-color: var(--card-color, var(--primary));
  background: var(--bg-card-hover);
}
.class-card.selected {
  border-color: var(--card-color, var(--primary));
  box-shadow: 0 0 25px rgba(0, 212, 255, 0.15), inset 0 0 20px rgba(0, 212, 255, 0.05);
}
.class-card .class-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.class-card .class-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.class-card .class-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.class-card .class-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.4;
}
.class-card .class-stats {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.class-card .stat-chip {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
}
.class-card .stat-chip.primary {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

/* ---- Game Screen ---- */
#screen-game {
  display: none;
}
#screen-game.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  min-height: 48px;
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1px;
}
.hero-class-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--primary-glow);
  color: var(--primary);
  text-transform: uppercase;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.rebirth-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
}
.rebirth-icon { font-size: 0.9rem; }

.level-display {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.level-display .label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.level-display .value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.resource {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
}
.resource.gold { color: var(--gold); }
.res-icon { font-size: 0.9rem; }

/* ---- XP Bar ---- */
.xp-bar-container {
  padding: 0 1rem;
  padding-top: 0.4rem;
  padding-bottom: 0.3rem;
  background: var(--bg-panel);
  flex-shrink: 0;
  position: relative;
}
.xp-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
  box-shadow: 0 0 8px var(--primary-glow);
}
.xp-text {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-heading);
  letter-spacing: 1px;
}

/* ---- Game Nav ---- */
.game-nav {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-tab {
  flex: 1;
  min-width: 80px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---- Game Content ---- */
.game-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.game-panel {
  display: none;
  max-width: 700px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}
.game-panel.active { display: block; }

/* ---- Combat Panel ---- */
.zone-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}
.zone-banner .zone-icon { font-size: 2rem; }
.zone-banner h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.zone-desc-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.idle-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: rgba(0, 255, 136, 0.06);
  border: 1px solid rgba(0, 255, 136, 0.15);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--success);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--success); }
  50% { opacity: 0.3; box-shadow: 0 0 12px var(--success); }
}

.idle-report {
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
.idle-report .accent { color: var(--primary); font-weight: 600; }
.idle-report .gold-text { color: var(--gold); font-weight: 600; }
.idle-report .xp-text-report { color: var(--accent); font-weight: 600; }

.section-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.combat-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 600px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  background: var(--bg-card);
  border-left: 2px solid var(--success);
}
.log-entry.loss {
  border-left-color: var(--danger);
  opacity: 0.7;
}
.log-entry.boss {
  border-left-color: var(--gold);
  background: rgba(255, 215, 0, 0.05);
}
.log-enemy { font-weight: 500; }
.log-rewards {
  display: flex;
  gap: 0.8rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.log-xp { color: var(--accent); }
.log-gold { color: var(--gold); }

/* ---- Skills Panel ---- */
.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-header-row h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
}
.points-badge {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  background: var(--primary-glow);
  border-radius: var(--radius);
  letter-spacing: 1px;
}

.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.skill-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.skill-card.locked {
  opacity: 0.4;
}
.skill-card.maxed {
  border-color: var(--gold-dim);
}
.skill-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.skill-info { flex: 1; }
.skill-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
}
.skill-type {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.skill-type.active-type { color: var(--secondary); }
.skill-type.passive-type { color: var(--success); }
.skill-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.skill-level-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.skill-level {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}
.skill-pips {
  display: flex;
  gap: 3px;
}
.skill-pip {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.skill-pip.filled {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 4px var(--primary-glow);
}
.skill-req {
  font-size: 0.7rem;
  color: var(--danger);
}

.btn-upgrade-skill {
  background: var(--primary);
  color: white;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-upgrade-skill:hover {
  box-shadow: 0 0 10px var(--primary-glow);
}
.btn-upgrade-skill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---- Stats Panel ---- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-value.hp-val { color: var(--success); }
.stat-value.atk-val { color: var(--secondary); }
.stat-value.def-val { color: var(--primary); }
.stat-value.spd-val { color: var(--warning); }
.stat-value.spr-val { color: var(--accent); }

.btn-stat-up {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-left: 0.4rem;
}
.btn-stat-up:hover {
  background: var(--primary);
  color: white;
}
.btn-stat-up:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.bonus-section {
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bonus-section h3 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.bonus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.bonus-chip {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
}

/* ---- Zones Panel ---- */
.zones-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.zone-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.zone-card:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}
.zone-card.active-zone {
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.1);
}
.zone-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.zone-card .z-icon { font-size: 1.8rem; }
.zone-card .z-info { flex: 1; }
.zone-card .z-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1px;
}
.zone-card .z-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.zone-card .z-meta {
  font-size: 0.7rem;
  color: var(--text-dark);
  margin-top: 0.3rem;
}
.zone-card .z-meta span { margin-right: 0.8rem; }
.zone-card .z-active-tag {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--success);
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(0,255,136,0.3);
  border-radius: 4px;
}

/* ---- Rebirth Panel ---- */
.rebirth-section {
  text-align: center;
}
.rebirth-hero-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}
.rebirth-section h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 3px;
}
.rebirth-description {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 500px;
  margin: 0.5rem auto 1rem;
  line-height: 1.6;
}

.rebirth-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.8;
}
.rebirth-info .label { color: var(--text-dim); }
.rebirth-info .value { color: var(--primary); font-weight: 600; font-family: var(--font-heading); }

.btn-rebirth {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 4px;
  padding: 1rem 2.5rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(255,0,110,0.1));
  color: var(--accent);
  transition: all 0.3s;
  margin-bottom: 2rem;
}
.btn-rebirth:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: white;
  box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--secondary-glow);
  transform: scale(1.05);
}
.btn-rebirth:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.awakening-section {
  text-align: left;
  margin-top: 1rem;
}
.awakening-section h3 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  text-align: center;
}

.awakening-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.awk-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.awk-card .awk-icon { font-size: 1.2rem; }
.awk-card .awk-info { flex: 1; }
.awk-card .awk-name {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
}
.awk-card .awk-value {
  font-size: 0.7rem;
  color: var(--accent);
}
.awk-card .awk-desc {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.btn-awk {
  background: var(--accent);
  color: white;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}
.btn-awk:hover { box-shadow: 0 0 10px var(--accent-glow); }
.btn-awk:disabled { opacity: 0.3; cursor: not-allowed; }

.rebirth-history-section {
  margin-top: 1.5rem;
  text-align: left;
}
.rebirth-history-section h3 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  text-align: center;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 0.78rem;
}
.history-entry .h-num { color: var(--accent); font-weight: 600; }
.history-entry .h-details { color: var(--text-dim); }

/* ---- Utility ---- */
.hidden { display: none !important; }
.accent { color: var(--primary); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---- Responsive ---- */
/* ---- Mode Toggle ---- */
.mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mode-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 0.7rem;
  cursor: pointer;
  transition: all 0.3s;
}
.mode-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.mode-btn:hover:not(.active) {
  background: var(--bg-card-hover);
  color: var(--text);
}

.combat-mode {
  display: none;
}
.combat-mode.active {
  display: block;
}

/* ---- Active Mode ---- */
.explore-prompt {
  text-align: center;
  padding: 2rem 1rem;
}
.explore-prompt p {
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.btn-explore {
  font-size: 1.1rem;
  letter-spacing: 4px;
  padding: 1rem 2rem;
}

/* Event Card */
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  animation: fadeSlideUp 0.4s ease;
}
.event-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.event-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.event-icon {
  font-size: 2rem;
}
.event-text {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 1.2rem;
}
.event-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.btn-event-choice {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.btn-event-choice:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}
.btn-event-choice:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Fight Arena */
.fight-arena {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.8rem;
  animation: fadeIn 0.3s ease;
}
.arena-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.arena-fighter {
  flex: 1;
}
.arena-vs {
  font-size: 1.5rem;
  flex-shrink: 0;
  padding: 0 0.5rem;
}
.af-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  letter-spacing: 0.5px;
}
.af-lvl {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.af-hp-bar {
  height: 10px;
  background: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.2rem;
}
.af-hp-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease, background 0.3s;
}
.af-hp-text {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--text-dim);
}
.arena-round {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--text-dark);
  margin-top: 0.5rem;
}
.hero-side .af-name { color: var(--primary); }
.enemy-side .af-name { color: var(--secondary); }

/* Fight Actions */
.fight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.btn-fight-action, .btn-fight-skill {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
}
.btn-attack {
  background: linear-gradient(135deg, rgba(255,0,110,0.15), rgba(255,0,110,0.05));
  border-color: var(--secondary);
  color: var(--secondary);
  flex: 1;
  min-width: 120px;
}
.btn-attack:hover {
  background: var(--secondary);
  color: white;
  box-shadow: 0 0 20px var(--secondary-glow);
}
.btn-fight-skill {
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04));
  border-color: var(--accent);
  color: var(--accent);
  flex: 1;
  min-width: 120px;
}
.btn-fight-skill:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-fight-skill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-flee {
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  min-width: 100px;
}
.btn-flee:hover {
  background: rgba(255,255,255,0.08);
  color: var(--warning);
  border-color: var(--warning);
}

/* Result screens */
.result-victory, .result-defeat, .result-fled {
  text-align: center;
  padding: 1.5rem;
  animation: fadeSlideUp 0.5s ease;
}
.result-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.result-victory h3 { color: var(--gold); font-family: var(--font-display); letter-spacing: 4px; font-size: 1.5rem; }
.result-defeat h3 { color: var(--danger); font-family: var(--font-display); letter-spacing: 4px; font-size: 1.5rem; }
.result-fled h3 { color: var(--warning); font-family: var(--font-display); letter-spacing: 4px; font-size: 1.3rem; }
.result-text { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 0.8rem; }
.result-rewards { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 0.8rem 0; }
.rr-xp { color: var(--accent); font-weight: 600; font-family: var(--font-heading); }
.rr-gold { color: var(--gold); font-weight: 600; font-family: var(--font-heading); }
.rr-heal { color: var(--success); font-weight: 600; font-family: var(--font-heading); }
.rr-loss { color: var(--danger); font-weight: 600; font-family: var(--font-heading); }
.rr-buff { color: var(--accent); font-weight: 600; font-family: var(--font-heading); }
.result-stats { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.5rem; }

/* ---- Skill Detail Boxes ---- */
.skill-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.skill-detail-box {
  margin-top: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  line-height: 1.5;
}
.skill-detail-box.active-detail {
  background: rgba(255, 0, 110, 0.06);
  border-left: 2px solid var(--secondary);
}
.skill-detail-box.passive-detail {
  background: rgba(0, 255, 136, 0.05);
  border-left: 2px solid var(--success);
}
.sd-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
}
.active-detail .sd-label { color: var(--secondary); }
.passive-detail .sd-label { color: var(--success); }
.sd-text { color: var(--text-dim); }
.sd-cd {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--warning);
  margin-top: 0.2rem;
  font-size: 0.68rem;
}
.sd-passive {
  color: var(--text-dark);
  margin-top: 0.2rem;
  font-style: italic;
}
.sd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.sd-meta {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

/* ---- Skill Effects Grid ---- */
.skill-effects-grid {
  margin-top: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.04);
}
.se-header {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding-bottom: 0.3rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.se-header-hint {
  font-weight: 400;
  font-size: 0.58rem;
  color: var(--text-dark);
  font-style: italic;
  letter-spacing: 0;
}
.se-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0;
  font-size: 0.72rem;
}
.se-row + .se-row {
  border-top: 1px solid rgba(255,255,255,0.03);
}
.se-name {
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.7rem;
}
.se-values {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.se-current {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--primary);
}
.se-next {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.68rem;
  color: var(--success);
  background: rgba(0, 255, 136, 0.08);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}
.se-per-level {
  font-size: 0.6rem;
  color: var(--text-dark);
  font-style: italic;
}
.se-preview .se-name {
  color: var(--text-dark);
}
.se-preview .se-next {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
}

/* Maxed skill effects use gold */
.skill-card.maxed .se-current {
  color: var(--gold);
}
.se-max {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
}
.se-max-preview {
  font-size: 0.6rem;
  color: var(--text-dark);
  font-style: italic;
}
.skill-max-badge {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

/* ---- HP Mini Bar in Header ---- */
.hp-resource {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}
.hp-bar-mini {
  width: 50px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.hp-fill-mini {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.5s ease, background 0.3s;
}
.btn-rest {
  background: none;
  border: 1px solid var(--success);
  color: var(--success);
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}
.btn-rest:hover {
  background: var(--success);
  color: var(--bg);
}

/* ---- Premium Shop ---- */
.premium-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.crystal-balance {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.crystal-icon { font-size: 1.2rem; }

.premium-code-section {
  padding: 0.8rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.code-input-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.code-input-row input {
  flex: 1;
  text-transform: uppercase;
  font-family: var(--font-heading);
  letter-spacing: 2px;
  font-size: 0.85rem;
}
.code-result {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
}
.code-result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}
.code-result.error {
  background: rgba(255, 0, 50, 0.08);
  border: 1px solid rgba(255, 0, 50, 0.2);
  color: var(--danger);
}

.active-boosts-section {
  margin-bottom: 1rem;
}
.boost-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  margin: 0.15rem;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.1), rgba(0, 212, 255, 0.08));
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  color: #c4b5fd;
}

.premium-section { margin-bottom: 1.2rem; }
.premium-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.premium-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.premium-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 45, 85, 0.04);
  border: 1px solid rgba(255, 45, 85, 0.15);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.premium-card:hover {
  border-color: rgba(255, 45, 85, 0.35);
  background: rgba(255, 45, 85, 0.08);
}
.premium-card.cant-afford {
  opacity: 0.5;
}
.premium-consumable {
  background: rgba(167, 139, 250, 0.04);
  border-color: rgba(167, 139, 250, 0.15);
}
.premium-consumable:hover {
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.08);
}

.pitem-icon {
  font-size: 1.8rem;
  min-width: 2.2rem;
  text-align: center;
}
.pitem-info { flex: 1; }
.pitem-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
}
.pitem-rarity {
  font-size: 0.62rem;
  color: #ff2d55;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pitem-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin: 0.15rem 0;
}
.pitem-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}
.pitem-stat {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 212, 255, 0.08);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.btn-premium-buy {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-premium-buy:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}
.btn-premium-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Crystal in header */
.resource.crystals {
  color: #a78bfa;
}
.resource.crystals .res-icon {
  font-size: 0.85rem;
}

/* ---- Arena Stats ---- */
.af-stats {
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  letter-spacing: 0.3px;
}

/* ---- Combat Preview / Threat Bar ---- */
.combat-threat {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.threat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  font-size: 0.7rem;
}
.threat-label {
  color: var(--text-dim);
  font-weight: 600;
}
.threat-dmg {
  color: var(--danger);
  font-family: var(--font-heading);
  font-weight: 700;
}
.threat-tag {
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 600;
}
.threat-good {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Action buttons with preview */
.fight-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.btn-fight-action, .btn-fight-skill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 90px;
  padding: 0.5rem 0.6rem;
}
.action-name {
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}
.action-preview {
  font-size: 0.6rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  justify-content: center;
  align-items: center;
  line-height: 1.2;
}
.action-cd {
  color: var(--warning);
  font-weight: 600;
}
.ap-crit { color: #f59e0b; }
.ap-double { color: var(--accent); }
.ap-stun { color: #a78bfa; }
.ap-exec { color: var(--danger); }
.ap-pen { color: #f97316; }
.ap-shield { color: var(--info); }
.ap-debuff { color: #ef4444; }
.ap-heal { color: var(--success); }

/* ---- Death Realm ---- */
.death-realm {
  animation: drFadeIn 0.8s ease;
}
@keyframes drFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.dr-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(255, 0, 80, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius);
}
.dr-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.5));
  animation: drPulse 2s ease-in-out infinite;
}
@keyframes drPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.7)); }
}
.dr-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--accent), #ff2d55);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
}
.dr-progress {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.dr-narrative {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.dr-narr {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.5;
  animation: drFadeIn 0.5s ease;
}
.dr-death {
  background: rgba(255, 0, 50, 0.06);
  border-left: 3px solid var(--danger);
  color: var(--danger);
}
.dr-choice {
  background: rgba(139, 92, 246, 0.06);
  border-left: 3px solid var(--accent);
  color: var(--text);
}
.dr-tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.4rem;
}
.dr-resurrect {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--success);
  color: var(--success);
  font-weight: 600;
}

.dr-stage {
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
}
.dr-text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 0.8rem;
}
.dr-choices {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.btn-dr-choice {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-dr-choice:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent);
  transform: translateX(4px);
}
.btn-dr-choice:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dr-complete {
  text-align: center;
  padding: 1rem;
  margin-top: 0.5rem;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius);
}
.dr-complete-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 0.8rem;
}

/* ---- Derived Combat Stats ---- */
.derived-values {
  margin-top: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.dv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.4rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.dv-row:last-child { border-bottom: none; }
.dv-icon {
  font-size: 0.75rem;
}
.dv-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
}
.dv-value {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: auto;
}
.dv-value.dv-static {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 0;
}
.dv-desc {
  width: 100%;
  font-size: 0.58rem;
  color: var(--text-dark);
  font-style: italic;
  padding-left: 1.15rem;
}

/* ---- Shop & Equipment ---- */
.equip-section { margin-bottom: 1.5rem; }
.shop-section { margin-bottom: 1rem; }

.equipment-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.equip-slot {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
}
.equip-slot.filled {
  border-left: 3px solid var(--rarity-color, var(--border));
}
.equip-slot.empty {
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0.5;
}
.es-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}
.es-slot-name {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.es-empty {
  font-size: 0.72rem;
  color: var(--text-dark);
}
.btn-unequip {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dark);
  font-size: 0.7rem;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-unequip:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.es-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.es-item-icon {
  font-size: 1.3rem;
}
.es-item-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
}
.es-item-rarity {
  font-size: 0.62rem;
  display: block;
}
.es-stats {
  margin-top: 0.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ei-stat {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(0, 255, 136, 0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.equip-bonuses-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
}
.eb-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.eb-chip {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(0, 212, 255, 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.shop-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--rarity-color, var(--border));
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  transition: border-color 0.2s;
}
.shop-item:hover { border-color: var(--rarity-color); }
.shop-item.too-expensive { opacity: 0.5; }
.si-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.si-icon { font-size: 1.4rem; }
.si-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
}
.si-meta {
  font-size: 0.62rem;
  color: var(--text-dim);
  display: block;
}
.si-stats {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.3rem;
}
.si-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  padding: 0.2rem 0;
  border-top: 1px solid rgba(255,255,255,0.03);
}
.comp-up {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--success);
}
.comp-down {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--danger);
}
.btn-buy {
  width: 100%;
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(0,212,255,0.03));
  border: 1px solid var(--primary);
  color: var(--primary);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-buy:hover:not(:disabled) {
  background: var(--primary);
  color: var(--bg);
  box-shadow: 0 0 20px var(--primary-glow);
}
.btn-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Detailed Fight Cards ---- */
.fight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
  border-left: 3px solid var(--success);
  transition: border-color 0.2s;
}
.fight-card.loss {
  border-left-color: var(--danger);
}
.fight-card.boss {
  border-left-color: var(--gold);
  background: rgba(255, 215, 0, 0.03);
}
.fight-card.boss.loss {
  border-left-color: var(--danger);
}

.fight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  gap: 0.5rem;
}
.fight-header:hover {
  background: var(--bg-card-hover);
}
.fight-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.fight-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.fight-enemy {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fight-lvl {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.boss-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.fight-closeness {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.fight-rewards {
  display: flex;
  gap: 0.5rem;
  font-size: 0.72rem;
}
.fight-expand-icon {
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: transform 0.3s;
}
.fight-details.expanded + .fight-header .fight-expand-icon,
.fight-details.expanded ~ .fight-expand-icon {
  transform: rotate(180deg);
}

.fight-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  border-top: 0 solid transparent;
}
.fight-details.expanded {
  max-height: 2000px;
  border-top: 1px solid var(--border);
}

.fight-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
}
.fight-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
}
.fs-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-heading);
}
.fs-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.fight-specials {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.8rem 0.5rem;
  flex-wrap: wrap;
}
.fight-special-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-heading);
}
.fight-special-tag.crit {
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
}
.fight-special-tag.dodge {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary);
}
.fight-special-tag.multi {
  background: rgba(236, 72, 153, 0.1);
  color: var(--secondary);
}

.fight-skills-used {
  padding: 0 0.8rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.fsu-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.fsu-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent);
}

/* ---- Narrative ---- */
.narr-container {
  padding: 0.5rem 0.8rem 0.8rem;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.narr-round-header {
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-dark);
  font-family: var(--font-heading);
  letter-spacing: 3px;
  margin: 0.4rem 0 0.2rem;
}
.narr-line {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  margin: 0.1rem 0;
  line-height: 1.4;
}
.narr-line strong {
  color: var(--text);
}
.narr-initiative {
  color: var(--primary);
  font-style: italic;
  margin-bottom: 0.3rem;
}
.narr-hero-atk {
  color: var(--text-dim);
  border-left: 2px solid var(--success);
  padding-left: 0.5rem;
}
.narr-hero-atk strong {
  color: var(--success);
}
.narr-enemy-atk {
  color: var(--text-dim);
  border-left: 2px solid var(--danger);
  padding-left: 0.5rem;
}
.narr-enemy-atk strong {
  color: var(--danger);
}
.narr-dodge {
  color: var(--primary);
  border-left: 2px solid var(--primary);
  padding-left: 0.5rem;
}
.narr-heal {
  color: var(--success);
  border-left: 2px solid var(--success);
  padding-left: 0.5rem;
  opacity: 0.8;
}

/* ---- Detailed Stat Cards ---- */
.stat-card-detailed {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  transition: border-color 0.2s;
}
.stat-card-detailed:hover {
  border-color: var(--border-light);
}
.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.stat-card-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-card-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stat-primary-tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary);
}
.stat-secondary-tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent);
}
.stat-card-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.stat-card-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
.stat-growth, .stat-manual {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.stat-growth strong, .stat-manual strong {
  font-family: var(--font-heading);
}
.stat-card-combat {
  font-size: 0.68rem;
  color: var(--text-dark);
  font-style: italic;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.03);
}

/* Update stats grid for single column detailed view */
.stats-grid {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: unset !important;
  gap: 0.5rem !important;
}

/* ---- Level Up Overlay ---- */
.level-up-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.level-up-overlay.show {
  opacity: 1;
}
.level-up-content {
  text-align: center;
  animation: levelUpBounce 0.6s ease;
}
.level-up-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 40px var(--gold));
  animation: levelUpSpin 0.6s ease;
}
.level-up-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
  margin-top: 0.3rem;
}
.level-up-number {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 0 40px var(--primary-glow);
}

@keyframes levelUpBounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes levelUpSpin {
  0% { transform: rotate(0deg) scale(0.5); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ---- Rebirth Overlay ---- */
.rebirth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: rgba(6, 6, 14, 0.9);
  opacity: 0;
  transition: opacity 0.5s;
}
.rebirth-overlay.show {
  opacity: 1;
}
.rebirth-content {
  text-align: center;
}
.rebirth-flash {
  font-size: 5rem;
  filter: drop-shadow(0 0 60px var(--accent)) drop-shadow(0 0 100px var(--secondary));
  animation: rebirthPulse 2s ease-in-out infinite;
}
.rebirth-text {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(90deg, var(--accent), var(--secondary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 0.5rem;
  animation: rebirthGlow 2s ease-in-out infinite;
}
.rebirth-sub {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-dim);
  letter-spacing: 4px;
  margin-top: 0.5rem;
}

@keyframes rebirthPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); filter: drop-shadow(0 0 80px var(--accent)) drop-shadow(0 0 120px var(--secondary)); }
}
@keyframes rebirthGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .logo-title { font-size: 1.8rem; letter-spacing: 3px; }
  .stats-grid { grid-template-columns: 1fr; }
  .awakening-grid { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
  .game-header { padding: 0.4rem 0.6rem; }
  .hero-name { font-size: 0.85rem; }
}
