:root {
  --finn-blue: #0063FB;
  --finn-blue-dark: #0052D4;
  --denim: #011E41;
  --aqua: #B6F0FF;
  --sand: #F4F2EE;
  --white: #FFFFFF;
  --win: #1E7B4B;
  --error: #C8331F;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(1, 30, 65, .18);
}

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

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

body {
  font-family: "FINN Type", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color: var(--denim);
  background: linear-gradient(170deg, var(--finn-blue) 0%, var(--finn-blue) 42%, var(--aqua) 42%, var(--sand) 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: baseline;
  gap: 10px;
  margin-bottom: 18px;
}
.brand__logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--white);
}
.brand__tag {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
}

/* ---------- 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: #3B4A5C;
  max-width: 30ch;
}
.fine-print {
  font-size: 13px;
  color: #6B7785;
  margin-top: 14px;
}

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

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

/* ---------- 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 #C3CBD5;
  border-radius: 12px;
  background: var(--white);
  color: var(--denim);
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--finn-blue);
  box-shadow: 0 0 0 3px rgba(0, 99, 251, .2);
}

.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(--finn-blue); color: var(--white); }
.btn--primary:hover { background: var(--finn-blue-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(1, 30, 65, .08);
  touch-action: none; /* så skraping ikke scroller siden */
}
.ticket__prize {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, var(--aqua) 0%, #E6F8FF 70%, var(--sand) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px;
}
.ticket__cat { width: 96px; height: 96px; }
.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: #3B4A5C;
}
#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; }
.screen--win h1 { color: var(--win); }

/* ---------- 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(--finn-blue);
  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(1, 30, 65, .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(--sand);
  border-radius: 12px;
  padding: 14px;
}
.stat__value { font-size: 28px; font-weight: 800; color: var(--finn-blue); }
.stat__label { font-size: 13px; color: #3B4A5C; }
.phase-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--aqua);
  color: var(--denim);
}
.phase-pill[data-phase="active"] { background: #D6F4E3; color: var(--win); }
.phase-pill[data-phase="closed"] { background: #F6D9D4; 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(--sand); color: var(--denim); }
.btn--danger { background: #F6D9D4; color: var(--error); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid #E5E8EC; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6B7785; }
.winner-row td { font-weight: 700; color: var(--win); }
.empty { color: #6B7785; font-size: 15px; margin: 6px 0 0; }
