*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #07070e;
  --surface: rgba(255,255,255,0.05);
  --surface-2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f8;
  --muted: rgba(240,240,248,0.45);
  --dim: rgba(240,240,248,0.2);
  --green: #34d399;
  --yellow: #fbbf24;
  --orange: #f97316;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --header-h: 56px;
  --tab-h: 48px;
  --status-h: 32px;
  --ridden-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top);
}

/* ── Background ── */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.25; }
.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: -100px; left: -100px;
  animation: float1 20s ease-in-out infinite;
}
.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  bottom: 100px; right: -80px;
  animation: float2 25s ease-in-out infinite;
}
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,60px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-40px,-50px)} }

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(7,7,14,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.header-left { display: flex; flex-direction: column; gap: 1px; }

.logo {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trip-date { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.04em; }

.refresh-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.refresh-btn:hover { background: var(--surface-2); color: var(--text); }
.refresh-btn.spinning #refreshIcon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Park tabs ── */
.park-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  display: flex;
  background: rgba(7,7,14,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--tab-h);
}

.park-tab {
  flex: 1;
  height: 100%;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em;
}

.park-tab.active { color: var(--text); }

.park-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 16px; right: 16px;
  height: 2px;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  border-radius: 2px 2px 0 0;
}

/* ── Controls ── */
.controls {
  position: sticky;
  top: calc(var(--header-h) + var(--tab-h));
  z-index: 98;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(7,7,14,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.controls-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* View pills (All / Must Do) */
.view-pills { display: flex; gap: 0.35rem; }

.view-pill {
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.view-pill:hover { background: var(--surface-2); color: var(--text); }
.view-pill[data-view="all"].active,
.view-pill[data-view="mustdo"].active {
  background: rgba(251,191,36,0.15);
  color: var(--yellow);
  border-color: rgba(251,191,36,0.35);
}

.view-pill[data-view="ridden"].active {
  background: rgba(52,211,153,0.15);
  color: var(--green);
  border-color: rgba(52,211,153,0.35);
}

.sort-pills { display: flex; gap: 0.35rem; }

.sort-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sort-pill:hover { background: var(--surface-2); color: var(--text); }
.sort-pill.active { background: rgba(96,165,250,0.15); color: var(--blue); border-color: rgba(96,165,250,0.3); }

.toggle-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toggle-wrap input { display: none; }

.toggle-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.15s;
}

.toggle-wrap input:checked + .toggle-label {
  background: rgba(167,139,250,0.15);
  color: var(--purple);
  border-color: rgba(167,139,250,0.3);
}

/* ── Status bar ── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  height: var(--status-h);
  font-size: 0.68rem;
  color: var(--dim);
  position: relative;
  z-index: 1;
}

.refresh-countdown { font-variant-numeric: tabular-nums; }

/* ── Ride list ── */
.ride-list {
  position: relative;
  z-index: 1;
  padding: 0.5rem 0.75rem 7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Skeleton ── */
.skeleton {
  height: 72px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Ride card ── */
.ride-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem 0.75rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: background 0.15s, border-color 0.15s, opacity 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.ride-card:active { background: var(--surface-2); }
.ride-card.ridden { opacity: 0.45; }

/* Ride thumbnail */
.ride-thumb {
  width: 80px;
  min-width: 80px;
  height: 80px;
  border-radius: 12px 0 0 12px;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  flex-shrink: 0;
  align-self: stretch;
  border-right: 1px solid var(--border);
}

.ride-thumb-placeholder {
  width: 80px;
  min-width: 80px;
  align-self: stretch;
  border-radius: 12px 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Wait time bubble */
.wait-bubble {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.wait-bubble.green  { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.25); }
.wait-bubble.yellow { background: rgba(251,191,36,0.12);  border-color: rgba(251,191,36,0.25); }
.wait-bubble.orange { background: rgba(249,115,22,0.12);  border-color: rgba(249,115,22,0.25); }
.wait-bubble.red    { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.25); }
.wait-bubble.closed { background: rgba(255,255,255,0.04); border-color: var(--border); }

.wait-mins {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.wait-bubble.green  .wait-mins { color: var(--green); }
.wait-bubble.yellow .wait-mins { color: var(--yellow); }
.wait-bubble.orange .wait-mins { color: var(--orange); }
.wait-bubble.red    .wait-mins { color: var(--red); }
.wait-bubble.closed .wait-mins { color: var(--dim); font-size: 0.65rem; font-weight: 600; letter-spacing: 0.02em; text-align: center; line-height: 1.3; }

.wait-label {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-top: 1px;
}

/* Card inner row (replaces inline style) */
.card-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  padding-left: 0.25rem;
}

/* Ride info */
.ride-info { flex: 1; min-width: 0; }

.ride-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ride-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

.ride-tag {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-ll  { background: rgba(251,191,36,0.15); color: var(--yellow); }
.tag-sr  { background: rgba(96,165,250,0.15);  color: var(--blue); }

/* Action buttons */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mustdo-btn, .ridden-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.85rem;
  -webkit-tap-highlight-color: transparent;
}

.mustdo-btn:hover { border-color: rgba(251,191,36,0.4); color: var(--yellow); }
.ridden-btn:hover { border-color: rgba(52,211,153,0.4); color: var(--green); }

.ride-card.mustdo .mustdo-btn {
  background: rgba(251,191,36,0.15);
  border-color: rgba(251,191,36,0.4);
  color: var(--yellow);
}

.ride-card.ridden .ridden-btn {
  background: rgba(52,211,153,0.15);
  border-color: rgba(52,211,153,0.4);
  color: var(--green);
}

/* Must Do indicator stripe */
.ride-card.mustdo {
  border-color: rgba(251,191,36,0.25);
}

.ride-card.mustdo::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--yellow);
  border-radius: 14px 0 0 14px;
}

/* ── Empty / error states ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.empty-state .icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

/* ── Ridden bar ── */
.ridden-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--ridden-h);
  background: rgba(7,7,14,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  padding-bottom: env(safe-area-inset-bottom);
  font-size: 0.82rem;
  color: var(--muted);
}

.clear-ridden {
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.clear-ridden:hover { background: var(--surface-2); color: var(--text); }
