/* ============================================================
   Walk to Mordor — Dark Fantasy Theme
   ============================================================ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=IM+Fell+English:ital@0;1&family=Inter:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-deep:    #09090e;
  --bg-stone:   #111118;
  --bg-surface: #181820;
  --bg-raised:  #1e1e2a;
  --bg-hover:   #252534;

  /* Borders */
  --border:        rgba(212, 168, 71, 0.10);
  --border-dim:    rgba(212, 168, 71, 0.07);
  --border-active: rgba(212, 168, 71, 0.35);
  --border-input:  rgba(255,255,255,0.08);

  /* Text */
  --text-bright:    #f0e8d0;
  --text-primary:   #c8bc9e;
  --text-secondary: #9a8d72;
  --text-muted:     #8a7a60;

  /* Gold — "One Ring" accent */
  --gold:       #d4a847;
  --gold-light: #e8c060;
  --gold-dim:   #8a6c28;
  --gold-glow:  rgba(212, 168, 71, 0.15);
  --gold-glow2: rgba(212, 168, 71, 0.30);

  /* Mordor fire */
  --fire:       #c0441c;
  --fire-light: #e05520;
  --fire-glow:  rgba(192, 68, 28, 0.20);
  --fire-glow2: rgba(192, 68, 28, 0.40);

  /* Journey progress colors */
  --shire:    #4a7c3f;
  --rivendell:#5a8ab0;
  --mordor-r: #8b1a1a;

  /* Typography */
  --font-lore: 'Cinzel', 'Palatino Linotype', serif;
  --font-body: 'IM Fell English', Georgia, serif;
  --font-ui:   'Inter', system-ui, sans-serif;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* ── Light Theme Override ── */
[data-theme="light"] {
  --bg-deep:    #f7f2e8;
  --bg-stone:   #f0e8d4;
  --bg-surface: #e8dfc8;
  --bg-raised:  #ddd3b8;
  --bg-hover:   #d4c9a8;

  --border:        rgba(100, 75, 40, 0.14);
  --border-dim:    rgba(100, 75, 40, 0.10);
  --border-active: rgba(100, 75, 40, 0.38);
  --border-input:  rgba(100, 75, 40, 0.22);

  --text-bright:    #100a02;
  --text-primary:   #2c1f0e;
  --text-secondary: #5a4530;
  --text-muted:     #8a7060;

  --gold:       #a0720a;
  --gold-light: #c48c14;
  --gold-dim:   #7a5808;
  --gold-glow:  rgba(160, 114, 10, 0.12);
  --gold-glow2: rgba(160, 114, 10, 0.28);

  --fire:       #b03010;
  --fire-light: #cc4418;
  --fire-glow:  rgba(176, 48, 16, 0.15);
  --fire-glow2: rgba(176, 48, 16, 0.32);

  --shire:    #3a6630;
  --rivendell:#3a6888;
  --mordor-r: #7a1414;
}

[data-theme="light"] body {
  background-color: var(--bg-stone);
  color: var(--text-primary);
}
[data-theme="light"] .mordor-nav {
  background: rgba(247, 242, 232, 0.94);
  border-bottom-color: var(--border-active);
}
[data-theme="light"] .card {
  box-shadow: 0 1px 6px rgba(100,75,40,0.08);
}
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
  background: var(--bg-deep);
}
[data-theme="light"] .data-table tr:hover td {
  background: var(--bg-raised);
}
[data-theme="light"] .auth-wrap {
  background: radial-gradient(ellipse at 50% 40%, rgba(160,114,10,0.06) 0%, transparent 60%),
              var(--bg-stone);
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--border-active);
  color: var(--gold);
}

/* ── Avatar hover tooltip ── */
.avatar-hover-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: default;
}
.avatar-hover-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  padding: 0.6rem;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 100px;
  text-align: center;
}
.avatar-hover-wrap:hover .avatar-hover-tip,
.avatar-hover-wrap:focus .avatar-hover-tip {
  display: flex;
}
.avatar-hover-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-active);
}
.avatar-hover-name {
  font-family: var(--font-lore);
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

/* ── Avatar selection grid ── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.avatar-option:hover { background: var(--bg-hover); border-color: var(--border-active); }
.avatar-option.selected,
.avatar-option.active { border-color: var(--gold); background: var(--gold-glow); }
.avatar-option img,
.avatar-option svg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-option-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  font-family: var(--font-ui);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-stone);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
}

/* Background texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

main { position: relative; z-index: 1; }

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4 {
  font-family: var(--font-lore);
  color: var(--text-bright);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── Navigation ── */
.mordor-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 14, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 60px;
}

.nav-logo {
  font-family: var(--font-lore);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold) !important;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-decoration: none;
}
.nav-logo:hover { color: var(--gold-light) !important; }
.nav-logo span { color: var(--fire); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-left: 1rem;
  flex: 1;
}

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

