@font-face {
  font-family: 'Grandstander';
  src: url('fonts/grandstander.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #1D2340;      /* inktlijn, zoals in een Brusselse strip */
  --sky: #DDF0FA;      /* Brusselse lucht op een goeie dag */
  --paper: #FFFFFF;
  --fries: #FFCF33;    /* frietgeel: gehaald */
  --cherry: #E5423B;   /* kriekenrood: de route en de volgende stop */
  --steel: #AEBBC9;    /* Atomiumstaal: nog te doen */
  --muted: #535C7C;
  --row: 132px;
  --bubble: 78px;
  --font: 'Grandstander', 'Trebuchet MS', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sky) url('clouds.svg') repeat-y center top / 560px auto;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cherry); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px 92px;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}
.logo {
  position: absolute;
  left: 12px;
  bottom: -30px;
  width: 70px;
  height: auto;
  pointer-events: none;
}
.titles { min-width: 0; flex: 1; }
.titles h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.015em;
}
.titles p {
  margin: 3px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}
.score {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
}
.score svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.score polygon { fill: var(--fries); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.score .n { position: relative; font-weight: 900; font-size: 1.35rem; line-height: 1; }
.score .of { font-size: .85rem; font-weight: 800; }
.score.bump { animation: bump .5s ease-out; }
@keyframes bump { 40% { transform: scale(1.25) rotate(-8deg); } }

/* ---------- map ---------- */

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 34px 0 16px;
}
.editbanner {
  margin: 0 14px 14px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--fries);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  position: relative;
  z-index: 2;
}
.editbanner p { margin: 0; flex: 1; font-weight: 700; font-size: .95rem; line-height: 1.3; }
.loading { text-align: center; font-weight: 700; color: var(--muted); }

