/* Gjennomgangsskjermen. Fargetokener er definert i app.css. */

.gj-rot {
  display: flex;
  flex-direction: column;
  min-height: 0; /* høyden kommer fra .skjerm.arbeid i app.css */
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--tekst);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  position: relative;
}
.gj-rot [hidden] { display: none !important; }

.gj-video {
  flex: 0 1 32dvh;
  min-height: 100px;
  background: #000;
  display: flex;
  justify-content: center;
}
.gj-video video {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.gj-panel { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; }

.gj-topp {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--flate);
}
.gj-tellere { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.gj-antall { color: var(--tekst); }
.gj-usikre-antall { color: var(--usikker); }
.gj-usikre-antall.ingen { color: var(--ok); }

.gj-knapp {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--flate2);
  color: var(--tekst);
  font: inherit;
  font-size: 14px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.gj-knapp:active:not(:disabled) { filter: brightness(1.3); }
.gj-knapp:disabled { opacity: 0.35; }
.gj-knapp.gj-fare { color: var(--fare); }
.gj-knapp.gj-primaer { background: var(--aksent); color: #111; font-weight: 600; }
.gj-usikre-knapp { border: 1px solid var(--usikker); color: var(--usikker); }

.gj-ordomrade {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px;
}
.gj-pluss {
  min-width: 40px;
  min-height: 28px;
  margin-bottom: 4px;
  border: 1px dashed var(--dempet);
  border-radius: 10px;
  background: transparent;
  color: var(--dempet);
  font: inherit;
  touch-action: manipulation;
}
.gj-ordliste { display: flex; flex-wrap: wrap; gap: 6px; }

.gj-brikke {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 40px;
  max-width: 100%;
  padding: 4px 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--flate2);
  color: var(--tekst);
  font: inherit;
  font-size: 17px;
  line-height: 1.15;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.gj-tekst { overflow-wrap: anywhere; }
.gj-tid { font-size: 10px; color: var(--dempet); }
.gj-brikke.usikker { border-color: var(--usikker); background: rgba(255, 176, 32, 0.16); }
.gj-brikke.endret { box-shadow: inset 0 -3px 0 var(--ok); }
.gj-brikke.spilles { background: var(--flate); outline: 2px solid var(--ok); }
.gj-brikke.valgt { border-color: var(--aksent); background: rgba(250, 230, 122, 0.18); }

.gj-banner {
  flex: 0 0 auto;
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(90, 209, 122, 0.14);
  border: 1px solid var(--ok);
  color: var(--ok);
  font-size: 14px;
}

.gj-verktoy {
  flex: 0 0 auto;
  padding: 8px 12px 4px;
  background: var(--flate);
}
.gj-verktoyrad { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.gj-verktoyrad .gj-knapp { flex: 1 1 auto; padding: 0 8px; font-size: 13px; }

.gj-bunn {
  flex: 0 0 auto;
  padding: 8px 12px calc(8px + var(--sikker-bunn));
  background: var(--flate);
}
.gj-stor {
  display: block;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  touch-action: manipulation;
}
.gj-godkjenn { background: var(--ok); color: #0b1a10; }
.gj-tilbake { background: var(--flate2); color: var(--tekst); }

/* Bunnark for retting og innsetting */
.gj-ark-bakgrunn {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
}
.gj-ark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px calc(16px + var(--sikker-bunn));
  border-radius: 18px 18px 0 0;
  background: var(--flate);
  box-sizing: border-box;
}
.gj-ark-tittel { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.gj-ark-hint { font-size: 13px; color: var(--dempet); margin-bottom: 10px; }
.gj-felt {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--flate2);
  border-radius: 12px;
  background: var(--bg);
  color: var(--tekst);
  font: inherit;
  font-size: 16px; /* 16 px hindrer innzoom i Safari */
}
.gj-felt:focus { outline: 2px solid var(--aksent); border-color: transparent; }
.gj-ark-rad { display: flex; gap: 8px; margin-top: 12px; }
.gj-ark-rad .gj-knapp { flex: 1; min-height: 48px; }

/* Liggende telefon: video til venstre, panelet til høyre (etter grunnreglene den overstyrer) */
@media (orientation: landscape) and (max-height: 540px) {
  .gj-rot { flex-direction: row; }
  .gj-video { flex: 0 0 auto; max-width: 40%; padding-bottom: var(--sikker-bunn); }
  .gj-video video { width: auto; }
  .gj-verktoy { padding-top: 4px; }
  .gj-verktoyrad { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 4px; }
  .gj-stor { min-height: 44px; }
  /* lite høyde: hele panelet ruller, bunnknappene ligger fast nederst */
  .gj-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .gj-ordomrade { flex: none; min-height: auto; overflow: visible; }
  .gj-bunn { position: sticky; bottom: 0; z-index: 3; }
}
