/* Gjerdalen-stil: gul #F9BC06, sort #1A1A1A, hvit. Archivo Black i titler. */
@font-face { font-family: "Archivo Black"; src: url("fonts/ArchivoBlack-Regular.ttf") format("truetype"); font-display: swap; }
:root {
  --gul: #F9BC06;
  --gul-lys: #FDF1C7;
  --sort: #1A1A1A;
  --hvit: #FFFFFF;
  --bakgrunn: #F3F2EF;
  --tekst: #2B2B2B;
  --dempet: #6B6B6B;
  --linje: #E2E0DA;
  --gronn: #1E9E5A;
  --gronn-lys: #E3F5EA;
  --rod: #D2372B;
  --rod-lys: #FBE6E4;
  --tittel: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --brod: Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bakgrunn);
  color: var(--tekst);
  font-family: var(--brod);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; }

/* Topp */
.topp {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  background: var(--sort); color: var(--hvit);
  padding: 12px 16px; border-bottom: 4px solid var(--gul);
}
.topp-merke { flex: 1; display: flex; align-items: center; }
.topp-merke img { height: 34px; width: auto; display: block; }
.topp-bruker { font-size: 14px; color: #cfcfcf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.topp-tilbake {
  background: none; border: 0; color: var(--hvit); font-size: 24px; line-height: 1;
  padding: 4px 8px 4px 0;
}

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }

