/* Förfasen: den falska presentationen "I hälsans spår" som ligger över appen tills kapitel 0 startar.
   Allt är scopat under #pre så att appens mörka tema inte läcker in (och tvärtom). */
#pre { position: fixed; inset: 0; z-index: 20; overflow: auto; background: #fff; color: #222; font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.4; display: flex; flex-direction: column; --navy: #1f3a5f; --acc: #3b82c4; }
#pre[hidden] { display: none; }
body.is-pre { overflow: hidden; }
body.is-pre .top, body.is-pre .tabs, body.is-pre #main, body.is-pre .foot { visibility: hidden; }

#pre .bar { height: 12px; background: linear-gradient(90deg, var(--navy), var(--acc)); flex: none; }
#pre > header { padding: 7vh 8vw 10px; }
#pre h1 { font-size: clamp(34px, 5.2vw, 68px); margin: 0 0 8px; color: var(--navy); font-weight: 600; letter-spacing: -.01em; font-family: inherit; }
#pre .sub { font-size: clamp(16px, 2vw, 24px); color: #555; margin: 0; font-family: inherit; letter-spacing: 0; text-transform: none; }
#pre > main { padding: 10px 8vw 30px; flex: 1; display: grid; grid-template-columns: 1.25fr .75fr; gap: 6vw; align-content: start; max-width: none; margin: 0; }
@media (max-width: 760px) { #pre > main { grid-template-columns: 1fr; } #pre > header { padding-top: 32px; } }
#pre h2 { font-size: clamp(18px, 2.2vw, 26px); color: var(--navy); margin: 0 0 10px; font-weight: 600; font-family: inherit; }
#pre table { border-collapse: collapse; width: 100%; font-size: clamp(14px, 1.55vw, 19px); }
#pre td { padding: 8px 6px; border-bottom: 1px solid #e6e6e6; vertical-align: top; text-align: left; }
#pre td.t { color: var(--acc); font-weight: 600; white-space: nowrap; width: 5.2em; }
#pre .box { background: #f3f6fa; border-left: 4px solid var(--acc); padding: 16px 20px; border-radius: 4px; margin-bottom: 18px; font-size: clamp(14px, 1.4vw, 17px); }
#pre .box h3 { margin: 0 0 6px; font-size: 1em; color: var(--navy); font-family: inherit; }
#pre .box ul { margin: 0; padding-left: 18px; }
#pre .box li { margin: 3px 0; }
#pre button { font: inherit; font-size: 16px; background: var(--navy); color: #fff; border: 0; border-radius: 4px; padding: 11px 20px; cursor: pointer; font-weight: 400; }
#pre > footer { display: flex; justify-content: space-between; gap: 20px; padding: 14px 8vw; color: #888; font-size: 14px; border-top: 1px solid #eee; }

/* bild 1: titelbilden */
#pre #cover { position: absolute; inset: 0; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; z-index: 3; }
#pre #cover[hidden] { display: none; }
#pre #cover .bar { position: absolute; top: 0; left: 0; right: 0; }
#pre #cover h1 { font-size: clamp(44px, 7vw, 96px); margin: 0 0 14px; }
#pre #cover .sub { font-size: clamp(20px, 2.6vw, 34px); color: #666; margin: 0 0 7vh; font-weight: 300; }
#pre #cover button { font-size: clamp(17px, 1.6vw, 22px); padding: 16px 34px; border-radius: 6px; }
#pre #cover .foot { position: absolute; bottom: 18px; color: #999; font-size: 14px; padding: 0; }

/* ledarens PIN-ruta (5 tryck på rubriken eller tangent L) */
#pre #pre-pin { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; border: 1px solid #ccc; box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 18px 20px; border-radius: 6px; z-index: 8; font-size: 14px; color: #555; }
#pre #pre-pin[hidden] { display: none; }
#pre #pre-pin form { display: flex; gap: 8px; margin-top: 8px; }
#pre #pre-pin input { font: inherit; font-size: 18px; padding: 8px 10px; border: 1px solid #bbb; border-radius: 4px; width: 7em; background: #fff; color: #222; letter-spacing: .2em; }
#pre #pre-pin button { padding: 8px 14px; }

/* presentatörsraden: syns bara för ledaren */
#pre #pre-lead { position: fixed; left: 12px; bottom: 10px; z-index: 7; display: flex; gap: 8px; align-items: center; font-size: 12px; color: #999; background: rgba(255,255,255,.85); padding: 4px 8px; border-radius: 4px; }
#pre #pre-lead[hidden] { display: none; }
#pre #pre-lead button { font-size: 12px; padding: 4px 9px; background: #eee; color: #444; border: 1px solid #ccc; }

/* ---- intrånget ---- */
#pre .glitch { animation: pre-glitch .28s steps(2) infinite; }
@keyframes pre-glitch {
  0% { transform: none; text-shadow: none; }
  25% { transform: translate(-3px, 1px); text-shadow: 3px 0 #f0f, -3px 0 #0ff; }
  50% { transform: translate(2px, -1px) skewX(-4deg); text-shadow: -3px 0 #f0f, 3px 0 #0ff; clip-path: inset(10% 0 40% 0); }
  75% { transform: translate(-1px, 2px) skewX(5deg); clip-path: inset(50% 0 5% 0); }
  100% { transform: none; }
}
#pre .dead { color: #b00; font-family: ui-monospace, Consolas, Menlo, monospace; }
#pre .gone { text-decoration: line-through; color: #999; }
#pre #term { position: fixed; right: 24px; bottom: 24px; width: min(540px, 92vw); background: #0b0f0c; color: #7ddc8a; font-family: "IBM Plex Mono", ui-monospace, Consolas, Menlo, monospace; font-size: 14px; padding: 12px 16px; border-radius: 6px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); display: none; z-index: 5; border: 1px solid #24352a; }
#pre #term p { margin: 0 0 5px; }
#pre #term .bar2 { height: 4px; background: #24352a; margin: -4px -16px 8px; }
#pre #prog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); background: #fff; border: 1px solid #8a8a8a; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: none; z-index: 6; }
#pre #prog .ttl { background: var(--navy); color: #fff; padding: 8px 12px; font-size: 14px; display: flex; justify-content: space-between; }
#pre #prog .bd { padding: 18px; font-size: 15px; }
#pre #prog .track { height: 20px; border: 1px solid #8a8a8a; background: #eee; margin: 12px 0 6px; }
#pre #prog .fill { height: 100%; width: 0; background: #2a9d4a; transition: width .25s; }
#pre.invert { filter: invert(1); }
#pre.shake { animation: pre-shake .12s 6; }
@keyframes pre-shake { 0%, 100% { transform: none; } 50% { transform: translate(6px, -4px); } }
#pre #black { position: fixed; inset: 0; background: #000; display: none; z-index: 10; padding: 40px 24px; font-family: "IBM Plex Mono", ui-monospace, Consolas, Menlo, monospace; color: #7ddc8a; font-size: clamp(15px, 2vw, 22px); }
#pre #black p { margin: 0 0 12px; animation: pre-fadein .2s; }
#pre .cur { animation: pre-blink 1s steps(2) infinite; }
@keyframes pre-blink { to { opacity: 0; } }
@keyframes pre-fadein { from { opacity: 0; } to { opacity: 1; } }
#pre .stray { position: fixed; font-family: ui-monospace, Consolas, monospace; color: #1a1a1a; font-size: 18px; pointer-events: none; animation: pre-blink .9s steps(2) infinite; z-index: 4; }
