/* Aetheria: Infinite Ascent - Core Cyber-Fantasy Dark UI Theme */

:root {
  --bg-main: #07090e;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(30, 41, 59, 0.88);
  --bg-header: rgba(11, 17, 33, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);

  --color-gold: #fbbf24;
  --color-shard: #c084fc;
  --color-essence: #fde047;
  --color-scrap: #94a3b8;
  --color-void: #f43f5e;
  --color-cyan: #38bdf8;
  --color-emerald: #10b981;
  --color-crimson: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-heading: 'Cinzel', serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, input, select, textarea, a, .card, .btn, .nav-tab-btn, .gear-slot, .inv-slot, .skill-btn {
  touch-action: manipulation;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(192, 132, 252, 0.08) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

/* Base Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* App Wrapper */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
}

/* TOP HEADER / HUD */
.top-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  gap: 12px;
  width: 100%;
}

.brand-section {
  display: flex;
  flex-direction: column;
}

.game-logo {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #38bdf8, #c084fc, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.3);
}

.game-subtitle {
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-weight: 700;
}

/* Currencies Bar */
.currencies-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.currency-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
}

.gold-pill .curr-val { color: var(--color-gold); }
.shard-pill .curr-val { color: var(--color-shard); }
.essence-pill .curr-val { color: var(--color-essence); }
.scrap-pill .curr-val { color: var(--color-scrap); }
.void-pill .curr-val { color: var(--color-void); }

/* Header Right Controls */
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.dps-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--border-glow);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.dps-number {
  color: var(--color-cyan);
}

.click-badge {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
}

.click-badge .dps-number {
  color: var(--color-void);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon:hover, .btn-icon:active {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-cyan);
}

.lang-btn {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 8px;
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
}
.lang-btn:hover {
  border-color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.2);
}

/* MAIN CONTENT GRID (DESKTOP) */
.main-content-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 14px;
  padding: 12px;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* COMBAT SECTION */
.combat-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  width: 100%;
}

/* Stage Header */
.stage-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
  width: 100%;
}

.stage-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.btn-nav-stage {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-nav-stage:hover, .btn-nav-stage:active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--color-cyan);
}

.stage-number {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-cyan);
  white-space: nowrap;
}

.biome-name {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wave-indicator-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.wave-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gold);
  white-space: nowrap;
}

.btn-auto-progress {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.btn-auto-progress.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--color-emerald);
  color: var(--color-emerald);
}

/* Monster Info Card */
.monster-info-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  width: 100%;
}

.monster-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.monster-name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monster-affix {
  font-weight: 800;
  margin-right: 4px;
}

.monster-hp-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.monster-hp-bar {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.monster-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Boss Timer */
.boss-timer-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
  width: 100%;
}

.boss-timer-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-crimson);
}

.boss-timer-bar {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  overflow: hidden;
}

.boss-timer-fill {
  height: 100%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  transition: width 0.1s linear;
}

/* Combat Arena Canvas */
.combat-arena-container {
  position: relative;
  flex: 1;
  min-height: 220px;
  width: 100%;
  background: #090d16;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: background 0.5s ease;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.click-hint-overlay {
  position: absolute;
  bottom: 6px;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  pointer-events: none;
}

/* Skills Action Bar */
.skills-bar-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 6px;
  width: 100%;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}

.skill-btn {
  position: relative;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: visible;
  touch-action: manipulation;
  min-width: 0;
}

.skill-btn:hover, .skill-btn:active {
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.skill-hotkey {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 8px;
  color: var(--text-dim);
  font-weight: 700;
}

.skill-icon {
  font-size: 18px;
  margin-top: 3px;
}

.skill-name {
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.skill-lvl {
  font-size: 8px;
  color: var(--text-muted);
}

.skill-cooldown-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  pointer-events: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.skill-cooldown-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  color: #f8fafc;
  text-shadow: 0 0 6px #000;
}

.skill-btn.active-buff {
  box-shadow: 0 0 14px #38bdf8;
  animation: pulseBuff 1.5s infinite;
}

/* Tooltip on Hover */
.skill-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border-glow);
  padding: 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 500;
  pointer-events: auto;
}

.skill-btn:hover .skill-tooltip,
.skill-btn:focus-within .skill-tooltip {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tooltip-title {
  font-weight: 700;
  font-size: 11px;
}

.tooltip-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.tooltip-stats {
  font-size: 9px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
}

.btn-upgrade-skill {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--color-cyan);
  padding: 4px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 3px;
}

.btn-upgrade-skill.can-afford:hover,
.btn-upgrade-skill.can-afford:active {
  background: rgba(56, 189, 248, 0.3);
}

.autocast-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: var(--text-muted);
  cursor: pointer;
}

/* MANAGEMENT TABS & SUB-CONTROLS */
.management-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
  width: 100%;
}

.nav-tabs-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.nav-tab-btn {
  flex: 1;
  min-width: 60px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  touch-action: manipulation;
}