.nav-link {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary) !important;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text-bright) !important; background: var(--bg-raised); }
.nav-link.active { color: var(--gold) !important; background: var(--gold-glow); }

.nav-user {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.nav-hamburger:hover { color: var(--gold); background: var(--gold-glow); }

/* Mobile dropdown panel (hidden by default) */
.nav-mobile-panel {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem 0.75rem;
}
.nav-mobile-links {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.nav-mobile-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bg-deep);
  flex-shrink: 0;
  border: 1.5px solid var(--border-active);
}

/* ── Page wrapper ── */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-title {
  font-family: var(--font-lore);
  font-size: 1.6rem;
  color: var(--text-bright);
  margin: 0 0 0.25rem;
}
.page-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0 0 2rem;
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title {
  font-family: var(--font-lore);
  font-size: 1rem;
  color: var(--gold);
  margin: 0;
  letter-spacing: 0.04em;
}

/* ── Progress Bar (journey) ── */
.journey-bar-wrap {
  position: relative;
  padding: 0.5rem 0 1.5rem;
}
.journey-bar-track {
  height: 10px;
  background: var(--bg-raised);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.journey-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--shire) 0%, var(--rivendell) 50%, var(--mordor-r) 100%);
  box-shadow: 0 0 8px rgba(212,168,71,0.3);
  transition: width 0.8s ease;
  position: relative;
}
.journey-bar-fill::after {
  content: '';
  position: absolute;
  right: -1px; top: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold), 0 0 16px var(--gold-glow2);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--gold-glow2), 0 0 8px var(--gold); }
  70%  { box-shadow: 0 0 0 8px rgba(212,168,71,0), 0 0 8px var(--gold); }
  100% { box-shadow: 0 0 0 0 rgba(212,168,71,0), 0 0 8px var(--gold); }
}
.journey-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ── Landmark Hero Card ── */
.landmark-hero {
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  display: grid;
  grid-template-columns: 280px 1fr;
}
@media (max-width: 700px) {
  .landmark-hero { grid-template-columns: 1fr; }
  .landmark-hero-img { max-height: 200px; }
}
.landmark-hero-img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  object-position: center;
  display: block;
}
.landmark-hero-img-wrap {
  position: relative;
  background: var(--bg-raised);
}
.landmark-hero-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}
.landmark-eyebrow {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.landmark-name {
  font-family: var(--font-lore);
  font-size: 1.5rem;
  color: var(--text-bright);
  margin: 0;
  line-height: 1.2;
}
.landmark-desc {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
  margin: 0;
}
.landmark-miles {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
}
.landmark-miles strong { color: var(--gold); }

/* Mordor region fire treatment */
.region-mordor .landmark-hero { border-color: var(--fire); box-shadow: 0 0 20px var(--fire-glow); }
.region-mordor .landmark-eyebrow { color: var(--fire-light); }

/* ── Stat Row ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  font-family: var(--font-lore);
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  color: var(--text-bright);
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  font-family: var(--font-ui);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.form-error {
  font-size: 0.78rem;
  color: var(--fire-light);
  margin-top: 0.3rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-ui);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg-deep);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--bg-deep); transform: translateY(-1px); box-shadow: 0 4px 16px var(--gold-glow2); }
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-bright); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: #000;
}
.btn-gold:hover { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #000; transform: translateY(-1px); box-shadow: 0 4px 16px var(--gold-glow2); }
.btn-danger { background: rgba(192,68,28,0.2); color: var(--fire-light); border: 1px solid rgba(192,68,28,0.3); }
.btn-danger:hover { background: var(--fire); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-active);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
}
.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 0.5rem; white-space: nowrap; }

/* ── Flash Messages ── */
.flash {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
}
.flash-success { background: rgba(74,124,63,0.15); border-color: rgba(74,124,63,0.4); color: #8ecf7e; }
.flash-error   { background: rgba(192,68,28,0.15); border-color: rgba(192,68,28,0.4); color: var(--fire-light); }
.flash-icon    { font-size: 0.8rem; flex-shrink: 0; }

/* ── Login / Register Page ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at 50% 40%, rgba(212,168,71,0.04) 0%, transparent 60%),
              var(--bg-stone);
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-logo {
  text-align: center;
  margin-bottom: 0.5rem;
}
.auth-logo-ring {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px var(--gold));
}
.auth-title {
  text-align: center;
  font-family: var(--font-lore);
  font-size: 1.5rem;
  color: var(--gold);
  margin: 0 0 0.25rem;
}
.auth-subtitle {
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
}
.auth-divider {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: '——';
  margin: 0 0.5rem;
}

/* ── Journey Map (landmark scroll) ── */
.landmark-list { display: flex; flex-direction: column; gap: 0; position: relative; }
.landmark-list::before {
  content: '';
  position: absolute;
  left: 28px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--shire) 0%, var(--rivendell) 50%, var(--fire) 100%);
  opacity: 0.4;
}
.landmark-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
}
.landmark-item:last-child { padding-bottom: 0; }
.landmark-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.landmark-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-active);
  background: var(--bg-stone);
  margin-top: 4px;
}
.landmark-dot.visited { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px var(--gold-glow2); }
.landmark-dot.current { background: var(--gold-light); border-color: var(--gold-light); box-shadow: 0 0 12px var(--gold); animation: pulse-ring 2s infinite; }
.landmark-dot.mordor-region { border-color: var(--fire); }
.landmark-dot.mordor-region.visited { background: var(--fire); box-shadow: 0 0 6px var(--fire-glow2); }
.landmark-num {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-ui);
}
.landmark-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  transition: border-color 0.2s;
}
.landmark-card.visited { border-left: 3px solid var(--gold); }
.landmark-card.current { border-left: 3px solid var(--gold-light); box-shadow: 0 0 16px var(--gold-glow); }
.landmark-card.future { opacity: 0.5; }
.landmark-card.mordor-card { border-color: rgba(192,68,28,0.2); }
.landmark-card.mordor-card.visited { border-left-color: var(--fire); }
.landmark-card.mordor-card.current { border-left-color: var(--fire-light); box-shadow: 0 0 16px var(--fire-glow); }
.landmark-card-header { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.25rem; }
.landmark-card-name {
  font-family: var(--font-lore);
  font-size: 0.92rem;
  color: var(--text-bright);
}
.landmark-card-miles { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-ui); }
.landmark-card-desc { font-size: 0.82rem; color: var(--text-secondary); display: none; font-family: var(--font-body); font-style: italic; }
.landmark-card.visited .landmark-card-desc,
.landmark-card.current .landmark-card-desc { display: block; }
.landmark-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--gold-glow);
  color: var(--gold);
  font-family: var(--font-ui);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.landmark-badge.you-are-here { background: var(--gold); color: var(--bg-deep); animation: pulse-ring 2s infinite; }

