:root{
  --bg: #ffffff;
  --panel: rgba(255,255,255,.75);
  --text: #111;
  --muted: rgba(0,0,0,.55);
  --grid: rgba(0,0,0,.08);
  --border: rgba(0,0,0,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --popup-bg: #fff;
  --popup-text: #111;
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #0b0f14;
    --panel: rgba(10,14,20,.72);
    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.55);
    --grid: rgba(255,255,255,.10);
    --border: rgba(255,255,255,.14);
    --shadow: 0 10px 30px rgba(0,0,0,.45);
    --popup-bg: #111826;
    --popup-text: rgba(255,255,255,.92);
  }
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar{
  height: 56px;
  display:flex;
  align-items:center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.title{
  display:flex;
  gap: 12px;
  align-items: baseline;
}
.hint{
  color: var(--muted);
  font-size: 13px;
}

.app{
  height: calc(100% - 56px);
  display:flex;
  flex-direction: column;
}

.viewport{
  position: relative;
  flex: 1 1 auto;
  overflow: hidden; /* panning gebeurt custom */
  touch-action: none; /* zodat pointer events smooth zijn */
}

#timelineCanvas{
  width: 100%;
  height: 100%;
  display:block;
}

.ruler-wrap{
  position: sticky;
  bottom: 0;
  z-index: 15;
  border-top: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px);
}

#rulerCanvas{
  width: 100%;
  height: 56px;
  display:block;
}

.popup{
  position:absolute;
  min-width: 260px;
  max-width: 360px;
  background: var(--popup-bg);
  color: var(--popup-text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 12px 10px;
  transform: translate(10px, -10px);
}

.popup-close{
  position:absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.popup-content{
  padding-right: 34px;
}

.popup h3{
  margin: 0 0 8px 0;
  font-size: 15px;
}
.popup .row{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.popup .row:first-of-type{
  border-top: none;
}
.popup .k{ color: var(--muted); }
.popup .v{ text-align:right; }
