/* =============================================================================
   main.css  -  Arcane Rebirth: Dark Fantasy Design System
   Mobile-first | CSS Custom Properties | Flexbox + Grid
   ============================================================================= */

/* -- Google Fonts ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* -- Design Tokens ----------------------------------------------------------- */
:root {
  /* Palette */
  --c-bg-deep: #08090f;
  --c-bg-base: #0d0f1a;
  --c-bg-card: #12152a;
  --c-bg-elevated: #181c35;
  --c-bg-glass: rgba(18, 21, 42, 0.72);

  --c-border: rgba(120, 100, 200, 0.18);
  --c-border-glow: rgba(138, 100, 255, 0.45);

  /* Brand purple/gold */
  --c-primary: #8a64ff;
  --c-primary-dim: #6b4dd4;
  --c-primary-glow: rgba(138, 100, 255, 0.35);
  --c-gold: #e8c96b;
  --c-gold-dim: #c4a535;
  --c-gold-glow: rgba(232, 201, 107, 0.30);

  /* Element colours */
  --c-fire: #ff6b35;
  --c-water: #35a8ff;
  --c-earth: #85c74a;
  --c-wind: #b2f0fb;
  --c-void: #c060ff;
  --c-steel: #b0c4d8;
  --c-diamond: #a8f0ff;
  --c-time: #ffe680;

  /* Semantic */
  --c-success: #4ade80;
  --c-error: #f87171;
  --c-warning: #fb923c;
  --c-info: #60a5fa;

  /* HP / Mana / Stamina bars */
  --c-hp: #e05252;
  --c-mana: #5b8fff;
  --c-stamina: #52c47a;

  /* Text */
  --c-text: #ddd8f0;
  --c-text-muted: #7a729a;
  --c-text-faint: #4a4566;
  --c-heading: #f0eaff;

  /* Typography */
  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 24px var(--c-primary-glow);

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-slow: 0.4s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--c-bg-deep);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient background runes */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(138, 100, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(232, 201, 107, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* -- Typography -------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--c-heading);
  line-height: 1.2;
  letter-spacing: 0.03em;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

p {
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--c-primary);
  text-decoration: none;
  transition: color var(--t-fast), opacity var(--t-fast);
}

a:hover {
  color: var(--c-gold);
}

/* -- Layout Wrappers --------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* -- Cards ------------------------------------------------------------------- */
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-primary), transparent);
  opacity: 0.7;
}

