:root {
  --cream: #f6f3ec;
  --paper: #fffdf8;
  --ink: #11241b;
  --pitch: #1e4433;
  --moss: #3d6b53;
  --muted: #6b7a70;
  --line: #e2ddd1;
  --line-soft: #efebe1;
  --orange: #dd5f2c;
  --orange-dark: #c14f21;
  --red: #b3402c;
  --radius: 14px;
  --max: 1080px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 640; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
}
/* Moet ná de display-regel staan, anders wint display:flex van [hidden]. */
.topbar[hidden] { display: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 680; letter-spacing: -0.02em; }
.brand-mark {
  width: 12px; height: 20px;
  border: 2px solid var(--pitch);
  border-left: none;
  border-radius: 0 3px 3px 0;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: -2px; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--orange);
}
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.whoami { color: var(--muted); }

/* ----------------------------------------------------------------- layout */

.view { max-width: var(--max); margin: 0 auto; padding: 28px 24px 80px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 27px; }
.page-head .sub { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

.back {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.back:hover { color: var(--ink); }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .card-sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* --------------------------------------------------------------- knoppen */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 560;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn-dark { background: var(--pitch); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #163527; }
.btn-quiet { background: transparent; border-color: #cdc5b5; color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: rgba(0,0,0,.04); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; padding: 0;
  color: var(--muted); font-size: 13.5px; cursor: pointer; text-decoration: underline;
}
.btn-link:hover { color: var(--ink); }

/* ---------------------------------------------------------------- formulier */

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; font-weight: 560; color: #35473d; }
.field .hint { font-size: 12.5px; color: var(--muted); }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(61,107,83,.14);
}
input[type=file] { font-size: 14px; }

.form-narrow { max-width: 400px; margin: 40px auto; }
.form-narrow h1 { font-size: 25px; margin-bottom: 6px; }
.form-narrow .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 24px; }
.form-foot { margin-top: 16px; font-size: 14px; color: var(--muted); text-align: center; }
.form-foot a { color: var(--moss); text-decoration: underline; }

/* ------------------------------------------------------------------ lijsten */

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.list-item:first-child { border-top: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 560; }
.list-item .li-sub { font-size: 13.5px; color: var(--muted); }

.tile {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color .15s ease, transform .1s ease;
}
.tile:hover { border-color: #cbc2b0; }
.tile h3 { font-size: 17.5px; margin-bottom: 4px; }
.tile .tile-sub { font-size: 13.5px; color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 560;
  padding: 3px 9px;
  border-radius: 20px;
  background: #eae5d8;
  color: #4b5a51;
}
.pill-good { background: #dcebe1; color: #2c5a41; }
.pill-warn { background: #f7e4d6; color: #97441d; }
.pill-mine { background: #e6ded0; color: #6c5638; }

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px;
  letter-spacing: .16em;
  font-weight: 600;
  background: var(--pitch);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
}

/* ------------------------------------------------------------------ speler */

.player { background: #0c1a13; border-radius: var(--radius); overflow: hidden; outline: none; }
.player:focus-visible { box-shadow: 0 0 0 3px rgba(61,107,83,.5); }

.player-stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player-stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }

.player-gap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background:
    repeating-linear-gradient(45deg, #14251c 0 10px, #101f18 10px 20px);
  color: #cfe0d6;
  text-align: center;
  padding: 20px;
}
.player-gap[hidden] { display: none; }
.pg-title { font-size: 15px; font-weight: 620; letter-spacing: .04em; text-transform: uppercase; color: #8fae9d; }
.pg-sub { font-size: 15px; }
.player-gap .btn { border-color: #3c5b4b; color: #dff0e6; }
.player-gap .btn:hover { background: rgba(255,255,255,.07); }

.player-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #12241b;
  color: #dbe8e0;
}
.pp {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: none;
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  flex: none;
}
.pp:hover { background: var(--orange-dark); }
.player-bar .pos, .player-bar .dur { font-size: 13px; color: #a9c0b3; flex: none; min-width: 46px; }
.player-bar .dur { text-align: right; }

.scrub { flex: 1; padding: 10px 0; cursor: pointer; touch-action: none; }
.sb-track { position: relative; height: 8px; background: #21402f; border-radius: 5px; }
.sb-have { position: absolute; top: 0; bottom: 0; background: #4d8a67; }
.sb-gap {
  position: absolute; top: 0; bottom: 0;
  background: repeating-linear-gradient(45deg, #2c3a33 0 4px, #22302a 4px 8px);
}
.sb-track > .sb-have:first-of-type { border-radius: 5px 0 0 5px; }
.sb-tags { position: absolute; inset: 0; }
.sb-tag {
  position: absolute;
  top: -4px;
  width: 3px; height: 16px;
  background: var(--orange);
  border-radius: 2px;
  transform: translateX(-1.5px);
}
.sb-head {
  position: absolute; top: -4px;
  width: 3px; height: 16px;
  background: #fff;
  border-radius: 2px;
  transform: translateX(-1.5px);
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
  pointer-events: none;
}

.coverage-note { font-size: 13.5px; color: var(--muted); margin-top: 10px; }

/* ------------------------------------------------------------------ blokken */

.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.block-free { border-style: dashed; background: transparent; }
.block-mine { border-color: var(--moss); background: #f2f8f4; }
.block-time { font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }
.block-who { font-size: 13px; color: var(--muted); min-height: 19px; }
.block .btn { width: 100%; }

/* ------------------------------------------------------------------ upload */

.drop {
  border: 1.5px dashed #c9c0ad;
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  background: #fbf9f3;
}
.drop.over { border-color: var(--moss); background: #f1f7f3; }
.drop p { font-size: 14.5px; color: var(--muted); }

.progress { height: 8px; background: #e8e3d6; border-radius: 5px; overflow: hidden; margin-top: 12px; }
/* scaleX in plaats van width: de balk vult tijdens een upload continu bij,
   en zo blijft dat een compositor-taak zonder layout-berekening. */
.progress > div {
  height: 100%;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .2s ease;
}
.progress-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------------------------------------------------------- markeringen */

.tag-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.tag-row:first-child { border-top: none; }
.tag-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  background: var(--pitch);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.tag-time:hover { background: #16352f; }
.tag-what { flex: 1; min-width: 0; }
.tag-what .t-label { font-weight: 560; font-size: 15px; }
.tag-what .t-who { font-size: 13px; color: var(--muted); }

.marker-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px;
  background: #f1efe7;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 14px;
}
.marker-bar select { width: auto; min-width: 160px; }
.marker-bar .at { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ clips */

.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.clip {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.clip video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }
.clip-body { padding: 12px 14px; display: grid; gap: 3px; }
.clip-body .c-label { font-weight: 560; }
.clip-body .c-meta { font-size: 13px; color: var(--muted); }
.clip-locked {
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  gap: 8px;
  background: repeating-linear-gradient(45deg, #efeade 0 10px, #e9e3d5 10px 20px);
  text-align: center;
  padding: 16px;
}
.clip-locked span { font-size: 13.5px; color: #7a7160; }

.paywall {
  background: #12241b;
  color: #dfeae3;
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.paywall h3 { font-size: 18px; margin-bottom: 4px; color: #fff; }
.paywall p { font-size: 14.5px; color: #a9c0b3; max-width: 52ch; }

/* ------------------------------------------------------------------ prijzen */

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
}
.plan-best { border-color: var(--pitch); border-width: 1.5px; }
.plan .badge {
  position: absolute; top: -10px; left: 20px;
  background: var(--pitch); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 20px;
}
.plan h3 { font-size: 16px; color: var(--moss); font-weight: 600; }
.plan .price { font-size: 30px; font-weight: 660; letter-spacing: -0.03em; margin-top: 6px; }
.plan .price-per { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.plan ul { flex: 1; margin-bottom: 18px; }
.plan li { font-size: 14.5px; color: #46564d; padding: 6px 0 6px 20px; position: relative; }
.plan li::before {
  content: ""; position: absolute; left: 2px; top: 14px;
  width: 6px; height: 3px;
  border-left: 2px solid var(--moss); border-bottom: 2px solid var(--moss);
  transform: rotate(-45deg);
}

.notice {
  border: 1px solid #d9cfae;
  background: #fdf6e3;
  color: #6b5a2a;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 18px;
}

/* ------------------------------------------------------- leeg / laden / melding */

.empty {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed #cfc7b6;
  border-radius: var(--radius);
  background: #fbf9f3;
}
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14.5px; max-width: 46ch; margin: 0 auto 16px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 0; font-size: 14.5px; }
.spin {
  width: 15px; height: 15px;
  border: 2px solid #cfc7b6;
  border-top-color: var(--moss);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--pitch);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14.5px;
  box-shadow: 0 14px 30px -14px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 100;
  max-width: min(90vw, 460px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--red); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17,36,27,.42);
  display: grid; place-items: center;
  z-index: 90;
  padding: 20px;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 50px -20px rgba(0,0,0,.4);
}
.modal-msg { margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------------------------------------- responsief */

/*
 * De echte gebruikssituatie is een telefoon: zaterdag langs de lijn met één
 * hand, en zondag terugkijkend op de bank. Vandaar dat op smalle schermen de
 * speler blijft staan en de belangrijkste knop onderin binnen duimbereik komt,
 * in plaats van dat alles alleen maar smaller wordt.
 */

@media (max-width: 760px) {
  .view { padding: 16px 16px 24px; }
  .topbar { padding: 10px 14px; }
  .topbar-right { gap: 6px; }
  /* Compacter dan de standaard voor aanraakschermen: dit zijn navigatielinks,
     geen hoofdacties, en met drie ervan past de balk anders niet. */
  .topbar-right .btn { padding: 9px 12px; font-size: 14px; min-height: 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .whoami { display: none; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 18px 16px; border-radius: 12px; }
  .card + .card { margin-top: 12px; }

  /* Uitloggen staat op de accountpagina; in de balk is er geen ruimte voor. */
  #logout { display: none; }

  /* De speler blijft in beeld terwijl je naar de markeringen scrolt. */
  #player-mount {
    position: sticky;
    top: 56px;
    z-index: 20;
    margin: 0 -16px;
  }
  #player-mount .player { border-radius: 0; }

  /* Inklapbare onderdelen: de pagina begint kort, je opent wat je nodig hebt. */
  .vouw > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 17px;
    font-weight: 640;
    letter-spacing: -0.02em;
  }
  .vouw > summary::-webkit-details-marker { display: none; }
  .vouw > summary::after {
    content: "";
    margin-left: auto;
    width: 9px; height: 9px;
    border-right: 2px solid var(--moss);
    border-bottom: 2px solid var(--moss);
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s ease;
  }
  .vouw[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
  .vouw > summary .telling {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
  }
  .vouw > .vouw-in { padding-top: 14px; }

  /* De markeerbalk los van de kaart, vast onderin binnen duimbereik. */
  .marker-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    margin: 0;
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: var(--paper);
    box-shadow: 0 -8px 24px -18px rgba(17, 36, 27, .6);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  }
  .marker-bar select { min-width: 0; width: 100%; }
  .marker-bar .at { display: none; }
  .marker-bar #add-tag {
    grid-column: 1 / -1;
    width: 100%;
    padding: 13px 16px;
    font-size: 16px;
  }
  /* Ruimte zodat de laatste kaart niet tegen de balk aan plakt. */
  body.heeft-markeerbalk .view {
    padding-bottom: calc(152px + env(safe-area-inset-bottom));
  }

  .blocks { grid-template-columns: repeat(2, 1fr); }
  .clips { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .code-chip { font-size: 22px; letter-spacing: .2em; padding: 12px 18px; }
}

/* Vingers in plaats van een muis: alles wat je aanraakt wordt groter. */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 11px 18px; }
  .btn-sm { min-height: 40px; padding: 9px 14px; font-size: 14px; }
  .btn-link { min-height: 40px; display: inline-flex; align-items: center; }
  .pp { width: 44px; height: 44px; }

  /* Een balk van 8px is met een duim niet te raken; het raakvlak wordt 32px
     hoog terwijl de balk zelf even dun blijft. */
  .scrub { padding: 14px 0; }
  .sb-track { height: 10px; }
  .sb-tag, .sb-head { top: -5px; height: 20px; }

  .list-item { padding: 16px 0; }
  .tag-row { padding: 14px 0; }
  .tag-time { padding: 7px 11px; font-size: 14px; }
  .block { padding: 14px 16px; }

  /* iOS zoomt in op een veld met tekst kleiner dan 16px. */
  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=datetime-local], select, textarea {
    font-size: 16px;
    padding: 12px 14px;
  }
}

@media (max-width: 400px) {
  .blocks { grid-template-columns: 1fr; }
  .code-chip { font-size: 19px; }
  /* Op een heel smal scherm wint de navigatie het van de merknaam. */
  .brand { font-size: 0; gap: 0; }
  .brand-mark { margin-right: 0; }
}