.nav-tab-btn:hover, .nav-tab-btn:active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.tab-sub-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}

.buy-mult-group {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.mult-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-right: 2px;
}

.btn-mult {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-mult:hover, .btn-mult:active {
  color: var(--text-main);
}

.btn-mult.active {
  background: rgba(251, 191, 36, 0.2);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

/* TAB CONTENT CONTAINER */
.tab-content-wrapper {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* HEROES LIST */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
  width: 100%;
}

.hero-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.hero-card.locked {
  opacity: 0.75;
}

.hero-header {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.hero-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.hero-stars {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 8px;
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.hero-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-name {
  font-weight: 700;
  font-size: 13px;
}

.hero-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-title {
  font-size: 10px;
  color: var(--text-dim);
}

.hero-dps {
  font-size: 11px;
  color: var(--text-muted);
}

.dps-share {
  font-size: 9px;
  color: var(--text-dim);
  margin-left: 3px;
}

/* Milestone track */
.milestone-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.milestone-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
}

.progress-bar-bg {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  transition: width 0.2s ease;
}

.hero-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  transition: all 0.2s;
  font-family: var(--font-body);
  touch-action: manipulation;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-buy {
  flex: 1;
  display: flex;
  justify-content: space-between;
}

.btn-disabled {
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-dim);
  border-color: var(--border-subtle);
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ascend {
  background: rgba(254, 240, 138, 0.15);
  border-color: rgba(250, 204, 21, 0.4);
  color: var(--color-essence);
  padding: 6px 10px;
  font-size: 10px;
  flex-shrink: 0;
}

.btn-ascend:hover, .btn-ascend:active {
  background: rgba(254, 240, 138, 0.25);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

/* FORGE & INVENTORY GRID */
.forge-layout {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  gap: 10px;
  width: 100%;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.equipped-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.gear-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  width: 100%;
}

.gear-slot:hover, .gear-slot:active {
  transform: translateX(2px);
  background: var(--bg-card-hover);
}

.slot-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.item-name {
  font-weight: 700;
  font-size: 11px;
}

.item-sub {
  font-size: 9px;
  color: var(--text-dim);
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.inventory-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.auto-salvage-label {
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.select-dropdown {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.btn-salvage-all {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 10px;
  padding: 4px 8px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}

.inv-slot {
  aspect-ratio: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  touch-action: manipulation;
}

.inv-slot:hover, .inv-slot:active {
  transform: scale(1.05);
  background: var(--bg-card-hover);
}

.inv-slot.selected {
  box-shadow: 0 0 12px var(--color-cyan);
  border-color: var(--color-cyan) !important;
}

.inv-item-icon {
  font-size: 18px;
}

.inv-item-lvl {
  font-size: 8px;
  color: var(--text-muted);
}

.inv-forge-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  color: var(--color-gold);
  font-weight: 700;
}

.inv-lock-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 8px;
}

/* Detail Panel */
.forge-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.detail-item-header {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-icon {
  font-size: 28px;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.detail-affix-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.affix-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}

.affix-val {
  font-weight: 700;
  color: var(--color-cyan);
}

.forge-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  width: 100%;
}

.btn-forge-upgrade {
  background: linear-gradient(135deg, #ca8a04, #eab308);
  color: #000;
  font-weight: 800;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover, .btn-secondary:active {
  background: rgba(255, 255, 255, 0.15);
}

/* PRESTIGE & TALENTS HUB */
.prestige-hub-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.reincarnation-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.8), rgba(88, 28, 135, 0.4));
  border-color: rgba(192, 132, 252, 0.3);
  padding: 12px;
  width: 100%;
}

.prestige-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prestige-gem {
  font-size: 28px;
  animation: pulseGlow 2s infinite;
  flex-shrink: 0;
}

.prestige-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.shards-stats-row {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.stat-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-rebirth {
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-rebirth.can-rebirth {
  background: linear-gradient(135deg, #9333ea, #c084fc);
  color: #fff;
  border-color: #e9d5ff;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
  animation: pulseBuff 1.5s infinite;
}

.rebirth-main-text {
  font-size: 13px;
  font-weight: 800;
}

.rebirth-sub-text {
  font-size: 9px;
  opacity: 0.9;
}

.branch-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.branch-tab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 11px;
  transition: all 0.2s;
  white-space: nowrap;
}

.branch-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.talent-tree-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.branch-desc-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.branch-desc-header p {
  font-size: 10px;
  color: var(--text-muted);
}

.talent-nodes-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  width: 100%;
}

.talent-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.talent-node {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  touch-action: manipulation;
}

.talent-node:hover, .talent-node:active {
  transform: translateY(-2px);
  border-color: var(--color-cyan);
}

.talent-node.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.talent-node.maxed {
  border-color: var(--color-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.talent-icon {
  font-size: 20px;
}

.talent-name {
  font-size: 10px;
  font-weight: 700;
}

.talent-rank {
  font-size: 9px;
  color: var(--color-gold);
}

.talent-desc {
  font-size: 8px;
  color: var(--text-muted);
  line-height: 1.2;
}

.talent-cost {
  font-size: 8px;
  color: var(--color-shard);
  font-weight: 700;
  margin-top: 2px;
}

/* ARTIFACTS / RELICS */
.artifacts-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.artifacts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.artifacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  width: 100%;
}

.artifact-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.artifact-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.artifact-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.artifact-name {
  font-weight: 700;
  font-size: 12px;
}

.artifact-level {
  font-size: 9px;
  color: var(--text-dim);
}

.artifact-lore {
  font-size: 9px;
  font-style: italic;
  color: var(--text-dim);
}

.artifact-desc {
  font-size: 10px;
  color: var(--color-cyan);
}

/* DUNGEON / ABYSSAL RIFT */
.dungeon-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.dungeon-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.dungeon-arena-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.floor-modifier-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.rewards-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.reward-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.milestone-pill {
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: var(--color-gold);
}

.rift-battle-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.rift-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-large {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 800;
}

/* CODEX */
.codex-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.biome-codex-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.biome-title {
  font-size: 13px;
  font-weight: 700;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  width: 100%;
}

.codex-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.codex-card.undiscovered-monster {
  opacity: 0.4;
}

.codex-top {
  display: flex;
  gap: 6px;
  align-items: center;
}

.codex-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.codex-name {
  font-weight: 700;
  font-size: 11px;
}

.codex-stars {
  font-size: 9px;
  color: var(--color-gold);
}

.codex-buff {
  font-size: 9px;
  color: var(--color-emerald);
}

/* ACHIEVEMENTS */
.achievements-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.achievements-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  width: 100%;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  width: 100%;
}

.achievement-card.unlocked {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}

.achievement-card.ready-claim {
  border-color: var(--color-gold);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.ach-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ach-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.ach-name {
  font-weight: 700;
  font-size: 12px;
}

.ach-cat-badge {
  font-size: 8px;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-left: 4px;
}

.ach-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* STATS DASHBOARD */
.stats-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  width: 100%;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.stat-card-title {
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

/* MODALS */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: #0d1322;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 10px;
}

.setting-group input[type="range"] {
  width: 120px;
}

.modal-divider {
  border: 0;
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.save-management-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.save-textarea {
  width: 100%;
  height: 60px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: monospace;
  font-size: 10px;
  padding: 6px;
  resize: none;
}

.save-btn-row {
  display: flex;
  gap: 6px;
}

.danger-zone {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

/* OFFLINE MODAL */
.offline-card {
  text-align: center;
  border-color: var(--color-gold);
}

.offline-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.offline-stat {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ==========================================================
   TABLET & MOBILE RESPONSIVE MEDIA QUERIES (ROCK-SOLID 100%)
   ========================================================== */

@media (max-width: 1024px) {
  .app-wrapper {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .top-header {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-section {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .currencies-bar {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .currencies-bar::-webkit-scrollbar {
    display: none;
  }

  .currency-pill {
    padding: 3px 8px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .header-right-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Single Column Stack */
  .main-content-grid {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 8px;
    gap: 12px;
    width: 100%;
  }

  .combat-section {
    width: 100%;
  }

  .combat-arena-container {
    height: 220px;
    min-height: 200px;
  }

  .management-section {
    width: 100%;
    overflow: visible;
  }

  .tab-content-wrapper {
    max-height: none;
    overflow-y: visible;
    width: 100%;
  }

  .forge-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .equipped-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .game-logo {
    font-size: 16px;
  }

  .game-subtitle {
    display: none;
  }

  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .skill-btn {
    padding: 5px 2px;
  }

  .nav-tabs-bar {
    gap: 3px;
    padding: 3px;
  }

  .nav-tab-btn {
    padding: 6px 8px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .reincarnation-banner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .banner-left, .banner-right {
    width: 100%;
  }

  .prestige-title-row {
    justify-content: center;
  }

  .shards-stats-row {
    justify-content: center;
  }

  .btn-rebirth {
    width: 100%;
  }

  .talent-row {
    justify-content: space-around;
  }

  .talent-node {
    width: calc(50% - 6px);
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .combat-arena-container {
    height: 180px;
    min-height: 170px;
  }

  .stage-number {
    font-size: 13px;
  }

  .stage-header-card {
    padding: 6px 8px;
  }

  .dps-badge {
    padding: 3px 6px;
    font-size: 10px;
  }

  .btn-icon {
    padding: 5px 7px;
    font-size: 12px;
  }

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

  .hero-card {
    padding: 8px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-buy, .btn-ascend {
    width: 100%;
  }

  .offline-stats-grid {
    grid-template-columns: 1fr;
  }

  .save-btn-row {
    flex-direction: column;
  }

  .modal-card {
    max-width: 95vw;
  }
}
