/* Georeg mobiltest – lastes KUN med media="(max-width: 640px)" og kun når testcookie er satt.
   PC/Mac påvirkes ikke. Alle regler er i tillegg avgrenset til body.mobiltest. */
@media (max-width: 640px) {
  body.mobiltest {
    --mt-tekst: #d9e1e3;      /* dempet hvit i stedet for kritt-hvit */
    --mt-svak: #93a4a8;       /* grå sekundærtekst */
    font-family: 'Space Grotesk', system-ui, sans-serif !important;
    font-size: 14.5px !important;
    line-height: 1.45 !important;
    color: var(--mt-tekst) !important;
  }
  body.mobiltest :is(p, li, td, th, label, input, select, textarea, button, a, span, div) {
    font-family: 'Space Grotesk', system-ui, sans-serif;
  }
  /* Tall, koordinater, tider og poeng */
  body.mobiltest :is(.tall, .poeng, .mono, .ov-tall, .ov-tid, td.h, th.h, .sumkol, .koordinat, code, time) {
    font-family: 'JetBrains Mono', ui-monospace, monospace !important;
    font-size: .9em !important;
    font-weight: 400 !important;
  }
  /* Logo: tynn, ikke fet */
  body.mobiltest :is(.logo .name, .name) {
    font-family: "Smoolthan Thin", sans-serif !important;
    font-weight: 100 !important;
    font-size: 1.6rem !important;
  }
  body.mobiltest .logo img { width: 2.1rem !important; height: 2.1rem !important; }
  body.mobiltest .top { padding-top: .6rem !important; padding-bottom: .6rem !important; gap: .5rem !important; }

  /* Overskrifter: mindre og uten tung bold */
  body.mobiltest :is(h1,h2,h3,h4) { font-family: 'Space Grotesk', system-ui, sans-serif !important; }
  body.mobiltest h1, body.mobiltest .kort h1, body.mobiltest .card h1 { font-size: 1.35rem !important; font-weight: 500 !important; line-height: 1.2 !important; }
  body.mobiltest h2 { font-size: 1.1rem !important; font-weight: 500 !important; }
  body.mobiltest h3, body.mobiltest h4 { font-size: 1rem !important; font-weight: 500 !important; }
  body.mobiltest :is(strong, b, th) { font-weight: 600 !important; }

  /* Brødtekst og felt */
  body.mobiltest :is(.lead, .profilhjelp, .sideinfo, .poengoversikt li, .tilbake, .ok, .feil, .field label, .lenker a) {
    font-size: .95rem !important; line-height: 1.45 !important;
  }
  body.mobiltest :is(.lead, .profilhjelp, .sideinfo, .toppoeng, .soon, .opphavsrett) { color: var(--mt-svak) !important; }
  body.mobiltest .field { margin-top: .8rem !important; }
  body.mobiltest :is(.field input, .field textarea, .field select, .valg label) {
    font-size: 16px !important; /* 16px hindrer automatisk zoom på iPhone */
    padding: .6rem .75rem !important;
  }

  /* Knapper og meny */
  body.mobiltest .btn, body.mobiltest button { font-size: .95rem !important; font-weight: 500 !important; padding: .55rem 1rem !important; }
  body.mobiltest .meny a { font-size: .95rem !important; padding: .5rem .75rem !important; font-weight: 400 !important; }
  body.mobiltest .meny a.valgt { font-weight: 500 !important; }
  body.mobiltest .meny li + li { margin-top: .1rem !important; }

  /* Tabeller og kort: tettere */
  body.mobiltest :is(.resultattabell, table) { font-size: .85rem !important; }
  body.mobiltest :is(table td, table th) { padding: .35rem .45rem !important; }
  body.mobiltest :is(.kort, .card, .profilkort, .glass) { padding: 1rem !important; }
  body.mobiltest :is(.medlem, .resultat) { gap: 1rem !important; padding-top: .5rem !important; padding-bottom: 2rem !important; }
  body.mobiltest .wrap { padding-left: .85rem !important; padding-right: .85rem !important; }
}

