/* ─── Base ─────────────────────────────────────────────────────────────────── */
:root {
  --bg-body:    #0d1117;
  --bg-card:    #161b22;
  --bg-card2:   #1c2230;
  --border:     #30363d;
  --primary:    #2f81f7;
  --accent:     #58a6ff;
  --success:    #3fb950;
  --warning:    #d29922;
  --danger:     #da3633;
  --text:       #e6edf3;
  --text-muted: #8b949e;
}

body {
  background: var(--bg-body);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--bg-card) !important;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.navbar-brand {
  color: var(--accent) !important;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.nav-link {
  color: var(--text-muted) !important;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem !important;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text) !important; background: rgba(255,255,255,0.06); }
.btn-new {
  background: var(--primary);
  color: #fff !important;
  font-weight: 600;
}
.btn-new:hover { background: var(--accent); }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* ─── Page title ─────────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Rider cards ─────────────────────────────────────────────────────────── */
.rider-card .card,
.rider-card {
  transition: border-color 0.15s, transform 0.12s;
  cursor: pointer;
}
.rider-card .card:hover,
.rider-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.rider-card-me {
  border-color: rgba(47,129,247,0.5) !important;
}
.rider-park-card {
  transition: border-color 0.15s, transform 0.12s;
  cursor: pointer;
}
.rider-park-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.text-accent { color: var(--accent); }
.rider-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(47,129,247,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.stance-badge { font-size: 0.75rem; font-weight: 600; }
.stance-regular { background: #1f4e7a; color: #7ec8e3; }
.stance-goofy   { background: #4a2c0a; color: #f5a623; }

.level-badge { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.level-beginner     { background: #1a3a1a; color: var(--success); }
.level-intermediate { background: #1e2d4a; color: var(--accent); }
.level-advanced     { background: #3a2a00; color: #f5c518; }
.level-pro          { background: #3a0000; color: #ff6b6b; }

.badge-switch {
  background: rgba(88,166,255,0.15);
  color: var(--accent);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.badge-dir {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 0.65rem;
}

/* ─── Stats bar ──────────────────────────────────────────────────────────── */
.stats-bar .card-body { padding: 0.75rem 1.25rem; }
.stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.progress { background: var(--border); }
.progress-bar { border-radius: 4px; transition: width 0.4s ease; }

/* ─── Level select ────────────────────────────────────────────────────────── */
.level-select {
  background: var(--bg-card2);
  border-color: var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  width: auto;
}

/* ─── Obstacle sections ───────────────────────────────────────────────────── */
.obstacle-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.obstacle-header {
  background: var(--bg-card);
  border: none;
  color: var(--text);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
  text-align: left;
}
.obstacle-header:hover { background: var(--bg-card2); }
.obs-icon { color: var(--text-muted); font-size: 0.85rem; }
.obs-name { font-weight: 600; font-size: 0.95rem; }
.chevron-icon { transition: transform 0.2s; color: var(--text-muted); font-size: 0.8rem; }
.obstacle-header[aria-expanded="false"] .chevron-icon { transform: rotate(-90deg); }

/* ─── Tricks grid ─────────────────────────────────────────────────────────── */
.tricks-grid {
  background: var(--bg-body);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trick-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  background: var(--bg-card);
  transition: background 0.12s;
}
.trick-item:hover { background: var(--bg-card2); }
.trick-item.learned { border-left: 3px solid var(--success); }
.trick-item.locked { opacity: 0.45; }
.trick-item.locked .trick-name { color: var(--text-muted); }

.trick-check { padding-top: 2px; }
.trick-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--success);
}
.trick-checkbox:disabled { cursor: not-allowed; }

.trick-name { font-size: 0.9rem; font-weight: 500; line-height: 1.3; }
.trick-meta { flex-wrap: wrap; }

/* ─── Difficulty dots ─────────────────────────────────────────────────────── */
.difficulty-dots { display: flex; gap: 2px; align-items: center; }
.dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
  display: inline-block;
}
.dot.active { background: var(--accent); }

/* ─── Tips toggle ─────────────────────────────────────────────────────────── */
.trick-tips-btn { font-size: 0.8rem; opacity: 0.5; transition: opacity 0.15s; }
.trick-tips-btn:hover { opacity: 1; }
.trick-tips { font-size: 0.8rem; line-height: 1.5; border-left: 2px solid var(--border); padding-left: 0.5rem; }

/* ─── Session page ────────────────────────────────────────────────────────── */
.session-section-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.session-trick-card .card { background: var(--bg-card2); }
.trick-tips-session { border-left: 2px solid var(--border); padding-left: 0.5rem; line-height: 1.5; }

.session-tag { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; }
.session-tag-warmup   { background: rgba(88,166,255,0.15); color: var(--accent); }
.session-tag-learn    { background: rgba(47,129,247,0.25); color: #79b8ff; }
.session-tag-challenge { background: rgba(210,153,34,0.2); color: #f5c518; }
.session-tag-switch   { background: rgba(63,185,80,0.15); color: var(--success); }

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { opacity: 0.7; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .stats-bar .row { row-gap: 0.5rem; }
  .stat-number { font-size: 1.2rem; }

  /* Na małym ekranie chowaj trick-chipssy na mapie — zostają tylko kropki */
  .sm-obs-trick { display: none !important; }
  .sm-flat-marker { display: none !important; }
  .sm-obs-label { font-size: 0.5rem; max-width: 52px; }
  .sm-map { height: 160px; }
}

/* ─── Park editor ─────────────────────────────────────────────────────────── */

.pe-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pe-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.pe-sidebar {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
}

.pe-main { flex: 1; min-width: 0; }

/* Palette */
#obstacle-palette { display: flex; flex-direction: column; gap: 3px; }

.pe-palette-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s, background 0.12s;
}
.pe-palette-item:hover  { border-color: var(--primary); background: rgba(47,129,247,0.08); }
.pe-palette-item:active { cursor: grabbing; opacity: 0.7; }

.pe-hints { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; }

/* ── Map — wolny canvas (basen z góry) ────────────────────────────────────── */

.pe-map {
  position: relative;
  width: 100%;
  aspect-ratio: 14 / 5;
  min-height: 260px;
  border-radius: 16px;
  overflow: hidden;
  user-select: none;

  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(255,255,255,0.04) 0%, transparent 50%),
    linear-gradient(160deg, #071e30 0%, #0b3050 45%, #071e30 100%);

  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pe-map--drop-over {
  border-color: rgba(47,129,247,0.55);
  box-shadow: inset 0 0 0 2px rgba(47,129,247,0.25);
}

/* Cable strip at vertical centre */
.pe-cable-strip {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}

.pe-pole {
  width: 10px;
  height: 28px;
  background: linear-gradient(to bottom, #d5d5d5, #a0a0a0);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.pe-cable-line {
  flex: 1;
  height: 4px;
  background: rgba(220,200,120,0.88);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(220,200,120,0.4);
}

/* Direction labels pinned to cable ends */
.pe-dir-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  background: rgba(7,30,48,0.75);
  padding: 2px 7px;
  border-radius: 4px;
}
.pe-dir-left  { left: 12px;  color: #58a6ff; }
.pe-dir-right { right: 12px; color: #3fb950; }

/* Full-cable overlay (oval) */
.pe-fullcable-overlay {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.pe-map[data-cable="full_cable"] .pe-fullcable-overlay { display: block; }
.pe-map[data-cable="full_cable"] .pe-cable-strip        { display: none;  }
.pe-map[data-cable="full_cable"] .pe-dir-label          { display: none;  }

.pe-oval-ring {
  position: absolute;
  inset: 8%;
  border: 4px solid rgba(220,200,120,0.7);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(220,200,120,0.2), inset 0 0 10px rgba(220,200,120,0.08);
}

.pe-island {
  position: absolute;
  top: 30%; bottom: 30%;
  left: 32%; right: 32%;
  background: linear-gradient(135deg, #1a4020, #2a6030);
  border-radius: 50%;
  border: 2px solid rgba(80,160,80,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pe-island span {
  font-size: 0.6rem;
  color: rgba(150,220,150,0.6);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Empty canvas hint */
.pe-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.18);
  pointer-events: none;
  font-style: italic;
  z-index: 0;
}

/* ── Obstacle chip — absolutnie na canvasie ───────────────────────────────── */

.pe-obs {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 5;
  touch-action: none;
}

.pe-obs--dragging {
  cursor: grabbing !important;
  z-index: 20;
  opacity: 0.85;
}

.pe-obs--snap-target .pe-obs-inner {
  border-color: #f5c518 !important;
  box-shadow: 0 0 0 3px rgba(245,197,24,0.35);
}

.pe-obs--connected .pe-obs-inner {
  animation: pe-connect-pulse 0.55s ease-out;
}
@keyframes pe-connect-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(245,197,24,0.7); }
  100% { box-shadow: 0 0 0 12px rgba(245,197,24,0);  }
}

.dir1-color   { color: #58a6ff; }
.return-color { color: #3fb950; }

.pe-obs-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  background: rgba(13, 22, 36, 0.88);
  border: 2px solid var(--obs-color, var(--primary));
  border-radius: 10px;
  min-width: 64px;
  max-width: 120px;
  backdrop-filter: blur(4px);
  transition: box-shadow 0.12s;
}
.pe-obs:hover .pe-obs-inner {
  box-shadow: 0 0 0 3px rgba(var(--obs-color), 0.25), 0 4px 16px rgba(0,0,0,0.5);
}

.pe-obs-icon {
  font-size: 1.1rem;
  color: var(--obs-color, var(--primary));
}

.pe-obs-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e6edf3;
  text-align: center;
  outline: none;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.pe-obs-name:focus {
  background: rgba(255,255,255,0.08);
  padding: 1px 4px;
  white-space: normal;
  overflow: visible;
}

.pe-obs-del {
  position: absolute;
  top: -7px; right: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  color: #fff;
  font-size: 0.6rem;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 11;
}
.pe-obs:hover .pe-obs-del { display: flex; }
.pe-obs--drag { opacity: 0.8; z-index: 20; }

.pe-obs-dir {
  display: flex;
  align-items: center;
  gap: 3px;
  border: none;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: filter 0.12s;
  white-space: nowrap;
  margin-top: 2px;
}
.pe-obs-dir:hover { filter: brightness(1.3); }
.pe-obs-dir i { font-size: 0.68rem; }
.dir--out  { background: rgba(88,166,255,0.25);  color: #58a6ff; }
.dir--ret  { background: rgba(63,185,80,0.25);   color: #3fb950; }
.dir--both { background: rgba(245,197,24,0.25);  color: #f5c518; }

/* Type-change button (wraps icon) */
.pe-obs-type-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.12s;
}
.pe-obs-type-btn:hover { background: rgba(255,255,255,0.1); }

/* Link button */
.pe-obs-link-btn {
  position: absolute;
  bottom: -7px; left: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #58a6ff;
  border: none;
  color: #fff;
  font-size: 0.6rem;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 11;
}
.pe-obs:hover .pe-obs-link-btn { display: flex; }
.pe-obs--linked .pe-obs-link-btn { display: flex; background: #3fb950; }
.pe-obs--link-source .pe-obs-inner {
  border-color: #58a6ff !important;
  box-shadow: 0 0 0 4px rgba(88,166,255,0.4);
  animation: pe-link-pulse 0.8s ease-in-out infinite;
}
@keyframes pe-link-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(88,166,255,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(88,166,255,0.15); }
}
.pe-obs--linked .pe-obs-inner {
  border-style: dashed;
}

/* SVG link connectors */
.pe-links-svg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}
.pe-link-line {
  stroke: #58a6ff;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  opacity: 0.6;
}

/* Type picker popup */
.pe-type-picker {
  position: fixed;
  z-index: 10000;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 200px;
}
.pe-type-picker-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #e6edf3;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
  border-left: 3px solid var(--obs-color, #8b949e);
}
.pe-type-picker-item:hover { background: rgba(255,255,255,0.06); }
.pe-type-picker-item.active { background: rgba(255,255,255,0.1); font-weight: 700; }
.pe-type-picker-item i { color: var(--obs-color, #8b949e); font-size: 0.9rem; }

/* Drag ghost */
.pe-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  padding: 5px 10px;
  background: rgba(47, 129, 247, 0.9);
  color: #fff;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ─── Park list ───────────────────────────────────────────────────────────── */
.park-obs-badge {
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

/* ─── Ekran powitalny (niezalogowany) ────────────────────────────────────── */
.wake-hero-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: #58a6ff;
}
.wake-hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: #e6edf3;
  letter-spacing: -0.5px;
}
.wake-hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.6;
}

/* ─── Park select (widok zwykłego użytkownika) ────────────────────────────── */
.park-select-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  cursor: pointer;
}
.park-select-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.park-select-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(88,166,255,0.12);
  color: #58a6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ─── Park editor layout ──────────────────────────────────────────────────── */
.editor-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.editor-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
}

.editor-main {
  flex: 1;
  min-width: 0;
}

/* ─── Palette ─────────────────────────────────────────────────────────────── */
#obstacle-palette {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: grab;
  font-size: 0.85rem;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
  user-select: none;
}
.palette-item:hover { border-color: var(--primary); background: rgba(47,129,247,0.08); }
.palette-item:active { cursor: grabbing; }
.palette-icon { color: var(--text-muted); font-size: 0.9rem; }
.palette-name { font-size: 0.82rem; }

/* ─── Track container ─────────────────────────────────────────────────────── */
.track-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1rem;
}

.track-section { padding: 0.5rem 0; }

.track-dir-label {
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  padding-left: 0.25rem;
}
.dir1-color   { color: #58a6ff; }
.return-color { color: #3fb950; }

.track-rail-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.track-pole {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.track-rail {
  flex: 1;
  background: var(--bg-body);
  border: 1px dashed var(--border);
  border-radius: 8px;
  min-height: 68px;
  position: relative;
}

.track-cable-divider {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
}
.cable-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
}

/* ─── Track lane ──────────────────────────────────────────────────────────── */
.track-lane {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 8px;
  min-height: 68px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lane-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.5;
  pointer-events: none;
  gap: 0.3rem;
}

/* ─── Obstacle card in track ──────────────────────────────────────────────── */
.track-obs {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--obs-color, var(--primary));
  border-radius: 7px;
  cursor: default;
  min-width: 110px;
  max-width: 180px;
  position: relative;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.track-obs:hover {
  border-color: var(--obs-color, var(--primary));
  box-shadow: 0 0 0 1px var(--obs-color, var(--primary));
}

.track-obs-drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 0.85rem;
  flex-shrink: 0;
  opacity: 0.5;
}
.track-obs-drag:hover { opacity: 1; }
.track-obs-drag:active { cursor: grabbing; }

.track-obs-icon {
  color: var(--obs-color, var(--primary));
  font-size: 0.9rem;
  flex-shrink: 0;
}

.track-obs-body {
  min-width: 0;
  flex: 1;
}

.track-obs-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  outline: none;
  border-radius: 3px;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-obs-name:focus {
  background: rgba(255,255,255,0.06);
  padding: 1px 3px;
  white-space: normal;
}

.track-obs-type {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
}

.track-obs-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
  flex-shrink: 0;
  cursor: pointer;
}
.track-obs:hover .track-obs-remove { opacity: 0.6; }
.track-obs-remove:hover { opacity: 1 !important; color: var(--danger); }

/* Drag states */
.track-obs-ghost   { opacity: 0.35; }
.track-obs-chosen  { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* ─── Track legend ────────────────────────────────────────────────────────── */
.track-legend { opacity: 0.6; }

/* ─── Responsive editor ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .editor-layout { flex-direction: column; }
  .editor-sidebar { width: 100%; position: static; }
  #obstacle-palette { flex-direction: row; flex-wrap: wrap; }
  .palette-item { flex: 0 0 auto; }
}

/* ─── Session run plan ────────────────────────────────────────────────────── */

.session-lap-header { margin-bottom: .25rem; }
.session-lap-num { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }

.run-pass-header { display: flex; align-items: center; gap: 0.5rem; }

.run-pass-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
}
.run-label-dir1   { background: rgba(88,166,255,0.15); color: #58a6ff; }
.run-label-return { background: rgba(63,185,80,0.15);  color: #3fb950; }

/* Track visual */
.run-track-wrap {
  background: linear-gradient(160deg, #071e30, #0b3050 60%, #071e30);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow-x: auto;
  padding: 0;
}

.run-track {
  display: flex;
  align-items: center;
  min-height: 110px;
  padding: 1rem 1rem;
  min-width: max-content;
}

/* Endpoints */
.run-endpoint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.run-ep-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.4);
}
.run-ep-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.3);
}

/* Gap segment */
.run-gap {
  flex: var(--gap, 1);
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.run-gap-top,
.run-gap-bot {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.run-gap-line {
  height: 3px;
  background: rgba(220,200,120,0.35);
  border-radius: 2px;
  flex-shrink: 0;
}
.run-gap-dist {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.2);
  white-space: nowrap;
}

/* Flat-water trick chip (inside gap) */
.run-flat-chip {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: default;
}
.run-flat-chip--learnable { background: rgba(47,129,247,0.25); color: #79b8ff; }
.run-flat-chip--practice  { background: rgba(63,185,80,0.2);   color: #3fb950; }
.run-flat-chip--locked    { background: rgba(139,148,158,0.12); color: #8b949e; }

/* Obstacle stop */
.run-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.run-stop-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--obs-color, var(--primary));
  box-shadow: 0 0 8px var(--obs-color, var(--primary));
  flex-shrink: 0;
}
.run-stop-card {
  background: rgba(13,22,36,0.9);
  border: 1.5px solid var(--obs-color, var(--primary));
  border-radius: 9px;
  padding: 6px 10px;
  text-align: center;
  min-width: 88px;
  max-width: 140px;
  backdrop-filter: blur(4px);
}
.run-stop-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}
.run-trick-chip {
  display: flex;
  align-items: center;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.run-trick-chip--learnable { background: rgba(47,129,247,0.25); color: #79b8ff; }
.run-trick-chip--practice  { background: rgba(63,185,80,0.18);  color: #3fb950; }
.run-trick-chip--locked    { background: rgba(139,148,158,0.1); color: #8b949e; }

/* Detail cards below track */
.run-detail-stop {
  border-left: 3px solid var(--obs-color, var(--primary));
  padding-left: 1rem;
  margin-left: 0.25rem;
}
.run-detail-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.run-detail-obs-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--obs-color, var(--primary));
  flex-shrink: 0;
}
.run-detail-obs-name {
  font-weight: 700;
  font-size: 0.9rem;
}
.run-flat-inline {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.run-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 6px;
}
.run-detail-card--learnable { border-left: 3px solid #58a6ff; }
.run-detail-card--practice  { border-left: 3px solid #3fb950; }
.run-detail-card--locked    { border-left: 3px solid var(--border); opacity: 0.6; }

.run-badge-learnable { background: rgba(47,129,247,0.25); color: #79b8ff; font-size: 0.6rem; }
.run-badge-practice  { background: rgba(63,185,80,0.2);   color: #3fb950; font-size: 0.6rem; }
.run-badge-locked    { background: rgba(139,148,158,0.15); color: #8b949e; font-size: 0.6rem; }
.run-badge-transfer  { background: rgba(191,140,255,0.25); color: #bf8cff; font-size: 0.6rem; }

/* Prerequisites & unlocks in session detail cards */
.trick-prereqs, .trick-unlocks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.prereq-label {
  font-size: 0.6rem;
  color: #8b949e;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.prereq-chip {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.prereq-chip--practice  { background: rgba(63,185,80,0.15);  color: #3fb950; border-color: rgba(63,185,80,0.3); }
.prereq-chip--learnable { background: rgba(47,129,247,0.15); color: #79b8ff; border-color: rgba(47,129,247,0.3); }
.prereq-chip--locked    { background: rgba(139,148,158,0.12); color: #8b949e; border-color: rgba(139,148,158,0.25); }

.unlock-chip {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.unlock-chip--ready   { background: rgba(210,153,34,0.15); color: #d2a022; border-color: rgba(210,153,34,0.3); }
.unlock-chip--pending { background: rgba(139,148,158,0.08); color: #6e7681; border-color: rgba(139,148,158,0.2); }

/* Missing prerequisites in rider profile (locked tricks) */
.trick-missing-prereqs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}
.missing-prereq-chip {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 20px;
  background: rgba(224,108,117,0.12);
  color: #e06c75;
  border: 1px solid rgba(224,108,117,0.25);
  white-space: nowrap;
}

/* Transfer chip — purple accent */
.run-transfer-chip { border-color: rgba(191,140,255,0.4) !important; }
.run-flat-chip.run-transfer-chip { background: rgba(191,140,255,0.18); color: #bf8cff; }
.run-flat-chip.run-transfer-chip.run-flat-chip--practice { background: rgba(191,140,255,0.18); color: #bf8cff; }
.run-flat-chip.run-transfer-chip.run-flat-chip--locked   { background: rgba(191,140,255,0.10); color: #9c6fd6; }

/* Transfer detail card */
.run-detail-card--transfer {
  border-left-color: #bf8cff !important;
  background: rgba(191,140,255,0.06) !important;
}

/* Entry-blocked detail card */
.run-detail-card--entry-blocked {
  border-left-color: var(--danger) !important;
  background: rgba(218,54,51,0.07) !important;
}

/* Entry-blocked chip on track visual */
.run-trick-chip--entry-blocked {
  background: rgba(218,54,51,0.15);
  color: #f85149;
  border: 1px solid rgba(218,54,51,0.3);
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

/* Entry badge in detail header (ollie required indicator) */
.run-entry-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
}
.run-entry-badge--ok {
  background: rgba(63,185,80,0.15);
  color: #3fb950;
  border: 1px solid rgba(63,185,80,0.3);
}
.run-entry-badge--blocked {
  background: rgba(218,54,51,0.15);
  color: #f85149;
  border: 1px solid rgba(218,54,51,0.3);
}
.run-entry-badge--transfer {
  background: rgba(191,140,255,0.15);
  color: #bf8cff;
  border: 1px solid rgba(191,140,255,0.3);
}

/* Exit label on stop card (e.g. "Trapez → Rooftop") */
.run-stop-exit-label {
  display: block;
  font-size: 0.6rem;
  opacity: 0.8;
  margin-top: 1px;
}

/* ── Session park map ─────────────────────────────────────────────────────── */
.sm-wrap { overflow: hidden; }

.sm-map {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(180deg, rgba(30,40,60,0.6) 0%, rgba(20,30,50,0.8) 100%);
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
}

/* Cable */
.sm-cable {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.sm-cable-line {
  position: absolute;
  top: 50%; left: 3%; right: 3%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25) 10%, rgba(255,255,255,0.25) 90%, transparent);
  transform: translateY(-50%);
}
.sm-pole {
  position: absolute;
  top: 20%; bottom: 20%;
  width: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
.sm-pole--left  { left: 3%; }
.sm-pole--right { right: 3%; }

/* Direction arrow */
.sm-dir-arrow {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
}

/* Zones */
.sm-zone {
  position: absolute;
  border-radius: 4px;
  pointer-events: none;
}
.sm-zone--edge {
  background: rgba(88,166,255,0.12);
  border: 1px solid rgba(88,166,255,0.3);
  border-top: 2px solid rgba(88,166,255,0.5);
}
.sm-zone--ollie {
  background: rgba(63,185,80,0.1);
  border: 1px solid rgba(63,185,80,0.3);
  border-top: 2px solid rgba(63,185,80,0.5);
}
.sm-zone-label {
  position: absolute;
  top: 4px; left: 8px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

/* Obstacles on map */
.sm-obs {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}
.sm-obs-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--obs-color, #8b949e);
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s;
}
.sm-obs-label {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-obs--planned .sm-obs-dot {
  opacity: 1;
  width: 14px; height: 14px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15), 0 0 12px var(--obs-color, #fff);
}
.sm-obs--planned .sm-obs-label {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

/* Trick labels on planned obstacles */
.sm-obs-trick,
.sm-flat-marker {
  display: none;
}
.sm-obs-trick--learnable {
  background: rgba(47,129,247,0.25);
  color: #58a6ff;
  border: 1px solid rgba(47,129,247,0.35);
}
.sm-obs-trick--practice {
  background: rgba(63,185,80,0.2);
  color: #3fb950;
  border: 1px solid rgba(63,185,80,0.3);
}
.sm-obs-trick--locked {
  background: rgba(139,148,158,0.15);
  color: #8b949e;
  border: 1px solid rgba(139,148,158,0.2);
}

/* Flat trick markers between obstacles */
.sm-flat-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}
.sm-flat-marker--learnable {
  background: rgba(47,129,247,0.2);
  color: #58a6ff;
  border: 1px solid rgba(47,129,247,0.3);
}
.sm-flat-marker--practice {
  background: rgba(63,185,80,0.15);
  color: #3fb950;
  border: 1px solid rgba(63,185,80,0.25);
}
.sm-flat-marker--locked {
  background: rgba(139,148,158,0.1);
  color: #8b949e;
  border: 1px solid rgba(139,148,158,0.2);
}

/* ── Park editor zones panel ──────────────────────────────────────────────── */
.pe-zone-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 0.8rem;
}
.pe-zone-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pe-zone-dot--edge   { background: #58a6ff; }
.pe-zone-dot--ollie  { background: #3fb950; }
.pe-zone-info { flex: 1; min-width: 0; line-height: 1.3; }
.pe-zone-del {
  background: none; border: none; color: var(--text-muted);
  padding: 0 2px; cursor: pointer; flex-shrink: 0;
}
.pe-zone-del:hover { color: var(--danger); }

/* Zones rendered on editor canvas */
.pe-zone-band {
  position: absolute;
  border-radius: 4px;
  cursor: grab;
  pointer-events: all;
}
.pe-zone-band:active { cursor: grabbing; }
.pe-zone-band--preview { opacity: 0.5; pointer-events: none; }
.pe-zone-band--edge {
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.3);
}
.pe-zone-band--ollie {
  background: rgba(63,185,80,0.08);
  border: 1px solid rgba(63,185,80,0.3);
}
.pe-zone-band-label {
  position: absolute;
  top: 3px; left: 6px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.5;
  white-space: nowrap;
  pointer-events: none;
}

/* Zone resize handles */
.pe-zone-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 10px;
  cursor: ew-resize;
  z-index: 2;
}
.pe-zone-handle--left  { left: 0; border-radius: 4px 0 0 4px; }
.pe-zone-handle--right { right: 0; border-radius: 0 4px 4px 0; }
.pe-zone-handle::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 18px;
  background: rgba(255,255,255,0.35);
  border-radius: 2px;
}

/* Draw mode cursor */
.pe-map--draw-mode { cursor: crosshair !important; }
.pe-map--draw-mode * { pointer-events: none !important; }

/* ─── Ranking ────────────────────────────────────────────────────────────────── */
.rk-silver  { background: rgba(170,170,170,0.06); }
.rk-bronze  { background: rgba(205,127,50,0.06); }

.rk-pending-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.rk-pts-badge {
  background: rgba(47,129,247,0.15);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
}

.rk-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.rk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  transition: background 0.2s;
}

.rk-dot--filled {
  background: var(--success);
  border-color: var(--success);
}

/* ─── Auth / navbar rider ────────────────────────────────────────────────────── */
.nav-rider-sep {
  border-left: 1px solid var(--border);
}
.nav-rider-name {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  pointer-events: auto;
}
.nav-rider-name:hover {
  color: #fff;
  text-decoration: underline !important;
}
.nav-logout-btn {
  font-size: 0.8rem;
  color: var(--text-muted, #8b949e);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nav-logout-btn:hover {
  color: #fff;
  border-color: #6e7681;
  background: rgba(255,255,255,0.08);
}

/* ─── Dice FAB ───────────────────────────────────────────────────────────── */
.dice-fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 1040;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px rgba(47,129,247,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.dice-fab:hover {
  background: var(--accent);
  transform: scale(1.08) rotate(-10deg);
  box-shadow: 0 6px 28px rgba(88,166,255,0.55);
}
.dice-fab:active { transform: scale(0.96); }

/* ─── Dice Modal ─────────────────────────────────────────────────────────── */
.dice-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
}
.dice-modal-content .modal-header { padding-bottom: 0; }

.dice-mode-wrap {
  display: flex;
  background: var(--bg-body);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border);
}
.dice-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dice-mode-btn.active {
  background: var(--primary);
  color: #fff;
}

.dice-obs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dice-obs-chip {
  background: var(--bg-card2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.dice-obs-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.dice-obs-chip.selected {
  border-color: var(--primary);
  background: rgba(47,129,247,0.15);
  color: var(--accent);
  font-weight: 600;
}
.dice-obs-chip.empty {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── Slot machine ───────────────────────────────────────────────────────── */
.dice-slot-wrap {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.dice-slot-idle { text-align: center; padding: 1.5rem; }

.dice-slot-drum { text-align: center; padding: 1.5rem 1rem; width: 100%; }
.dice-drum-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  transition: opacity 0.1s;
  word-break: break-word;
}
.dice-drum-name.spinning { color: var(--text-muted); }
.dice-drum-name.landing  { color: var(--accent); }

@keyframes dicePop {
  0%   { transform: scale(0.85); opacity: 0.5; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1);    opacity: 1; }
}
.dice-drum-name.popped { animation: dicePop 0.35s ease-out forwards; }

.dice-drum-meta .badge { font-size: 0.72rem; }
.difficulty-dots-sm .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  margin: 0 1px;
}
.difficulty-dots-sm .dot.active { background: var(--accent); }

.dice-spin-btn { font-weight: 600; border-radius: 8px; }
