/* Solborg Quiz – papir, blekk og fire farger. */
:root {
  --paper: #f4efe6;
  --paper-2: #ebe3d4;
  --card: #fffdf8;
  --ink: #1d1b18;
  --ink-soft: #5c564c;
  --line: #d9cfbd;
  --a: #2b4c7e; /* indigo */
  --b: #c8553d; /* rødoransje */
  --c: #4f7a46; /* matcha */
  --d: #b8892a; /* oker */
  --a-soft: #dfe6f0;
  --b-soft: #f5ddd6;
  --c-soft: #dfe9dc;
  --d-soft: #f3e7cc;
  --good: #4f7a46;
  --bad: #b23a2a;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 0 rgba(29, 27, 24, .06), 0 6px 18px -8px rgba(29, 27, 24, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* svak papirstruktur */
  background-image:
    radial-gradient(rgba(29, 27, 24, .035) 1px, transparent 1px),
    radial-gradient(rgba(29, 27, 24, .025) 1px, transparent 1px);
  background-size: 22px 22px, 13px 13px;
  background-position: 0 0, 7px 9px;
  min-height: 100dvh;
}
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 2rem; margin: 0 0 .4em; }
h2 { font-size: 1.5rem; margin: 0 0 .5em; }
h3 { font-size: 1.15rem; margin: 0 0 .4em; }
a { color: var(--a); }
.muted { color: var(--ink-soft); }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.error { color: var(--bad); font-weight: 600; }

/* ---- Merkevare */
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; margin: 0; letter-spacing: -.02em; }
.brand em { font-style: italic; color: var(--b); }
.brand-dots { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.brand-dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.brand-dots i:nth-child(1) { background: var(--a); }
.brand-dots i:nth-child(2) { background: var(--b); }
.brand-dots i:nth-child(3) { background: var(--c); }
.brand-dots i:nth-child(4) { background: var(--d); }

/* ---- Skjema */
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px;
  outline: none; width: 100%;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--a); box-shadow: 0 0 0 3px var(--a-soft); }

.btn {
  font: inherit; font-weight: 700; border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 10px 20px; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .08s ease, box-shadow .15s ease, background .15s;
  box-shadow: 0 3px 0 var(--ink);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.big { font-size: 1.25rem; padding: 14px 32px; min-height: 58px; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 6px 14px; min-height: 36px; font-size: .9rem; box-shadow: 0 2px 0 var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); box-shadow: 0 2px 0 var(--bad); }

.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 20px; box-shadow: 4px 4px 0 var(--ink); }

/* ---- Enkel side (innlogging) */
body.simple { display: grid; place-items: center; padding: 16px; }
.simple-card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 28px; max-width: 420px; width: 100%; box-shadow: 6px 6px 0 var(--ink); }
.simple-card .brand { margin-bottom: 16px; }

/* ---- Svarkort A–D */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer {
  --col: var(--a); --soft: var(--a-soft);
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--col); color: #fffdf8; border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 14px 16px; font: inherit; font-weight: 700; text-align: left; min-height: 84px;
  box-shadow: 0 5px 0 var(--ink); transition: transform .12s ease, opacity .3s, filter .3s, box-shadow .12s;
  cursor: pointer; overflow: hidden;
}
.answer[data-i="1"] { --col: var(--b); --soft: var(--b-soft); }
.answer[data-i="2"] { --col: var(--c); --soft: var(--c-soft); }
.answer[data-i="3"] { --col: var(--d); --soft: var(--d-soft); }
.answer .letter {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: #fffdf8; color: var(--col); display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.6rem; font-weight: 700; border: 2px solid var(--ink);
}
.answer .txt { flex: 1; font-size: 1.1rem; line-height: 1.25; overflow-wrap: anywhere; }
button.answer:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
button.answer:not(:disabled):active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.answer:disabled { cursor: default; }
.answer.dim { opacity: .28; filter: grayscale(.6); }
.answer.chosen { outline: 4px solid var(--ink); outline-offset: 3px; }
.answer.correct { transform: scale(1.03); box-shadow: 0 6px 0 var(--ink), 0 0 0 6px var(--paper), 0 0 0 9px var(--col); }
.answer .check { position: absolute; right: 12px; top: 50%; translate: 0 -50%; font-size: 2rem; display: none; }
.answer.correct .check { display: block; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }

/* ---- Tidslinje */
.timebar { height: 12px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.timebar > i { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; }
.timebar.low > i { background: var(--b); }

/* ---- Stempel (Riktig / Feil) */
.stamp {
  display: inline-block; font-family: var(--serif); font-weight: 800; font-size: 3rem; letter-spacing: .04em;
  padding: 6px 26px; border: 6px double currentColor; border-radius: 12px; rotate: -8deg;
  text-transform: uppercase; line-height: 1.1;
  animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1) both;
  mix-blend-mode: multiply;
}
.stamp.good { color: var(--good); }
.stamp.bad { color: var(--bad); rotate: 6deg; }
.stamp.none { color: var(--ink-soft); }

@keyframes stamp {
  0% { transform: scale(2.6); opacity: 0; }
  60% { transform: scale(.92); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-1deg); }
  40% { transform: translateX(9px) rotate(1deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-4deg); } 50% { transform: scale(1.15) rotate(4deg); } }
.shake { animation: shake .5s ease; }
.fade-up { animation: fadeUp .4s ease both; }

/* ---- Venteprikker */
.dots { display: inline-flex; gap: 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; display: block; animation: bob 1.1s ease-in-out infinite; border: 2px solid var(--ink); }
.dots i:nth-child(1) { background: var(--a); }
.dots i:nth-child(2) { background: var(--b); animation-delay: .12s; }
.dots i:nth-child(3) { background: var(--c); animation-delay: .24s; }
.dots i:nth-child(4) { background: var(--d); animation-delay: .36s; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 8px 6px 14px; font-weight: 700; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
.chip.off { opacity: .45; border-style: dashed; }
.chip button { border: 0; background: var(--paper-2); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--ink); }
.chip button:hover { background: var(--b); color: #fff; }

.streak { display: inline-flex; align-items: center; gap: 6px; background: var(--d-soft); border: 2px solid var(--d); color: #6b4e10; border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.streak .fire { display: inline-block; animation: flame .7s ease-in-out infinite; }

/* ---- Konfetti */
.fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100vw; height: 100vh; }

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