/* ==========================================================================
   HUYPHAN TIÊN GIỚI - 2D XIANXIA ACTION RPG STYLESHEET
   Pure CSS3 Glassmorphism, Dark Xianxia Aesthetics, Responsive 16:9 Canvas
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Noto+Serif:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --font-title: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Noto Serif', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Xianxia Palette */
  --bg-space: #050b14;
  --bg-panel: rgba(11, 20, 34, 0.88);
  --bg-panel-light: rgba(22, 38, 62, 0.75);
  --border-gold: rgba(251, 191, 36, 0.4);
  --border-gold-glow: #fbbf24;
  --accent-gold: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-crimson: #ef4444;
  --accent-purple: #a855f7;

  /* Rarities */
  --rarity-normal: #94a3b8;
  --rarity-rare: #3b82f6;
  --rarity-epic: #a855f7;
  --rarity-legendary: #f59e0b;
  --rarity-mythic: #ef4444;
  --rarity-divine: #ec4899;

  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-gold: #fde68a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  font-family: var(--font-body);
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================================================
   GAME CONTAINER & WRAPPER (16:9 Responsive Fit)
   ========================================================================== */
#game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #0b1c2e 0%, #03070d 100%);
  position: relative;
}

#game-wrapper {
  position: relative;
  width: 1280px;
  height: 720px;
  max-width: 100vw;
  max-height: 100vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(251, 191, 36, 0.15);
  overflow: hidden;
  background-color: #000;
  border-radius: 6px;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* Loading Screen */
#game-loading {
  position: absolute;
  inset: 0;
  background: #040911;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.4s ease;
}

#game-loading.loading-done {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(251, 191, 36, 0.15);
  border-top-color: var(--border-gold-glow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loader-title {
  font-family: var(--font-title);
  font-size: 24px;
  letter-spacing: 4px;
  color: var(--text-gold);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.loader-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 1px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   DOM SCENE OVERLAY
   ========================================================================== */
.scene-ui-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.scene-ui-container * {
  pointer-events: auto;
}

/* Common Top Nav Bar */
.top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(5, 12, 22, 0.95) 0%, rgba(5, 12, 22, 0) 100%);
}

.nav-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 30, 48, 0.85);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
  padding: 8px 18px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.nav-back-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fde047;
  transform: translateX(-3px);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

/* Global Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
  border: 1px solid #fde68a;
  color: #fff;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-danger {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  border: 1px solid #fca5a5;
  color: #fff;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* Rarities */
.rarity-normal { color: var(--rarity-normal); border-color: var(--rarity-normal); }
.rarity-rare { color: var(--rarity-rare); border-color: var(--rarity-rare); }
.rarity-epic { color: var(--rarity-epic); border-color: var(--rarity-epic); }
.rarity-legendary { color: var(--rarity-legendary); border-color: var(--rarity-legendary); }
.rarity-mythic { color: var(--rarity-mythic); border-color: var(--rarity-mythic); }
.rarity-divine { color: var(--rarity-divine); border-color: var(--rarity-divine); }

.rarity-tag {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid currentColor;
  text-transform: uppercase;
}

/* ==========================================================================
   MAIN MENU UI
   ========================================================================== */