/* ===== App-utseende + fiksert bunnlinje (alternativ B) ===== */
.mt-bunnlinje, .mt-skygge { display: none; }
@media (max-width: 640px) {
  body.mobiltest { background: #0f1115 !important; padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
  body.mobiltest .bg, body.mobiltest .mobil-tips { display: none !important; }

  /* Skjul gammel skrivebordstopp på alle medlemssider (oversikt, kart, undermenyer).
     Forsiden (index.html) beholder sin egen topp via .mt-forside. */
  body.mobiltest:not(.mt-forside) .top { display: none !important; }

  /* Tittel på undersider under Meny (f.eks. Mine besøk, Min profil, Etterregistrering) */
  body.mobiltest :is(.medlem, .kort) > h1,
  body.mobiltest .profilkort > h2 {
    border-left: 3.5px solid #b8f029 !important;
    padding-left: .7rem !important;
    margin-top: .4rem !important;
    margin-bottom: .8rem !important;
    font-size: 1.25rem !important;
    color: #d9e1e3 !important;
  }

  /* Kart på mobil: full høyde ned til bunnlinja når toppen er borte */
  body.mobiltest #postkart.postkart {
    height: calc(100vh - 125px) !important;
    height: calc(100dvh - 125px) !important;
    min-height: 350px !important;
  }

  /* Flate kort */
  body.mobiltest :is(.kort, .card, .profilkort, .glass) { background: #16191e !important; border: 1px solid rgba(255,255,255,.08) !important; border-radius: 12px !important; box-shadow: none !important; backdrop-filter: none !important; }

  /* Hovedmenyen som ark nedenfra på mobil */
  body.mobiltest nav[aria-label="Medlemsmeny"] {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    max-height: 75vh !important;
    overflow-y: auto !important;
    z-index: 100 !important;
    margin: 0 !important;
    background: #16191e !important;
    border-top: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 16px 16px 0 0 !important;
    transform: translateY(110%);
    transition: transform .25s ease, visibility .25s ease;
    visibility: hidden;
    padding: 1rem 1rem 1.5rem !important;
  }
  body.mobiltest.mt-meny-apen nav[aria-label="Medlemsmeny"] {
    transform: translateY(0) !important;
    visibility: visible !important;
  }
  body.mobiltest .mt-skygge:not([hidden]) {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.65) !important;
    z-index: 90 !important;
  }

  /* Bunnlinja */
  body.mobiltest .mt-bunnlinje {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #121417; border-top: 1px solid rgba(255,255,255,.08);
  }
  body.mobiltest .mt-bunnlinje :is(a, button) {
    display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none !important; border: 0 !important; padding: 0 !important; color: #93a4a8 !important;
    font-size: .7rem !important; font-weight: 400 !important; text-decoration: none; cursor: pointer;
  }
  body.mobiltest .mt-bunnlinje .aktiv, body.mobiltest.mt-meny-apen #mt-meny-knapp { color: #b8f029 !important; }
  body.mobiltest .mt-bunnlinje .aktiv svg { filter: drop-shadow(0 0 6px rgba(184,240,41,.35)); }
}

