@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800&family=Inter:wght@400;600;800&display=swap');

:root {
  --bg: #070912;
  --bg2: #0e1430;
  --card: rgba(255, 255, 255, .055);
  --line: rgba(255, 255, 255, .12);
  --text: #eef1ff;
  --muted: #9aa3c7;
  --gold: #f5c451;
  --gold2: #ffde8a;
  --ember: #ff7a3d;
  --cyan: #5ee7ff;
  --violet: #9b7bff;
  --ok: #5dffa8;
  --radius: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
/* Glødende bakgrunn + drivende gnister */
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -2;
  background:
    radial-gradient(40% 35% at 20% 10%, rgba(155, 123, 255, .28), transparent 70%),
    radial-gradient(45% 40% at 85% 25%, rgba(94, 231, 255, .16), transparent 70%),
    radial-gradient(60% 50% at 50% 110%, rgba(255, 122, 61, .22), transparent 70%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  animation: drift 18s ease-in-out infinite alternate;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff8, transparent),
    radial-gradient(1px 1px at 30% 70%, #ffd, transparent),
    radial-gradient(1.5px 1.5px at 70% 40%, #ffc76b, transparent),
    radial-gradient(1px 1px at 90% 80%, #fff, transparent),
    radial-gradient(2px 2px at 50% 50%, #ff9a5a, transparent),
    radial-gradient(1px 1px at 80% 10%, #fff, transparent);
  background-size: 260px 260px, 340px 340px, 420px 420px, 300px 300px, 520px 520px, 380px 380px;
  animation: embers 40s linear infinite;
}
@keyframes drift { to { transform: translate3d(3%, -2%, 0) scale(1.05); } }
@keyframes embers { to { background-position: 0 -1040px, 0 -1360px, 0 -1680px, 0 -1200px, 0 -2080px, 0 -1520px; } }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 80px; }

header.top { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 8px; text-align: center; }
.logo { width: 150px; height: 150px; cursor: pointer; filter: drop-shadow(0 0 24px rgba(245, 196, 81, .35)); transition: transform .2s; user-select: none; }
.logo:active { transform: scale(.94) rotate(-4deg); }
h1 {
  font-family: Cinzel, Georgia, serif; font-weight: 800; letter-spacing: .06em; margin: 4px 0 0;
  font-size: clamp(28px, 8vw, 44px);
  background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, #b9822a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(245, 196, 81, .25);
}
.wordmark { width: 170px; height: auto; opacity: .85; margin-top: -2px; }
.sub { color: var(--muted); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: #ff5d6c; box-shadow: 0 0 10px #ff5d6c; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

input[type=text] {
  width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 14px; color: var(--text);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line); outline: none;
}
input[type=text]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 196, 81, .2); }

.btn {
  font: inherit; font-weight: 800; border: 0; cursor: pointer; border-radius: 14px; padding: 14px 18px; color: #1c1405;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 8px 30px rgba(245, 196, 81, .25), inset 0 1px 0 #fff8;
  transition: transform .1s, filter .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { filter: grayscale(1) brightness(.6); cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: linear-gradient(180deg, #ff8f8f, #ff5d6c); color: #2a0508; }

/* Spørsmålskort */
.qlist { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.q {
  position: relative; border-radius: var(--radius); padding: 18px; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: reveal .7s cubic-bezier(.2, .9, .25, 1.2) both;
}
.q.open { border-color: rgba(245, 196, 81, .6); box-shadow: 0 0 0 1px rgba(245, 196, 81, .25), 0 20px 60px -20px rgba(245, 196, 81, .45); }
.q.open::before {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none; padding: 2px;
  background: conic-gradient(from var(--a, 0deg), transparent 0 70%, var(--gold) 80%, var(--ember) 88%, transparent 95%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 3.5s linear infinite;
}
@property --a { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --a: 360deg; } }
@keyframes reveal { from { opacity: 0; transform: perspective(800px) rotateX(-35deg) translateY(30px) scale(.94); filter: blur(6px); } }

.qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qnum { font-family: Cinzel, serif; font-weight: 800; font-size: 15px; color: #1c1405; background: linear-gradient(180deg, var(--gold2), var(--gold)); border-radius: 10px; padding: 4px 10px; }
.qstate { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-left: auto; }
.q.open .qstate { color: var(--gold); }
.qtext { font-size: 21px; font-weight: 800; line-height: 1.3; margin: 2px 0 16px; text-wrap: balance; }

.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opt {
  position: relative; font: inherit; color: var(--text); cursor: pointer; text-align: center;
  border-radius: 16px; padding: 12px 6px 12px; min-height: 92px; overflow: hidden;
  background: rgba(0, 0, 0, .3); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s, border-color .2s, box-shadow .2s, background .2s;
}
.opt b { font-family: Cinzel, serif; font-size: 30px; line-height: 1; }
.opt span { overflow-wrap: anywhere; hyphens: auto; font-size: 13px; color: var(--muted); line-height: 1.25; position: relative; }
.opt:not(:disabled):active { transform: scale(.95); }
.opt.picked { border-color: var(--cyan); background: rgba(94, 231, 255, .12); box-shadow: 0 0 24px rgba(94, 231, 255, .35), inset 0 0 20px rgba(94, 231, 255, .15); }
.opt.picked b { color: var(--cyan); text-shadow: 0 0 16px var(--cyan); }
.opt:disabled { cursor: default; }
.opt .bar { position: absolute; left: 0; bottom: 0; width: 100%; background: linear-gradient(0deg, rgba(155, 123, 255, .45), rgba(155, 123, 255, .08)); transition: height .9s cubic-bezier(.2, .9, .2, 1); }
.opt .pct { font-weight: 800; font-size: 14px; color: var(--text); position: relative; }
.opt b, .opt span { position: relative; }
.opt.correct { border-color: var(--gold); box-shadow: 0 0 30px rgba(245, 196, 81, .55); animation: crown 1s ease both; }
.opt.correct b { color: var(--gold); text-shadow: 0 0 18px var(--gold); }
.opt.correct::after { content: '👑'; position: absolute; top: 4px; right: 6px; font-size: 16px; }
.opt.wrong { opacity: .45; }
@keyframes crown { 30% { transform: scale(1.08); } }

.verdict { margin-top: 12px; font-weight: 800; text-align: center; font-size: 15px; }
.verdict.ok { color: var(--ok); }
.verdict.no { color: #ff8f8f; }

.fact { margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; color: var(--text); background: rgba(245, 196, 81, .1); border: 1px solid rgba(245, 196, 81, .35); animation: reveal .6s ease both; }
.fact b { color: var(--gold2); }
.waiting { text-align: center; color: var(--muted); padding: 30px 10px; }
.waiting .seal { font-size: 42px; display: block; margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); z-index: 50;
  background: rgba(20, 16, 6, .92); border: 1px solid var(--gold); color: var(--gold2); padding: 12px 18px; border-radius: 14px;
  font-weight: 600; max-width: calc(100% - 32px); text-align: center; transition: transform .35s cubic-bezier(.2, .9, .25, 1.3);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Påskeegg: Excalibur */
.excalibur { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(255, 222, 138, .35), rgba(7, 9, 18, .85) 60%); animation: fadeio 4.5s ease forwards; }
.excalibur svg { width: min(46vw, 220px); filter: drop-shadow(0 0 30px var(--gold)); animation: sword 4.5s cubic-bezier(.2, .9, .2, 1) forwards; }
.excalibur p { position: absolute; bottom: 18vh; left: 0; right: 0; text-align: center; font-family: Cinzel, serif; font-size: clamp(22px, 6vw, 40px); color: var(--gold2); text-shadow: 0 0 20px var(--gold); padding: 0 16px; animation: fadeio 4.5s ease forwards; }
@keyframes sword { 0% { transform: translateY(-120vh) rotate(180deg); } 35% { transform: translateY(0) rotate(180deg); } 45% { transform: translateY(-14px) rotate(180deg); } 100% { transform: translateY(-14px) rotate(180deg); } }
@keyframes fadeio { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.spark { position: fixed; width: 6px; height: 6px; border-radius: 50%; background: var(--gold2); box-shadow: 0 0 10px var(--gold); z-index: 101; pointer-events: none; animation: spark 1.4s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
body.legend { --cyan: #ffde8a; }
body.legend h1 { animation: shimmer 2s linear infinite; background-size: 200% 100%; background-image: linear-gradient(90deg, var(--gold), #fff6d5, var(--gold)); }
@keyframes shimmer { to { background-position: -200% 0; } }

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