/* ========================================
   TALORIA — Sirus.one-Inspired Modern Dark WoW UI
   Clean, modern, glassmorphism, warm gold
   ======================================== */

/* --- CSS Variables --- */
:root {
  --bg: #0b0f15;
  --bg-lighter: #101520;
  --panel: rgba(16, 20, 30, 0.88);
  --panel-solid: #131825;
  --panel-hover: #181d2c;
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-border-hover: rgba(58, 204, 96, 0.25);
  --gold: #f6c86d;
  --gold-dim: #c9a24e;
  --gold-bright: #ffe08a;
  --gold-bg: rgba(246, 200, 109, 0.08);
  --gold-glow: rgba(246, 200, 109, 0.3);
  --cta: #3acc60;
  --cta-dim: #2ea84d;
  --cta-bright: #50e878;
  --cta-glow: rgba(58, 204, 96, 0.3);
  --blue: #5b8fff;
  --blue-dim: #4170dd;
  --blue-bright: #7daaff;
  --red: #ff4d4d;
  --red-dim: #cc3333;
  --green: #4dff88;
  --green-dim: #33cc66;
  --purple: #a855f7;
  --purple-bright: #c084fc;
  --orange: #ff8c42;
  --teal: #22d3ee;
  --text: #e8e6e0;
  --text-dim: #9a9a9e;
  --text-muted: #5a5a62;
  --font-heading: 'Cinzel', 'Georgia', serif;
  --font-body: 'Montserrat', 'Inter', 'Segoe UI', sans-serif;
  --max-width: 1200px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --transition: 0.25s ease;
  --blur: blur(20px);

  /* Rarity colors */
  --rarity-common: #9D9D9D;
  --rarity-uncommon: #1EFF00;
  --rarity-rare: #0070FF;
  --rarity-epic: #A335EE;
  --rarity-legendary: #FF8000;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: max(14px, 10px + 0.3vw);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Atmospheric blurred background layer for screens */
.screen::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(20, 80, 55, 0.6) 0%, transparent 55%),
    radial-gradient(ellipse 70% 55% at 85% 75%, rgba(15, 45, 85, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 60% 45% at 50% 10%, rgba(60, 35, 75, 0.4) 0%, transparent 45%),
    radial-gradient(ellipse 55% 55% at 70% 40%, rgba(10, 60, 45, 0.45) 0%, transparent 45%),
    radial-gradient(ellipse 80% 80% at 30% 90%, rgba(10, 30, 60, 0.5) 0%, transparent 55%),
    var(--bg);
  filter: blur(60px) saturate(1.4);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--gold);
  font-weight: 700;
}

a { color: var(--gold); text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(246, 200, 109, 0.25);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(246, 200, 109, 0.45);
}

/* --- Screens --- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* --- Glass Panel Base --- */
.glass {
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
  outline: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--cta) 0%, var(--cta-dim) 100%);
  color: #fff;
  box-shadow: 0 4px 20px var(--cta-glow);
  border: 1px solid var(--cta);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--cta-bright) 0%, var(--cta) 100%);
  box-shadow: 0 6px 30px rgba(58, 204, 96, 0.45);
  transform: translateY(-2px);
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dim) 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(91, 143, 255, 0.3);
}
.btn-blue:hover {
  box-shadow: 0 6px 30px rgba(91, 143, 255, 0.45);
  transform: translateY(-2px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(246, 200, 109, 0.06);
}

.btn-telegram {
  background: transparent;
  color: var(--cta);
  padding: 14px 32px;
  font-size: 0.9rem;
  border: 2px solid var(--cta);
  border-radius: 25px;
}
.btn-telegram:hover {
  background: rgba(58, 204, 96, 0.08);
  box-shadow: 0 0 20px rgba(58, 204, 96, 0.2);
  transform: translateY(-2px);
}

.btn-email {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 32px;
  font-size: 0.9rem;
  border-radius: 25px;
}
.btn-email:hover {
  border-color: var(--text);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.75rem;
}

.btn-icon { width: 20px; height: 20px; }

.btn-danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.gold-text { color: var(--gold); }

/* ============================
   SCREEN 1: LOGIN
   ============================ */

#screen-login {
  position: relative;
  justify-content: center;
  align-items: center;
}
#screen-login::before {
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(120, 70, 15, 0.5) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 15% 70%, rgba(10, 60, 45, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(20, 35, 75, 0.5) 0%, transparent 45%),
    radial-gradient(ellipse 50% 40% at 50% 85%, rgba(70, 30, 15, 0.35) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.5);
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.login-ruins {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(246, 200, 109, 0.03) 0%, transparent 40%);
}

.login-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.login-content {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}
.invite-hint {
  background: rgba(180,150,60,0.2);
  border: 1px solid rgba(200,170,60,0.5);
  color: #e8d9b0;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 1rem;
  text-align: center;
  margin-bottom: 20px;
  max-width: 440px;
  animation: inviteHintPulse 2s ease-in-out infinite;
}
@keyframes inviteHintPulse {
  0%, 100% { border-color: rgba(200,170,60,0.5); }
  50% { border-color: rgba(200,170,60,0.9); box-shadow: 0 0 12px rgba(200,170,60,0.3); }
}

.login-card {
  background: rgba(18, 21, 32, 0.8);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(246, 200, 109, 0.12);
  border-radius: var(--radius-lg);
  padding: 60px 50px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  position: relative;
}

.logo-rune,
.logo-glow { display: none; }

.login-logo-img {
  width: 220px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 4px 20px rgba(246, 200, 109, 0.2));
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 12px rgba(246, 200, 109, 0.3));
}

.logo-subtitle {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 24px;
  font-weight: 500;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(246, 200, 109, 0.2), transparent);
}
.divider-rune {
  color: var(--gold);
  font-size: 1rem;
  opacity: 0.6;
}

