:root {
  /* Grønn Jobb-paletten, hentet fra gronnjobb.no */
  --brand: #007B5F;        /* signalgrønn */
  --brand-dark: #093024;   /* mørk skoggrønn */
  --brand-deep: #04211A;   /* enda mørkere, til toppen av bakgrunnen */
  --brand-soft: #A8DBCF;   /* mint */
  --accent: #0076A5;       /* blå aksent */
  --ink: #093024;
  --paper: #F2F6F4;
  --white: #FFFFFF;
  --win: #007B5F;
  --error: #B3261E;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(9, 48, 36, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Poppins", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, var(--brand-dark) 0%, var(--brand-dark) 42%, var(--brand-soft) 42%, var(--paper) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Merkevare ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.brand__logo {
  height: 30px;
  width: auto;
  display: block;
}
.brand__tag {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, .3);
}

/* ---------- Skjermer ---------- */
.screen {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  animation: rise .35s ease both;
}
.screen[hidden] { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 8px 0 2px;
  font-weight: 800;
}
.lead {
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 8px;
  color: #3F5750;
  max-width: 30ch;
}
.fine-print {
  font-size: 13px;
  color: #6B7C77;
  margin-top: 14px;
}

.hero-cat { width: 116px; height: 116px; display: block; }

.counter {
  margin: 10px 0 0;
  font-size: 15px;
  color: #3F5750;
}
.counter strong { font-size: 20px; color: var(--brand); }

/* ---------- Skjema ---------- */
form { width: 100%; margin-top: 14px; }

.field { display: block; text-align: left; }
.field__label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 17px; /* hindrer zoom på iOS */
  padding: 14px 16px;
  border: 2px solid #C5D3CE;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 123, 95, .22);
}

.btn {
  width: 100%;
  margin-top: 16px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 15px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: var(--white); }
.btn--primary:hover { background: var(--brand-dark); }
.btn[disabled] { opacity: .55; cursor: progress; }

.error {
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 0;
}
.error[hidden] { display: none; }

/* ---------- Skrapelodd ---------- */
.ticket {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-top: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(9, 48, 36, .08);
  touch-action: none; /* så skraping ikke scroller siden */
}
.ticket__prize {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, var(--brand-soft) 0%, #DCF0EA 70%, var(--paper) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px;
}
.ticket__cat { width: 92px; height: 92px; }
.ticket__headline {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}
.ticket__sub {
  margin: 2px 0 0;
  font-size: 14px;
  color: #3F5750;
}
#scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  transition: opacity .45s ease;
}
#scratch-canvas.is-done { opacity: 0; pointer-events: none; }

/* ---------- Resultat ---------- */
.result-art { font-size: 64px; line-height: 1; }
.result-art img { width: 96px; height: 96px; }
.screen--win h1 { color: var(--brand); }

/* ---------- Venterom ---------- */
.pulse { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.dots { display: flex; gap: 8px; margin-top: 16px; }
.dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand);
  animation: blink 1.3s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-4px); }
}

.foot {
  text-align: center;
  font-size: 12px;
  color: rgba(9, 48, 36, .55);
  padding-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Admin ---------- */
.admin { max-width: 860px; }
.admin .panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  text-align: left;
}
.admin h2 { font-size: 18px; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat {
  background: var(--paper);
  border-radius: 12px;
  padding: 14px;
}
.stat__value { font-size: 28px; font-weight: 800; color: var(--brand); }
.stat__label { font-size: 13px; color: #3F5750; }
.phase-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--ink);
}
.phase-pill[data-phase="active"] { background: #C9EBDF; color: var(--brand); }
.phase-pill[data-phase="closed"] { background: #F3D9D6; color: var(--error); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions .btn { width: auto; margin-top: 0; flex: 1 1 150px; font-size: 15px; padding: 12px 18px; }
.btn--ghost { background: var(--paper); color: var(--ink); }
.btn--danger { background: #F3D9D6; color: var(--error); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid #E2EAE7; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6B7C77; }
.winner-row td { font-weight: 700; color: var(--brand); }
.empty { color: #6B7C77; font-size: 15px; margin: 6px 0 0; }
