/* ================================================
   Sea of Thieves Tall Tales Tracker — Main CSS
   Dark-first, Sea/Pirate aesthetic
   ================================================ */

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

/* ---- CSS Variables ---- */
[data-theme="dark"] {
  --bg-deep:     #0a0e14;
  --bg-surface:  #111720;
  --bg-card:     #141c28;
  --card-bg:     #141c28;
  --sidebar-bg:  #0d1420;
  --border:      rgba(255,255,255,0.08);
  --border-hover:rgba(212,160,23,0.35);
  --text:        #e8eaf0;
  --text-muted:  #7a8299;
  --text-dim:    #4a5470;
  --gold:        #d4a017;
  --gold-light:  #f0c040;
  --ocean:       #2eb8d0;
  --ocean-dark:  #1a7d8e;
  --success:     #3ecf8e;
  --warning:     #f0a030;
  --danger:      #e05050;
  --input-bg:    rgba(255,255,255,0.05);
  --scrollbar:   rgba(212,160,23,0.3);
  --arc-orig:    #d4a017;
  --arc-pirate:  #2eb8d0;
  --arc-monkey:  #3ecf8e;
  --arc-ashen:   #e06040;
}

[data-theme="light"] {
  --bg-deep:     #f0f2f7;
  --bg-surface:  #ffffff;
  --bg-card:     #ffffff;
  --card-bg:     #ffffff;
  --sidebar-bg:  #1a2035;
  --border:      rgba(0,0,0,0.1);
  --border-hover:rgba(212,160,23,0.5);
  --text:        #1a2035;
  --text-muted:  #5a6080;
  --text-dim:    #9aa0b8;
  --gold:        #b8900f;
  --gold-light:  #d4a820;
  --ocean:       #1a7d8e;
  --ocean-dark:  #0f5a68;
  --success:     #28a070;
  --warning:     #c07820;
  --danger:      #c03838;
  --input-bg:    rgba(0,0,0,0.04);
  --scrollbar:   rgba(180,140,20,0.3);
  --arc-orig:    #b8900f;
  --arc-pirate:  #1a7d8e;
  --arc-monkey:  #28a070;
  --arc-ashen:   #c04830;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ================================================
   LAYOUT — Sidebar + Main
   ================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 12px rgba(212,160,23,0.6));
}

.sidebar-logo .logo-text {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Inter', sans-serif;
}

/* Search */
.sidebar-search {
  padding: 1rem 1.25rem 0.5rem;
}
.sidebar-search input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}
.sidebar-search input:focus { outline: none; border-color: var(--gold); }
.sidebar-search input::placeholder { color: var(--text-dim); }

/* Nav */
.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem 1rem; }

.nav-section { margin-bottom: 0.25rem; }

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.nav-link.active {
  background: rgba(212,160,23,0.12);
  color: var(--gold);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-link .nav-icon { font-size: 1rem; opacity: 0.8; }

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
}
.nav-badge.gold { background: rgba(212,160,23,0.2); color: var(--gold); }

/* Arc color indicators */
.arc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.arc-orig   { background: var(--arc-orig); }
.arc-pirate { background: var(--arc-pirate); }
.arc-monkey { background: var(--arc-monkey); }
.arc-ashen  { background: var(--arc-ashen); }

/* Sidebar bottom */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--ocean-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 0.875rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

.sidebar-actions {
  display: flex; gap: 0.5rem;
}
.btn-sm {
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 0.4rem;
}
.btn-sm:hover { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.07); }
.btn-sm.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Main Content ---- */
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-title { font-family: 'Cinzel', serif; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.topbar-breadcrumb { font-size: 0.8rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* Mobile menu btn */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.1rem;
}

/* Theme toggle */
.theme-toggle {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--border-hover); }

/* Page content */
.page-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ================================================
   COMPONENTS
   ================================================ */

/* Page header */
.page-header {
  margin-bottom: 2rem;
}
.page-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.page-header p { color: var(--text-muted); font-size: 0.9rem; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--gold));
}
.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent, var(--gold));
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Arc section */
.arc-section {
  margin-bottom: 2.5rem;
}
.arc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.arc-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.arc-progress-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 180px;
}
.arc-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.arc-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--arc-color, var(--gold));
  transition: width 0.5s ease;
}
.arc-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--arc-color, var(--gold));
  min-width: 36px;
  text-align: right;
}

/* Tall Tales grid */
.tales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Tale card */
.tale-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  color: inherit;
}
.tale-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

.tale-card.status-story  { border-left: 3px solid var(--warning); }
.tale-card.status-100    { border-left: 3px solid var(--success); }
.tale-card.status-none   { border-left: 3px solid var(--border); }

.tale-card-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.tale-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-none    { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.badge-story   { background: rgba(240,160,48,0.15); color: var(--warning); border: 1px solid rgba(240,160,48,0.25); }
.badge-100     { background: rgba(62,207,142,0.12); color: var(--success); border: 1px solid rgba(62,207,142,0.25); }

.tale-commend-bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.75rem;
}
.tale-commend-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--arc-color, var(--gold));
  transition: width 0.4s;
}
.tale-commend-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* ================================================
   TALE DETAIL PAGE
   ================================================ */