.login-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.8;
  margin-bottom: 32px;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-footer {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.rune-symbol { color: var(--gold-dim); opacity: 0.5; }

/* ============================
   TOP NAVIGATION
   ============================ */

.top-nav {
  background: rgba(12, 14, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  cursor: pointer;
  letter-spacing: 0.08em;
}

.nav-breadcrumb {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  border-radius: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.nav-item.active {
  color: #fff;
  background: none;
  border-bottom: 2px solid var(--cta);
  border-radius: 0;
  padding-bottom: 6px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gold-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
}
.gold-icon { width: 22px; height: 22px; }

.notif-bell {
  position: relative;
  color: var(--text-dim);
  cursor: pointer;
  width: 24px;
  height: 24px;
}
.notif-bell svg { width: 20px; height: 20px; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar { cursor: pointer; }
.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #0c0e14;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ============================
   SCREEN 2: DASHBOARD
   ============================ */

#screen-dashboard::before {
  background:
    radial-gradient(ellipse 70% 55% at 10% 25%, rgba(10, 70, 40, 0.6) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 90% 55%, rgba(15, 40, 80, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 55% 45% at 50% 85%, rgba(35, 65, 20, 0.4) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.4);
}

#screen-char-create::before {
  background:
    radial-gradient(ellipse 60% 55% at 50% 15%, rgba(60, 28, 75, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 70% 55% at 15% 70%, rgba(15, 55, 65, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 55% 45% at 85% 50%, rgba(75, 50, 15, 0.4) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.4);
}

#screen-lobby::before {
  background:
    radial-gradient(ellipse 80% 60% at 25% 25%, rgba(10, 50, 70, 0.6) 0%, transparent 50%),
    radial-gradient(ellipse 60% 55% at 75% 70%, rgba(20, 70, 35, 0.5) 0%, transparent 50%),
    var(--bg);
  filter: blur(60px) saturate(1.4);
}

#screen-inventory::before {
  background:
    radial-gradient(ellipse 70% 55% at 80% 20%, rgba(50, 22, 70, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 10% 65%, rgba(15, 55, 40, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 55% 45% at 50% 90%, rgba(65, 35, 10, 0.35) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.4);
}

#screen-shop::before {
  background:
    radial-gradient(ellipse 70% 55% at 50% 15%, rgba(80, 45, 10, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 60% 55% at 15% 70%, rgba(10, 50, 60, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 55% 45% at 85% 55%, rgba(50, 15, 65, 0.45) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.5);
}

.dashboard-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

.section { margin-bottom: 48px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: #fff;
}

/* Hero Cards */
.heroes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.hero-card {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.hero-card {
  cursor: pointer;
  transition: all 0.3s ease;
}
.hero-card:hover {
  border-color: var(--panel-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Selected hero card — bright and highlighted */
.hero-card-selected {
  border-color: var(--gold) !important;
  box-shadow: 0 0 20px rgba(246, 200, 109, 0.2), 0 8px 32px rgba(0, 0, 0, 0.3);
}
.hero-card-selected .hero-portrait::after {
  content: '✦ Выбран';
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(246, 200, 109, 0.9);
  color: #1a1a1a;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  z-index: 2;
}

/* Dimmed (non-selected) hero cards */
.hero-card-dimmed {
  opacity: 0.5;
  filter: grayscale(0.3);
}
.hero-card-dimmed:hover {
  opacity: 0.8;
  filter: grayscale(0);
}

/* Locked "create new" card */
.hero-card-locked {
  border-style: dashed;
  opacity: 0.7;
  cursor: default;
}
.hero-card-locked:hover {
  transform: none;
  box-shadow: none;
}
.hero-slots-left {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.hero-buy-slot-btn {
  margin-top: 10px;
}

.hero-portrait {
  height: 180px;
  position: relative;
  overflow: hidden;
}
.hero-portrait-img {
  width: 100%;
  height: 100%;
}
.warrior-portrait {
  background: linear-gradient(135deg, #2a1f15, #4a3828, #3a2818);
}
.mage-portrait {
  background: linear-gradient(135deg, #1a2040, #2a3060, #3a2060);
}
.priest-portrait {
  background: linear-gradient(135deg, #2a2a1a, #404028, #3a3a28);
}

.hero-level {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(12, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid rgba(246, 200, 109, 0.2);
}

.hero-info { padding: 16px; }
.hero-name {
  font-size: 1.1rem;
  margin-bottom: 2px;
}
.hero-meta {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.xp-bar {
  height: 22px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 11px;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 11px;
  transition: width 0.6s ease;
}
.xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Hero coins on dashboard card */
.hero-coins {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.hero-coin-gold { color: #f6c86d; }
.hero-coin-silver { color: #c0c0c0; }

.hero-actions {
  display: flex;
  gap: 8px;
}
.btn-danger-sm {
  border-color: rgba(255, 80, 80, 0.3) !important;
  color: rgba(255, 80, 80, 0.7) !important;
}
.btn-danger-sm:hover {
  border-color: rgba(255, 80, 80, 0.6) !important;
  color: #ff5050 !important;
  background: rgba(255, 80, 80, 0.1) !important;
}

/* New Hero Card */
.hero-card-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  cursor: pointer;
  border-style: dashed;
  color: var(--text-muted);
  gap: 12px;
}
.hero-card-new:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.new-hero-icon {
  width: 56px;
  height: 56px;
  border: 2px dashed currentColor;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Adventure Cards */
.adventures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.adventure-card {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.adventure-card:hover {
  border-color: var(--panel-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.adventure-locked {
  opacity: 0.5;
  filter: grayscale(0.6);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}
.adventure-locked:hover {
  transform: translateY(-4px) scale(1.03);
  opacity: 0.7;
  filter: grayscale(0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.adventure-locked .adventure-img {
  position: relative;
}
.adventure-locked .adventure-img::after {
  content: 'Купить новую карту';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #f6c86d;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.adventure-locked:hover .adventure-img::after {
  opacity: 1;
}
.adventure-lock {
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
}

.adventure-img {
  height: 140px;
  width: 100%;
}
.adventure-img-1 { background: url('map2.jpg') center/cover no-repeat; }
.adventure-img-2 { background: linear-gradient(135deg, #2a1a2a, #4a2a3a, #3a1a2a); }
.adventure-img-3 { background: linear-gradient(135deg, #2a1a0a, #5a3a1a, #3a2a0a); }

.adventure-info { padding: 16px; }
.adventure-title {
  font-size: 1rem;
  margin-bottom: 8px;
}
.adventure-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.difficulty {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.difficulty-medium {
  background: rgba(255, 140, 66, 0.12);
  color: var(--orange);
  border: 1px solid rgba(255, 140, 66, 0.25);
}
.difficulty-hard {
  background: rgba(255, 77, 77, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 77, 77, 0.25);
}
.difficulty-legendary {
  background: rgba(255, 128, 0, 0.12);
  color: var(--rarity-legendary);
  border: 1px solid rgba(255, 128, 0, 0.25);
}

.team-size { color: var(--text-dim); }

/* ============================
   SCREEN 3: CHARACTER CREATION
   ============================ */

.create-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
  width: 70px;
  flex-shrink: 0;
}
.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.step.active .step-num {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border-color: var(--gold);
  color: #0c0e14;
  box-shadow: 0 0 20px var(--gold-glow);
}
.step.completed .step-num {
  background: rgba(246, 200, 109, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}
.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.step.active .step-label { color: var(--gold); }
.step.completed .step-label { color: var(--gold-dim); }

.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 8px;
  margin-bottom: 22px;
}

/* Step Content */
.create-step { display: none; }
.create-step.active { display: block; }

.create-title {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.create-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* Race Grid */
.race-grid, .class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.race-card, .class-card {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.race-card:hover, .class-card:hover {
  border-color: rgba(246, 200, 109, 0.2);
  background: var(--panel-hover);
}
.race-card.selected, .class-card.selected {
  border-color: var(--gold);
  background: rgba(246, 200, 109, 0.06);
  box-shadow: 0 0 30px rgba(246, 200, 109, 0.1);
}

.race-portrait, .class-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  border: 2px solid rgba(255, 255, 255, 0.08);
}
.race-human { background: linear-gradient(135deg, #3a3020, #5a4a30); }
.race-elf { background: linear-gradient(135deg, #203a4a, #305a6a); }
.race-dwarf { background: linear-gradient(135deg, #3a2a1a, #5a3a2a); }

.class-warrior { background: linear-gradient(135deg, #3a2a1a, #5a3a2a); }
.class-mage { background: linear-gradient(135deg, #1a2a4a, #2a3a6a); }
.class-priest { background: linear-gradient(135deg, #3a3a1a, #5a5a2a); }
.class-bard { background: linear-gradient(135deg, #2a1a3a, #4a2a5a); }

/* Gender selection */
.gender-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 600px;
  margin: 0 auto;
}
.gender-card {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.gender-card:hover {
  border-color: rgba(246, 200, 109, 0.2);
  background: var(--panel-hover);
}
.gender-card.selected {
  border-color: var(--gold);
  background: rgba(246, 200, 109, 0.06);
  box-shadow: 0 0 30px rgba(246, 200, 109, 0.1);
}
.gender-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border: 2px solid rgba(255, 255, 255, 0.08);
}
.gender-male {
  background: linear-gradient(135deg, #1a2a4a, #2a4a6a);
  color: #6ab0f3;
}
.gender-female {
  background: linear-gradient(135deg, #3a1a3a, #5a2a4a);
  color: #e88ace;
}
.gender-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 8px;
}
.gender-desc {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.4;
}

.race-card h3, .class-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 4px;
}
.race-bonus {
  color: var(--green);
  font-size: 0.75rem;
  margin-bottom: 8px;
  font-weight: 500;
}
.race-desc {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}

.class-role {
  color: var(--text-dim);
  font-size: 0.75rem;
  display: block;
  margin-bottom: 12px;
}
.class-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}
.skill-tag {
  padding: 3px 10px;
  background: rgba(91, 143, 255, 0.08);
  border: 1px solid rgba(91, 143, 255, 0.15);
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--blue-bright);
}

/* Stats */
.stats-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  max-width: 940px;
  margin: 0 auto;
  align-items: start;
}
.stats-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: sticky;
  top: 20px;
}
.stats-avatar {
  width: 340px;
  height: 380px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.3);
  overflow: hidden;
}
.stats-avatar .avatar-placeholder {
  width: 120px;
  height: 120px;
  opacity: 0.3;
}
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
}
.stat-row:hover { border-color: rgba(246, 200, 109, 0.15); }

.stat-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-str { background: rgba(255, 77, 77, 0.1); border: 1px solid rgba(255, 77, 77, 0.2); }
.stat-agi { background: rgba(77, 255, 136, 0.1); border: 1px solid rgba(77, 255, 136, 0.2); }
.stat-end { background: rgba(255, 170, 50, 0.1); border: 1px solid rgba(255, 170, 50, 0.2); }
.stat-int { background: rgba(91, 143, 255, 0.1); border: 1px solid rgba(91, 143, 255, 0.2); }
.stat-wis { background: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.2); }
.stat-cha { background: rgba(255, 215, 0, 0.1); border: 1px solid rgba(255, 215, 0, 0.2); }

.stat-info h4 {
  font-family: var(--font-body);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}
.stat-info p {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.stat-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(246, 200, 109, 0.08);
}
.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 24px;
  text-align: center;
}

/* Appearance */
.appearance-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  max-width: 800px;
  margin: 0 auto;
}
.appearance-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}
.appearance-avatar {
  width: 280px;
  height: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-placeholder { width: 140px; height: 140px; opacity: 0.3; }

.appearance-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.appearance-option label {
  display: block;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.color-picks {
  display: flex;
  gap: 8px;
}
.color-pick {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
}
.color-pick:hover { transform: scale(1.15); }
.color-pick.selected {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.style-picks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.style-pick {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.style-pick:hover {
  border-color: rgba(246, 200, 109, 0.3);
  color: var(--text);
}
.style-pick.selected {
  background: rgba(246, 200, 109, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}

/* Name Input */
.name-input-wrap {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}
.name-input {
  width: 100%;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.3rem;
  text-align: center;
  outline: none;
  transition: all var(--transition);
}
.name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(246, 200, 109, 0.15);
}
.name-input::placeholder { color: var(--text-muted); }

.name-suggestions {
  margin-top: 20px;
}
.name-suggestions p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.suggestion-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.suggestion-tag {
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}
.suggestion-tag:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Create Navigation */
.create-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
  padding-bottom: 40px;
}

/* ============================
   SCREEN: SCENARIO SELECTION
   ============================ */

.scenario-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap) var(--gap);
}

.scenario-hero-banner {
  position: relative;
  height: 180px;
  background: linear-gradient(135deg, rgba(30,35,50,0.9), rgba(20,22,30,0.95)),
              url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" stroke="%23c8a94e22" width="99" height="99"/></svg>');
  border-radius: var(--radius);
  margin-bottom: var(--gap);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
}

.scenario-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(12,14,20,0.95) 0%, rgba(12,14,20,0.3) 60%, transparent 100%);
}

.scenario-hero-content {
  position: relative;
  z-index: 1;
  padding: 24px 32px;
}

.scenario-adventure-title {
  font-size: 2rem;
  color: var(--gold);
  margin: 0 0 6px;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(200, 169, 78, 0.3);
}

.scenario-adventure-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.scenario-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.scenario-card:hover:not(.scenario-card-locked) {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(200, 169, 78, 0.15);
}

.scenario-card-selected {
  border-color: var(--gold) !important;
  background: rgba(200, 169, 78, 0.08);
  box-shadow: 0 0 20px rgba(200, 169, 78, 0.2), inset 0 0 30px rgba(200, 169, 78, 0.05);
}

.scenario-card-selected::before {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--gold);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.scenario-card-locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.scenario-card-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.scenario-card-preview {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.scenario-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.scenario-card:hover .scenario-card-preview img {
  transform: scale(1.05);
}

.scenario-card-title {
  color: var(--text);
  font-size: 1.1rem;
  margin: 0 0 8px;
  font-weight: 600;
}

.scenario-card-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 12px;
  line-height: 1.4;
}

.scenario-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.scenario-difficulty {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.scenario-diff-easy {
  background: rgba(30, 200, 80, 0.15);
  color: #1ec850;
  border: 1px solid rgba(30, 200, 80, 0.3);
}

.scenario-diff-medium {
  background: rgba(230, 180, 40, 0.15);
  color: #e6b428;
  border: 1px solid rgba(230, 180, 40, 0.3);
}

.scenario-diff-hard {
  background: rgba(230, 60, 60, 0.15);
  color: #e63c3c;
  border: 1px solid rgba(230, 60, 60, 0.3);
}

.scenario-diff-legendary {
  background: rgba(255, 128, 0, 0.15);
  color: #ff8000;
  border: 1px solid rgba(255, 128, 0, 0.3);
}

.scenario-duration {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.scenario-card-rewards {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.scenario-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.scenario-actions .btn-multi {
  border-color: #5E86FF;
  color: #5E86FF;
}

.scenario-actions .btn-multi:hover:not(:disabled) {
  background: rgba(94, 134, 255, 0.15);
}

/* --- Active Games Section --- */
.active-games-section {
  margin-bottom: 24px;
}

.active-games-title {
  color: #C9A86A;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.scenario-section-title {
  color: #C9A86A;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.active-games-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-game-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 30, 40, 0.8);
  border: 1px solid rgba(201, 168, 106, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  transition: border-color 0.2s;
}

.active-game-card:hover {
  border-color: rgba(201, 168, 106, 0.6);
}

.active-game-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-game-name {
  color: #e0d8c0;
  font-weight: 600;
  font-size: 0.95rem;
}

.active-game-meta {
  color: #8a8a8a;
  font-size: 0.8rem;
}

.active-game-status {
  font-weight: 600;
}

.status-playing { color: #4CAF50; }
.status-lobby { color: #FF9800; }
.status-paused { color: #9E9E9E; }

.active-game-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-delete-game {
  color: #e74c3c !important;
  border-color: #e74c3c !important;
  padding: 4px 10px !important;
  font-size: 0.85rem;
  min-width: auto;
}

.btn-delete-game:hover {
  background: rgba(231, 76, 60, 0.2) !important;
}

/* ============================
   SCREEN 4: TEAM LOBBY
   ============================ */

.lobby-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

.lobby-mission {
  display: flex;
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
  position: relative;
}
.lobby-mission-img {
  width: 280px;
  min-height: 160px;
  background: linear-gradient(135deg, #1a2a1a, #2a4a2a);
  flex-shrink: 0;
}
.lobby-mission-info {
  padding: 20px 24px;
}
.lobby-mission-info h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.lobby-mission-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.lobby-mission-goal {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}
.lobby-mission-goal strong { color: var(--text); }

.lobby-section-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.lobby-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.lobby-slot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
}
.lobby-slot:hover { border-color: rgba(246, 200, 109, 0.15); }

.slot-portrait {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
}
.warrior-portrait, .mage-portrait, .priest-portrait {
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.slot-info { flex: 1; }
.slot-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.slot-class {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.slot-status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
}
.slot-status.ready {
  color: var(--green);
  background: rgba(77, 255, 136, 0.08);
}
.slot-status.waiting {
  color: var(--orange);
  background: rgba(255, 140, 66, 0.08);
}

.lobby-slot.empty {
  border-style: dashed;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  color: var(--text-muted);
}
.slot-empty-icon {
  font-size: 1.2rem;
  opacity: 0.3;
}

/* Invite Modal */
.invite-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.invite-modal-content {
  background: rgba(18, 21, 32, 0.95);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 400px;
  position: relative;
}
.invite-modal-content h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
}
.invite-method {
  margin-bottom: 16px;
}
.invite-method label {
  display: block;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 6px;
  font-weight: 500;
}
.invite-link-row {
  display: flex;
  gap: 8px;
}
.invite-input {
  flex: 1;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}
.invite-code {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.15em;
}

.lobby-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-ready {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(60,160,60,0.3);
  border: 2px solid rgba(80,200,80,0.5);
  color: #bde8bd;
  transition: all 0.3s;
}
.btn-ready:hover {
  background: rgba(60,160,60,0.5);
  border-color: rgba(80,200,80,0.8);
}
.btn-ready.ready-active {
  background: rgba(60,180,60,0.5);
  border-color: rgba(80,220,80,0.9);
  color: #fff;
  box-shadow: 0 0 12px rgba(80,200,80,0.4);
}

/* ============================
   SCREEN 5: GAME SCREEN
   ============================ */

.game-topbar {
  background: rgba(12, 14, 20, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 16px;
}
.game-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.game-mission-info {
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
}
.game-mission-label { color: var(--text-muted); }
.game-mission-name { color: var(--gold); font-weight: 600; }

.game-round-info {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.round-divider { opacity: 0.3; }
.party-gold-display {
  color: #d4b050;
  font-weight: 600;
}
.party-gold-display strong {
  color: #f0d060;
}

/* Game Layout */
.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  overflow: hidden;
}

/* Left Panel */
.game-panel-left {
  background: rgba(18, 21, 32, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px;
  overflow-y: auto;
}

.panel-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.team-member {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  transition: all var(--transition);
}
.team-member.active-turn {
  border-color: rgba(246, 200, 109, 0.2);
  background: rgba(246, 200, 109, 0.04);
}

.tm-portrait {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.warrior-portrait-sm { background: linear-gradient(135deg, #3a2a1a, #5a3a2a); }
.mage-portrait-sm { background: linear-gradient(135deg, #1a2a4a, #2a3a6a); }
.priest-portrait-sm { background: linear-gradient(135deg, #3a3a1a, #5a5a2a); }

.tm-info { flex: 1; min-width: 0; }
.tm-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.tm-bar {
  height: 14px;
  border-radius: 7px;
  position: relative;
  overflow: hidden;
  margin-bottom: 3px;
}
.hp-bar { background: rgba(255, 77, 77, 0.15); }
.mana-bar { background: rgba(91, 143, 255, 0.15); }

.bar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.4s ease;
}
.hp-bar .bar-fill { background: linear-gradient(90deg, #cc3333, #ff4d4d); }
.mana-bar .bar-fill { background: linear-gradient(90deg, #4170dd, #5b8fff); }
.xp-bar-tm .bar-fill { background: linear-gradient(90deg, #9b59b6, #c39bd3); }

.tm-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.tm-effects { display: flex; gap: 4px; width: 100%; margin-top: 2px; }
.effect-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
}
.effect-shield { background: rgba(91, 143, 255, 0.15); color: var(--blue); }
.effect-fire { background: rgba(255, 77, 77, 0.15); color: var(--red); }

/* Center: Dungeon Map */
.game-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0a0c10;
}

.ai-narration {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(91, 143, 255, 0.04);
  border-bottom: 1px solid rgba(91, 143, 255, 0.08);
  align-items: flex-start;
}
.ai-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dim));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ai-narration p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  font-style: italic;
}

.dungeon-map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 0;
}

/* Viewport — fills wrapper, clips the grid, handles pan/zoom */
.map-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.map-viewport.is-dragging {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M9 3a1.5 1.5 0 0 1 3 0v5.5a1 1 0 1 1 0 0V3a1.5 1.5 0 0 1 3 0v5.5a1 1 0 1 1 0 0V4.5a1.5 1.5 0 0 1 3 0V12l-1 8H7l-1-8V6.5A1.5 1.5 0 0 1 9 5V3z' fill='%23fff' stroke='%23333' stroke-width='0.7'/%3E%3C/svg%3E") 12 2, grabbing;
}
.map-viewport.is-dragging * {
  pointer-events: none;
}

/* Zoom controls — top-left overlay */
.map-zoom-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}
.map-zoom-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(212, 176, 80, 0.35);
  background: rgba(12, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  color: #d4b050;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
}
.map-zoom-btn:hover {
  background: rgba(212, 176, 80, 0.15);
  border-color: rgba(212, 176, 80, 0.6);
}
.map-zoom-btn:active {
  transform: scale(0.92);
  background: rgba(212, 176, 80, 0.25);
}

/* Right Panel */
.game-panel-right {
  background: rgba(18, 21, 32, 0.9);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px;
  overflow-y: auto;
}

.combat-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 176, 80, 0.3) transparent;
}
.combat-log::-webkit-scrollbar {
  width: 4px;
}
.combat-log::-webkit-scrollbar-track {
  background: transparent;
}
.combat-log::-webkit-scrollbar-thumb {
  background: rgba(212, 176, 80, 0.3);
  border-radius: 2px;
}
.combat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 176, 80, 0.5);
}
.log-entry {
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.log-action { border-left-color: rgba(246, 200, 109, 0.4); }
.log-damage { border-left-color: rgba(255, 77, 77, 0.4); }
.log-heal { border-left-color: rgba(77, 255, 136, 0.4); }
.log-discovery { border-left-color: rgba(168, 85, 247, 0.4); }
.log-enemy { border-left-color: rgba(255, 77, 77, 0.6); }

.log-actor { color: var(--gold); font-weight: 600; }
.log-spell { color: var(--blue-bright); }
.log-dmg { color: var(--red); font-weight: 600; }
.log-hp { color: var(--green); font-weight: 600; }
.log-find { color: var(--purple-bright); font-weight: 600; }
.log-target { color: var(--text); font-weight: 500; }
.log-status { color: var(--orange); font-weight: 600; }

/* Action Bar */
.action-bar {
  background: rgba(12, 14, 20, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 16px;
}
.action-bar-inner {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 80px;
  height: 44px;
  font-family: var(--font-body);
}
.action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}
.action-btn.active {
  background: rgba(246, 200, 109, 0.08);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 20px rgba(246, 200, 109, 0.1);
}
.action-btn.end-turn {
  background: rgba(77, 255, 136, 0.06);
  border-color: rgba(77, 255, 136, 0.2);
  color: var(--green);
}
.action-icon { font-size: 1.2rem; }
.action-btn span:last-child {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Action Menu Dropdown */
.action-menu-wrapper {
  position: relative;
}
.action-menu-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(20, 24, 38, 0.98) 0%, rgba(12, 14, 22, 0.98) 100%);
  border: 1px solid rgba(212, 176, 80, 0.4);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 240px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6), 0 0 1px rgba(212, 176, 80, 0.3);
  backdrop-filter: blur(12px);
}
.action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.action-menu-item:hover {
  background: rgba(212, 176, 80, 0.1);
}
.ami-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.ami-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e0d8c0;
  white-space: nowrap;
}
.ami-desc {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  margin-left: auto;
  text-align: right;
  max-width: 140px;
}
.action-menu-item.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ===== Map Markers ===== */
.marker-menu-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(20, 24, 38, 0.98) 0%, rgba(12, 14, 22, 0.98) 100%);
  border: 1px solid rgba(212, 176, 80, 0.4);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 180px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
}
.marker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #e0d8c0;
  transition: background 0.15s;
}
.marker-option:hover {
  background: rgba(212, 176, 80, 0.1);
}
.marker-option-clear {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 2px;
  padding-top: 8px;
  color: #e07070;
}

/* Marker overlays on cells */
.map-marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  z-index: 12;
  pointer-events: none;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
  opacity: 0.9;
}

/* Marker comment bubble */
.marker-comment-bubble {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 14, 20, 0.92);
  color: #f6c86d;
  font-size: 0.55rem;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(246,200,109,0.25);
  white-space: nowrap;
  max-width: 200%;
  z-index: 14;
  pointer-events: none;
  line-height: 1.3;
  box-sizing: border-box;
  overflow: visible;
}

/* ===== Marker Visibility Popup ===== */
.marker-visibility-popup {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
}
.mv-card {
  background: linear-gradient(160deg, #1a1d2e 0%, #0e1018 100%);
  border: 1px solid rgba(246,200,109,0.25);
  border-radius: 12px;
  padding: 18px 22px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.mv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #f6c86d;
  margin-bottom: 14px;
}
.mv-icon { font-size: 1.3rem; }
.mv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.mv-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d0cfc8;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.mv-option:hover { background: rgba(246,200,109,0.08); }
.mv-option input[type="checkbox"] {
  accent-color: #f6c86d;
  width: 16px;
  height: 16px;
}
.mv-hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mv-hero-name { flex: 1; }
.mv-owner-badge {
  font-size: 0.7rem;
  color: #888;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 4px;
}
.mv-comment-wrap {
  margin-bottom: 12px;
}
.mv-comment-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(246,200,109,0.18);
  border-radius: 6px;
  padding: 7px 10px;
  color: #d0cfc8;
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.mv-comment-input::placeholder { color: #666; }
.mv-comment-input:focus { border-color: rgba(246,200,109,0.4); }

.mv-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.mv-btn-ok {
  flex: 1;
  padding: 7px 14px !important;
  font-size: 0.85rem !important;
}
.mv-btn-del {
  background: rgba(224,80,80,0.15) !important;
  color: #e05050 !important;
  border: 1px solid rgba(224,80,80,0.25) !important;
  padding: 7px 12px !important;
  font-size: 0.85rem !important;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.mv-btn-del:hover {
  background: rgba(224,80,80,0.3) !important;
}

/* ===== Team Chat ===== */
.team-chat {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 20%;
  height: 50%;
  min-width: 180px;
  min-height: 140px;
  background: rgba(12, 14, 20, 0.80);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(246, 200, 109, 0.12);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  transition: height 0.25s ease, min-height 0.25s ease;
}
.team-chat.minimized {
  height: 32px !important;
  min-height: 32px !important;
}
.team-chat.minimized .team-chat-messages,
.team-chat.minimized .team-chat-input {
  display: none;
}
.team-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(246, 200, 109, 0.06);
  border-bottom: 1px solid rgba(246, 200, 109, 0.1);
  font-size: 0.72rem;
  color: var(--gold);
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.team-chat-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #ccc;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.team-chat-toggle:hover {
  background: rgba(255,255,255,0.08);
}
.team-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,176,80,0.2) transparent;
}
.team-chat-messages::-webkit-scrollbar { width: 4px; }
.team-chat-messages::-webkit-scrollbar-thumb { background: rgba(212,176,80,0.2); border-radius: 2px; }
.chat-msg {
  font-size: 0.72rem;
  line-height: 1.35;
  word-break: break-word;
}
.chat-sender {
  font-weight: 700;
  font-size: 0.7rem;
}
.chat-text {
  color: #ccc;
}
.team-chat-input {
  display: flex;
  gap: 4px;
  padding: 5px 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.team-chat-input input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 8px;
  color: #ddd;
  font-size: 0.72rem;
  outline: none;
}
.team-chat-input input:focus {
  border-color: rgba(246,200,109,0.3);
}
.team-chat-send {
  background: rgba(246,200,109,0.15);
  border: 1px solid rgba(246,200,109,0.2);
  border-radius: 6px;
  color: var(--gold);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
}
.team-chat-send:hover {
  background: rgba(246,200,109,0.25);
}

/* Free Action Modal */
.free-action-content {
  max-width: 420px;
}
.free-action-input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e0d8c0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  margin-top: 8px;
}
.free-action-input:focus {
  border-color: rgba(212, 176, 80, 0.5);
}
.free-action-input::placeholder {
  color: rgba(255,255,255,0.2);
}

/* ============================
   SCREEN 6: INVENTORY
   ============================ */

.inventory-main {
  display: grid;
  grid-template-columns: 350px 1fr;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  gap: 24px;
  width: 100%;
}

.inventory-equip {}
.inv-section-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.equip-avatar {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}
.equip-avatar-img {
  width: 120px;
  height: 160px;
  border-radius: var(--radius);
  margin: 0 auto 20px;
}
.equip-slots { display: flex; flex-direction: column; gap: 10px; }
.equip-slot {
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}
.equip-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}
.equip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}
.equip-item-icon { font-size: 1rem; }

.rarity-common .equip-item, .rarity-common .inv-item-icon { color: var(--rarity-common); }
.rarity-uncommon .equip-item, .rarity-uncommon .inv-item-icon { color: var(--rarity-uncommon); }
.rarity-rare .equip-item, .rarity-rare .inv-item-icon { color: var(--rarity-rare); }
.rarity-epic .equip-item, .rarity-epic .inv-item-icon { color: var(--rarity-epic); }
.rarity-legendary .equip-item, .rarity-legendary .inv-item-icon { color: var(--rarity-legendary); }

/* Inventory Grid */
.inventory-grid-section {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.inv-categories {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.inv-cat {
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.inv-cat:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.inv-cat.active {
  background: rgba(58, 204, 96, 0.1);
  border-color: var(--cta);
  color: var(--cta);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.inv-item {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.5rem;
}
.inv-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}
.inv-item.selected {
  border-color: var(--gold);
  background: rgba(246, 200, 109, 0.06);
  box-shadow: 0 0 15px rgba(246, 200, 109, 0.1);
}
.inv-item.empty {
  opacity: 0.3;
  cursor: default;
}

.inv-item.rarity-common { border-color: rgba(157, 157, 157, 0.3); }
.inv-item.rarity-uncommon { border-color: rgba(30, 255, 0, 0.3); }
.inv-item.rarity-rare { border-color: rgba(0, 112, 255, 0.3); }
.inv-item.rarity-epic { border-color: rgba(163, 53, 238, 0.3); }
.inv-item.rarity-legendary { border-color: rgba(255, 128, 0, 0.3); }

.inv-item-icon { font-size: 1.4rem; }
.inv-item-qty {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Item Description */
.inv-item-desc {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}
.inv-desc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.inv-desc-name {
  font-weight: 700;
  font-size: 1rem;
}
.rarity-rare-text { color: var(--rarity-rare); }
.rarity-epic-text { color: var(--rarity-epic); }
.rarity-legendary-text { color: var(--rarity-legendary); }

.inv-desc-type {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.inv-desc-text {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 12px;
  line-height: 1.6;
}
.inv-desc-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  color: var(--green);
}
.inv-desc-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   Dashboard Inventory (screen-inventory)
   Mirrors the in-game inventory layout
   ======================================== */

/* Hero Tabs */
.dinv-hero-tabs {
  display: flex;
  gap: 8px;
  max-width: 860px;
  margin: 0 auto 12px;
  padding: 0 16px;
  flex-wrap: wrap;
}
.dinv-hero-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 18px;
  background: rgba(20, 24, 38, 0.8);
  border: 1px solid rgba(212, 176, 80, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 130px;
}
.dinv-hero-tab:hover {
  border-color: rgba(212, 176, 80, 0.4);
  background: rgba(212, 176, 80, 0.06);
}
.dinv-hero-tab.active {
  border-color: rgba(212, 176, 80, 0.6);
  background: rgba(212, 176, 80, 0.1);
  box-shadow: 0 0 12px rgba(212, 176, 80, 0.15);
}
.dinv-tab-name { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.dinv-hero-tab.active .dinv-tab-name { color: var(--gold); }
.dinv-tab-meta { font-size: 0.7rem; color: var(--text-muted); }

/* Frame wrapper — mimics ginv-frame */
.dinv-wrapper {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 7vw;
  box-sizing: border-box;
}
.dinv-frame {
  background: linear-gradient(170deg, #161a26 0%, #10131c 100%);
  border: 2px solid rgba(212, 176, 80, 0.35);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(212, 176, 80, 0.1), 0 16px 48px rgba(0,0,0,0.5);
  overflow: hidden;
  width: fit-content;
  margin: 0 auto;
}

/* 3-column body — mimics ginv-body */
.dinv-body {
  display: grid;
  grid-template-columns: 240px 280px auto;
  gap: 14px;
  padding: 14px;
}

/* Section labels */
.dinv-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(212, 176, 80, 0.5);
  margin-bottom: 6px;
  font-weight: 600;
}

/* Left column: portrait + stats + coins + description */
.dinv-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.dinv-portrait-box {
  width: 90px;
  height: 107px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  margin: 0 auto 2px;
}

/* Stats */
.dinv-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dinv-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.75rem;
  border-radius: 3px;
}
.dinv-stat-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}
.dinv-stat-label {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}
.dinv-stat-val { color: var(--text); font-weight: 700; font-size: 0.75rem; }
.dinv-stat-bonus { color: #5ddf5d; font-size: 0.65rem; margin-left: 2px; }

/* Coins */
.dinv-coins {
  display: flex;
  gap: 8px;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid rgba(246, 200, 109, 0.15);
  margin-top: 2px;
}
.dinv-coin { display: flex; align-items: center; gap: 3px; white-space: nowrap; font-size: 0.7rem; }
.dinv-coin .coin-icon { font-size: 11px; }
.dinv-coin .coin-amount { font-size: 0.8rem; font-weight: bold; }
.dinv-coin .coin-label { font-size: 0.65rem; color: #777; }

/* Description panel */
.dinv-desc {
  margin-top: 4px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.05);
  flex: 1;
  min-height: 60px;
}
.dinv-desc-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 3px;
}
.dinv-desc-rarity {
  font-size: 0.65rem;
  margin-bottom: 3px;
}
.dinv-desc-text {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.dinv-desc .inv-desc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #8cf;
}

/* Dashboard inventory action buttons */
.dinv-desc-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.dinv-btn {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid;
  transition: background 0.15s, transform 0.1s;
}
.dinv-btn:hover {
  transform: translateY(-1px);
}
.dinv-btn-equip {
  background: rgba(42,120,60,0.5);
  border-color: rgba(42,160,60,0.6);
  color: #cfc;
}
.dinv-btn-equip:hover {
  background: rgba(42,140,60,0.8);
}
.dinv-btn-unequip {
  background: rgba(160,80,40,0.4);
  border-color: rgba(180,100,50,0.5);
  color: #eda;
}
.dinv-btn-unequip:hover {
  background: rgba(180,80,40,0.7);
}

/* Center column: equipment grid 2x3 — mimics ginv-equip */
.dinv-equip {
  display: flex;
  flex-direction: column;
}
.dinv-equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
}
.dinv-equip-slot {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.dinv-equip-slot:hover {
  background: rgba(212,176,80,0.08);
  border-color: rgba(212,176,80,0.3);
}
.dinv-equip-slot.selected {
  border-color: rgba(212,176,80,0.6);
  background: rgba(212,176,80,0.1);
  box-shadow: 0 0 10px rgba(212,176,80,0.15);
}
.dinv-equip-slot:not(.empty) .dinv-slot-label { display: none; }
.dinv-equip-slot:not(.empty) { gap: 0; padding: 4px; }
.dinv-equip-slot.empty { cursor: default; }
.dinv-equip-slot.empty .dinv-slot-icon { opacity: 0.2; width: auto; height: auto; }
.dinv-slot-icon { font-size: 1.9rem; line-height: 1; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.dinv-slot-icon img { width: 85% !important; height: 85% !important; object-fit: contain !important; }
.dinv-slot-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.35);
}

/* Rarity borders for equip slots */
.dinv-equip-slot.rarity-common { border-color: rgba(157,157,157,0.4); }
.dinv-equip-slot.rarity-uncommon { border-color: rgba(30,200,30,0.4); }
.dinv-equip-slot.rarity-rare { border-color: rgba(60,130,255,0.5); }
.dinv-equip-slot.rarity-epic { border-color: rgba(163,53,238,0.5); }
.dinv-equip-slot.rarity-legendary { border-color: rgba(255,140,20,0.5); }

/* Right column: inventory grid — mimics ginv-right */
.dinv-right {
  display: flex;
  flex-direction: column;
}

/* Weight bar */
.dinv-weight { margin-bottom: 6px; }
.dinv-weight-label { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 3px; }
.dinv-weight-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.dinv-weight-fill {
  height: 100%;
  background: linear-gradient(90deg, #5a8f3a, #8cbf60);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.dinv-weight-fill.overweight { background: linear-gradient(90deg, #c44, #f66); }

/* Inventory grid cells — mimics ginv-inv-grid */
.dinv-inv-grid {
  display: grid;
  grid-template-columns: repeat(6, 60px);
  gap: 3px;
}
.dinv-inv-cell {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  font-size: 1.2rem;
}
.dinv-inv-cell:hover { background: rgba(212,176,80,0.08); border-color: rgba(212,176,80,0.25); }
.dinv-inv-cell.selected {
  border-color: rgba(212,176,80,0.6);
  background: rgba(212,176,80,0.12);
  box-shadow: 0 0 8px rgba(212,176,80,0.15);
}
.dinv-inv-cell img { width: 85% !important; height: 85% !important; object-fit: contain !important; }
.dinv-inv-cell > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.dinv-inv-cell.empty { cursor: default; opacity: 0.4; }
.dinv-inv-cell.empty:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
.dinv-cell-qty {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

/* Rarity borders for inventory cells */
.dinv-inv-cell.rarity-common { border-color: rgba(157,157,157,0.3); }
.dinv-inv-cell.rarity-uncommon { border-color: rgba(30,200,30,0.35); }
.dinv-inv-cell.rarity-rare { border-color: rgba(60,130,255,0.45); }
.dinv-inv-cell.rarity-epic { border-color: rgba(163,53,238,0.45); }
.dinv-inv-cell.rarity-legendary { border-color: rgba(255,140,20,0.45); }

/* Responsive */
@media (max-width: 900px) {
  .dinv-body { grid-template-columns: 1fr; }
  .dinv-equip-grid { grid-template-columns: repeat(3, 1fr); }
  .dinv-inv-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================
   SCREEN 7: MISSION END
   ============================ */

#screen-mission-end {
  position: relative;
  justify-content: center;
  align-items: center;
}
#screen-mission-end::before {
  background:
    radial-gradient(ellipse 60% 55% at 50% 20%, rgba(100, 65, 15, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 70% 55% at 15% 70%, rgba(10, 50, 65, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 55% 45% at 85% 45%, rgba(50, 15, 65, 0.45) 0%, transparent 45%),
    var(--bg);
  filter: blur(60px) saturate(1.5);
}

.mission-end-bg {
  position: absolute;
  inset: 0;
}

.mission-end-content {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.mission-end-card {
  background: rgba(18, 21, 32, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(246, 200, 109, 0.12);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 700px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  position: relative;
}

.victory-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(246, 200, 109, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.victory-title {
  font-size: 2rem;
  margin-bottom: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.victory-title.defeat-title {
  background: linear-gradient(180deg, #e74c3c, #8b2020);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.victory-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 24px;
}
.victory-divider::before,
.victory-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(246, 200, 109, 0.2), transparent);
}

/* Rewards */
.rewards-section {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
}
.reward-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.reward-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.reward-xp {
  background: linear-gradient(135deg, var(--blue), var(--blue-dim));
  color: #fff;
}
.reward-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #0c0e14;
}
.reward-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Loot */
.loot-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.loot-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.loot-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
  min-width: 130px;
  position: relative;
}
.loot-card.rarity-rare { border-color: rgba(0, 112, 255, 0.3); }
.loot-card.rarity-uncommon { border-color: rgba(30, 255, 0, 0.3); }
.loot-card.rarity-epic { border-color: rgba(163, 53, 238, 0.3); }
.loot-card.rarity-legendary { border-color: rgba(255, 128, 0, 0.3); }

.loot-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 8px;
}
.loot-card.rarity-rare .loot-icon { color: var(--rarity-rare); }
.loot-card.rarity-uncommon .loot-icon { color: var(--rarity-uncommon); }
.loot-card.rarity-epic .loot-icon { color: var(--rarity-epic); }
.loot-card.rarity-legendary .loot-icon { color: var(--rarity-legendary); }

.loot-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.loot-rarity {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Hero XP */
.hero-xp-bars {
  text-align: left;
  margin-bottom: 28px;
}
.hero-xp-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.hero-xp-row .xp-bar {
  flex: 1;
  margin-bottom: 0;
}
.hero-xp-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  min-width: 70px;
}

.xp-animate {
  animation: xp-grow 1.2s ease-out;
}
@keyframes xp-grow {
  from { width: 0; }
}

.mission-end-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============================
   SCREEN 8: SHOP
   ============================ */

.shop-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.shop-card {
  background: var(--panel);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.shop-card:hover {
  border-color: var(--panel-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.shop-card-featured {
  border-color: rgba(246, 200, 109, 0.2);
}

.shop-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(246, 200, 109, 0.1);
  border: 1px solid rgba(246, 200, 109, 0.2);
  color: var(--gold);
}
.shop-badge-sub {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
  color: var(--purple-bright);
}

.shop-card-glow { display: none; }

.shop-icon {
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.shop-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 8px;
}
.shop-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
}
.shop-price {
  margin-bottom: 16px;
}
.price-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-heading);
}

/* ============================
   WARCRAFT GOLD FRAMES — 3D Beveled WoW Style
   ============================ */

/* --- Ornate Beveled Frame: Major Panels --- */
.login-card,
.mission-end-card,
.invite-modal-content {
  border-radius: 4px;
  border-top: 6px solid #f0d070;
  border-left: 6px solid #d4b050;
  border-bottom: 6px solid #7a5a18;
  border-right: 6px solid #8a6520;
  box-shadow:
    inset 0 0 0 2px #0e1018,
    inset 0 0 0 3px rgba(201, 162, 78, 0.25),
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    0 0 0 2px #0a0c12,
    0 0 0 4px rgba(138, 101, 32, 0.5),
    0 0 0 5px #0a0c12,
    0 0 30px rgba(246, 200, 109, 0.08),
    0 20px 80px rgba(0, 0, 0, 0.6);
}

/* Top gem ornament — diamond shape with blue crystal */
.login-card::after,
.mission-end-card::after {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #7db8ff 0%, #3a70cc 40%, #2a55aa 100%);
  border: 3px solid #d4b050;
  border-top-color: #f0d070;
  border-left-color: #e0c060;
  border-bottom-color: #8a6520;
  border-right-color: #9a7530;
  z-index: 10;
  box-shadow:
    0 0 8px rgba(91, 143, 255, 0.5),
    0 0 20px rgba(91, 143, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Decorative outer gold line above frame */
.login-card::before,
.mission-end-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 208, 112, 0.6) 15%, rgba(246, 200, 109, 0.8) 50%, rgba(240, 208, 112, 0.6) 85%, transparent);
  z-index: 6;
  filter: drop-shadow(0 0 4px rgba(246, 200, 109, 0.4));
}

/* --- Beveled Frame: Cards --- */
.hero-card,
.adventure-card,
.shop-card {
  border-radius: 4px;
  border-top: 3px solid #d4b050;
  border-left: 3px solid #c0a040;
  border-bottom: 3px solid #6a4a10;
  border-right: 3px solid #7a5a18;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(0, 0, 0, 0.2),
    0 0 0 1px #0a0c12,
    0 8px 32px rgba(0, 0, 0, 0.4);
}
.hero-card:hover,
.adventure-card:hover,
.shop-card:hover {
  border-top-color: #f0d070;
  border-left-color: #d4b050;
  border-bottom-color: #8a6520;
  border-right-color: #9a7530;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 0 15px rgba(0, 0, 0, 0.15),
    0 0 0 1px #0a0c12,
    0 0 0 3px rgba(201, 162, 78, 0.3),
    0 0 20px rgba(246, 200, 109, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Loot cards beveled */
.loot-card {
  border-radius: 4px;
  border-top: 2px solid #c0a040;
  border-left: 2px solid #b09030;
  border-bottom: 2px solid #5a4010;
  border-right: 2px solid #6a4a18;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    0 0 0 1px #0a0c12;
}

/* Featured shop card — thicker ornate frame */
.shop-card-featured {
  border-top: 5px solid #f0d070 !important;
  border-left: 5px solid #d4b050 !important;
  border-bottom: 5px solid #7a5a18 !important;
  border-right: 5px solid #8a6520 !important;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 0 15px rgba(0, 0, 0, 0.2),
    0 0 0 2px #0a0c12,
    0 0 0 3px rgba(201, 162, 78, 0.4),
    0 0 25px rgba(246, 200, 109, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

/* --- Beveled Frame: Selection Cards (character creation) --- */
.race-card,
.class-card,
.gender-card {
  border-radius: 4px;
  border-top: 2px solid rgba(192, 160, 64, 0.4);
  border-left: 2px solid rgba(176, 144, 48, 0.35);
  border-bottom: 2px solid rgba(90, 64, 16, 0.5);
  border-right: 2px solid rgba(106, 74, 24, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.2);
}
.race-card.selected,
.class-card.selected,
.gender-card.selected {
  border-top: 4px solid #f0d070;
  border-left: 4px solid #d4b050;
  border-bottom: 4px solid #7a5a18;
  border-right: 4px solid #8a6520;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    inset 0 0 15px rgba(246, 200, 109, 0.04),
    0 0 0 1px #0a0c12,
    0 0 0 2px rgba(201, 162, 78, 0.3),
    0 0 25px rgba(246, 200, 109, 0.1);
}

/* --- Beveled Frame: Lobby & Inventory panels --- */
.lobby-mission,
.equip-avatar,
.inventory-grid-section {
  border-radius: 4px;
  border-top: 4px solid #d4b050;
  border-left: 4px solid #c0a040;
  border-bottom: 4px solid #6a4a10;
  border-right: 4px solid #7a5a18;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 0 15px rgba(0, 0, 0, 0.2),
    0 0 0 1px #0a0c12,
    0 0 0 2px rgba(138, 101, 32, 0.35),
    0 0 15px rgba(246, 200, 109, 0.05);
}

/* Corner ornaments for lobby mission panel — gold rivets */
.lobby-mission::after {
  content: '';
  position: absolute;
  inset: -4px;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(circle 5px at 2px 2px, #f0d070 2px, #8a6520 3px, transparent 4px),
    radial-gradient(circle 5px at calc(100% - 2px) 2px, #f0d070 2px, #8a6520 3px, transparent 4px),
    radial-gradient(circle 5px at 2px calc(100% - 2px), #f0d070 2px, #8a6520 3px, transparent 4px),
    radial-gradient(circle 5px at calc(100% - 2px) calc(100% - 2px), #f0d070 2px, #8a6520 3px, transparent 4px);
}

/* --- Gold Filled Lobby Slots --- */
.lobby-slot.filled {
  border-radius: 4px;
  border-top: 2px solid rgba(192, 160, 64, 0.5);
  border-left: 2px solid rgba(176, 144, 48, 0.45);
  border-bottom: 2px solid rgba(90, 64, 16, 0.6);
  border-right: 2px solid rgba(106, 74, 24, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.2);
}
.lobby-slot.filled:hover {
  border-top-color: #d4b050;
  border-left-color: #c0a040;
  border-bottom-color: #7a5a18;
  border-right-color: #8a6520;
  box-shadow:
    inset 0 0 10px rgba(246, 200, 109, 0.03),
    0 0 12px rgba(246, 200, 109, 0.08);
}

/* --- Gold Accent: Game Panels --- */
.game-panel-left {
  border-right: 3px solid;
  border-image: linear-gradient(to bottom, #d4b050, #7a5a18) 1;
  box-shadow: inset -4px 0 15px rgba(0, 0, 0, 0.4);
}
.game-panel-right {
  border-left: 3px solid;
  border-image: linear-gradient(to bottom, #d4b050, #7a5a18) 1;
  box-shadow: inset 4px 0 15px rgba(0, 0, 0, 0.4);
}

.team-member.active-turn {
  border-top: 2px solid rgba(240, 208, 112, 0.5);
  border-left: 2px solid rgba(212, 176, 80, 0.4);
  border-bottom: 2px solid rgba(122, 90, 24, 0.6);
  border-right: 2px solid rgba(138, 101, 32, 0.5);
  box-shadow:
    inset 0 0 10px rgba(246, 200, 109, 0.04),
    0 0 12px rgba(246, 200, 109, 0.08);
}

/* --- Gold Accent: Action Bar Buttons --- */
.action-btn.active {
  border-top: 2px solid #d4b050;
  border-left: 2px solid #c0a040;
  border-bottom: 2px solid #6a4a10;
  border-right: 2px solid #7a5a18;
  box-shadow:
    inset 0 0 10px rgba(246, 200, 109, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(246, 200, 109, 0.12);
}

/* --- Gold Accent: Top Nav --- */
.top-nav {
  border-bottom: 2px solid;
  border-image: linear-gradient(to right, #6a4a10, #c0a040 30%, #d4b050 50%, #c0a040 70%, #6a4a10) 1;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

/* --- Gold Accent: Game Top Bar --- */
.game-topbar {
  border-bottom: 2px solid;
  border-image: linear-gradient(to right, #6a4a10, #c0a040 30%, #d4b050 50%, #c0a040 70%, #6a4a10) 1;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

/* --- Gold Accent: Action Bar --- */
.action-bar {
  border-top: 2px solid;
  border-image: linear-gradient(to right, #6a4a10, #c0a040 30%, #d4b050 50%, #c0a040 70%, #6a4a10) 1;
  box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.4);
}

/* --- Beveled Frame: Stat Rows --- */
.stat-row {
  border-radius: 4px;
  border-top: 2px solid rgba(192, 160, 64, 0.25);
  border-left: 2px solid rgba(176, 144, 48, 0.2);
  border-bottom: 2px solid rgba(90, 64, 16, 0.35);
  border-right: 2px solid rgba(106, 74, 24, 0.3);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.15);
}
.stat-row:hover {
  border-top-color: rgba(212, 176, 80, 0.5);
  border-left-color: rgba(192, 160, 64, 0.45);
  border-bottom-color: rgba(122, 90, 24, 0.6);
  border-right-color: rgba(138, 101, 32, 0.55);
  box-shadow:
    inset 0 0 10px rgba(246, 200, 109, 0.03),
    0 0 12px rgba(246, 200, 109, 0.06);
}

/* --- Ornate Divider Enhancement --- */
.login-divider::before,
.login-divider::after,
.victory-divider::before,
.victory-divider::after {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim) 20%, var(--gold) 50%, var(--gold-dim) 80%, transparent);
}
.divider-rune {
  color: var(--gold-bright);
  font-size: 1.2rem;
  opacity: 0.8;
  filter: drop-shadow(0 0 4px rgba(246, 200, 109, 0.4));
}

/* --- Inventory Item Beveled Frame by Rarity --- */
.inv-item.rarity-rare {
  border-top: 2px solid rgba(0, 140, 255, 0.5);
  border-left: 2px solid rgba(0, 120, 230, 0.4);
  border-bottom: 2px solid rgba(0, 60, 140, 0.6);
  border-right: 2px solid rgba(0, 70, 160, 0.5);
  box-shadow: inset 0 0 8px rgba(0, 112, 255, 0.1), 0 0 6px rgba(0, 112, 255, 0.08);
}
.inv-item.rarity-epic {
  border-top: 2px solid rgba(190, 80, 255, 0.5);
  border-left: 2px solid rgba(170, 60, 240, 0.4);
  border-bottom: 2px solid rgba(100, 30, 160, 0.6);
  border-right: 2px solid rgba(120, 40, 180, 0.5);
  box-shadow: inset 0 0 8px rgba(163, 53, 238, 0.1), 0 0 6px rgba(163, 53, 238, 0.08);
}
.inv-item.rarity-legendary {
  border-top: 2px solid rgba(255, 160, 0, 0.6);
  border-left: 2px solid rgba(240, 140, 0, 0.5);
  border-bottom: 2px solid rgba(160, 80, 0, 0.7);
  border-right: 2px solid rgba(180, 90, 0, 0.6);
  box-shadow: inset 0 0 10px rgba(255, 128, 0, 0.1), 0 0 10px rgba(255, 128, 0, 0.12);
}

/* Loot card glow by rarity */
.loot-card.rarity-rare {
  border-top-color: rgba(0, 140, 255, 0.5);
  border-left-color: rgba(0, 120, 230, 0.4);
  border-bottom-color: rgba(0, 60, 140, 0.5);
  border-right-color: rgba(0, 70, 160, 0.45);
  box-shadow: inset 0 0 12px rgba(0, 112, 255, 0.06), 0 0 12px rgba(0, 112, 255, 0.1);
}
.loot-card.rarity-epic {
  border-top-color: rgba(190, 80, 255, 0.5);
  border-left-color: rgba(170, 60, 240, 0.4);
  border-bottom-color: rgba(100, 30, 160, 0.5);
  border-right-color: rgba(120, 40, 180, 0.45);
  box-shadow: inset 0 0 12px rgba(163, 53, 238, 0.06), 0 0 12px rgba(163, 53, 238, 0.1);
}
.loot-card.rarity-uncommon {
  border-top-color: rgba(30, 255, 0, 0.4);
  border-left-color: rgba(25, 220, 0, 0.35);
  border-bottom-color: rgba(15, 130, 0, 0.5);
  border-right-color: rgba(20, 150, 0, 0.45);
  box-shadow: inset 0 0 12px rgba(30, 255, 0, 0.04), 0 0 10px rgba(30, 255, 0, 0.08);
}

/* --- Gold Accent: Equipment Slots --- */
.equip-slot {
  border-left: 3px solid;
  border-image: linear-gradient(to bottom, #c0a040, #6a4a10) 1;
  transition: all var(--transition);
}
.equip-slot:hover {
  border-image: linear-gradient(to bottom, #f0d070, #8a6520) 1;
  background: rgba(246, 200, 109, 0.03);
}

/* --- Gold Level Badge --- */
.hero-level {
  border: 2px solid;
  border-top-color: #d4b050;
  border-left-color: #c0a040;
  border-bottom-color: #6a4a10;
  border-right-color: #7a5a18;
  box-shadow: 0 0 8px rgba(246, 200, 109, 0.15);
}

/* --- Step Indicator Gold Enhancement --- */
.step.active .step-num {
  box-shadow: 0 0 20px var(--gold-glow), 0 0 0 3px rgba(201, 162, 78, 0.2);
}

/* --- Reward Icons Gold Frame --- */
.reward-icon {
  box-shadow:
    0 0 0 2px #0e1018,
    0 0 0 4px #c0a040,
    0 0 0 5px #6a4a10,
    0 0 12px rgba(246, 200, 109, 0.15);
}

/* ============================
   DUNGEON GRID & FOG OF WAR
   ============================ */

.dungeon-grid {
  display: grid;
  gap: 0;
  /* Size is set dynamically by JS based on zoom level */
  aspect-ratio: 29 / 16; /* 29 cols × 16 rows — square cells */
  background-image: url('map2.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 4px;
  overflow: hidden;
  border-top: 3px solid #d4b050;
  border-left: 3px solid #c0a040;
  border-bottom: 3px solid #6a4a10;
  border-right: 3px solid #7a5a18;
  box-shadow:
    inset 0 0 0 1px #0e1018,
    0 0 0 1px #0a0c12,
    0 0 20px rgba(0, 0, 0, 0.5);
  transform-origin: 0 0;
  will-change: transform;
}

.dungeon-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background 0.15s, box-shadow 0.15s;
  overflow: hidden;
  /* Subtle grid line to help align with map grid */
  outline: 1px solid rgba(255, 255, 255, 0.06);
}

/* Floor tiles — transparent so map shows through */
.cell-floor {
  background: transparent;
}
.cell-floor:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Wall tiles — transparent, map trees show through */
.cell-wall {
  background: transparent;
  cursor: not-allowed;
}

/* --- Fog of War — Dense atmospheric fog --- */
.cell-fog-unknown {
  background: rgba(8, 10, 18, 0.96);
  cursor: default;
  overflow: hidden;
}
.cell-fog-unknown::before {
  content: '';
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(60, 70, 100, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(40, 50, 80, 0.2) 0%, transparent 50%);
  animation: fog-drift 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
}
.cell-fog-unknown::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(30, 35, 60, 0.3) 0%, rgba(8, 10, 18, 0.05) 80%);
  pointer-events: none;
  z-index: 2;
}

@keyframes fog-drift {
  0%   { transform: translate(-5%, -3%) scale(1.0); opacity: 0.7; }
  50%  { transform: translate(3%, 2%) scale(1.05); opacity: 1; }
  100% { transform: translate(-2%, 4%) scale(0.98); opacity: 0.8; }
}

/* Explored but not currently visible — thin residual fog */
.cell-fog-explored {
  background: rgba(8, 10, 18, 0.5);
  transition: background 0.6s ease;
  overflow: hidden;
}
.cell-fog-explored::before {
  content: '';
  position: absolute;
  inset: -30%;
  width: 160%;
  height: 160%;
  background: radial-gradient(ellipse at center, rgba(40, 50, 70, 0.15) 0%, transparent 70%);
  animation: fog-drift 12s ease-in-out infinite alternate-reverse;
  pointer-events: none;
  opacity: 0.5;
}
.cell-fog-explored .cell-entity {
  display: none;
}

/* Visible — fog fully cleared */
.cell-fog-visible {
  background: transparent;
  transition: background 0.4s ease;
}

/* --- Entities --- */
.cell-entity {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  font-family: 'Cinzel', serif;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  z-index: 2;
  position: relative;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.entity-token-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Hero tokens on map — portrait-style circles with white outline */
.hero-token {
  width: 85% !important;
  height: auto !important;
  aspect-ratio: 1;
  border: 2.5px solid #fff !important;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5), 0 0 16px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0,0,0,0.6) !important;
  overflow: hidden;
  z-index: 5 !important;
}
.hero-token-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 0;
}
.hero-portrait-initial {
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5px;
  margin-top: 1px;
}
.hero-portrait-icon {
  font-size: 0.5rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
  margin-bottom: 1px;
}
.hero-token-skull {
  font-size: 0.8rem;
  line-height: 1;
}
.hero-token-warrior {
  background: radial-gradient(circle at 35% 30%, #ffe080 0%, #d4a030 35%, #8a5a10 70%, #5a3808 100%);
}
.hero-token-mage {
  background: radial-gradient(circle at 35% 30%, #a0c8ff 0%, #5a7fcc 35%, #2a4580 70%, #162a50 100%);
}
.hero-token-priest {
  background: radial-gradient(circle at 35% 30%, #d0f080 0%, #8faa50 35%, #506828 70%, #2a3a10 100%);
}

/* Active hero — pulsing white glow */
.hero-token-active {
  animation: hero-active-pulse 1.5s ease-in-out infinite;
}
@keyframes hero-active-pulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5), 0 0 16px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0,0,0,0.6) !important;
    border-color: #fff !important;
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 24px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0,0,0,0.6) !important;
    border-color: #ffe8a0 !important;
  }
}

.entity-warrior {
  background: linear-gradient(135deg, #d4a030 0%, #8a6a18 100%);
  border-color: #f0d070;
  box-shadow: 0 0 10px rgba(212, 160, 48, 0.4), 0 2px 6px rgba(0,0,0,0.4);
}
.entity-mage {
  background: linear-gradient(135deg, #5a7fcc 0%, #2a4580 100%);
  border-color: #7da0ee;
  box-shadow: 0 0 10px rgba(90, 127, 204, 0.4), 0 2px 6px rgba(0,0,0,0.4);
}
.entity-priest {
  background: linear-gradient(135deg, #8faa50 0%, #506828 100%);
  border-color: #b0cc70;
  box-shadow: 0 0 10px rgba(143, 170, 80, 0.4), 0 2px 6px rgba(0,0,0,0.4);
}
/* Map entity hover tooltip (fixed, on body) */
.map-tooltip {
  position: fixed;
  z-index: 500;
  pointer-events: auto;
  opacity: 0;
  display: none;
  transition: opacity 0.12s;
  background: rgba(16,14,12,0.95);
  border: 1px solid rgba(212,176,80,0.5);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 120px;
  max-width: 180px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  white-space: nowrap;
}
.tooltip-close-btn {
  display: none;
}
.tooltip-talk-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #e8dcc8;
  background: rgba(212, 176, 80, 0.15);
  border: 1px solid rgba(212, 176, 80, 0.4);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.tooltip-talk-btn:hover {
  background: rgba(212, 176, 80, 0.3);
  border-color: rgba(212, 176, 80, 0.7);
  color: #f6c86d;
}
.map-tooltip-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid rgba(212,176,80,0.3);
  margin-bottom: 4px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.map-tooltip-icon {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 2px;
}
.map-tooltip-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e8dcc8;
  margin-bottom: 2px;
}
.map-tooltip-info {
  font-size: 0.6rem;
  color: #a99;
  margin-bottom: 2px;
}
.map-tooltip-hp {
  font-size: 0.65rem;
  color: #e66;
  font-weight: 600;
}

/* Dead entity (corpse) */
.entity-dead {
  opacity: 0.3;
  filter: grayscale(0.8);
  animation: none !important;
  box-shadow: none !important;
}
.cell-corpse { cursor: pointer; }
.cell-corpse:hover .entity-dead {
  opacity: 0.5;
  filter: grayscale(0.5);
}
.entity-goblin {
  background: linear-gradient(135deg, #cc4444 0%, #7a2020 100%);
  border-color: #ee6666;
  box-shadow: 0 0 10px rgba(204, 68, 68, 0.4), 0 2px 6px rgba(0,0,0,0.4);
}
.entity-wolf {
  background: linear-gradient(135deg, #777777 0%, #444444 100%);
  border-color: #999999;
  box-shadow: 0 0 10px rgba(120, 120, 120, 0.4), 0 2px 6px rgba(0,0,0,0.4);
  font-size: 0.85rem;
}
.entity-chief {
  background: linear-gradient(135deg, #cc2222 0%, #661111 100%);
  border-color: #ff4444;
  box-shadow: 0 0 14px rgba(255, 40, 40, 0.5), 0 0 24px rgba(255, 40, 40, 0.2), 0 2px 6px rgba(0,0,0,0.4);
  font-size: 0.85rem;
  animation: chief-glow 2s ease-in-out infinite;
}
@keyframes chief-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 40, 40, 0.3), 0 2px 6px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 20px rgba(255, 40, 40, 0.6), 0 0 30px rgba(255, 40, 40, 0.2), 0 2px 6px rgba(0,0,0,0.4); }
}
.entity-scout {
  background: linear-gradient(135deg, #cc9944 0%, #7a5a18 100%);
  border-color: #eebb55;
  box-shadow: 0 0 10px rgba(204, 153, 68, 0.4), 0 2px 6px rgba(0,0,0,0.4);
  animation: scout-talk-pulse 2s ease-in-out infinite;
}
@keyframes scout-talk-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(204, 153, 68, 0.3), 0 2px 6px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 16px rgba(204, 153, 68, 0.7), 0 0 24px rgba(204, 153, 68, 0.2), 0 2px 6px rgba(0,0,0,0.4); }
}
.entity-wanderer {
  background: linear-gradient(135deg, #88aa66 0%, #556633 100%);
  border-color: #aabb88;
  box-shadow: 0 0 10px rgba(136, 170, 102, 0.4), 0 2px 6px rgba(0,0,0,0.4);
  animation: npc-pulse 2.5s ease-in-out infinite;
  font-size: 0.9rem;
}
@keyframes npc-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(136, 170, 102, 0.3), 0 2px 6px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 16px rgba(136, 170, 102, 0.6), 0 0 24px rgba(136, 170, 102, 0.2), 0 2px 6px rgba(0,0,0,0.4); }
}
.cell-talkable {
  box-shadow: inset 0 0 0 1px rgba(204, 153, 68, 0.4);
}
.cell-friendly {
  box-shadow: inset 0 0 0 1px rgba(102, 170, 68, 0.4);
}
.entity-trader {
  background: linear-gradient(135deg, #66aa44 0%, #3a6a22 100%);
  border-color: #88cc66;
  box-shadow: 0 0 10px rgba(102, 170, 68, 0.4), 0 2px 6px rgba(0,0,0,0.4);
  animation: traderPulse 3s ease-in-out infinite;
}
@keyframes traderPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(102, 170, 68, 0.3), 0 2px 6px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 16px rgba(102, 170, 68, 0.6), 0 0 24px rgba(102, 170, 68, 0.2), 0 2px 6px rgba(0,0,0,0.4); }
}

/* Mission Objectives Panel */
.mission-objectives-panel {
  background: linear-gradient(135deg, rgba(20, 30, 20, 0.95) 0%, rgba(15, 25, 15, 0.9) 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #c8b896;
}
.mission-header {
  color: #d4af37;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.mission-header:hover {
  color: #f0d060;
}
.mission-toggle {
  font-size: 11px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.mission-header:hover .mission-toggle {
  opacity: 1;
}
.mission-collapsed {
  padding-bottom: 10px;
}
.mission-collapsed .mission-header {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.mission-obj {
  padding: 3px 0;
  color: #a89880;
  font-size: 12px;
}
.mission-obj.obj-done {
  color: #88cc66;
  text-decoration: line-through;
  opacity: 0.8;
}
.mission-obj.obj-fail {
  color: #cc4444;
}

.entity-chest {
  background: url('chest.png') center center / contain no-repeat;
  border: none;
  border-radius: 4px;
  font-size: 0;
  width: 200%;
  height: 200%;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
  transition: transform 0.25s ease;
  cursor: pointer;
  z-index: 3;
}
.entity-chest:hover {
  transform: scale(1.15);
}
.entity-trap {
  background: url('trap-glow.png') center center / contain no-repeat;
  border: none;
  border-radius: 50%;
  font-size: 0;
  width: 100%;
  height: 100%;
  filter: none;
  z-index: 8;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.entity-trap.trap-revealed {
  filter:
    drop-shadow(0 0 6px rgba(255, 0, 0, 1))
    drop-shadow(0 0 14px rgba(255, 20, 0, 0.9))
    drop-shadow(0 0 24px rgba(200, 0, 0, 0.7))
    drop-shadow(0 0 38px rgba(150, 0, 0, 0.5));
  animation: trap-glow 1.8s ease-in-out infinite;
}
@keyframes trap-glow {
  0%, 100% {
    filter:
      drop-shadow(0 0 6px rgba(255, 0, 0, 1))
      drop-shadow(0 0 14px rgba(255, 20, 0, 0.9))
      drop-shadow(0 0 24px rgba(200, 0, 0, 0.7))
      drop-shadow(0 0 38px rgba(150, 0, 0, 0.5));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(255, 30, 30, 1))
      drop-shadow(0 0 20px rgba(255, 10, 0, 1))
      drop-shadow(0 0 34px rgba(220, 0, 0, 0.85))
      drop-shadow(0 0 50px rgba(180, 0, 0, 0.6));
  }
}
.hero-dead {
  filter: grayscale(1) brightness(0.5);
  opacity: 0.7;
  font-size: 1rem;
}
.member-dead {
  position: relative;
  filter: grayscale(0.8) brightness(0.6);
  opacity: 0.7;
}
.member-left {
  position: relative;
  filter: grayscale(1) brightness(0.4);
  opacity: 0.4;
}
.dead-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.3);
  border-radius: inherit;
}
.dead-label {
  background: rgba(180, 30, 30, 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.btn-leave-game {
  background: rgba(120, 40, 40, 0.8);
  border: 1px solid rgba(200, 60, 60, 0.5);
  color: #ddd;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-leave-game:hover {
  background: rgba(180, 40, 40, 0.9);
  color: #fff;
}

/* Trap alert popup */
.trap-alert-popup {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  opacity: 0;
  z-index: 9999;
  background: linear-gradient(135deg, rgba(60, 10, 10, 0.95) 0%, rgba(40, 5, 5, 0.95) 100%);
  border: 2px solid rgba(255, 50, 50, 0.6);
  border-radius: 10px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 20px rgba(255, 30, 30, 0.4), 0 4px 16px rgba(0,0,0,0.6);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 90vw;
}
.trap-alert-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.trap-alert-hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}
.trap-alert-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 6px rgba(255, 60, 60, 0.8));
  animation: trap-alert-pulse 0.6s ease-in-out 3;
}
@keyframes trap-alert-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}
.trap-alert-text {
  color: #ff9090;
  font-size: 0.95rem;
  line-height: 1.3;
}
.trap-alert-text strong {
  color: #ffcc70;
}
.trap-alert-hint {
  color: #aa6060;
  font-size: 0.75rem;
  margin-top: 2px;
}

/* ========== Full-screen Game Inventory (Dark Theme) ========== */
.game-inventory-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}
.game-inventory-overlay.open {
  display: flex;
  animation: ginv-fade-in 0.2s ease-out;
}
@keyframes ginv-fade-in { from { opacity: 0; } to { opacity: 1; } }

.game-inventory {
  width: 96vw;
  max-width: 820px;
  max-height: 96vh;
  animation: ginv-scale-in 0.25s ease-out;
}
@keyframes ginv-scale-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ginv-frame {
  background: linear-gradient(170deg, #161a26 0%, #10131c 100%);
  border: 2px solid rgba(212, 176, 80, 0.4);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(212, 176, 80, 0.1), 0 16px 48px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  max-height: 96vh;
  overflow: hidden;
}

/* Header */
.ginv-header {
  background: linear-gradient(180deg, rgba(212,176,80,0.12) 0%, transparent 100%);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid rgba(212, 176, 80, 0.25);
  flex-shrink: 0;
}
.ginv-header-deco { display: none; }
.ginv-title {
  font-family: 'Philosopher', serif;
  color: #f0d070;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  text-shadow: 0 1px 6px rgba(212,176,80,0.3);
  margin: 0;
}
.ginv-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(200, 60, 60, 0.3);
  border: 1px solid rgba(200, 60, 60, 0.5);
  color: #e88;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}
.ginv-close:hover { background: rgba(220, 60, 60, 0.6); color: #fff; }

/* Hero Tabs */
.ginv-hero-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px 0;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.ginv-hero-tab {
  padding: 5px 16px;
  font-family: 'Philosopher', serif;
  font-size: 0.8rem;
  color: #888;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.15s;
}
.ginv-hero-tab:hover { background: rgba(255,255,255,0.08); color: #ccc; }
.ginv-hero-tab.active {
  background: rgba(212,176,80,0.1);
  color: #f0d070;
  font-weight: 700;
  border-color: rgba(212,176,80,0.3);
}

/* Body — 3 columns, compact */
.ginv-body {
  display: grid;
  grid-template-columns: 150px 170px 1fr;
  gap: 10px;
  padding: 10px;
  min-height: 0;
  flex: 1;
}

/* Left: portrait + stats + description */
.ginv-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.ginv-portrait {
  width: 72px;
  height: 88px;
  border: 2px solid rgba(212,176,80,0.4);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.ginv-section-label {
  font-family: 'Philosopher', serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #f0d070;
  border-bottom: 1px solid rgba(212,176,80,0.2);
  padding-bottom: 2px;
}
.ginv-stats {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ginv-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #ccc;
  padding: 1px 0;
}
.ginv-stat-label {
  font-weight: 700;
  font-family: 'Philosopher', serif;
  color: #aaa;
}
.ginv-stat-val {
  font-weight: 700;
  min-width: 20px;
  text-align: right;
  color: #eee;
}
.ginv-stat-bonus {
  color: #5cbf5c;
  font-size: 0.7rem;
  margin-left: 2px;
}

/* Description panel */
.ginv-desc {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(212,176,80,0.15);
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: auto;
  min-height: 60px;
}
.ginv-desc-title {
  font-family: 'Philosopher', serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: #f0d070;
  margin-bottom: 3px;
}
.ginv-desc-text {
  font-size: 0.72rem;
  color: #999;
  line-height: 1.3;
}
.ginv-desc-rarity {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 2px;
}
.ginv-desc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-top: 4px;
}
.ginv-desc-stat {
  font-size: 0.7rem;
  font-weight: 600;
  color: #5cbf5c;
}
.ginv-desc-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.ginv-btn {
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid;
  transition: background 0.15s;
}
.ginv-btn-equip { background: rgba(42,120,60,0.5); border-color: rgba(42,160,60,0.6); color: #cfc; }
.ginv-btn-equip:hover { background: rgba(42,140,60,0.8); }
.ginv-btn-use { background: rgba(60,100,180,0.5); border-color: rgba(80,130,220,0.6); color: #cdf; }
.ginv-btn-use:hover { background: rgba(60,100,180,0.8); }
.ginv-btn-unequip { background: rgba(160,80,40,0.4); border-color: rgba(180,100,50,0.5); color: #eda; }
.ginv-btn-unequip:hover { background: rgba(180,80,40,0.7); }
.ginv-btn-transfer { background: rgba(140,80,180,0.5); border-color: rgba(160,100,220,0.6); color: #dcf; }
.ginv-btn-transfer:hover { background: rgba(140,80,180,0.8); }

/* Transfer Item Modal */
.transfer-modal-content { max-width: 360px; }
.transfer-item-preview {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 12px; margin: 10px 0;
  background: rgba(255,255,255,0.05); border-radius: 8px;
  font-size: 1rem; color: #e8d9b0;
}
.transfer-subtitle { color: #aaa; font-size: 0.9rem; margin: 8px 0 12px; text-align: center; }
.transfer-targets { display: flex; flex-direction: column; gap: 8px; }
.transfer-target-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: #e8d9b0; text-align: left;
}
.transfer-target-btn:hover {
  background: rgba(180,150,80,0.2); border-color: rgba(200,170,80,0.5);
}
.transfer-target-portrait { font-size: 1.6rem; }
.transfer-target-name { font-weight: 600; font-size: 1rem; flex: 1; }
.transfer-target-cls { font-size: 0.8rem; color: #999; }

/* Use Item Modal */
.use-item-content { text-align: center; }
.use-item-icon { margin: 8px 0; }
.use-item-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.use-item-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.use-item-action-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(60,100,180,0.3);
  border: 1px solid rgba(80,130,220,0.5);
  color: #cdf;
  transition: all 0.15s;
}
.use-item-action-btn:hover { background: rgba(60,100,180,0.6); border-color: rgba(100,150,240,0.8); }
.use-item-custom { margin-top: 8px; }
.use-item-label { font-size: 0.8rem; color: #aaa; margin-bottom: 4px; display: block; text-align: left; }
.use-item-input {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  color: #eee;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.use-item-input:focus { border-color: rgba(100,150,240,0.5); outline: none; }
.use-item-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* Center: equipment slots */
.ginv-equip {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ginv-equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}
.ginv-equip-slot {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  padding: 3px;
}
.ginv-equip-slot:hover {
  background: rgba(212,176,80,0.08);
  border-color: rgba(212,176,80,0.3);
}
.ginv-equip-slot.selected {
  border-color: rgba(212,176,80,0.6);
  background: rgba(212,176,80,0.1);
  box-shadow: 0 0 10px rgba(212,176,80,0.15);
}
.ginv-slot-icon { font-size: 2.8rem; line-height: 1; }
/* Equipment hover tooltip */
.ginv-tooltip-wrap {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  padding-bottom: 6px;
}
.ginv-equip-slot:hover .ginv-tooltip-wrap {
  opacity: 1;
}
.ginv-tooltip {
  background: rgba(20,18,16,0.95);
  border: 1px solid rgba(212,176,80,0.4);
  border-radius: 6px;
  padding: 8px 10px;
  min-width: 140px;
  max-width: 200px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
.ginv-tooltip-icon {
  font-size: 2.5rem;
  line-height: 1.1;
  margin-bottom: 4px;
}
.ginv-tooltip-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e8dcc8;
  margin-bottom: 4px;
}
.ginv-tooltip-name.rarity-text-uncommon { color: #3c3; }
.ginv-tooltip-name.rarity-text-rare { color: #5aafff; }
.ginv-tooltip-name.rarity-text-epic { color: #b35aef; }
.ginv-tooltip-name.rarity-text-legendary { color: #ff9c20; }
.ginv-tooltip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  justify-content: center;
  margin-bottom: 3px;
}
.ginv-tooltip-stat {
  font-size: 0.65rem;
  color: #8f8;
  font-weight: 600;
}
.ginv-tooltip-desc {
  font-size: 0.6rem;
  color: #999;
  margin-top: 2px;
}
.ginv-equip-slot.empty .ginv-slot-icon { opacity: 0.2; }

/* Rarity borders for equip slots */
.ginv-equip-slot.rarity-common { border-color: rgba(157,157,157,0.4); }
.ginv-equip-slot.rarity-uncommon { border-color: rgba(30,200,30,0.4); }
.ginv-equip-slot.rarity-rare { border-color: rgba(60,130,255,0.5); }
.ginv-equip-slot.rarity-epic { border-color: rgba(163,53,238,0.5); }
.ginv-equip-slot.rarity-legendary { border-color: rgba(255,140,20,0.5); }

/* Right: inventory grid */
.ginv-right { display: flex; flex-direction: column; }

/* Coin bar above inventory grid */
.ginv-coin-bar {
  display: flex;
  gap: 10px;
  padding: 3px 8px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(246, 200, 109, 0.2);
}
.ginv-coin {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.ginv-coin .coin-icon { font-size: 12px; }
.ginv-coin .coin-amount { font-size: 12px; font-weight: bold; }
.gold-coin .coin-amount { color: #f6c86d; }
.silver-coin .coin-amount { color: #c0c0c0; }
.ginv-coin .coin-label { font-size: 10px; color: #777; }

.ginv-inv-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.ginv-inv-cell {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  font-size: 1.8rem;
}
.ginv-inv-cell:hover {
  background: rgba(212,176,80,0.08);
  border-color: rgba(212,176,80,0.3);
}
.ginv-inv-cell.selected {
  border-color: rgba(212,176,80,0.6);
  background: rgba(212,176,80,0.1);
  box-shadow: 0 0 8px rgba(212,176,80,0.15);
}
.ginv-inv-cell.empty { opacity: 0.4; cursor: default; }
.ginv-cell-qty {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 0.5rem;
  font-weight: 700;
  color: #ccc;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Rarity for inv cells */
.ginv-inv-cell.rarity-common { border-color: rgba(157,157,157,0.3); }
.ginv-inv-cell.rarity-uncommon { border-color: rgba(30,200,30,0.4); }
.ginv-inv-cell.rarity-rare { border-color: rgba(60,130,255,0.5); }
.ginv-inv-cell.rarity-epic { border-color: rgba(163,53,238,0.5); }
.ginv-inv-cell.rarity-legendary { border-color: rgba(255,140,20,0.5); }

/* Rarity text colors */
.ginv-rarity-common { color: #999; }
.ginv-rarity-uncommon { color: #4cbb4c; }
.ginv-rarity-rare { color: #5a9aff; }
.ginv-rarity-epic { color: #b366e0; }
.ginv-rarity-legendary { color: #f0a030; }

/* Footer runes */
.ginv-footer {
  display: flex;
  justify-content: space-between;
  padding: 4px 16px;
  border-top: 1px solid rgba(212,176,80,0.15);
  flex-shrink: 0;
}
.ginv-rune {
  font-size: 0.6rem;
  color: rgba(212,176,80,0.25);
  letter-spacing: 0.1em;
}

/* Inventory discard button */
.ginv-bottom-bar {
  display: flex;
  justify-content: flex-end;
  padding: 6px 0 0;
  margin-top: 4px;
}
/* Weight bar */
.ginv-weight-bar {
  margin-bottom: 6px;
}
.ginv-weight-label {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 3px;
}
.ginv-weight-track {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.ginv-weight-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a9, #6c4);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.ginv-weight-fill.overweight {
  background: linear-gradient(90deg, #c44, #f44);
  animation: overweight-pulse 1s ease-in-out infinite alternate;
}
@keyframes overweight-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.ginv-btn-discard {
  display: block;
  width: 100%;
  padding: 4px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(200,60,60,0.4);
  background: rgba(200,60,60,0.2);
  color: #e88;
  transition: all 0.15s;
  text-align: center;
  margin-top: 6px;
}
.ginv-btn-discard:hover:not(:disabled) {
  background: rgba(200,60,60,0.4);
  border-color: rgba(200,60,60,0.7);
  color: #fcc;
}
.ginv-btn-discard:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Spells section in inventory */
.ginv-spells-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.ginv-spells-title {
  font-size: 0.75rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ginv-spell-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: rgba(100, 80, 200, 0.15);
  border: 1px solid rgba(130, 100, 255, 0.25);
  border-radius: 6px;
  color: #ccc;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.ginv-spell-btn:hover:not(.disabled) {
  background: rgba(100, 80, 200, 0.3);
  border-color: rgba(130, 100, 255, 0.5);
  color: #fff;
}
.ginv-spell-btn.disabled {
  opacity: 0.4;
  cursor: default;
}
.ginv-spell-icon { font-size: 1.1rem; }
.ginv-spell-name { flex: 1; text-align: left; }
.ginv-spell-cost { color: #66aaff; font-size: 0.7rem; }

/* Quest item yellow glow */
.ginv-inv-cell.quest-item {
  border-color: rgba(240, 208, 112, 0.7) !important;
  box-shadow: 0 0 8px rgba(240, 208, 112, 0.25), inset 0 0 6px rgba(240, 208, 112, 0.1);
}
.ginv-inv-cell.quest-item::after {
  content: '!';
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 0.5rem;
  font-weight: 900;
  color: #f0d070;
}

/* Equipment slot hover tooltip (fixed, on body) */
.equip-hover-tooltip {
  position: fixed;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  display: none;
  transition: opacity 0.12s;
  background: rgba(16,14,12,0.9);
  border: 1px solid rgba(212,176,80,0.45);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 150px;
  max-width: 200px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

/* Inventory item hover tooltip (fixed, on body, 85% opacity) */
.inv-hover-tooltip {
  position: fixed;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  display: none;
  transition: opacity 0.12s;
  background: rgba(16,14,12,0.85);
  border: 1px solid rgba(212,176,80,0.45);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 150px;
  max-width: 200px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.inv-hover-icon {
  font-size: 2.2rem;
  line-height: 1.1;
  margin-bottom: 4px;
}
.inv-hover-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e8dcc8;
  margin-bottom: 3px;
}
.inv-hover-name.rarity-text-uncommon { color: #3c3; }
.inv-hover-name.rarity-text-rare { color: #5aafff; }
.inv-hover-name.rarity-text-epic { color: #b35aef; }
.inv-hover-name.rarity-text-legendary { color: #ff9c20; }
.inv-hover-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  justify-content: center;
  margin-bottom: 3px;
}
.inv-hover-stats span {
  font-size: 0.65rem;
  color: #8f8;
  font-weight: 600;
}
.inv-hover-desc {
  font-size: 0.62rem;
  color: #aaa;
  margin-top: 3px;
  white-space: normal;
}
.inv-hover-slot {
  font-size: 0.58rem;
  color: #a99;
  margin-top: 3px;
  font-style: italic;
}
.inv-hover-quest {
  font-size: 0.6rem;
  color: #f0d070;
  font-weight: 600;
  margin-top: 3px;
}

/* Chest loot popup */
.chest-modal-content {
  max-width: 380px;
  position: relative;
}
.chest-modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 4px;
}
.chest-modal-close {
  position: absolute;
  right: -8px;
  top: -4px;
}
.chest-loot-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  max-height: 260px;
  overflow-y: auto;
}
.chest-loot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,176,80,0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.chest-loot-item:hover {
  background: rgba(212,176,80,0.1);
  border-color: rgba(212,176,80,0.5);
}
.chest-loot-item.taken {
  opacity: 0.35;
  pointer-events: none;
  border-color: rgba(255,255,255,0.05);
}
.chest-loot-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.95rem;
  opacity: 0.7;
}

/* ===== Item Received Popup ===== */
.item-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: itemPopupFadeIn 0.3s ease;
}
@keyframes itemPopupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes itemPopupSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes itemPopupGlow {
  0%, 100% { opacity: 0.5; transform: translate(-50%,-50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
}
.item-popup-card {
  position: relative;
  background: rgba(18, 21, 32, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(246, 200, 109, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px 36px 28px;
  text-align: center;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(246,200,109,0.08);
  animation: itemPopupSlideUp 0.4s ease;
}
.item-popup-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(246,200,109,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: itemPopupGlow 2s ease-in-out infinite;
}
.item-popup-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  margin-bottom: 16px;
  opacity: 0.8;
}
.item-popup-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(246,200,109,0.3));
}
.item-popup-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.item-popup-rarity {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.item-popup-rarity.rarity-common { color: #888; }
.item-popup-rarity.rarity-uncommon { color: #2ecc71; }
.item-popup-rarity.rarity-rare { color: #3498db; }
.item-popup-rarity.rarity-epic { color: #9b59b6; }
.item-popup-rarity.rarity-legendary { color: #f39c12; }
.item-popup-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 14px;
}
.item-popup-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.item-popup-stats:empty { display: none; }
.item-popup-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #7bed7b;
}
.item-popup-btn {
  min-width: 140px;
}
.chest-loot-icon { font-size: 1.5rem; }
.chest-loot-info { flex: 1; }
.chest-loot-name {
  font-weight: 700;
  color: #f0d070;
  font-size: 0.85rem;
}
.chest-loot-desc {
  color: #999;
  font-size: 0.72rem;
  margin-top: 1px;
}
.chest-loot-take {
  font-size: 0.65rem;
  color: #5cbf5c;
  font-weight: 600;
}
/* ---- Scenario Briefing Parchment ---- */
.briefing-parchment {
  background: linear-gradient(170deg, #f4e4c1 0%, #e8d5a3 20%, #dcc48e 50%, #e2cfa0 80%, #f0ddb4 100%);
  border: 3px solid #8b7355;
  border-radius: 6px;
  box-shadow:
    0 0 40px rgba(139, 115, 85, 0.5),
    inset 0 0 60px rgba(139, 115, 85, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.6);
  max-width: 480px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px 28px 24px;
  position: relative;
  color: #3a2e1e;
  font-family: Georgia, 'Times New Roman', serif;
}
.briefing-parchment::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 6px;
}
.briefing-seal {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.briefing-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #2a1f0f;
  margin: 0 0 4px;
  text-shadow: 0 1px 2px rgba(139, 115, 85, 0.3);
  letter-spacing: 1px;
}
.briefing-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: #6b5a42;
  font-style: italic;
  margin-bottom: 10px;
}
.briefing-divider {
  text-align: center;
  color: #8b7355;
  font-size: 0.9rem;
  letter-spacing: 8px;
  margin: 8px 0 14px;
  opacity: 0.6;
}
.briefing-lore {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #3e3020;
  margin: 0 0 16px;
  text-align: justify;
  text-indent: 1.5em;
}
.briefing-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4a3a22;
  margin: 14px 0 6px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
  padding-bottom: 3px;
}
.briefing-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}
.briefing-list li {
  font-size: 0.82rem;
  color: #3e3020;
  padding: 3px 0 3px 18px;
  position: relative;
  line-height: 1.4;
}
.briefing-list li::before {
  content: '▸';
  position: absolute;
  left: 2px;
  color: #8b7355;
  font-weight: bold;
}
.briefing-list-bonus li::before {
  content: '⭐';
  font-size: 0.65rem;
  top: 3px;
}
.briefing-rewards {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 6px 0 10px;
}
.briefing-reward-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #3e3020;
}
.briefing-reward-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}
.briefing-tip {
  background: rgba(139, 115, 85, 0.12);
  border: 1px solid rgba(139, 115, 85, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #4a3a22;
  margin: 12px 0;
  font-style: italic;
  line-height: 1.5;
}
.briefing-start-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  letter-spacing: 1px;
  padding: 12px;
}
/* scrollbar for parchment */
.briefing-parchment::-webkit-scrollbar {
  width: 6px;
}
.briefing-parchment::-webkit-scrollbar-track {
  background: rgba(139, 115, 85, 0.1);
}
.briefing-parchment::-webkit-scrollbar-thumb {
  background: rgba(139, 115, 85, 0.4);
  border-radius: 3px;
}

/* Confirm modal */
/* Weapon choice modal */
.weapon-choice-content {
  max-width: 380px;
  text-align: center;
}
/* Dashboard inventory weapon choice — bigger version */
.dinv-wc-content {
  max-width: 520px;
}
.dinv-wc-content .weapon-choice-btn {
  padding: 20px 28px;
  min-width: 180px;
}
.dinv-wc-content .weapon-choice-icon {
  font-size: 4rem;
}
.dinv-wc-content .weapon-choice-name {
  font-size: 1.05rem;
}
.dinv-wc-content .weapon-choice-desc {
  font-size: 0.8rem;
}
.weapon-choice-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 16px;
}
.weapon-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  background: rgba(30,28,24,0.9);
  border: 2px solid rgba(212,176,80,0.3);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 130px;
}
.weapon-choice-btn:hover {
  border-color: rgba(212,176,80,0.8);
  background: rgba(212,176,80,0.15);
  transform: translateY(-2px);
}
.weapon-choice-icon {
  font-size: 2.5rem;
  line-height: 1;
}
.weapon-choice-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e8dcc8;
}
.weapon-choice-desc {
  font-size: 0.7rem;
  color: #999;
}

.confirm-modal-content {
  max-width: 320px;
  text-align: center;
}
.confirm-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

/* Escape roll modal */
.escape-roll-content {
  max-width: 360px;
  text-align: center;
}
.escape-roll-content .dice-title {
  margin-bottom: 8px;
}
.escape-dice-zone {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
}
.escape-dice {
  width: 80px;
  height: 80px;
  border: 3px solid var(--gold-dim);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(246, 200, 109, 0.06);
  transition: all 0.2s;
}
.escape-dice.rolling {
  animation: diceShake 0.1s infinite;
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--gold-glow);
}
.escape-dice.success {
  border-color: #5ddf5d;
  color: #5ddf5d;
  background: rgba(93, 223, 93, 0.1);
  box-shadow: 0 0 20px rgba(93, 223, 93, 0.3);
}
.escape-dice.fail {
  border-color: #e66;
  color: #e66;
  background: rgba(230, 102, 102, 0.1);
  box-shadow: 0 0 20px rgba(230, 102, 102, 0.3);
}
@keyframes diceShake {
  0% { transform: rotate(-5deg) scale(1.05); }
  50% { transform: rotate(5deg) scale(1.05); }
  100% { transform: rotate(-5deg) scale(1.05); }
}
.escape-result-text {
  font-size: 1rem;
  font-weight: 600;
  margin: 10px 0 16px;
}
.escape-result-text.success { color: #5ddf5d; }
.escape-result-text.fail { color: #e66; }

.chest-modal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.item-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 176, 80, 0.3);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.item-btn:hover {
  background: rgba(212, 176, 80, 0.15);
  border-color: rgba(212, 176, 80, 0.6);
}
.item-btn-spell {
  border-color: rgba(90, 127, 204, 0.4);
}
.item-btn-spell:hover {
  background: rgba(90, 127, 204, 0.15);
  border-color: rgba(90, 127, 204, 0.7);
}
.item-btn-name {
  font-weight: 700;
  color: #f0d070;
  font-size: 0.9rem;
}
.item-btn-spell .item-btn-name {
  color: #7fa8e0;
}
.item-btn-desc {
  color: #aaa;
  font-size: 0.78rem;
  margin-top: 2px;
}
.entity-rune {
  background: linear-gradient(135deg, #6060cc 0%, #303080 100%);
  border-color: #8888ee;
  font-size: 0.85rem;
  box-shadow: 0 0 12px rgba(96, 96, 204, 0.5), 0 2px 6px rgba(0,0,0,0.4);
  animation: rune-glow 2s ease-in-out infinite;
}
@keyframes rune-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(96, 96, 204, 0.3), 0 2px 6px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 18px rgba(96, 96, 204, 0.7), 0 2px 6px rgba(0,0,0,0.4); }
}

/* --- Combat Zone highlight --- */
.cell-combat-zone {
  box-shadow: inset 0 0 0 1px rgba(255, 40, 40, 0.25);
  background: rgba(255, 30, 30, 0.08) !important;
}
.cell-combat-zone.cell-wall {
  background: rgba(255, 30, 30, 0.04) !important;
}

/* --- Reachable cells (movement) --- */
.cell-reachable {
  cursor: pointer !important;
  background: rgba(80, 200, 120, 0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(80, 200, 120, 0.3);
}
.cell-reachable:hover {
  background: rgba(80, 200, 120, 0.25) !important;
  box-shadow: inset 0 0 0 2px rgba(80, 200, 120, 0.6), 0 0 12px rgba(80, 200, 120, 0.2);
}
.cell-reachable-offroad {
  cursor: pointer !important;
  background: rgba(220, 160, 50, 0.15) !important;
  box-shadow: inset 0 0 0 1px rgba(220, 160, 50, 0.35);
}
.cell-reachable-offroad:hover {
  background: rgba(220, 160, 50, 0.3) !important;
  box-shadow: inset 0 0 0 2px rgba(220, 160, 50, 0.6), 0 0 12px rgba(220, 160, 50, 0.2);
}

/* --- Path preview --- */
.cell-path {
  background: rgba(80, 200, 120, 0.2) !important;
  box-shadow: inset 0 0 8px rgba(80, 200, 120, 0.3);
}

/* --- Targetable cells (attack/skill) --- */
.cell-targetable {
  cursor: crosshair !important;
  box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.5);
  animation: target-pulse 1s ease-in-out infinite;
}
.cell-targetable:hover {
  box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.8), 0 0 15px rgba(255, 60, 60, 0.3);
}
@keyframes target-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.3); }
  50% { box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.6), inset 0 0 12px rgba(255, 60, 60, 0.1); }
}

/* --- Revealed highlights (search / magic-sight) --- */
.cell-revealed-gold {
  box-shadow: inset 0 0 0 2px rgba(246, 200, 109, 0.6), inset 0 0 15px rgba(246, 200, 109, 0.3) !important;
  animation: reveal-gold-pulse 1.5s ease-in-out infinite;
}
@keyframes reveal-gold-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(246, 200, 109, 0.4), inset 0 0 10px rgba(246, 200, 109, 0.15); }
  50% { box-shadow: inset 0 0 0 2px rgba(246, 200, 109, 0.9), inset 0 0 22px rgba(246, 200, 109, 0.45); }
}

.cell-revealed-red {
  box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.6), inset 0 0 15px rgba(255, 60, 60, 0.3) !important;
  animation: reveal-red-pulse 1.5s ease-in-out infinite;
}
@keyframes reveal-red-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.4), inset 0 0 10px rgba(255, 60, 60, 0.15); }
  50% { box-shadow: inset 0 0 0 2px rgba(255, 60, 60, 0.9), inset 0 0 22px rgba(255, 60, 60, 0.45); }
}

.cell-revealed-blue {
  box-shadow: inset 0 0 0 2px rgba(100, 180, 255, 0.6), inset 0 0 15px rgba(100, 180, 255, 0.3) !important;
  animation: reveal-blue-pulse 1.5s ease-in-out infinite;
}
@keyframes reveal-blue-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(100, 180, 255, 0.4), inset 0 0 10px rgba(100, 180, 255, 0.15); }
  50% { box-shadow: inset 0 0 0 2px rgba(100, 180, 255, 0.9), inset 0 0 22px rgba(100, 180, 255, 0.45); }
}

.cell-revealed-white {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3) !important;
  animation: reveal-white-pulse 1.5s ease-in-out infinite;
}
@keyframes reveal-white-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.15); }
  50% { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9), inset 0 0 22px rgba(255, 255, 255, 0.45); }
}

/* Hero cell active turn glow */
.cell-hero .entity-warrior,
.cell-hero .entity-mage,
.cell-hero .entity-priest {
  cursor: pointer;
}

/* ============================
   TURN PHASE BAR
   ============================ */

.turn-phase-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 8px;
  background: rgba(10, 12, 20, 0.6);
  border-radius: 6px;
  border: 1px solid rgba(201, 162, 78, 0.15);
}
.phase-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  transition: all 0.3s;
  border: 1px solid transparent;
}
.phase-item.active {
  color: #f0d070;
  background: rgba(246, 200, 109, 0.1);
  border-color: rgba(246, 200, 109, 0.3);
  box-shadow: 0 0 12px rgba(246, 200, 109, 0.1);
}
.phase-item.done {
  color: rgba(80, 200, 120, 0.6);
}
.phase-item.done .phase-icon::after {
  content: ' \2713';
}
.phase-arrow {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.7rem;
}
.phase-icon {
  font-size: 0.85rem;
}

/* ============================
   ACTION BAR ENHANCEMENTS
   ============================ */

.action-btn .action-uses {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(80, 200, 120, 0.2);
  color: #50c878;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(80, 200, 120, 0.4);
}
.action-btn {
  position: relative;
}
.action-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.5);
}

/* ============================
   DICE ROLL MODAL
   ============================ */

.dice-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dice-modal-content {
  background: linear-gradient(135deg, #141822 0%, #0e1118 100%);
  padding: 40px 50px;
  border-radius: 4px;
  text-align: center;
  min-width: 360px;
  border-top: 5px solid #f0d070;
  border-left: 5px solid #d4b050;
  border-bottom: 5px solid #7a5a18;
  border-right: 5px solid #8a6520;
  box-shadow:
    inset 0 0 0 2px #0e1018,
    inset 0 0 0 3px rgba(201, 162, 78, 0.25),
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    0 0 0 2px #0a0c12,
    0 0 0 4px rgba(138, 101, 32, 0.5),
    0 0 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(246, 200, 109, 0.08);
  position: relative;
}
.dice-modal-content::after {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #7db8ff 0%, #3a70cc 40%, #2a55aa 100%);
  border: 3px solid #d4b050;
  border-top-color: #f0d070;
  border-left-color: #e0c060;
  border-bottom-color: #8a6520;
  border-right-color: #9a7530;
  z-index: 10;
  box-shadow:
    0 0 8px rgba(91, 143, 255, 0.5),
    0 0 20px rgba(91, 143, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.dice-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.dice-desc {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.dice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0 8px;
}

/* D20 die image wrapper */
.dice-d20-inner {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.3s;
}

.d20-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

/* Result number below the die */
.dice-value-row {
  margin-top: 6px;
  text-align: center;
}

.dice-value {
  font-family: 'Cinzel', serif;
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #f0d870 0%, #d4a030 40%, #a07820 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

/* Rolling animation — violent shake with rotation, no smoothing */
.dice-rolling .dice-d20-inner {
  animation: dice-shake 0.04s steps(1) infinite;
}
.dice-rolling .dice-value {
  animation: value-flash 0.05s steps(1) infinite;
}
@keyframes dice-shake {
  0%   { transform: translate(-5px, -4px) rotate(-8deg) scale(1.02); }
  10%  { transform: translate(4px, 5px) rotate(10deg) scale(0.98); }
  20%  { transform: translate(-6px, 3px) rotate(-11deg) scale(1.03); }
  30%  { transform: translate(4px, -6px) rotate(7deg) scale(0.97); }
  40%  { transform: translate(6px, 2px) rotate(-9deg) scale(1.02); }
  50%  { transform: translate(-3px, 5px) rotate(12deg) scale(0.98); }
  60%  { transform: translate(5px, -4px) rotate(-6deg) scale(1.02); }
  70%  { transform: translate(-4px, -3px) rotate(9deg) scale(0.98); }
  80%  { transform: translate(3px, 6px) rotate(-10deg) scale(1.03); }
  90%  { transform: translate(-6px, -5px) rotate(7deg) scale(0.97); }
  100% { transform: translate(0, 0) rotate(0deg) scale(1); }
}
@keyframes value-flash {
  0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; }
}

/* --- Result states --- */

/* Success - green glow on die + green number */
.dice-success .d20-img {
  filter: drop-shadow(0 0 20px rgba(80, 200, 120, 0.6)) drop-shadow(0 0 40px rgba(80, 200, 120, 0.3));
}
.dice-success .dice-value {
  background: linear-gradient(180deg, #70ff98 0%, #50c878 40%, #308050 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(80, 200, 120, 0.8)) drop-shadow(0 2px 3px rgba(0,0,0,0.7));
}

/* Fail - red glow on die + red number */
.dice-fail .d20-img {
  filter: drop-shadow(0 0 20px rgba(200, 60, 60, 0.6)) drop-shadow(0 0 40px rgba(200, 60, 60, 0.3));
}
.dice-fail .dice-value {
  background: linear-gradient(180deg, #ff6666 0%, #cc3333 40%, #882020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(204, 68, 68, 0.8)) drop-shadow(0 2px 3px rgba(0,0,0,0.7));
}

/* Crit - epic golden glow + pulse on die + big golden number */
.dice-crit .d20-img {
  filter: drop-shadow(0 0 25px rgba(246, 200, 109, 0.7)) drop-shadow(0 0 50px rgba(246, 200, 109, 0.4));
  animation: dice-crit-img-glow 0.5s ease infinite;
}
.dice-crit .dice-value {
  font-size: 3.2rem;
  background: linear-gradient(180deg, #fff8d0 0%, #f0d070 30%, #d4a030 70%, #a07820 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(246, 200, 109, 0.9)) drop-shadow(0 2px 3px rgba(0,0,0,0.7));
}
@keyframes dice-crit-img-glow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(246, 200, 109, 0.5)) drop-shadow(0 0 40px rgba(246, 200, 109, 0.2)); }
  50% { filter: drop-shadow(0 0 35px rgba(246, 200, 109, 0.8)) drop-shadow(0 0 70px rgba(246, 200, 109, 0.4)); }
}

.dice-modifier {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.dice-result {
  margin: 16px 0;
}
.dice-total {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.dice-outcome {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 6px 20px;
  border-radius: 4px;
  display: inline-block;
}
.dice-outcome-success {
  color: #50c878;
  background: rgba(80, 200, 120, 0.1);
  border: 1px solid rgba(80, 200, 120, 0.3);
  text-shadow: 0 0 12px rgba(80, 200, 120, 0.3);
}
.dice-outcome-fail {
  color: #cc4444;
  background: rgba(204, 68, 68, 0.1);
  border: 1px solid rgba(204, 68, 68, 0.3);
  text-shadow: 0 0 12px rgba(204, 68, 68, 0.3);
}
.dice-outcome-crit {
  color: #f0d070;
  background: rgba(246, 200, 109, 0.15);
  border: 1px solid rgba(246, 200, 109, 0.4);
  text-shadow: 0 0 16px rgba(246, 200, 109, 0.4);
  animation: crit-text 0.4s ease infinite;
}
@keyframes crit-text {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.dice-roll-btn {
  margin-top: 16px;
  min-width: 180px;
  font-size: 1.1rem;
  padding: 12px 32px;
}
.dice-continue-btn {
  margin-top: 10px;
  min-width: 140px;
}

/* ============================
   DIALOG MODAL
   ============================ */

.dialog-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.dialog-modal-content {
  background: linear-gradient(160deg, #1a1e30 0%, #0e1020 100%);
  border: 3px solid;
  border-top-color: #d4b050;
  border-left-color: #c0a040;
  border-bottom-color: #6a4a10;
  border-right-color: #7a5a18;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 176, 80, 0.15);
}

.dialog-portrait-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 20px;
}

.dialog-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dialog-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid #d4b050;
  background: linear-gradient(135deg, #d4a030 0%, #8a6a18 100%);
  box-shadow: 0 0 12px rgba(212, 160, 48, 0.4);
}

.dialog-avatar-monster {
  background: linear-gradient(135deg, #cc9944 0%, #7a5a18 100%);
  border-color: #eebb55;
  box-shadow: 0 0 12px rgba(204, 153, 68, 0.4);
}

.dialog-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.dialog-text-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 176, 80, 0.2);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.dialog-speaker {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #d4b050;
  margin: 0 0 6px 0;
}

.dialog-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin: 0;
}

.dialog-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog-choice-btn {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: all 0.2s;
}

.dialog-choice-btn:hover {
  background: rgba(212, 176, 80, 0.15);
  border-color: #d4b050;
  color: #f0d070;
  transform: translateX(4px);
}

/* ============================
   INITIATIVE MODAL
   ============================ */

.initiative-modal-content {
  max-width: 500px;
}

.initiative-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0;
  max-height: 400px;
  overflow-y: auto;
}

.initiative-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  order: 0;
}

.initiative-hero {
  background: rgba(212, 176, 80, 0.12);
  border: 1px solid rgba(212, 176, 80, 0.3);
}

.initiative-monster {
  background: rgba(204, 68, 68, 0.12);
  border: 1px solid rgba(204, 68, 68, 0.3);
}

.init-label {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.initiative-hero .init-label {
  background: rgba(212, 176, 80, 0.25);
  color: #f0d070;
}

.initiative-monster .init-label {
  background: rgba(204, 68, 68, 0.25);
  color: #ff8888;
}

.init-name {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Cinzel', serif;
}

.init-bonus {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  min-width: 28px;
  text-align: center;
}

.init-dice {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-weight: 700;
  font-size: 1rem;
  color: #f0d070;
}

.init-total {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #f0d070;
}

.init-position {
  font-weight: 700;
  font-size: 0.75rem;
  color: #f0d070;
  background: rgba(212, 176, 80, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 24px;
  text-align: center;
}

/* Mobile tabs — hidden on desktop */
.mobile-tabs { display: none; }

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
  /* --- General responsive --- */
  .nav-menu { display: none; }
  .inventory-main { grid-template-columns: 1fr; }
  .appearance-layout { grid-template-columns: 1fr; }
  .stats-layout { grid-template-columns: 1fr; }
  .stats-preview { justify-content: center; }
  .stats-avatar { width: 180px; height: 280px; }
  .lobby-mission { flex-direction: column; }
  .lobby-mission-img { width: 100%; height: 140px; }

  /* --- Screen / Game layout --- */
  #screen-game {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .game-panel-left,
  .game-panel-right {
    display: none;
  }

  .game-center {
    min-height: 0;
  }

  /* --- Mobile Tabs --- */
  .mobile-tabs {
    display: flex !important;
    gap: 0;
    background: rgba(12, 14, 20, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
  }

  .mobile-tab {
    flex: 1;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
  }

  .mobile-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: rgba(246, 200, 109, 0.05);
  }

  /* When team/log panels are shown via tab */
  .game-panel-left[style*="display: block"],
  .game-panel-left[style*="display: flex"],
  .game-panel-left:not([style*="display: none"]).mobile-visible,
  .game-panel-right[style*="display: block"],
  .game-panel-right[style*="display: flex"],
  .game-panel-right:not([style*="display: none"]).mobile-visible {
    display: block !important;
    overflow-y: auto;
    padding: 12px;
  }

  /* --- Topbar compact --- */
  .game-topbar {
    padding: 0 8px;
    flex-shrink: 0;
  }

  .game-topbar-inner {
    height: 40px;
    gap: 8px;
  }

  .game-mission-info {
    display: none;
  }

  .game-round-info {
    font-size: 0.75rem;
    gap: 6px;
    flex: 1;
  }

  .game-topbar-inner .btn {
    padding: 4px 8px;
    font-size: 0.7rem;
    min-width: unset;
  }

  /* --- AI Narration compact --- */
  .ai-narration {
    padding: 6px 10px;
    gap: 6px;
    max-height: 52px;
    overflow: hidden;
  }

  .ai-narration p {
    font-size: 0.72rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ai-icon {
    width: 22px;
    height: 22px;
    font-size: 0.55rem;
    flex-shrink: 0;
  }

  /* --- Map fills remaining space --- */
  .dungeon-map-wrapper {
    flex: 1;
    min-height: 0;
  }

  /* Zoom buttons bigger for touch */
  .map-zoom-controls {
    bottom: 60px;
    right: 8px;
  }

  .map-zoom-btn {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  /* --- Team chat compact --- */
  .team-chat {
    left: 4px;
    bottom: 4px;
    max-width: 200px;
    font-size: 0.7rem;
  }

  .team-chat-header {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .team-chat-messages {
    max-height: 80px;
  }

  /* Mission objectives compact */
  .mission-objectives-panel {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  /* --- Action Bar compact --- */
  .action-bar {
    padding: 6px 8px;
    flex-shrink: 0;
  }

  .action-bar-inner {
    gap: 4px;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .action-bar-inner::-webkit-scrollbar {
    display: none;
  }

  .action-btn {
    min-width: 48px;
    max-width: 48px;
    height: 44px;
    padding: 4px 6px;
    flex-shrink: 0;
    gap: 1px;
  }

  /* Hide text labels, keep only icons */
  .action-btn > span:last-child {
    display: none;
  }

  .action-btn .action-icon {
    font-size: 1.3rem;
  }

  /* End Turn button keeps text */
  .action-btn.end-turn {
    min-width: 72px;
    max-width: unset;
  }

  .action-btn.end-turn > span:last-child {
    display: block;
    font-size: 0.55rem;
  }

  /* Action uses badge */
  .action-btn .action-uses {
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    font-size: 0.55rem;
  }

  /* Action menu popup */
  .action-menu-popup {
    bottom: 52px;
    min-width: 220px;
    max-height: 60vh;
    overflow-y: auto;
  }

  .marker-menu-popup {
    bottom: 52px;
  }

  /* --- Team Panel (when shown via mobile tab) --- */
  .game-panel-left {
    border-right: none;
    border-image: none;
    box-shadow: none;
  }

  .team-member {
    padding: 10px;
    gap: 10px;
  }

  .tm-portrait,
  [class*="-portrait-sm"] {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .tm-bar {
    height: 18px;
    margin-bottom: 4px;
  }

  .tm-bar span {
    font-size: 0.68rem;
  }

  .tm-name {
    font-size: 0.85rem;
  }

  .panel-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  /* --- Combat Log (when shown via mobile tab) --- */
  .game-panel-right {
    border-left: none;
    border-image: none;
    box-shadow: none;
  }

  .combat-log {
    max-height: none;
  }

  .log-entry {
    font-size: 0.82rem;
    padding: 8px 10px;
  }

  /* --- Map Tooltip as bottom sheet --- */
  .map-tooltip {
    position: fixed !important;
    bottom: 100px !important;
    left: 50% !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    width: 90vw;
    max-width: 320px;
    text-align: center;
    border-radius: 12px;
    padding: 16px;
    white-space: normal;
    position: fixed !important;
  }

  .map-tooltip-img {
    width: 60px;
    height: 60px;
  }

  .map-tooltip-name {
    font-size: 0.85rem;
  }

  .map-tooltip-info {
    font-size: 0.7rem;
  }

  .map-tooltip-hp {
    font-size: 0.75rem;
  }

  .tooltip-talk-btn {
    min-height: 40px;
    font-size: 0.85rem;
    padding: 8px 16px;
    margin-top: 6px;
  }

  .tooltip-close-btn {
    display: block;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* Entity tokens more tappable on mobile */
  .cell-entity {
    min-width: 28px;
    min-height: 28px;
    cursor: pointer;
  }

  /* --- Dialog Modal --- */
  .dialog-modal-content {
    width: 95vw;
    max-width: 95vw;
    max-height: 85vh;
    padding: 16px;
    overflow-y: auto;
  }

  .dialog-portrait-row {
    gap: 12px;
  }

  .dialog-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .dialog-text-box {
    font-size: 0.85rem;
    padding: 12px;
  }

  .dialog-choice-btn {
    padding: 10px;
    font-size: 0.85rem;
  }

  /* --- Dice Roll Modal --- */
  .dice-modal-content,
  .chest-modal-content,
  .escape-modal-content,
  .persuasion-modal-content {
    width: 90vw;
    max-width: 90vw;
    max-height: 85vh;
    padding: 16px;
    overflow-y: auto;
  }

  .dice-container {
    width: 70px;
    height: 70px;
  }

  .dice-value {
    font-size: 1.6rem;
  }

  /* --- Game Inventory Overlay --- */
  .ginv-panel {
    width: 96vw;
    max-width: 96vw;
    max-height: 90vh;
    padding: 12px;
  }

  .dinv-body {
    grid-template-columns: 1fr;
  }

  .dinv-equip-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .ginv-header {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ginv-hero-name {
    font-size: 0.9rem;
  }

  .ginv-desc {
    max-width: 96vw;
    padding: 10px;
    font-size: 0.8rem;
  }

  /* --- Scenario Briefing --- */
  .scenario-briefing-modal .dice-modal-content {
    width: 95vw;
    max-width: 95vw;
    max-height: 90vh;
    padding: 16px;
  }

  .briefing-parchment {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
  }

  .briefing-title {
    font-size: 1.2rem;
  }

  /* --- Weapon Choice Modal --- */
  .weapon-choice-modal .dice-modal-content {
    width: 95vw;
  }

  .weapon-cards {
    flex-direction: column;
    gap: 10px;
  }

  .weapon-card {
    padding: 12px;
  }

  /* --- Use Item / Overweight / Free Action modals --- */
  .use-item-content,
  .overweight-content {
    width: 90vw;
    max-width: 90vw;
    padding: 16px;
  }

  .free-action-modal .dice-modal-content {
    width: 95vw;
  }

  .free-action-input {
    font-size: 0.9rem;
  }

  /* --- Item Popup --- */
  .item-popup-content {
    width: 85vw;
    max-width: 320px;
    padding: 16px;
  }

  /* --- Transfer Modal --- */
  .transfer-modal-content {
    width: 90vw;
    max-width: 90vw;
    padding: 16px;
  }
}

/* ========================================
   AUTH FORMS
   ======================================== */
.login-email-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  box-sizing: border-box;
}
.auth-input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.09);
}
.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-submit-btn {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: center;
}

.auth-toggle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.auth-toggle a {
  color: var(--gold);
  text-decoration: none;
  margin-left: 4px;
}
.auth-toggle a:hover {
  text-decoration: underline;
}

.auth-back-link {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--transition);
}
.auth-back-link:hover {
  color: var(--text);
}

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.auth-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

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

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: #0b0f15;
  font-weight: 600;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--gold-glow);
}
.btn-gold:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Nav user display */
.nav-user-name {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 500;
}
.nav-logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.nav-logout-btn:hover {
  border-color: var(--red-dim);
  color: var(--red);
}

/* ============================
   SCREEN: PROFILE
   ============================ */

.profile-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* Profile Header */
.profile-header-section {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(212,176,80,0.15);
  border-radius: 10px;
  margin-bottom: 12px;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.8rem;
  line-height: 64px;
}
.profile-player-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 4px;
}
.profile-member-since {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Stats Grid */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.profile-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  text-align: center;
  transition: border-color 0.2s;
}
.profile-stat-card:hover {
  border-color: rgba(212,176,80,0.25);
}
.profile-stat-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
}
.profile-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* Stat card colors */
.stat-total .profile-stat-number { color: #ccc; }
.stat-victories .profile-stat-number { color: #5ddf5d; }
.stat-defeats .profile-stat-number { color: #e66; }
.stat-winrate .profile-stat-number { color: var(--gold); }

.stat-victories { border-color: rgba(93,223,93,0.15); }
.stat-defeats { border-color: rgba(230,102,102,0.15); }
.stat-winrate { border-color: rgba(212,176,80,0.15); }

/* Campaign History */
.profile-history {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  transition: border-color 0.2s;
}
.profile-history-item:hover {
  border-color: rgba(212,176,80,0.2);
}
.profile-history-item.result-victory {
  border-left: 3px solid rgba(93,223,93,0.5);
}
.profile-history-item.result-defeat {
  border-left: 3px solid rgba(230,102,102,0.5);
}

.history-result-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 4px;
  min-width: 70px;
  text-align: center;
}
.result-victory .history-result-badge {
  background: rgba(93,223,93,0.12);
  color: #5ddf5d;
}
.result-defeat .history-result-badge {
  background: rgba(230,102,102,0.12);
  color: #e66;
}

.history-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-scenario {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.history-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.history-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.text-dim {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 700px) {
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-header-section { flex-direction: column; text-align: center; }
}
