/* ---- Barça-thema ---- */
:root {
  --blue: #004D98;
  --blue-dark: #003a73;
  --red: #A50044;
  --red-dark: #6f0030;
  --gold: #FFD800;
  --gold-deep: #EDBB00;
  --bg: #0a1030;
  --bg-soft: #141c44;
  --card: #161e4c;
  --card-soft: #232e6b;
  --text: #eef1ff;
  --muted: #9aa3cf;
  --ok: #2bd47d;
  --line: rgba(255,255,255,0.08);
  /* Blaugrana shirtstrepen */
  --stripes: repeating-linear-gradient(90deg, var(--blue) 0 34px, var(--red) 34px 68px);
  --stripes-fine: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 16px);
  --display: "Anton", "Arial Narrow", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, #10184a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* Sportieve, condensed koppen */
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: .02em; text-transform: uppercase; }

/* ---- Confetti ---- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* ---- LOGIN ---- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
  background: var(--stripes);
}
.login::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 30%, rgba(10,16,48,.45) 0%, rgba(10,16,48,.9) 100%);
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 360px; text-align: center;
  background: var(--card);
  border: 1px solid rgba(255,216,0,.25); border-top: 4px solid var(--gold); border-radius: 24px;
  padding: 30px 24px calc(28px + var(--safe-bottom)); box-shadow: 0 24px 70px rgba(0,0,0,0.55);
}
.crest-img { width: 84px; height: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.login-motto { font-family: var(--display); color: var(--gold); font-size: 15px; letter-spacing: .22em; margin-top: 12px; }
.login-card h1 { font-size: 30px; margin: 2px 0 4px; color: #fff; }
.login-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.pin-display { display: flex; gap: 14px; justify-content: center; margin-bottom: 8px; }
.pin-display span {
  width: 16px; height: 16px; border-radius: 50%; background: transparent;
  border: 2px solid var(--muted); transition: .15s;
}
.pin-display span.filled { background: var(--gold); border-color: var(--gold); transform: scale(1.1); }
.login-error { color: #ff7a90; min-height: 18px; font-size: 13px; margin: 8px 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.keypad button {
  aspect-ratio: 1 / 1; border-radius: 50%; border: none; font-size: 26px; font-weight: 600;
  background: var(--card-soft); color: var(--text); transition: .1s;
}
.keypad button:active { transform: scale(0.92); background: var(--gold); color: #2a2200; }
.keypad .key-action { background: transparent; font-size: 20px; color: var(--muted); }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }

/* ---- APP layout ---- */
.app { max-width: 560px; margin: 0 auto; padding-bottom: calc(78px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background:
    var(--stripes-fine),
    linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar-crest { width: 34px; height: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.topbar-title { font-family: var(--display); font-size: 21px; line-height: 1; }
.topbar-sub { font-size: 11.5px; color: #cdd6ff; margin-top: 2px; }
.topbar-stats { display: flex; gap: 14px; }
.stat { text-align: center; min-width: 42px; }
.stat span { display: block; font-family: var(--display); font-size: 24px; line-height: 1; color: var(--gold); }
.stat small { font-size: 10px; color: #cdd6ff; }

.views { padding: 16px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Cards & sessions ---- */
.section-title { font-family: var(--display); font-size: 14px; letter-spacing: .12em; color: var(--gold); margin: 20px 2px 10px; }
.banner {
  position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.06) 0 2px, transparent 2px 22px),
    linear-gradient(135deg, var(--red), var(--red-dark));
  border-radius: 20px; padding: 18px; margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,.1); border-left: 4px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.banner h2 { margin: 0 0 4px; font-size: 26px; color: #fff; }
.banner p { margin: 0; color: #ffd0df; font-size: 13px; font-weight: 600; }
.banner .next-city {
  margin-top: 12px; font-size: 13px; color: #fff; font-weight: 600;
  background: rgba(0,0,0,.22); border-radius: 12px; padding: 9px 12px;
}
.banner .next-city b { color: var(--gold); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; margin-bottom: 14px;
}
.card.done-card { border-color: rgba(43,212,125,.5); }
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.session-head h3 { margin: 0; font-size: 20px; }
.pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.loop { background: rgba(0,77,152,.4); color: #9fc0ff; border: 1px solid #2b66b5; }
.pill.kracht { background: rgba(165,0,68,.35); color: #ff9bbb; border: 1px solid #a50044; }
.pill.rust { background: rgba(255,255,255,.08); color: var(--muted); }
.session-focus { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }

.ex {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px;
  background: var(--bg-soft); margin-bottom: 8px; transition: .15s;
}
.ex.done { background: rgba(43,212,125,.12); }
.ex-check {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--muted); background: transparent; color: #fff; font-size: 16px;
  display: grid; place-items: center; transition: .15s;
}
.ex.done .ex-check { background: var(--ok); border-color: var(--ok); }
.ex-icon { font-size: 22px; }
.ex-body { flex: 1; min-width: 0; }
.ex-name { font-weight: 600; font-size: 15px; }
.ex.done .ex-name { text-decoration: line-through; color: var(--muted); }
.ex-dose { font-size: 12px; color: var(--muted); }
.ex-info {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; border: none;
  background: var(--card-soft); color: var(--gold); font-size: 16px;
}
.ex-info:active { transform: scale(0.9); }

.session-progress { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin: 4px 0 14px; }
.session-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ffd84d); width: 0; transition: width .3s; }

.rest-card { text-align: center; padding: 28px 18px; }
.rest-card .big { font-size: 44px; }

/* ---- Week view ---- */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.weeknav button { background: var(--card-soft); border: none; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.weeknav button:disabled { opacity: .3; }
.weeknav .wk-label { font-weight: 800; font-size: 16px; text-align: center; }
.weeknav .wk-label small { display: block; font-weight: 500; font-size: 12px; color: var(--gold); }
.daychip {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); margin-bottom: 10px;
}
.daychip.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.daychip .dc-day { width: 42px; font-weight: 700; font-size: 13px; color: var(--muted); }
.daychip .dc-main { flex: 1; }
.daychip .dc-title { font-weight: 600; font-size: 15px; }
.daychip .dc-type { font-size: 12px; color: var(--muted); }
.daychip .dc-state { font-size: 20px; }

/* ---- Reis (journey) ---- */
.journey-hero { text-align: center; margin-bottom: 18px; }
.journey-hero .km-big { font-family: var(--display); font-size: 54px; line-height: 1; color: var(--gold); }
.journey-hero .km-sub { color: var(--muted); font-size: 13px; }
.bigbar { height: 14px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin: 14px 0 6px; }
.bigbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--red), var(--gold)); width: 0; transition: width .5s; }

.route { position: relative; margin: 10px 0 0 0; padding-left: 8px; }
.stop { display: flex; gap: 14px; align-items: flex-start; position: relative; padding-bottom: 22px; }
.stop:last-child { padding-bottom: 0; }
.stop .line { position: absolute; left: 15px; top: 26px; bottom: -4px; width: 3px; background: var(--line); }
.stop:last-child .line { display: none; }
.stop .dot {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center; overflow: hidden;
  background: #fff; border: 2px solid var(--line); padding: 3px;
}
.stop.reached .dot { border-color: var(--ok); }
.stop.current .dot { border-color: var(--gold); animation: pulse 1.5s infinite; }
.stop:not(.reached):not(.current) .dot { opacity: .55; filter: grayscale(.4); }
.stop .line { left: 19px; }

/* Clublogo of clubkleurig badge */
.club-logo { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: 0 0 auto; }
.club-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.club-logo.mono { color: #fff; }
.club-logo.mono > span { font-family: var(--display); font-size: 11px; letter-spacing: .02em; line-height: 1; }
.stop.current .line, .stop.reached .line { background: var(--ok); }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(237,187,0,.5)} 50%{box-shadow:0 0 0 8px rgba(237,187,0,0)} }
.stop .stop-body { flex: 1; padding-top: 4px; }
.stop .stop-name { font-weight: 700; font-size: 15px; }
.stop .stop-meta { font-size: 12px; color: var(--muted); }
.stop.current .stop-name { color: var(--gold); }
.stop .you {
  display: inline-block; margin-left: 8px; font-size: 11px; background: var(--gold); color: #2a2200;
  padding: 2px 8px; border-radius: 999px; font-weight: 800;
}

/* ---- Badges ---- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px,1fr)); gap: 10px; }
.badge {
  text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 6px; opacity: .35; filter: grayscale(1);
}
.badge.earned { opacity: 1; filter: none; border-color: var(--gold); }
.badge .b-icon { font-size: 26px; }
.badge .b-name { font-size: 11px; margin-top: 4px; color: var(--muted); }
.badge.earned .b-name { color: var(--text); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 18px; animation: fade .2s; }
.modal-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 20px; padding: 20px; position: relative; border: 1px solid var(--line); }
.modal-close { position: absolute; top: 12px; right: 12px; background: var(--card-soft); border: none; color: #fff; width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.modal-card h2 { margin: 0 28px 12px 0; font-size: 19px; }
.modal-video { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 12px; }
.modal-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.modal-cue { color: var(--text); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.modal-link { display: inline-block; color: var(--gold); text-decoration: none; font-weight: 700; font-size: 14px; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--gold); color: #2a2200; font-weight: 800; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; transition: .3s; z-index: 300; pointer-events: none; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Tabbar ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; max-width: 560px; margin: 0 auto;
  background: rgba(12,18,48,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom);
}
.tab {
  position: relative;
  flex: 1; background: none; border: none; color: var(--muted); font-size: 11px; font-weight: 700;
  padding: 11px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tab span { font-size: 22px; filter: grayscale(1); opacity: .65; }
.tab.active { color: var(--gold); }
.tab.active span { filter: none; opacity: 1; }
.tab.active::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
  background: var(--gold); border-radius: 0 0 3px 3px;
}