.card--glass {
  background: var(--c-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card--gold::before {
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}

/* -- Auth Layout ------------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  position: relative;
  z-index: 1;
}

.auth-wrap {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.55) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_login.png') no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
}

body:has(.quests-page) {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.60) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_quests.png') no-repeat center center fixed !important;
  background-size: cover !important;
}

body:has(.inbox-container) {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.60) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_inbox.png') no-repeat center center fixed !important;
  background-size: cover !important;
}

.auth-wrap--login .auth-card {
  background: rgba(14, 16, 28, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(138, 100, 255, 0.25);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.8), 0 0 40px rgba(138, 100, 255, 0.12);
}

.auth-panel {
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo__img {
  display: block;
  margin: 0 auto var(--space-md);
  max-width: 280px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 25px rgba(168, 85, 247, 0.45)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
  animation: logoGlowPulse 4s ease-in-out infinite alternate;
  transition: transform var(--t-fast);
}

.auth-logo__img:hover {
  transform: scale(1.03);
}

@keyframes logoGlowPulse {
  0% {
    filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.35)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  }

  100% {
    filter: drop-shadow(0 0 28px rgba(192, 132, 252, 0.65)) drop-shadow(0 6px 18px rgba(0, 0, 0, 0.8));
  }
}

.auth-logo__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
  display: block;
}

.auth-logo__subtitle {
  color: var(--c-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  display: block;
  margin-top: var(--space-xs);
}

.auth-logo__rune {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-sm);
  filter: drop-shadow(0 0 12px var(--c-primary-glow));
  animation: runeFloat 4s ease-in-out infinite;
}

@keyframes runeFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.auth-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card), 0 0 60px rgba(138, 100, 255, 0.07);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--c-primary) 40%, var(--c-gold) 60%, transparent 100%);
}

.auth-card__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--c-heading);
  margin-bottom: var(--space-xs);
  text-align: center;
}

.auth-card__subtitle {
  color: var(--c-text-muted);
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-links {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.875rem;
  color: var(--c-text-muted);
}

.auth-links a {
  color: var(--c-primary);
  font-weight: 500;
}

.auth-links a:hover {
  color: var(--c-gold);
}

/* -- Forms ------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: var(--space-sm);
}

.form-input {
  width: 100%;
  background: rgba(10, 8, 24, 0.7);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--c-text-faint);
  font-size: 0.9rem;
}

.form-input:focus {
  border-color: var(--c-primary);
  background: rgba(15, 10, 35, 0.9);
  box-shadow: 0 0 0 3px var(--c-primary-glow);
}

.form-input--error {
  border-color: var(--c-error);
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.form-error {
  display: block;
  color: var(--c-error);
  font-size: 0.8rem;
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.form-error::before {
  content: '!';
  width: 14px;
  height: 14px;
  background: var(--c-error);
  color: #08090f;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Password visibility toggle wrapper */
.form-input-wrap {
  position: relative;
}

.form-input-wrap .form-input {
  padding-right: 2.8rem;
}

.form-toggle-pw {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color var(--t-fast);
}

.form-toggle-pw:hover {
  color: var(--c-primary);
}

/* -- Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  -webkit-appearance: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dim) 100%);
  border-color: var(--c-primary);
  color: #fff;
  box-shadow: 0 4px 18px var(--c-primary-glow);
}

.btn--primary:hover {
  background: linear-gradient(135deg, #9e7aff 0%, var(--c-primary) 100%);
  box-shadow: 0 4px 28px rgba(138, 100, 255, 0.55);
  color: #fff;
  transform: translateY(-1px);
}

.btn--gold {
  background: linear-gradient(135deg, var(--c-gold) 0%, var(--c-gold-dim) 100%);
  border-color: var(--c-gold);
  color: #1a1200;
  box-shadow: 0 4px 18px var(--c-gold-glow);
}

.btn--gold:hover {
  box-shadow: 0 4px 28px rgba(232, 201, 107, 0.5);
  color: #0d0a00;
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  border-color: var(--c-border);
  color: var(--c-text);
}

.btn--ghost:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-glow);
}

.btn--danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--c-error);
  color: var(--c-error);
}

.btn--danger:hover {
  background: var(--c-error);
  color: #08090f;
}

.btn--full {
  width: 100%;
}

.btn--lg {
  font-size: 1rem;
  padding: 0.875rem 2rem;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading spinner on button */
.btn--loading::after {
  content: '';
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* -- Flash Alerts ------------------------------------------------------------ */
.flash-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 380px;
  width: calc(100% - 2 * var(--space-lg));
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid;
  backdrop-filter: blur(12px);
  font-size: 0.9rem;
  animation: flashIn 0.3s ease-out;
  cursor: pointer;
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.flash--success {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.4);
  color: var(--c-success);
}

.flash--error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--c-error);
}

.flash--warning {
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.4);
  color: var(--c-warning);
}

.flash--info {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.4);
  color: var(--c-info);
}

.flash__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.flash__body {
  flex: 1;
}

.flash__close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.flash__close:hover {
  opacity: 1;
}