.tale-detail-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}
.tale-detail-arc {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.tale-detail-title {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
.tale-detail-status {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Checkbox group */
.check-group {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.check-group-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.check-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover .check-label { color: var(--text); }

.check-item input[type="checkbox"] {
  appearance: none;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
.check-item input[type="checkbox"]:checked {
  background: var(--success);
  border-color: var(--success);
}
.check-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.check-item input[type="checkbox"].gold-check:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.check-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
  transition: color 0.15s;
}
.check-item input:checked + .check-label {
  color: var(--text);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}

/* Notes */
.notes-area {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
}
.notes-area:focus { outline: none; border-color: var(--gold); }

/* Save button */
.btn-save {
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, var(--gold), #b8900f);
  border: none;
  border-radius: 10px;
  color: #1a1208;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212,160,23,0.35); }
.btn-save:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-outline:hover { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.04); }
.btn-outline.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Toast Notification ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s ease both;
  max-width: 320px;
}
.toast.success { background: #1a3a2a; border: 1px solid rgba(62,207,142,0.3); color: var(--success); }
.toast.error   { background: #3a1a1a; border: 1px solid rgba(220,80,80,0.3);  color: #f88; }
.toast.info    { background: #1a2a3a; border: 1px solid rgba(46,184,208,0.3); color: var(--ocean); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}
.filter-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: rgba(212,160,23,0.15); border-color: var(--gold); color: var(--gold); }

/* ---- Utility ---- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-gold  { color: var(--gold); }
.text-sm    { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Updated timestamp */
.updated-at {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    display: none;
  }
  .overlay.active { display: block; }
  .page-content { padding: 1.25rem; }
  .topbar { padding: 0.75rem 1.25rem; }
  .tales-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .arc-progress-wrap { display: none; }
  .tale-detail-title { font-size: 1.3rem; }
}

/* ================================================
   ALERTS (flash messages)
   ================================================ */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-error { background: rgba(220,50,50,0.12); border: 1px solid rgba(220,50,50,0.3); color: #f88; }
.alert-info  { background: rgba(46,184,208,0.1);  border: 1px solid rgba(46,184,208,0.3);  color: var(--ocean); }

/* ================================================
   LEADERBOARD
   ================================================ */
.lb-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th, .lb-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.lb-table th {
  background: rgba(255,255,255,0.03);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.lb-table tr.lb-me {
  background: rgba(212,160,23,0.08);
  border-left: 3px solid var(--gold);
}
.lb-table tr.lb-me:hover { background: rgba(212,160,23,0.12); }
.lb-rank { width: 60px; }
.lb-rank-num {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--text-muted);
}
.lb-medal { margin-left: 0.25rem; font-size: 1.05rem; }
.lb-num { text-align: center; width: 80px; font-variant-numeric: tabular-nums; }
.lb-num-strong {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.05rem;
}
.lb-bar-col { width: 220px; }
.lb-bar {
  display: inline-block;
  width: calc(100% - 50px);
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.lb-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ocean), var(--gold));
  border-radius: 3px;
  transition: width 0.6s;
}
.lb-pct {
  display: inline-block;
  width: 42px;
  text-align: right;
  font-size: 0.82rem;
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.lb-user { display: flex; align-items: center; gap: 0.75rem; }
.lb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--ocean-dark));
  color: #1a1208;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}
.lb-username { font-weight: 600; }
.lb-you {
  font-size: 0.7rem;
  color: var(--gold);
  margin-left: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.lb-legend {
  font-size: 0.72rem;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
}

/* ================================================
   CREWS
   ================================================ */
.crew-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.crew-action-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
}
.crew-action-card h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.crew-action-card p { margin-bottom: 0.85rem; }
.crew-form { display: flex; gap: 0.5rem; }
.crew-form input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
}
.crew-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}
.btn-gold, .btn-ocean {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b8900f);
  color: #1a1208;
}
.btn-ocean {
  background: linear-gradient(135deg, var(--ocean), var(--ocean-dark));
  color: #fff;
}
.btn-gold:hover, .btn-ocean:hover { transform: translateY(-1px); }

.crew-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.crew-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
  display: block;
}
.crew-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.crew-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}
.crew-card-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
}
.crew-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.crew-code code {
  background: rgba(255,255,255,0.05);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: var(--text);
  letter-spacing: 0.05em;
}
.crew-badge-owner {
  background: rgba(212,160,23,0.15);
  color: var(--gold);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(212,160,23,0.3);
}
.crew-invite-code {
  background: rgba(255,255,255,0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-size: 1rem;
}
.empty-state {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
}

/* Crew member strip */
.crew-members-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.crew-member-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem 0.4rem 0.4rem;
  min-width: 180px;
}
.crew-member-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--ocean-dark));
  color: #1a1208;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
}
.crew-member-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.crew-member-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.btn-icon-x {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(224,80,80,0.15);
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-x:hover { background: rgba(224,80,80,0.3); }

/* Comparison table */
.cmp-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
}
.cmp-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.cmp-table th, .cmp-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.cmp-table thead th {
  background: rgba(255,255,255,0.03);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}
.cmp-tale-col { min-width: 220px; }
.cmp-member-col { text-align: center; min-width: 110px; }
.cmp-tale-link {
  color: var(--text);
  text-decoration: none;
}
.cmp-tale-link:hover { color: var(--gold); }
.cmp-arc-row td {
  background: rgba(255,255,255,0.02);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--arc-color, var(--gold));
  padding: 0.7rem 0.85rem;
  font-size: 0.85rem;
}
.cmp-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cmp-icon { display: inline-block; font-size: 1.05rem; margin-right: 0.3rem; }
.cmp-icon-dim { color: var(--text-dim); }
.cmp-status-100 .cmp-icon { color: var(--success); }
.cmp-status-100 { background: rgba(62,207,142,0.06); }
.cmp-status-story .cmp-icon { color: var(--warning); }
.cmp-status-story { background: rgba(240,160,48,0.05); }
.cmp-commend {
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .crew-actions-row { grid-template-columns: 1fr; }
  .lb-bar-col { display: none; }
  .crew-member-pill { min-width: 0; flex: 1 1 calc(50% - 0.6rem); }
}