/* ── Leaderboard ── */
.lb-rank {
  font-family: var(--font-lore);
  font-size: 1.1rem;
  color: var(--text-muted);
  text-align: center;
  width: 40px;
}
.lb-rank.gold-rank   { color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,0.5); }
.lb-rank.silver-rank { color: #c0c0c0; }
.lb-rank.bronze-rank { color: #cd7f32; }
.lb-you { background: var(--gold-glow) !important; }
.lb-you td { border-color: var(--border-active) !important; }
.lb-mini-bar { height: 5px; background: var(--bg-raised); border-radius: 999px; overflow: hidden; width: 120px; }
.lb-mini-fill { height: 100%; background: linear-gradient(90deg, var(--shire), var(--rivendell), var(--mordor-r)); border-radius: 999px; }

/* ── Log Page ── */
.log-entry-date { font-weight: 500; color: var(--text-bright); }
.log-entry-miles { font-family: var(--font-lore); color: var(--gold); }
.log-entry-notes { font-style: italic; color: var(--text-secondary); font-size: 0.85rem; }

/* ── Admin ── */
.invite-code {
  font-family: 'Courier New', monospace;
  background: var(--bg-raised);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--gold);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.invite-code:hover { background: var(--gold-glow); }

/* ── Utility ── */
.text-gold    { color: var(--gold); }
.text-fire    { color: var(--fire-light); }
.text-muted   { color: var(--text-muted); }
.text-lore    { font-family: var(--font-lore); }
.text-body    { font-family: var(--font-body); font-style: italic; }
.text-center  { text-align: center; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mt-4  { margin-top: 2rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex  { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── Gamification Badge Tiers ─────────────────────────────────────────── */
.badge-bronze    { color: #cd7f32; border-color: #cd7f32; }
.badge-silver    { color: #a8a9ad; border-color: #a8a9ad; }
.badge-gold      { color: var(--gold); border-color: var(--gold); }
.badge-legendary { color: #e040fb; border-color: #e040fb; text-shadow: 0 0 8px rgba(224,64,251,0.4); }


/* ── Milestone Celebration Modal ─────────────────────────────────────────── */
.milestone-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: milestone-fade-in 0.4s ease;
}
.milestone-overlay.milestone-out {
  animation: milestone-fade-out 0.4s ease forwards;
}
@keyframes milestone-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes milestone-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.milestone-box {
  background: var(--bg-stone);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem 2rem;
  max-width: 480px;
  width: 92%;
  text-align: center;
  box-shadow: 0 0 60px rgba(212, 168, 71, 0.20), 0 24px 60px rgba(0,0,0,0.6);
  animation: milestone-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes milestone-rise {
  from { transform: translateY(30px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}
.milestone-ring {
  font-size: 2.4rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
  text-shadow: 0 0 18px var(--gold-glow2);
  animation: milestone-pulse 2s ease-in-out infinite;
}
@keyframes milestone-pulse {
  0%, 100% { text-shadow: 0 0 18px var(--gold-glow2); }
  50%       { text-shadow: 0 0 36px var(--gold-glow2), 0 0 12px var(--gold); }
}
.milestone-img-wrap {
  margin: 0 auto 1.25rem;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold-dim);
  box-shadow: 0 0 24px var(--gold-glow2);
  animation: milestone-zoom-in 0.6s 0.15s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes milestone-zoom-in {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.milestone-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.milestone-reached {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 0.25rem;
}
.milestone-name {
  font-family: var(--font-lore);
  color: var(--gold);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  text-shadow: 0 1px 8px var(--gold-glow);
}
.milestone-desc {
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
  max-width: 360px;
  margin-inline: auto;
  margin-bottom: 1.5rem;
}
.milestone-close {
  display: inline-block;
  background: var(--gold);
  color: #1a1510;
  font-family: var(--font-lore);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.milestone-close:hover { background: var(--gold-light); transform: translateY(-1px); }
.milestone-countdown {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
/* Light theme overrides */
[data-theme="light"] .milestone-box {
  background: var(--bg-stone);
  color: var(--text-primary);
}

/* ── Mobile Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav: show hamburger, hide desktop links */
  .nav-links        { display: none; }
  .nav-user         { display: none; }
  .nav-username     { display: none; }
  .nav-signout      { display: none; }
  .nav-hamburger    { display: flex; align-items: center; }

  /* Show mobile panel when nav-open */
  .mordor-nav.nav-open .nav-mobile-panel { display: flex; }

  /* Tighter page padding */
  .page-wrap { padding: 1rem 0.75rem 3rem; }

  /* Tables scroll horizontally */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Stat rows: wrap to 2 columns on narrow screens */
  .stat-row { grid-template-columns: repeat(2, 1fr); }

  /* Hide leaderboard mini progress bar on mobile */
  .lb-bar-col { display: none; }

  /* Make journey charts taller on mobile so axis labels + legend fit */
  .journey-chart-canvas { height: 460px !important; }

  /* Landmark hero: already 1-col at 700px, just reduce image height */
  .landmark-hero-img { min-height: 160px; }

  /* Card padding reduction */
  .card { padding: 1rem; }

  /* Journey bar margin */
  .journey-bar-wrap { margin-bottom: 1rem; }

  /* Log page inline editing table — keep it from overflowing */
  #log-entries td, #log-entries th { padding: 0.5rem 0.5rem; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  /* Very narrow: single column stats */
  .stat-row { grid-template-columns: repeat(2, 1fr); }

  /* Avatar grid: 3 per row instead of auto-fill */
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }

  /* Page title sizing */
  .page-title { font-size: 1.3rem; }

  /* Nav logo short form */
  .nav-logo-short { display: inline; }
}

/* ── Share Journey Page ───────────────────────────────────────────────────── */
.share-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  margin-bottom: 1.5rem;
}
.share-card-img-wrap {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
}
.share-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.share-card-body {
  padding: 1.5rem 1.75rem 1.75rem;
}
.share-card-eyebrow {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.share-card-landmark {
  font-family: var(--font-lore);
  font-size: 2rem;
  color: var(--gold);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.share-card-desc {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.share-card-pct {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
}
.share-card-bar {
  height: 10px;
  background: var(--bg-base);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.share-card-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.share-card-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  margin-bottom: 1rem;
}
.share-card-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--gold);
  border: 1px solid var(--border-gold, #3a2e12);
  background: rgba(212, 168, 71, 0.08);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
}

/* Share actions */
.share-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.1s;
}
.share-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.share-btn-copy    { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-bright); }
.share-btn-twitter { background: #000000; color: #ffffff; }
.share-btn-whatsapp{ background: #25d366; color: #ffffff; }

/* Dashboard landmark hero share button */
.share-journey-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(212,168,71,0.08);
  border: 1px solid rgba(212,168,71,0.25);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.share-journey-btn:hover {
  background: rgba(212,168,71,0.16);
  border-color: rgba(212,168,71,0.5);
}

/* Light theme overrides */
[data-theme="light"] .share-card        { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
[data-theme="light"] .share-card-bar   { background: #f1f5f9; }
[data-theme="light"] .share-btn-copy   { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }

@media (max-width: 768px) {
  .share-card-img-wrap { height: 160px; }
  .share-card-body     { padding: 1rem 1.25rem 1.25rem; }
  .share-card-landmark { font-size: 1.5rem; }
  .share-actions       { flex-direction: column; align-items: stretch; }
  .share-btn           { justify-content: center; }
}