/* -- Navigation -------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--c-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
}

.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 1.5rem;
}

.nav-brand-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.nav-mobile-toggle {
  display: none;
  background: rgba(30, 25, 45, 0.7);
  border: 1px solid rgba(147, 112, 219, 0.4);
  color: #e2e8f0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.nav-mobile-toggle:hover,
.nav-mobile-toggle:focus {
  background: rgba(50, 40, 75, 0.9);
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--c-primary), var(--c-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: transform var(--t-fast);
}

.nav-brand:hover {
  transform: scale(1.02);
}

.nav-brand__logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  list-style: none;
  flex: 1 1 auto;
  margin: 0 auto;
  padding: 0;
}

.nav-link-icon {
  display: none;
}

.nav-links a {
  color: var(--c-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--t-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--c-text);
}

.nav-user {
  margin-left: auto !important;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md, 1rem);
}

.nav-logout-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--c-border-glow);
  background: #1e1b2e;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

.nav-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-text);
  white-space: nowrap;
}

/* -- Resource Bars ----------------------------------------------------------- */
.resource-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.resource-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.resource-bar__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  width: 42px;
  flex-shrink: 0;
  color: var(--c-text-muted);
}

.resource-bar__track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.resource-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-bar--hp .resource-bar__fill {
  background: linear-gradient(90deg, #c03030, var(--c-hp));
}

.resource-bar--mana .resource-bar__fill {
  background: linear-gradient(90deg, #2855c0, var(--c-mana));
}

.resource-bar--stam .resource-bar__fill {
  background: linear-gradient(90deg, #1e9640, var(--c-stamina));
}

.resource-bar__value {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}

/* -- Stat Grid --------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.stat-box {
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.stat-box:hover {
  border-color: var(--c-border-glow);
  box-shadow: 0 0 16px var(--c-primary-glow);
}

.stat-box__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  display: block;
}

.stat-box__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-heading);
  display: block;
  line-height: 1;
  margin: var(--space-xs) 0;
}

.stat-box__sub {
  font-size: 0.75rem;
  color: var(--c-text-faint);
}

/* -- Badge / Tag ------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--rank-d {
  background: rgba(120, 120, 120, 0.2);
  border: 1px solid #666;
  color: #aaa;
}

.badge--rank-c {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid var(--c-success);
  color: var(--c-success);
}

.badge--rank-b {
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid var(--c-info);
  color: var(--c-info);
}

.badge--rank-a {
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid var(--c-warning);
  color: var(--c-warning);
}

.badge--rank-s {
  background: rgba(232, 201, 107, 0.15);
  border: 1px solid var(--c-gold);
  color: var(--c-gold);
}

.badge--role-2 {
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid var(--c-info);
  color: var(--c-info);
}

.badge--role-3 {
  background: rgba(232, 201, 107, 0.15);
  border: 1px solid var(--c-gold);
  color: var(--c-gold);
}

.badge--role-4 {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid var(--c-error);
  color: var(--c-error);
}

/* -- Dividers ---------------------------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--space-xl) 0;
}

.divider--glow {
  border-top-color: rgba(138, 100, 255, 0.3);
  box-shadow: 0 -1px 8px rgba(138, 100, 255, 0.15);
}

/* -- Error Page -------------------------------------------------------------- */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.error-container {
  text-align: center;
  padding: var(--space-xl);
}

.error-code {
  font-size: clamp(6rem, 20vw, 12rem);
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--c-primary), var(--c-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-md);
}

.error-message {
  color: var(--c-text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-xl);
}

/* -- Scrollbar --------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--c-bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--c-bg-elevated);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c-primary-dim);
}

/* -- Utility ----------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--c-text-muted);
}

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

.text-primary {
  color: var(--c-primary);
}

.text-success {
  color: var(--c-success);
}

.text-error {
  color: var(--c-error);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mt-xl {
  margin-top: var(--space-xl);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

/* -- Responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
  .nav-inner {
    padding: 0 1rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Mobile: hide logo and title to eliminate cramped navbar */
  .nav-brand {
    display: none !important;
  }

  .nav-mobile-toggle {
    display: inline-flex !important;
  }

  .nav-user {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
  }

  .nav-links {
    display: none;
  }

  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(10, 12, 20, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
    padding: 0.75rem 1rem 1.25rem;
    gap: 0.35rem;
    max-height: calc(100vh - 65px);
    overflow-y: auto;
    z-index: 995;
    animation: slideDownNav 0.2s ease-out;
  }

  @keyframes slideDownNav {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-links.is-open li {
    width: 100%;
    margin: 0;
  }

  .nav-links.is-open a {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.15s ease;
  }

  .nav-links.is-open a:hover,
  .nav-links.is-open a.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.45);
    color: #ffd700;
    padding-left: 1.1rem;
  }

  .nav-links.is-open .nav-link-icon {
    display: inline-block;
    margin-right: 0.6rem;
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .nav-inner {
    padding: 0 0.5rem;
    gap: 0.35rem;
  }

  .nav-brand-wrap {
    gap: 0.35rem;
  }

  .nav-brand {
    font-size: 1rem;
    gap: 0.35rem;
  }

  .nav-brand__logo {
    height: 30px;
  }

  .nav-user {
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .nav-username {
    display: none;
    /* Hide username text so avatar and logout are never pushed off screen */
  }

  .nav-logout-btn {
    padding: 0.3rem 0.55rem !important;
    font-size: 0.75rem !important;
    flex-shrink: 0;
  }

  .audio-btn-pill {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }

  .audio-btn-pill #audio-label {
    display: none;
    /* Icon-only on phone to keep header within bounds */
  }

  .auth-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .flash-container {
    top: auto;
    bottom: var(--space-lg);
    right: var(--space-md);
    left: var(--space-md);
    max-width: 100%;
    width: auto;
  }

  .site-footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .site-footer-links {
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .nav-brand-name {
    display: none;
    /* Ultra-compact: show logo icon only on <= 380px */
  }
}

/* -- Site Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--c-border, #1f2937);
  background: #080c14;
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
  color: var(--c-text-muted, #94a3b8);
}

.site-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.site-footer-title {
  font-weight: 800;
  color: #e2e8f0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.site-footer-sub {
  font-size: 0.8rem;
  color: #64748b;
}

.site-footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.15s;
}

.site-footer-links a:hover {
  color: #fbbf24;
}

/* -- Speciality Modals (Step 6.1) ------------------------------------------- */
.speciality-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 22, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.speciality-modal {
  background: #181528;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 820px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(139, 92, 246, 0.15);
  max-height: 90vh;
  overflow-y: auto;
}

.speciality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.vocation-card {
  background: rgba(30, 26, 48, 0.6);
  border: 1px solid rgba(147, 112, 219, 0.25);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vocation-card:hover {
  background: rgba(45, 38, 72, 0.8);
  border-color: #f59e0b;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

.vocation-card.selected {
  background: rgba(139, 92, 246, 0.2);
  border-color: #a78bfa;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.vocation-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.vocation-icon {
  font-size: 1.5rem;
}

.vocation-title {
  font-weight: 700;
  font-size: 1rem;
}

.vocation-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.vocation-perk {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.35rem;
  line-height: 1.35;
}

/* -- Realm Ambience Audio Widget (Step 7.2) --------------------------------- */
.arcane-audio-widget {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.audio-btn-pill {
  background: rgba(30, 25, 45, 0.7);
  border: 1px solid rgba(147, 112, 219, 0.4);
  color: #d8d0ea;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
  user-select: none;
}

.audio-btn-pill:hover {
  background: rgba(50, 40, 75, 0.9);
  border-color: #ffd700;
  color: #fff;
}

.audio-dropdown-panel {
  top: calc(100% + 8px) !important;
  bottom: auto !important;
}

/* -- Ambient Page Backgrounds ----------------------------------------------- */
body:has(.train-wrap) {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.60) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_train_grounds.png') no-repeat center center fixed !important;
  background-size: cover !important;
}

body:has(.dash-wrap) {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.60) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_dashboard.png') no-repeat center center fixed !important;
  background-size: cover !important;
}

body:has(.equipment-page-wrapper) {
  background:
    radial-gradient(ellipse at center, rgba(8, 9, 15, 0.60) 0%, rgba(8, 9, 15, 0.88) 70%, rgba(4, 5, 10, 0.96) 100%),
    url('/assets/img/ambient/bg_equipment.png') no-repeat center center fixed !important;
  background-size: cover !important;
}