/* Kort */
.kort {
  background: var(--hvit); border-radius: 14px; padding: 18px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.kort h2 { font-size: 18px; margin: 0 0 10px; color: var(--sort); }
.kort p { margin: 0 0 10px; }
.kort p:last-child { margin-bottom: 0; }
.kort ul { margin: 6px 0 0; padding-left: 20px; }
.kort li { margin-bottom: 6px; }
.kort .punkttittel { font-weight: bold; }
.verifiser {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: bold;
  background: #FFE1DD; color: #8A1C12; border-radius: 6px; padding: 2px 8px;
}

/* Innlogging */
.inn { text-align: center; padding-top: 24px; }
.inn h1 { font-family: var(--tittel); font-size: 28px; line-height: 1.15; margin: 8px 0 8px; color: var(--sort); }
.inn .under { color: var(--dempet); margin: 0 0 24px; }
.felt { text-align: left; margin-bottom: 14px; }
.felt label { display: block; font-weight: bold; margin-bottom: 6px; }
.felt input {
  width: 100%; font-size: 20px; padding: 14px; border-radius: 10px;
  border: 2px solid var(--linje); background: var(--hvit);
}
.felt input:focus { outline: none; border-color: var(--gul); }
.feil { color: var(--rod); font-weight: bold; min-height: 24px; }
.knapp {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 16px;
  background: var(--gul); color: var(--sort); font-weight: bold; font-size: 18px;
}
.knapp:disabled { opacity: .4; cursor: default; }
.knapp.sort { background: var(--sort); color: var(--hvit); }
.knapp.hvit { background: var(--hvit); color: var(--sort); border: 2px solid var(--sort); }
.liten { font-size: 13px; color: var(--dempet); margin-top: 16px; }

/* Kursoversikt */
.helt {
  background: var(--sort); color: var(--hvit); border-radius: 14px; padding: 22px 18px;
  margin-bottom: 16px; border-left: 8px solid var(--gul); position: relative;
}
.helt h1 { font-family: var(--tittel); color: var(--gul); font-size: 24px; line-height: 1.15; margin: 0 0 8px; }
.helt p { margin: 0; color: #ddd; font-size: 15px; }
.framdrift { margin-top: 16px; }
.framdrift-linje { height: 10px; background: #3a3a3a; border-radius: 5px; overflow: hidden; }
.framdrift-fyll { height: 100%; background: var(--gul); border-radius: 5px; transition: width .4s; }
.framdrift-tekst { font-size: 14px; margin-top: 6px; color: #ddd; }

.tidslinje { list-style: none; margin: 0; padding: 0; }
.tidslinje li { position: relative; }
.tidslinje li:not(:last-child)::after {
  content: ""; position: absolute; left: 27px; top: 46px; bottom: -10px; width: 2px; background: var(--linje);
}
.kap-knapp {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--hvit); border: 0; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.prikk {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--gul);
  display: grid; place-items: center; font-size: 15px; font-weight: bold; background: var(--hvit);
  position: relative; z-index: 1;
}
.prikk.ferdig { background: var(--gul); color: var(--sort); }
.kap-navn { flex: 1; font-weight: bold; }
.kap-status { font-size: 13px; color: var(--dempet); }

/* Kapittel */
.kap-hode { margin: 4px 0 16px; }
.kap-hode .nr { font-size: 13px; color: var(--dempet); font-weight: bold; text-transform: uppercase; letter-spacing: .5px; }
.kap-hode h1 { font-family: var(--tittel); font-size: 24px; line-height: 1.15; margin: 4px 0 0; color: var(--sort); }

.foto {
  border-radius: 14px; overflow: hidden; margin-bottom: 14px; background: var(--hvit);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.foto-plass {
  aspect-ratio: 16 / 9; background: repeating-linear-gradient(135deg, #2a2a2a 0 14px, #313131 14px 28px);
  color: #e8e8e8; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px; gap: 8px; font-size: 14px;
}
.foto-plass .ikon { font-size: 30px; }
.foto-plass b { color: var(--gul); }
.foto figcaption { padding: 12px 18px; font-size: 15px; color: var(--dempet); }

.sitat {
  border-radius: 14px; padding: 28px 22px; margin-bottom: 14px; text-align: center;
  font-family: var(--tittel); font-size: 24px; line-height: 1.2;
}
.sitat::before { content: "\201D"; display: block; font-size: 48px; line-height: .6; margin-bottom: 8px; }
.sitat.gul { background: var(--gul); color: var(--sort); }
.sitat.sort { background: var(--sort); color: var(--gul); font-size: 19px; }

.tall {
  background: var(--gul); border-radius: 14px; padding: 34px 18px; margin-bottom: 14px; text-align: center;
}
.tall .verdi { font-family: var(--tittel); font-size: 46px; line-height: 1.1; color: var(--sort); }
.tall .forklaring { margin-top: 8px; font-size: 15px; }

.flipp-rad { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.flippkort { perspective: 900px; height: 170px; border: 0; padding: 0; background: none; }
.flippkort-indre {
  position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d;
}
.flippkort.snudd .flippkort-indre { transform: rotateY(180deg); }
.flippkort-side {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1.35; text-align: center; padding: 12px;
}
.flippkort-side small { margin-top: 10px; font-size: 12px; opacity: .7; }
.flippkort-forside { background: var(--sort); color: var(--hvit); }
.flippkort-forside b { color: var(--gul); }
.flippkort-bakside { background: var(--gul); color: var(--sort); transform: rotateY(180deg); }

.illustrasjon svg { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.luftveier { list-style: none; margin: 4px 0 12px; padding: 0; }
.luftveier li { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 14px; }
.luftveier li:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--linje);
}
.luftveier .nr {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--sort); color: var(--hvit);
  display: grid; place-items: center; font-weight: bold; font-size: 15px;
}
.luftveier li:last-child .nr { background: var(--rod); }
.luftveier div { padding-top: 4px; }

/* Oppgavekort i kapittel */
.oppgave {
  background: var(--hvit); border: 2px dashed var(--linje); border-radius: 14px;
  padding: 26px 18px; margin-bottom: 14px; text-align: center;
}
.oppgave.bestatt { border: 2px solid var(--gronn); background: var(--gronn-lys); }
.oppgave h2 { margin: 0 0 6px; font-size: 18px; }
.oppgave p { margin: 0 0 16px; color: var(--dempet); font-size: 15px; }
.oppgave .knapp { display: inline-block; width: auto; padding: 12px 28px; }
.igjen { text-align: center; font-size: 14px; color: var(--dempet); margin: 4px 0 14px; }

/* Overlegg: quiz og sveipespill */
#overlegg {
  position: fixed; inset: 0; z-index: 50; background: var(--hvit);
  display: flex; flex-direction: column; overflow: auto;
}
#overlegg[hidden] { display: none; }
.ol-topp { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--linje); }
.ol-lukk { background: none; border: 0; font-size: 26px; line-height: 1; padding: 0 4px; color: var(--sort); }
.ol-linje { flex: 1; height: 10px; background: var(--linje); border-radius: 5px; overflow: hidden; }
.ol-linje div { height: 100%; background: var(--gul); transition: width .3s; }
.ol-teller { font-size: 13px; font-weight: bold; color: var(--dempet); }
.ol-innhold { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 16px; }
.ol-innhold h2 { font-size: 22px; line-height: 1.25; margin: 4px 0 18px; color: var(--sort); }
.svartype {
  display: inline-block; margin: -8px 0 16px; padding: 6px 12px; border-radius: 10px; line-height: 1.35;
  background: var(--bakgrunn); color: var(--tekst); font-size: 14px; font-weight: bold;
}
.svartype.flere { background: var(--gul-lys); color: #6b5200; }
.alt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--hvit); border: 2px solid var(--linje); border-radius: 12px;
  padding: 14px; margin-bottom: 10px; font-size: 16px; color: var(--tekst);
}
.alt .boks {
  flex: none; width: 24px; height: 24px; border: 2px solid #bbb; border-radius: 6px;
  display: grid; place-items: center; font-size: 15px; font-weight: bold;
}
.alt.radio .boks { border-radius: 50%; }
.alt.valgt { border-color: var(--sort); }
.alt.valgt .boks { background: var(--sort); border-color: var(--sort); color: var(--hvit); }
.alt.riktig { border-color: var(--gronn); background: var(--gronn-lys); }
.alt.riktig .boks { background: var(--gronn); border-color: var(--gronn); color: var(--hvit); }
.alt.galt { border-color: var(--rod); background: var(--rod-lys); }
.alt.galt .boks { background: var(--rod); border-color: var(--rod); color: var(--hvit); }
.alt:disabled { cursor: default; }
.tilbakemelding { border-radius: 12px; padding: 14px; margin-top: 8px; font-size: 15px; }
.tilbakemelding.ok { background: var(--gronn-lys); }
.tilbakemelding.ikke { background: var(--rod-lys); }
.tilbakemelding b { display: block; font-size: 17px; margin-bottom: 4px; }
.ol-bunn {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linje); background: var(--hvit);
}
.ol-bunn .hint { font-size: 14px; font-weight: bold; }
.ol-bunn .knapp { width: auto; padding: 12px 24px; }

