/* Velkommen til voksenlivet · stil for dette spillet (felles stil ligger i ../felles/spill.css) */

:root {
  --riktig: #2F7D4F;
  --riktig-lys: #DDF0E3;
  --feil: #B4452E;
  --feil-lys: #F6E0DA;
  --gull: #C98A1B;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --riktig: #7FD0A0; --riktig-lys: #1E3A2A; --feil: #EE9A86; --feil-lys: #3D2620; --gull: #F2C14E; }
}
:root[data-theme="dark"] { --riktig: #7FD0A0; --riktig-lys: #1E3A2A; --feil: #EE9A86; --feil-lys: #3D2620; --gull: #F2C14E; }

/* ---------- Oppsett ---------- */
.start-inner, .slutt-inner { max-width: 960px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 28px; }
.start h1, .slutt h1 { font-size: clamp(28px, 4vw, 44px); }
.ingress { font-size: 20px; color: var(--dempet); margin: 0; max-width: 60ch; }
.start section { display: grid; gap: 12px; }
.start h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.stegnr { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--granskog); color: var(--papir); font-size: 18px; flex: none; }

.valgrad { display: flex; flex-wrap: wrap; gap: 10px; }
.valg {
  font: inherit; text-align: left; cursor: pointer;
  border: 2px solid var(--stein); background: var(--flate); color: var(--grafitt);
  border-radius: var(--r); padding: 12px 16px; min-height: 56px; min-width: 64px;
  display: grid; gap: 2px;
}
.valg strong { font-size: 19px; }
.valg span { font-size: 15px; color: var(--dempet); }
.valg:hover { border-color: var(--granskog); }
.valg[aria-checked="true"], .valg[aria-pressed="true"] { border-color: var(--granskog); background: var(--granskog-lys); box-shadow: inset 0 0 0 1px var(--granskog); }
.valg[aria-checked="true"] strong::before, .valg[aria-pressed="true"] strong::before { content: "✓ "; color: var(--granskog); }