.menu-ui {
  justify-content: space-between;
  padding: 20px 30px;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 20, 35, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 12px 20px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #fbbf24;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.char-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.char-realm {
  font-size: 12px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.resource-bar {
  display: flex;
  align-items: center;
  gap: 20px;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(4, 10, 18, 0.7);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.menu-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
}

.game-logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-sub {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

.logo-title {
  font-family: var(--font-title);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fffbeb 0%, #fbbf24 45%, #d97706 80%, #78350f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 15px rgba(251, 191, 36, 0.5));
}

.logo-tagline {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-top: 4px;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 380px;
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(14, 25, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  color: #fff;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 20px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.menu-btn:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fde047;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.25);
}

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

.menu-actions-row .menu-btn {
  flex: 1;
}

.btn-sm {
  font-size: 12px;
  padding: 10px;
}

/* ==========================================================================
   WORLD MAP UI
   ========================================================================== */
.world-ui {
  background: rgba(5, 10, 18, 0.7);
}

.region-selector {
  display: flex;
  gap: 8px;
}

.region-tab {
  background: rgba(15, 27, 45, 0.8);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: 16px;
  font-family: var(--font-title);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.region-tab.active, .region-tab:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: var(--text-gold);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.region-info-banner {
  margin: 0 30px 15px 30px;
  background: rgba(11, 22, 38, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px 20px;
}

.region-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
}

.region-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin: 2px 0 6px 0;
}

.region-desc {
  font-size: 13px;
  color: #e2e8f0;
}

.region-lock-warning {
  margin: 40px auto;
  padding: 30px 40px;
  background: rgba(153, 27, 27, 0.3);
  border: 1px solid #ef4444;
  border-radius: 12px;
  text-align: center;
  max-width: 500px;
}

.lock-text {
  font-size: 16px;
  color: #fca5a5;
  margin-top: 10px;
}

.region-nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 0 30px 30px 30px;
  overflow-y: auto;
  max-height: calc(100% - 220px);
}

.node-card {
  background: rgba(12, 24, 40, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.node-card:hover {
  border-color: var(--border-gold-glow);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.node-card.node-boss {
  border-color: #ef4444;
  background: linear-gradient(135deg, rgba(30, 10, 15, 0.9) 0%, rgba(15, 20, 35, 0.9) 100%);
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.node-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.node-boss-badge {
  background: #991b1b;
  color: #fee2e2;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 4px;
}

.node-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin: 8px 0;
}

.node-drops {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.drop-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 3px;
  color: #fde68a;
}

.node-action-btn {
  width: 100%;
}

/* ==========================================================================
   BATTLE UI (HUD, Skills, Damage Floaters)
   ========================================================================== */
.battle-ui {
  justify-content: space-between;
  padding: 16px 24px;
}

.battle-top-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.combatant-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 440px;
  background: rgba(10, 18, 30, 0.85);
  backdrop-filter: blur(10px);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-avatar-frame {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border: 2px solid #fbbf24;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.hud-avatar {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.hud-details {
  flex: 1;
}

.hud-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
}

.hud-elem {
  font-size: 12px;
  font-weight: 700;
}

.bar-container {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.hp-bar .bar-fill {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

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

.mp-bar .bar-fill {
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%);
}

.bar-label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.vs-center-banner {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
  padding: 10px 20px;
}

.vs-text {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 26px;
  color: #fde68a;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
}

/* Battle Bottom HUD */
.battle-bottom-hud {
  display: flex;
  gap: 20px;
  align-items: flex-end;
}

.battle-skills-grid {
  display: flex;
  gap: 12px;
  flex: 1;
}

.skill-btn {
  flex: 1;
  position: relative;
  background: rgba(12, 22, 38, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  color: #fff;
  text-align: left;
  transition: all 0.2s ease;
  overflow: hidden;
}

.skill-btn:hover:not(:disabled) {
  border-color: #fde047;
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.3);
}

.skill-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.skill-btn.skill-ultimate {
  border-color: #ec4899;
  background: linear-gradient(135deg, rgba(40, 15, 30, 0.9) 0%, rgba(15, 20, 35, 0.9) 100%);
}

.skill-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.skill-details {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.skill-cd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 900;
  color: #ef4444;
}

.battle-combat-log {
  width: 360px;
  height: 120px;
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  overflow-y: auto;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  color: #cbd5e1;
}

.log-crit {
  color: #f59e0b;
  font-weight: 700;
}

.log-reaction {
  color: #38bdf8;
  font-weight: 700;
}

.log-boss {
  color: #ef4444;
}

/* ==========================================================================
   CULTIVATION UI (Động Phủ Tu Luyện)
   ========================================================================== */
.cultivate-ui {
  background: radial-gradient(circle at center, rgba(13, 30, 50, 0.8) 0%, rgba(3, 7, 13, 0.95) 100%);
}

.cultivate-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding-bottom: 40px;
}

.cultivate-realm-card {
  width: 480px;
  background: rgba(11, 22, 38, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.realm-current-name {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 900;
  color: var(--text-gold);
  letter-spacing: 3px;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.realm-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.qi-bar-wrapper {
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}

.qi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.qi-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.cultivate-stats {
  display: flex;
  justify-content: space-around;
  margin: 18px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.cultivate-actions {
  display: flex;
  gap: 14px;
  margin-top: 16px;
}

.cultivate-actions button {
  flex: 1;
}

/* ==========================================================================
   CHARACTER & INVENTORY & QUEST & SETTINGS UI
   ========================================================================== */
.character-content-grid {
  display: flex;
  gap: 24px;
  padding: 20px 30px;
  flex: 1;
  overflow: hidden;
}

.hero-showcase {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 320px;
}

.hero-character-roster {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(10, 20, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
}

.roster-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.roster-item.active {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.roster-item.locked {
  filter: grayscale(1);
  opacity: 0.5;
}

.roster-avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
}

.roster-name {
  font-size: 10px;
  color: #fff;
  margin-top: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50px;
}

.hero-preview {
  flex: 1;
  background: rgba(10, 20, 35, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-preview-img {
  max-height: 240px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.3));
}

.character-stats-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.stats-card, .equipment-slots-card {
  background: rgba(10, 20, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
}

.stats-header {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-gold);
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.equipment-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.eq-slot {
  background: rgba(5, 12, 22, 0.7);
  border: 1px dashed rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
}

.inventory-layout {
  display: flex;
  gap: 20px;
  padding: 16px 30px;
  flex: 1;
  overflow: hidden;
}

.inventory-left {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inventory-right {
  flex: 1;
  background: rgba(10, 20, 35, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 20px;
}

.inv-category-tabs {
  display: flex;
  gap: 8px;
}

.inv-tab {
  background: rgba(15, 27, 45, 0.8);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 13px;
}

.inv-tab.active {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: var(--text-gold);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  overflow-y: auto;
  max-height: 480px;
}

.inv-card {
  background: rgba(8, 16, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.inv-card:hover {
  border-color: #fbbf24;
  transform: translateY(-2px);
}

.inv-card-icon {
  margin: 6px auto;
}

.inv-card-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-card-count {
  font-size: 10px;
  color: var(--accent-gold);
  font-weight: 700;
}

/* Quests */
.quests-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 30px;
  overflow-y: auto;
  flex: 1;
}

.quest-card {
  background: rgba(11, 22, 38, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px 20px;
}

.quest-card.done {
  opacity: 0.7;
  border-color: #10b981;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quest-type-tag {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 4px;
}

.quest-type-tag.main { background: #b45309; color: #fff; }
.quest-type-tag.boss { background: #991b1b; color: #fff; }
.quest-type-tag.daily { background: #047857; color: #fff; }

.quest-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.quest-status-done {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #10b981;
  font-weight: 700;
}

.quest-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 6px 0 10px 0;
}

.quest-rewards-row {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.reward-pill {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Settings */
.settings-ui {
  background: rgba(5, 10, 18, 0.8);
}

.settings-card {
  max-width: 500px;
  margin: 30px auto;
  background: rgba(11, 22, 38, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.setting-item input[type="range"] {
  accent-color: #fbbf24;
}

.danger-zone {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

/* Reward Scene */
.reward-ui {
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
}

.reward-modal-card {
  width: 520px;
  background: rgba(12, 24, 42, 0.95);
  border: 2px solid #fbbf24;
  border-radius: 14px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 0 50px rgba(251, 191, 36, 0.3);
}

.victory-title {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 4px;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}

.rating-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: 12px;
  margin-top: 6px;
}

.level-up-banner {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #a7f3d0;
  font-family: var(--font-title);
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reward-summary-box {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  padding: 14px 0;
  background: rgba(5, 12, 22, 0.7);
  border-radius: 8px;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.reward-drops-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.reward-drop-item {
  background: rgba(15, 27, 45, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
}

.reward-modal-actions {
  display: flex;
  gap: 12px;
}

.reward-modal-actions button {
  flex: 1;
}

/* Toast Notifications */
#game-toast-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.game-toast {
  background: rgba(10, 20, 35, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.game-toast.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.game-toast-success { border-color: #10b981; color: #a7f3d0; }
.game-toast-warning { border-color: #f59e0b; color: #fde68a; }
.game-toast-danger { border-color: #ef4444; color: #fca5a5; }