.map { position: relative; }
.paths {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.paths path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.paths .walked { stroke: var(--cherry); stroke-width: 6; stroke-dasharray: 0 13; }
.paths .going { stroke: var(--cherry); stroke-width: 6; stroke-dasharray: 0 13; animation: march 0.9s linear infinite; }
.paths .future { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 0 11; opacity: .22; }
@keyframes march { to { stroke-dashoffset: -26; } }

.stops { list-style: none; margin: 0; padding: 0; position: relative; }
.stop { position: relative; height: var(--row); }

.bubble {
  position: absolute;
  left: var(--x);
  top: 50%;
  width: var(--bubble);
  height: var(--bubble);
  transform: translate(-50%, -50%);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  z-index: 2;
}
.bubble img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.bubble .ico, .bubble .emoji { display: block; line-height: 1; }
.badge {
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fries);
  border: 2.5px solid var(--ink);
  font-weight: 900;
  font-size: 17px;
  line-height: 1;
}
.stop.done .bubble { box-shadow: 0 0 0 5px var(--fries), 0 0 0 8px var(--ink); }
.stop.todo .bubble { background: #F2F7FB; border-style: dashed; box-shadow: none; }
.stop.todo .bubble .ico, .stop.todo .bubble .emoji { filter: grayscale(.7); opacity: .6; }
.stop.next .bubble::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 3px dashed var(--cherry);
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bubble.pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.6); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.caption {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(var(--tilt, 0deg));
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px 9px;
  text-align: left;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  z-index: 3;
}
.stop.left .caption { left: calc(var(--x) + var(--bubble) / 2 + 18px); margin-right: 10px; }
.stop.right .caption { right: calc(100% - var(--x) + var(--bubble) / 2 + 18px); margin-left: 10px; }
.caption .time {
  margin: -21px 0 3px -4px;
  padding: 1px 7px;
  background: var(--fries);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 800;
  font-size: .82rem;
  line-height: 1.3;
}
.caption .ttl { font-weight: 800; font-size: 1.08rem; line-height: 1.15; }
.caption .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.caption .extras { font-size: .82rem; font-weight: 700; color: var(--muted); }
.stop.next .caption .meta { color: #C7302A; font-weight: 800; }
.stop.todo .caption { background: #F7FAFC; box-shadow: 3px 3px 0 var(--steel); border-color: #6C7590; }
.stop.todo .caption .time { background: #E7EDF3; border-color: #6C7590; }

.stop.finish { height: 136px; }
.stop.finish .bubble { --bubble: 64px; top: 40%; }
.finish-label {
  position: absolute;
  left: 50%;
  top: calc(40% + 44px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--muted);
}
.stop.finish.alldone .finish-label { color: var(--ink); font-size: 1.3rem; }
.stop.finish.alldone .bubble { background: var(--fries); box-shadow: 0 0 0 5px var(--cherry), 0 0 0 8px var(--ink); }

body.editing .bubble,
body.editing .caption { outline: 2px dashed var(--cherry); outline-offset: 4px; }

/* ---------- bottom bar ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 3px solid var(--ink);
}
.barbtn {
  flex: 1 1 0;
  max-width: 220px;
  min-height: 46px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.1;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.barbtn.primary { background: var(--fries); }
.barbtn:active, .btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

/* ---------- buttons & forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 1rem;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .92rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.primary { background: var(--fries); }
.btn.big {
  width: 100%;
  min-height: 60px;
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  background: var(--cherry);
  box-shadow: 4px 4px 0 var(--ink);
}
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn.danger { color: var(--cherry); border-color: var(--cherry); box-shadow: 2px 2px 0 var(--cherry); }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }

input, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px; /* geen inzoomen op iOS */
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
label { display: block; font-weight: 700; font-size: .95rem; }
label > input, label > textarea { margin-top: 5px; }
label small { font-weight: 600; color: var(--muted); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- dialogs ---------- */

dialog { color: var(--ink); font-family: var(--font); padding: 0; border: 0; }
dialog::backdrop { background: rgba(29, 35, 64, .5); }
dialog h2 { margin: 0; font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
dialog h3 { margin: 0; font-size: 1.1rem; font-weight: 800; }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet[open] { animation: slideup .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes slideup { from { transform: translateY(40%); opacity: 0; } }
@media (min-width: 640px) {
  .sheet { margin: auto; border-bottom: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink); }
}
.close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  margin: -8px -6px 0 8px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  z-index: 2;
}

.sv-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.sv-bubble {
  flex: none;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #F2F7FB;
  overflow: hidden;
  font-size: 48px;
}
.sv-bubble.done { box-shadow: 0 0 0 5px var(--fries), 0 0 0 8px var(--ink); margin: 8px; }
.sv-bubble { position: relative; }
.sv-bubble img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sv-head .time {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 7px;
  background: var(--fries);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 800;
  font-size: .85rem;
}
.sv-head .place { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-weight: 700; color: var(--ink); }
.sv-note { margin: 0 0 14px; font-size: 1rem; line-height: 1.45; white-space: pre-wrap; }
.sv-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.sv-done { margin: 0; flex: 1; font-weight: 800; font-size: 1.05rem; }
.sv-sec { border-top: 2.5px dashed var(--steel); padding-top: 14px; margin-top: 4px; margin-bottom: 18px; }
.sv-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sv-sec > h3 { margin-bottom: 10px; }
.empty { margin: 0; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; padding: 8px 8px 0 0; }
.thumb { position: relative; }
.thumb-open {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #F2F7FB;
  cursor: pointer;
}
.thumb-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.thumb-del::before { content: ''; position: absolute; inset: -7px; } /* grotere tikzone */
.thumb-del:hover { color: #fff; background: var(--cherry); }
.notes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.notes li {
  position: relative;
  padding: 9px 12px;
  background: #F7FAFC;
  border: 2px solid var(--ink);
  border-radius: 12px 12px 12px 3px;
}
.notes .who { display: block; font-size: .82rem; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.notes .txt { white-space: pre-wrap; line-height: 1.4; }
.notes .del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}
.noteform { display: flex; gap: 8px; align-items: flex-end; }
.noteform textarea { min-height: 48px; }

.form { display: grid; gap: 14px; }
.iconpick { display: flex; flex-wrap: wrap; gap: 6px; }
.iconpick button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #F2F7FB;
  cursor: pointer;
}
.iconpick button[aria-pressed="true"] { background: var(--fries); }
.formbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.formbtns .btn.primary { flex: 1; }

.mini {
  width: min(92vw, 380px);
  padding: 22px 20px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
}
.mini form { display: grid; gap: 12px; }
.mini p { margin: 0; line-height: 1.4; }
.mini .btn { width: 100%; }
.loginlogo { justify-self: center; }
.err { color: var(--cherry); font-weight: 800; min-height: 1.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chips button {
  padding: 8px 14px;
  font-weight: 800;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--fries);
  cursor: pointer;
}

.photodlg {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  background: var(--ink);
  display: none;
  flex-direction: column;
}
.photodlg[open] { display: flex; }
.photodlg img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding-top: env(safe-area-inset-top, 0px); }
.photobar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 3px solid var(--ink);
}
.photobar span { flex: 1; font-weight: 700; font-size: .92rem; }

/* ---------- toast & confetti ---------- */

.toast {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  width: fit-content;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
  padding: 10px 16px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--cherry);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