.temavalg { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.temavalg .valg { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.temavalg .ikon { font-size: 26px; grid-row: span 2; }

.lagnavn { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.lagnavn label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; color: var(--dempet); }
.lagnavn input { font-size: 18px; min-height: 48px; }

.start-knapper { display: flex; gap: 12px; flex-wrap: wrap; }
.regler { background: var(--flate); border: 1px solid var(--stein); border-radius: var(--r); padding: 14px 18px; }
.regler summary { font-weight: 600; cursor: pointer; min-height: 32px; }
.regler ul { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 6px; }

/* ---------- Spillflate ---------- */
.spill { display: grid; grid-template-columns: 1fr; min-height: calc(100dvh - 66px); }
.spill-inner { max-width: 1200px; width: 100%; margin: 0 auto; padding: 20px 16px 24px; display: grid; gap: 18px; align-content: start; }
.sporsmal-topp { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.framdrift { font-weight: 600; color: var(--dempet); margin-right: 6px; }
.merke { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: var(--granskog-lys); color: var(--granskog); font-weight: 600; font-size: 15px; }
.merke.type { background: var(--kobber-lys); color: var(--kobber); }
.sporsmal-tittel { font-size: clamp(28px, 3.6vw, 52px); max-width: 30ch; outline: none; }
.utdyping { margin: 0; font-size: clamp(18px, 1.8vw, 26px); color: var(--dempet); max-width: 60ch; }

.alternativer { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.alt {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--flate); border: 3px solid var(--stein); border-radius: 14px;
  padding: 16px 18px; min-height: 84px; font-size: clamp(19px, 1.9vw, 28px); font-weight: 600;
  transition: transform .35s ease, opacity .35s ease, border-color .3s, background .3s, filter .35s;
}
.alt .bokstav { display: inline-grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 10px; background: var(--granskog); color: var(--papir); font-size: 24px; }
.alt { flex-wrap: wrap; }
.alt > span:nth-child(2) { flex: 1; min-width: 0; }
.alt .stemmer { flex-basis: 100%; display: flex; gap: 4px; flex-wrap: wrap; }
.alt .stemmer:empty { display: none; }
.alt .stemmer span { font-size: 14px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--kobber-lys); color: var(--kobber); }
.alt.bort { opacity: .28; transform: scale(.96); filter: grayscale(1); }
.alt.riktig { border-color: var(--riktig); background: var(--riktig-lys); transform: scale(1.03); animation: glod 1.2s ease-out 1; }
.alt.riktig .bokstav { background: var(--riktig); }
.alt.riktig::after { content: "✓ Riktig"; position: absolute; top: -14px; right: 14px; background: var(--riktig); color: var(--papir); font-size: 15px; padding: 2px 10px; border-radius: 99px; }
.alt.vurdert { border-color: var(--kobber); }
@keyframes glod { 0% { box-shadow: 0 0 0 0 rgba(47,125,79,.55); } 100% { box-shadow: 0 0 0 26px rgba(47,125,79,0); } }
.alt.rist { animation: rist .3s ease 1; }
@keyframes rist { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Gjett tallet */
.tallfelt { display: grid; gap: 22px; }
.tallvisning {
  font-size: clamp(56px, 9vw, 128px); font-weight: 700; line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--granskog); text-align: center;
  padding: 18px; border-radius: 18px; background: var(--flate); border: 3px dashed var(--stein);
}
.tallvisning.ferdig { border-style: solid; border-color: var(--riktig); color: var(--riktig); animation: sprett .45s ease-out 1; }
@keyframes sprett { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.tallinje { position: relative; height: 130px; margin: 0 40px; }
.tallinje .linje { position: absolute; left: 0; right: 0; top: 64px; height: 6px; border-radius: 3px; background: var(--stein); }
.pinne { position: absolute; top: var(--y, 0px); transform: translateX(-50%); display: grid; justify-items: center; gap: 2px; transition: left .1s linear; }
.pinne .navn { font-size: 14px; font-weight: 600; white-space: nowrap; background: var(--kobber-lys); color: var(--kobber); padding: 2px 8px; border-radius: 99px; }
.pinne .stav { width: 4px; height: calc(64px - var(--y, 0px) - 28px); background: var(--kobber); border-radius: 2px; }
.pinne .verdi { display: none; }
.pinne.svarpinne { top: 64px; z-index: 2; }
.pinne.svarpinne .stav { height: 30px; width: 6px; background: var(--riktig); order: -1; }
.pinne.svarpinne .navn { background: var(--riktig); color: var(--papir); font-size: 16px; }
.pinne.vinner .navn { background: var(--gull); color: #1d1a12; }

/* Spenning */
.spenning { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: clamp(26px, 3vw, 40px); font-weight: 700; color: var(--kobber); min-height: 60px; }
.spenning i { width: 14px; height: 14px; border-radius: 50%; background: var(--kobber); animation: hopp .6s ease-in-out infinite; }
.spenning i:nth-of-type(2) { animation-delay: .12s; }
.spenning i:nth-of-type(3) { animation-delay: .24s; }
@keyframes hopp { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-12px); opacity: 1; } }

/* Lagpanel */
.lagpanel { display: grid; gap: 8px; }
.lagpanel:empty { display: none; }
.lagpanel h2 { font-size: 18px; color: var(--dempet); }
.lagrad { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: var(--flate); border: 1px solid var(--stein); border-radius: var(--r); }
.lagrad .lagnavn-tekst { font-weight: 600; min-width: 150px; display: flex; align-items: center; gap: 8px; }
.lagrad .knapper { display: flex; gap: 6px; flex-wrap: wrap; }
.lagrad .svarknapp { min-width: 56px; min-height: 48px; font-size: 18px; padding: 6px 14px; }
.lagrad input { max-width: 220px; min-height: 48px; font-size: 20px; }
.lagrad .resultat { margin-left: auto; font-weight: 700; padding: 4px 12px; border-radius: 99px; }
.lagrad .resultat.pluss { background: var(--riktig-lys); color: var(--riktig); animation: sprett .45s ease-out 1; }
.lagrad .resultat.null { background: var(--feil-lys); color: var(--feil); }
.lagrad .enhet { color: var(--dempet); }

.handling { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.fasit { scroll-margin-bottom: 100px; background: var(--flate); border: 3px solid var(--granskog); border-radius: 16px; padding: 20px 22px; display: grid; gap: 10px; animation: inn .4s ease-out 1; }
.fasit-tittel { margin: 0; font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; color: var(--granskog); }
.fasit-tekst { margin: 0; font-size: clamp(19px, 1.8vw, 26px); max-width: 70ch; }
.kilde { margin: 0; font-size: 15px; color: var(--dempet); }
.kilde a { color: var(--kobber); }
@keyframes inn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Poengtavle */
.poengtavle { position: sticky; bottom: 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 10px 16px max(10px, env(safe-area-inset-bottom, 0px)); background: var(--papir); border-top: 1px solid var(--stein); }
.poengtavle:empty { display: none; }
.poeng { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; background: var(--flate); border: 2px solid var(--stein); font-weight: 600; }
.poeng b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--granskog); }
.poeng.leder { border-color: var(--gull); }
.poeng.leder::before { content: "★"; color: var(--gull); }
.poeng.okt { animation: sprett .5s ease-out 1; }

/* Slutt */
.pall { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pall li { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 14px; background: var(--flate); border: 2px solid var(--stein); font-size: 22px; font-weight: 600; opacity: 0; transform: translateY(14px); transition: opacity .4s, transform .4s; }
.pall li.vis { opacity: 1; transform: none; }
.pall li .plass { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--stein); flex: none; }
.pall li .p { margin-left: auto; font-variant-numeric: tabular-nums; }
.pall li.forst { border-color: var(--gull); font-size: 30px; }
.pall li.forst .plass { background: var(--gull); color: #1d1a12; }

/* Konfetti */
.konfetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.konfetti span { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall 1.8s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }
html.rolig .konfetti { display: none; }
@media (prefers-reduced-motion: reduce) { .konfetti { display: none; } }

/* Eget spørsmål */
.e-alt { display: flex; gap: 8px; align-items: center; }
.e-alt input[type="radio"] { width: 26px; height: 26px; flex: none; accent-color: var(--granskog); }

@media (max-width: 640px) {
  .poengtavle { position: static; }
  .alt { min-height: 64px; padding: 12px; }
  .alt .bokstav { width: 38px; height: 38px; font-size: 20px; }
  .lagrad .lagnavn-tekst { min-width: 100%; }
  .tallinje { margin: 0 8px; }
  .pinne .navn { font-size: 12px; }
}

/* ---------- Meny ---------- */
.meny h1, .samtale h1 { font-size: clamp(28px, 4vw, 44px); }
.menykort { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.menyvalg {
  display: grid; gap: 10px; align-content: start; text-decoration: none; color: var(--grafitt);
  background: var(--flate); border: 3px solid var(--granskog); border-radius: 18px; padding: 24px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.menyvalg:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,.12); }
.menyvalg.samtale { border-color: var(--kobber); }
.menyikon { font-size: 48px; line-height: 1; }
.menytittel { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; line-height: 1.15; }
.menytekst { color: var(--dempet); }
.menyknapp { justify-self: start; margin-top: 6px; font-weight: 600; padding: 10px 18px; border-radius: var(--r); background: var(--granskog); color: var(--papir); }
.menyvalg.samtale .menyknapp { background: var(--kobber); }

/* ---------- Klassens time: temabrett ---------- */
.kt-temaer { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kt-tema {
  font: inherit; color: var(--grafitt); cursor: pointer; text-align: left;
  display: grid; gap: 6px; align-content: start; min-height: 130px;
  background: var(--flate); border: 3px solid var(--stein); border-radius: 16px; padding: 14px 16px;
  transition: transform .12s ease, background .12s, border-color .12s, opacity .2s;
}
.kt-tema:hover { border-color: var(--kobber); }
.kt-ikon { font-size: 34px; line-height: 1; }
.kt-navn { font-weight: 700; font-size: 19px; line-height: 1.2; }
.kt-status { font-size: 14px; font-weight: 600; color: var(--dempet); min-height: 1em; }
.kt-tema.av { opacity: .45; border-style: dashed; }
.kt-tema.brukt:not(.av) { background: var(--granskog-lys); }
.kt-tema.brukt .kt-status::before { content: "✓ "; }
.kt-tema.lys { border-color: var(--sol); background: var(--kobber-lys); transform: scale(1.05); box-shadow: 0 0 0 4px var(--sol); }
.kt-tema.vinner { animation: sprett .5s ease-out 2; }

/* ---------- Klassens time: kortene ---------- */
.kt-kortflate { max-width: 1200px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 20px; }
.kt-tematittel { outline: none; }
.kt-metode { max-width: 70ch; font-size: 17px; }
.kt-spot { background: var(--flate); border: 3px solid var(--kobber); border-radius: 18px; padding: 24px 26px; display: grid; gap: 14px; scroll-margin: 16px; }
.kt-spot-nr { margin: 0; font-weight: 600; color: var(--kobber); }
.kt-spot-tekst { margin: 0; font-size: clamp(28px, 3.8vw, 56px); font-weight: 700; line-height: 1.18; text-wrap: balance; }
.kt-spot-tekst.inn { animation: inn .5s ease-out 1; }
.kt-tidramme { height: 8px; border-radius: 4px; background: var(--stein); overflow: hidden; }
.kt-tidbar { height: 100%; width: 0; background: var(--kobber); transition: width 1s linear; }

.kt-kortene { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kt-kortet { font: inherit; padding: 0; border: none; background: none; cursor: pointer; perspective: 900px; min-height: 170px; color: var(--grafitt); text-align: left; border-radius: 16px; }
.kt-inner { position: relative; display: block; width: 100%; height: 100%; min-height: 170px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3,.7,.3,1.2); }
.kt-kortet.snudd .kt-inner { transform: rotateY(180deg); }
.kt-side { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; padding: 16px; }
.kt-bak {
  place-items: center; align-content: center; gap: 4px;
  background: repeating-linear-gradient(45deg, var(--granskog) 0 14px, #2b5a4d 14px 28px);
  color: var(--papir); border: 3px solid var(--granskog);
}
.kt-tall { font-size: 56px; font-weight: 700; line-height: 1; }
.kt-ikon-lite { font-size: 26px; }
.kt-fram { transform: rotateY(180deg); background: var(--flate); border: 3px solid var(--stein); font-size: 17px; font-weight: 600; line-height: 1.3; align-content: center; overflow: auto; }
.kt-kortet.valgt .kt-fram { border-color: var(--kobber); background: var(--kobber-lys); }
.kt-kortet.vrikk { animation: vrikk .3s ease-in-out 2; }
@keyframes vrikk { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
html.rolig .kt-inner { transition: none; }
@media (prefers-reduced-motion: reduce) { .kt-inner { transition: none; } }

.kt-hjelp { background: var(--granskog-lys); border-radius: 14px; padding: 16px 20px; }
.kt-hjelp h2 { font-size: 20px; margin-bottom: 6px; }
.kt-hjelp p { margin: 0 0 8px; }
.kt-hjelp ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

@media (max-width: 640px) {
  .kt-kortene { grid-template-columns: 1fr 1fr; }
  .kt-kortet, .kt-inner { min-height: 150px; }
  .kt-fram { font-size: 15px; padding: 10px; }
  .kt-temaer { grid-template-columns: 1fr 1fr; }
  .kt-tema { min-height: 110px; padding: 10px; }
  .kt-navn { font-size: 16px; }
}
