:root {
  --paper: #f6f0e1;
  --ink: #2f2c36;
  --red: #e2463a;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --serif: "Lora", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c1a20; }

#stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform-origin: center; background: var(--paper); overflow: hidden; color: var(--ink);
}
#stage canvas { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
#gl { mix-blend-mode: multiply; visibility: hidden; }

/* tegningen toner ut mot teksten i høyre kant */
#veil {
  position: absolute; right: 0; top: 0; width: 640px; height: 100%; pointer-events: none;
  background: linear-gradient(90deg, rgba(246,240,225,0), rgba(246,240,225,.94) 44%);
}
/* papirkorn over alt som er tegnet */
#grain {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .37  0 0 0 0 .28  0 0 0 -1.25 .98'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- tittel ---------- */
#title {
  position: absolute; left: 1420px; top: 40px; width: 440px; transform-origin: top left;
  transition: transform 1.8s cubic-bezier(.6,.05,.25,1);
}
#title.intro { transform: translate(-1230px, 120px) scale(2.3); }
#title h1 { margin: 0; font: 700 62px/1 var(--hand); letter-spacing: .5px; white-space: nowrap; }
#title svg { display: block; width: 400px; height: 16px; margin: 2px 0 8px; }
#title svg path { fill: none; stroke: var(--red); stroke-width: 3.2; stroke-linecap: round; opacity: .85; }
#title p { margin: 0; font: italic 400 17.5px/1.45 var(--serif); letter-spacing: .2px; opacity: .78; }

/* ---------- fortelling ---------- */
#cap { position: absolute; left: 1420px; top: 300px; width: 450px; opacity: 0; will-change: transform, opacity; }
#cap h3 { margin: 0 0 10px; font: 700 50px/1 var(--hand); color: var(--red); }
#cap p { margin: 0; font: 400 28px/1.52 var(--serif); }
#cap a.r { font-size: .7em; vertical-align: super; color: var(--red); text-decoration: none; }

/* ---------- avspiller ---------- */
#player {
  position: absolute; left: 50%; bottom: 20px; width: 940px; transform: translateX(-50%);
  opacity: .62; transition: opacity .3s;
}
#player:hover { opacity: 1; }
#chname { text-align: center; font: 700 30px/1 var(--hand); margin-bottom: 6px; height: 30px; }
#player .row { display: flex; align-items: center; gap: 10px; }
#player button {
  width: 40px; height: 40px; flex: none; padding: 0; cursor: pointer; color: var(--ink);
  background: transparent; border: 2px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  font: 700 22px/1 var(--hand); display: grid; place-items: center;
}
#player button:hover { background: rgba(47,44,54,.1); }
#player button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#play .pl, #play.paused .pa { display: none; }
#play.paused .pl { display: block; }
#bar { position: relative; flex: 1; height: 40px; }
#segs { display: flex; gap: 5px; height: 100%; align-items: center; cursor: pointer; touch-action: none; }
.seg { height: 100%; display: flex; align-items: center; flex-basis: 0; min-width: 6px; }
.seg::before { content: ""; }
.seg i { display: block; height: 7px; border-radius: 4px; background: var(--ink); position: relative; z-index: 1; }
.seg { position: relative; }
.seg::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 7px; margin-top: -3.5px; border-radius: 4px; background: rgba(47,44,54,.2); }
.seg.on i { background: var(--red); }
.seg:hover::after { background: rgba(47,44,54,.36); }
#tip {
  position: absolute; bottom: 44px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font: 700 26px/1 var(--hand); background: var(--paper); padding: 4px 12px; opacity: 0; transition: opacity .15s;
  border: 2px solid var(--ink); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
#time { font: 500 24px/1 var(--hand); width: 110px; text-align: center; flex: none; }

#ref { position: absolute; right: 26px; bottom: 14px; font: 400 14px/1.3 var(--serif); opacity: .72; max-width: 420px; text-align: right; }
#ref a { color: inherit; }