/* Sveipespill */
#overlegg.sveip { background: var(--sort); color: var(--hvit); }
.sveip .ol-topp { border-bottom-color: #333; }
.sveip .ol-lukk { color: var(--hvit); }
.sveip-status { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.poeng { text-align: center; font-weight: bold; font-size: 20px; line-height: 1; }
.poeng small { display: block; font-size: 11px; color: #aaa; font-weight: normal; margin-top: 2px; }
.liv { font-size: 22px; letter-spacing: 2px; color: var(--rod); }
.liv .tapt { color: #444; }
.tid { position: relative; width: 52px; height: 52px; }
.tid svg { transform: rotate(-90deg); }
.tid span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: bold; font-size: 18px; }
.bunke { position: relative; height: 340px; max-width: 340px; margin: 20px auto 10px; touch-action: none; }
.sveipkort {
  position: absolute; inset: 0; background: var(--gul); color: var(--sort); border-radius: 18px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 26px; font-size: 22px; font-weight: bold; line-height: 1.3;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); user-select: none; -webkit-user-select: none;
}
.sveipkort.bak { transform: translateY(10px) scale(.95); background: #c99700; }
.sveipkort .merke {
  position: absolute; top: 18px; padding: 4px 10px; border: 3px solid; border-radius: 8px;
  font-size: 16px; opacity: 0; text-transform: uppercase;
}
.sveipkort .merke.ja { left: 18px; color: var(--gronn); transform: rotate(-12deg); }
.sveipkort .merke.nei { right: 18px; color: var(--rod); transform: rotate(12deg); }
.sveip-knapper { display: flex; gap: 12px; max-width: 340px; margin: 0 auto; }
.sveip-knapper button { flex: 1; border: 0; border-radius: 12px; padding: 14px 8px; font-weight: bold; font-size: 16px; color: var(--hvit); }
.sveip-knapper .nei { background: var(--rod); }
.sveip-knapper .ja { background: var(--gronn); }
.sveip-hjelp { text-align: center; color: #aaa; font-size: 14px; margin-top: 14px; }
.sveip-melding { text-align: center; padding-top: 30px; }
.sveip-melding h2 { color: var(--gul); font-family: var(--tittel); font-size: 26px; }
.sveip-melding p { color: #ddd; }
.sveip-melding .knapp { margin-top: 16px; }
.blink-ok { animation: blinkOk .5s; }
.blink-feil { animation: blinkFeil .5s; }
@keyframes blinkOk { 0%,100% { background: var(--sort); } 40% { background: #145c36; } }
@keyframes blinkFeil { 0%,100% { background: var(--sort); } 40% { background: #6e1d17; } }

/* Kursbevis */
.bevis {
  background: var(--sort); color: var(--hvit); border-radius: 16px; padding: 28px 22px; text-align: center;
  border-top: 10px solid var(--gul); margin-bottom: 16px;
}
.bevis .merke { font-family: var(--tittel); color: var(--gul); font-size: 18px; letter-spacing: 1px; }
.bevis h1 { font-family: var(--tittel); font-size: 26px; margin: 18px 0 6px; color: var(--hvit); }
.bevis .navn { font-size: 24px; font-weight: bold; color: var(--gul); margin: 18px 0 4px; }
.bevis .dato { color: #ccc; }
.bevis .hake {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: var(--gul); color: var(--sort);
  display: grid; place-items: center; font-size: 40px; font-weight: bold;
}
.bevis .slagord { margin-top: 22px; font-family: var(--tittel); color: var(--gul); font-size: 15px; }

@media (min-width: 700px) {
  .inn h1 { font-size: 34px; }
  .helt h1 { font-size: 30px; }
}