/* ===== Enkel app-lik oversikt (skisse fra app-utvikler) ===== */
.mt-oversikt { display: none; }
@media (max-width: 640px) {
  body.mobiltest .mt-oversikt { display: block; padding: .4rem .2rem 1rem; }
  /* Skjul gammel topp, velkomst, kortpiller og tips når ny oversikt finnes */
  body.mobiltest:has(.mt-oversikt) :is(.top, .medlemskort, .poengoversikt, .mobil-tips, .lead, .badge, .pille) { display: none !important; }
  body.mobiltest:has(.mt-oversikt) .medlem > :is(h1, .kort > h1) { display: none !important; }

  body.mobiltest .mt-hode { border-left: 3px solid #b8f029; padding: .1rem 0 .1rem .8rem; margin-bottom: 1.4rem; }
  body.mobiltest .mt-merke { font-family: "Typo Round", sans-serif !important; font-weight: 400 !important; font-size: 2.2rem; line-height: 1; color: #b8f029; letter-spacing: .02em; }
  body.mobiltest .mt-merke span { font-family: inherit !important; font-size: .55em; color: #b8f029; }
  body.mobiltest .mt-id { font-family: 'JetBrains Mono', monospace !important; font-size: .85rem; color: #d9e1e3; margin-top: .6rem; }
  body.mobiltest .mt-meta { font-size: .85rem; color: #93a4a8; margin-top: .35rem; line-height: 1.4; }

  body.mobiltest .mt-kort { background: #16191e; border: 1px solid rgba(255,255,255,.06); border-left: 3px solid #b8f029; border-radius: 4px; padding: .8rem .95rem; margin-bottom: .7rem; }
  body.mobiltest .mt-kort h3 { margin: 0 0 .2rem; font-size: 1rem !important; font-weight: 500 !important; color: #d9e1e3; }
  body.mobiltest .mt-kort p { margin: 0; font-size: .85rem !important; color: #93a4a8; }
  body.mobiltest .mt-tall { font-family: 'JetBrains Mono', monospace !important; color: #d9e1e3; }
  body.mobiltest .mt-kort a { display: inline-block; margin-top: .45rem; font-size: .85rem !important; color: #b8f029 !important; text-decoration: underline; text-underline-offset: 3px; }
  body.mobiltest .mt-svak { color: #93a4a8 !important; font-size: .8rem !important; }
}

/* ===== Forside (index.html) – kun mobiltest + mobil (balansert) ===== */
@media (max-width: 640px) {
  body.mobiltest.mt-forside {
    background: #0f1115 !important;
    padding-bottom: .6rem !important;
    box-sizing: border-box !important;
  }
  body.mobiltest.mt-forside .bg,
  body.mobiltest.mt-forside .scroll-hint { display: none !important; }

  /* Topp med GEOREG og lime-stolpe */
  body.mobiltest.mt-forside .top {
    border-left: 3.5px solid #b8f029;
    margin: .8rem 1rem .3rem !important;
    padding: .15rem 0 .15rem .75rem !important;
    background: none !important;
  }
  body.mobiltest.mt-forside .logo img { display: none !important; }
  body.mobiltest.mt-forside .logo .name {
    font-family: "Typo Round", sans-serif !important;
    font-weight: 400 !important;
    font-size: 2.1rem !important;
    color: #b8f029 !important;
    letter-spacing: .02em;
    line-height: 1;
  }

  /* Tittel */
  body.mobiltest.mt-forside .hero { padding: 0 1rem !important; display: block !important; min-height: 0 !important; }
  body.mobiltest.mt-forside .hero h1 {
    font-size: 1.25rem !important;
    font-weight: 500 !important;
    color: #d9e1e3 !important;
    margin: .4rem 0 .7rem !important;
    line-height: 1.25 !important;
  }
  body.mobiltest.mt-forside .hero h1 em { font-style: normal; color: #b8f029; }
  body.mobiltest.mt-forside .lead:empty { display: none; }

  /* Store knapper i full bredde (app-aktig, men strammet inn noen piksler) */
  body.mobiltest.mt-forside .cta {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: .5rem;
  }
body.mobiltest.mt-forside .cta .btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 46px; /* Justert fra 54px til 46px */
    border-radius: 3px !important;
    font-size: .98rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
  }
  body.mobiltest.mt-forside .cta .btn.solid { background: #b8f029 !important; color: #0f1115 !important; border: 0 !important; }
  body.mobiltest.mt-forside .cta .btn.ghost { background: #16191e !important; color: #d9e1e3 !important; border: 1px solid #2a3038 !important; }

  /* Kartflate: 175px (sparer 45px, men beholder god oversikt) */
  body.mobiltest.mt-forside .glass {
    background: #16191e !important;
    border: 0 !important;
    border-left: 3.5px solid #b8f029 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    margin-top: .7rem !important;
    padding: .65rem .8rem !important;
  }
  body.mobiltest.mt-forside .glass h2 {
    font-size: .78rem !important;
    font-weight: 500 !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #93a4a8 !important;
    margin: 0 0 .35rem !important;
  }
  body.mobiltest.mt-forside .dot { display: none !important; }
  body.mobiltest.mt-forside .map { height: 175px !important; border-radius: 3px; }
  body.mobiltest.mt-forside #sist-post {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: .8rem !important;
    color: #d9e1e3 !important;
    margin: .45rem 0 0 !important;
    line-height: 1.3;
  }

  /* Nøkkeltall: rene og fullt synlige */
  body.mobiltest.mt-forside .stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: .45rem;
    padding: 0 1rem !important;
    margin-top: .6rem !important;
  }
  body.mobiltest.mt-forside .stats article {
    background: #16191e !important;
    border: 0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    padding: .55rem .5rem !important;
    text-align: left;
  }
  body.mobiltest.mt-forside .stats h2 {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: #b8f029 !important;
    margin: 0 !important;
  }
  body.mobiltest.mt-forside .stats p {
    font-size: .68rem !important;
    color: #93a4a8 !important;
    margin: .15rem 0 0 !important;
    line-height: 1.2;
  }
}
/* 1. Felles app-header for åpne sider (forside, logg inn, glemt passord) */
body.mobiltest:not(:has(.medlem, .resultat)) .top {
  display: flex !important;
  border-left: 3.5px solid #b8f029 !important;
  margin: .8rem 1rem .5rem !important;
  padding: .15rem 0 .15rem .75rem !important;
  background: none !important;
  border-top: none !important;
  border-right: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

body.mobiltest:not(:has(.medlem, .resultat)) .logo {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Skjul gammelt bilde-ikon, vis GEOREG i lime med Typo Round */
body.mobiltest:not(:has(.medlem, .resultat)) .logo img {
  display: none !important;
}

body.mobiltest:not(:has(.medlem, .resultat)) .logo .name {
  font-family: "Typo Round", sans-serif !important;
  font-weight: 400 !important;
  font-size: 2.1rem !important;
  color: #b8f029 !important;
  letter-spacing: .02em;
  line-height: 1;
}
body.mobiltest .logo .name span {
  font-size: 0.55em !important;
  text-transform: lowercase !important;
  letter-spacing: .02em !important;
  font-family: inherit !important;
}
/* 2. Skjul toppen inne i medlemsområdet og resultatlistene (der bunnlinja styrer) */
body.mobiltest:has(.medlem, .resultat, .mt-oversikt) .top {
  display: none !important;
}

/* 3. Innloggingsskjemaet på mobil (rent og mørkt) */
body.mobiltest .card {
  background: #16191e !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
body.mobiltest .field input {
  background: #121417 !important;
  border: 1px solid #2a3038 !important;
  color: #d9e1e3 !important;
}
body.mobiltest .card .btn.solid {
  background: #b8f029 !important;
  color: #0f1115 !important;
  font-weight: 600 !important;
  border-radius: 3px !important;
}

