:root {
  --bg: #070b14;
  --surface: rgba(17, 24, 39, 0.78);
  --surface-strong: rgba(20, 29, 48, 0.92);
  --surface-hover: rgba(30, 41, 66, 0.92);
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.32);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #34d399;
  --accent-2: #38bdf8;
  --warn: #f59e0b;
  --danger: #f87171;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.15;
  pointer-events: none;
  z-index: -1;
}
.bg-glow-1 { top: -180px; left: -120px; background: #34d399; }
.bg-glow-2 { bottom: -200px; right: -120px; background: #38bdf8; }

/* Navbar */
.navbar-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.75rem 1rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.8);
  border-bottom: 1px solid var(--border);
}

.navbar {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #38bdf8);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.8);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.42rem 0.82rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.1);
}

.nav-link.active {
  color: var(--text);
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.35);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}

.quota-pill {
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #7dd3fc;
}

/* Main container */
.container {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  flex: 1;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(92vw, 520px);
  padding: 0.75rem 1.15rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #ecfdf5;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fef2f2;
}

/* Cards & Typography */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(12px);
}

.card + .card {
  margin-top: 1rem;
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: -0.02em;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* Buttons */
button, .btn {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(30, 41, 59, 0.75);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.16s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.5);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  border-color: transparent;
  color: #04131c;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: linear-gradient(135deg, #10b981, #0ea5e9);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.26);
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 9px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.65);
  color: var(--text);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Forms */
.form-grid {
  display: grid;
  gap: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
}

.field small {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(9, 14, 26, 0.85);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: #cbd5e1;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Auth / Landing view */
.auth-card {
  max-width: 560px;
  margin: 2.5rem auto;
  text-align: center;
  padding: 2rem 1.5rem;
}

.auth-card h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin-bottom: 0.65rem;
}

.auth-card p {
  color: var(--muted);
  margin: 0 0 1.4rem;
}

.auth-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.7rem;
  margin: 1.5rem 0;
  text-align: left;
}

.auth-feature {
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.auth-feature strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.2rem;
}

#google-signin-mount {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  min-height: 44px;
}

/* Banners */
.banner {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.banner-info {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  color: #bae6fd;
}

/* Toolbar & Filters */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-head h1 {
  font-size: clamp(1.35rem, 3.5vw, 1.8rem);
}

.filters-bar {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

@media (max-width: 720px) {
  .filters-bar {
    grid-template-columns: 1fr 1fr;
  }
  .filters-bar input[type="search"] {
    grid-column: 1 / -1;
  }
}

/* Route Grid */
.routes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.route-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.route-card:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 211, 153, 0.45);
  background: var(--surface-hover);
}

.route-cover {
  height: 175px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.8));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.route-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.route-cover-empty {
  color: var(--muted);
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.route-cover-badges {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  pointer-events: none;
}

.route-body {
  padding: 0.95rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.route-title {
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1.3;
}

.route-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border);
  color: #cbd5e1;
}

.pill-green {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

.pill-amber {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.pill-blue {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}

.pill-red {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Route Detail */
.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.detail-header-card {
  margin-bottom: 1rem;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.detail-title-row h1 {
  font-size: clamp(1.3rem, 3.6vw, 1.85rem);
}

.status-switcher {
  display: inline-flex;
  gap: 0.3rem;
  background: rgba(9, 14, 26, 0.75);
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.status-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-btn.active {
  background: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
}

/* Photos Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.photo-tile {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b1120;
  aspect-ratio: 4 / 3;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.photo-tile-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  color: #e2e8f0;
}

.photo-del-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.85);
  color: #fca5a5;
  font-size: 0.8rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.55rem 1rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--text);
}

/* Beta Sections */
.beta-steps {
  display: grid;
  gap: 0.7rem;
  margin: 0.9rem 0;
}

.beta-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 13px;
  background: rgba(9, 14, 26, 0.72);
  border: 1px solid var(--border);
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(56, 189, 248, 0.25));
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.step-body h4 {
  font-size: 0.96rem;
  margin-bottom: 0.3rem;
}

.step-detail {
  font-size: 0.86rem;
  color: #cbd5e1;
  margin: 0.2rem 0;
}

.step-detail strong {
  color: #7dd3fc;
}

.callout {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.7);
  margin: 0.85rem 0;
  font-size: 0.9rem;
}

.callout-crux {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.callout-body {
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(16, 185, 129, 0.08);
}

.callout h4 {
  margin-bottom: 0.4rem;
  font-size: 0.94rem;
}

.clean-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.clean-list li {
  margin-bottom: 0.3rem;
}

/* Mini Chat */
.chat-box {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0;
  max-height: 460px;
  overflow-y: auto;
}

.chat-msg {
  padding: 0.75rem 0.95rem;
  border-radius: 13px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-end;
  max-width: 86%;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.chat-msg.assistant {
  align-self: flex-start;
  max-width: 95%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
}

.chat-form {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
}

.chat-form textarea {
  min-height: 46px;
  max-height: 140px;
}

/* Video Attempts */
.progress-wrap {
  margin-top: 0.75rem;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  transition: width 0.15s ease;
}

.attempt-card {
  margin-top: 1rem;
}

.attempt-video {
  width: 100%;
  max-height: 440px;
  border-radius: 12px;
  background: #000;
  margin: 0.75rem 0;
}

.timeline {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(9, 14, 26, 0.72);
  border: 1px solid var(--border);
}

.time-jump {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.time-jump:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.28);
}

.time-jump:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Admin table */
.user-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-radius: 13px;
  background: rgba(9, 14, 26, 0.7);
  border: 1px solid var(--border);
}

.user-row.pending {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Modal & Lightbox */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 0.75rem;
  overflow-y: auto;
}

.modal-card {
  width: 100%;
  max-width: 640px;
  background: #0f172a;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox img {
  max-width: 95vw;
  max-height: 82vh;
  border-radius: 10px;
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 1.1rem;
}

.lightbox-caption {
  margin-top: 0.75rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  text-align: center;
}

/* Color Swatches */
.color-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.color-chip {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.color-chip:hover {
  border-color: var(--accent);
}

/* Footer */
.footer {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer a {
  color: var(--accent-2);
  text-decoration: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 600px) {
  .card { padding: 1rem; }
  .chat-form { flex-direction: column; align-items: stretch; }
}
