:root {
  --bg: #0a0f1e;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eef2ff;
  --muted: #94a0bf;
  --green: #5ef2b5;
  --teal: #4cc9f0;
  --violet: #9b7bff;
  --yellow: #ffd166;
  --red: #ff6b81;
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --display: "Sora", var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* northern lights backdrop */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .32;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 60vw; height: 40vh; left: -10vw; top: -12vh; background: var(--green); }
.aurora span:nth-child(2) { width: 50vw; height: 38vh; right: -12vw; top: -6vh; background: var(--violet); animation-delay: -8s; }
.aurora span:nth-child(3) { width: 46vw; height: 30vh; left: 28vw; top: 4vh; background: var(--teal); opacity: .18; animation-delay: -14s; }
@keyframes drift { to { transform: translate(6vw, 5vh) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .aurora span { animation: none; } }

/* header */
.top {
  width: 100%; max-width: 640px; padding: 20px 16px 8px;
  display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center;
}
.brand { text-align: center; min-width: 0; }
.brand h1, .brand p { white-space: nowrap; }
.brand h1 {
  margin: 0; font: 800 clamp(22px, 7.6vw, 40px)/1 var(--display); letter-spacing: -.02em;
}
.brand h1 span {
  background: linear-gradient(120deg, var(--green), var(--teal), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { margin: 6px 0 0; color: var(--muted); font-size: clamp(9px, 3vw, 13px); letter-spacing: .06em; text-transform: uppercase; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; font-weight: 700; font-size: 18px;
  transition: background .15s;
}
.icon-btn:hover { background: var(--panel-2); }

/* mode tabs */
.modes {
  width: 100%; max-width: 640px; padding: 14px 16px 0;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.modes::-webkit-scrollbar { display: none; }
.modes button {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-weight: 600; font-size: 14px; white-space: nowrap; transition: all .15s;
}
.modes button:hover { color: var(--text); }
.modes button.active {
  color: #06121a; border-color: transparent;
  background: linear-gradient(120deg, var(--green), var(--teal));
}

/* game column */
.game { width: 100%; max-width: 560px; padding: 16px; flex: 1; }
.round-label { margin: 6px 0 14px; text-align: center; color: var(--muted); font-size: 13px; min-height: 20px; }

/* snippet stages */
.stages { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.stages li { flex: 1; text-align: center; }
.stages .bar {
  height: 10px; border-radius: 6px; background: var(--panel-2); overflow: hidden; position: relative;
}
.stages .fill {
  position: absolute; inset: 0; width: 0;
  background: linear-gradient(90deg, var(--green), var(--teal));
}
.stages li.open .bar { background: rgba(94, 242, 181, .22); }
.stages li.bad .bar { box-shadow: inset 0 0 0 2px var(--red); }
.stages li.skip .bar { box-shadow: inset 0 0 0 2px #5b6584; }
.stages li.close .bar { box-shadow: inset 0 0 0 2px var(--yellow); }
.stages li.good .bar { box-shadow: inset 0 0 0 2px var(--green); }
.stages small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stages li.open small { color: var(--text); font-weight: 600; }

/* player */
.player { display: flex; flex-direction: column; align-items: center; margin: 26px 0 18px; }
.play {
  position: relative; width: 132px; height: 132px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.1), rgba(255,255,255,.02));
  display: grid; place-items: center; transition: transform .15s;
}
.play:hover:not(:disabled) { transform: scale(1.04); }
.play:active:not(:disabled) { transform: scale(.97); }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: var(--panel-2); }
.ring-fg { stroke: url(#g); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; }
.glyph { width: 46px; height: 46px; color: var(--green); }
.pause-glyph, .spinner { display: none; }
.play.playing .play-glyph { display: none; }
.play.playing .pause-glyph { display: block; }
.play.loading .play-glyph { display: none; }
.play.loading .spinner {
  display: block; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--panel-2); border-top-color: var(--green); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.play-label { margin: 10px 0 0; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.volume { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); }
.volume input { width: 120px; accent-color: var(--green); }

/* guessing */
.search {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); color: var(--muted); transition: border-color .15s;
}
.search:focus-within { border-color: var(--teal); }
.search input {
  flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent;
  color: var(--text); font: 500 16px var(--font);
}
.search input::placeholder { color: var(--muted); }
.suggestions {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 10;
  list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow-y: auto;
  background: #141b31; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0,0,0,.45); display: none;
}
.suggestions.show { display: block; }
.suggestions li {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column;
}
.suggestions li small { color: var(--muted); font-size: 13px; }
.suggestions li.active, .suggestions li:hover { background: var(--panel-2); }
.suggestions .empty { color: var(--muted); cursor: default; }
.suggestions mark { background: none; color: var(--green); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.btn {
  height: 48px; white-space: nowrap; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line);
  font-weight: 700; font-size: 15px; transition: filter .15s, background .15s;
}
.btn.ghost { background: var(--panel); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); }
.btn.primary { border: 0; color: #06121a; background: linear-gradient(120deg, var(--green), var(--teal)); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.wide { width: 100%; margin-top: 8px; }
.link-btn {
  display: block; margin: 14px auto 0; background: none; border: 0;
  color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--red); }

/* guesses list */
.guesses { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; }
.guesses li {
  min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); display: flex; align-items: center; gap: 10px; font-size: 14px;
}
.guesses li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guesses li .tag { font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.guesses li.bad { border-color: rgba(255,107,129,.45); }
.guesses li.bad .tag { color: var(--red); }
.guesses li.close { border-color: rgba(255,209,102,.5); }
.guesses li.close .tag { color: var(--yellow); }
.guesses li.good { border-color: rgba(94,242,181,.6); background: rgba(94,242,181,.08); }
.guesses li.good .tag { color: var(--green); }
.guesses li.skip { color: var(--muted); }
.guesses li.empty { border-style: dashed; background: transparent; }

/* result card */
.result {
  display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center;
  padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line);
  animation: pop .35s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.cover { width: 112px; height: 112px; border-radius: 12px; object-fit: cover; background: var(--panel-2); }
.result-text { min-width: 0; }
.verdict { margin: 0; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.verdict.win { color: var(--green); }
.verdict.lose { color: var(--red); }
.result h2 { margin: 4px 0 0; font: 700 22px/1.2 var(--display); overflow-wrap: anywhere; }
.answer-artist { margin: 2px 0 8px; color: var(--muted); }
.apple { color: var(--teal); font-size: 13px; font-weight: 600; text-decoration: none; }
.apple:hover { text-decoration: underline; }
.result-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result.single .result-actions { grid-template-columns: 1fr; }
.countdown { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.countdown:empty { display: none; }

.streak { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.foot { max-width: 560px; padding: 24px 16px 28px; text-align: center; color: #66708f; font-size: 12px; }

/* dialogs */
.dlg {
  width: min(440px, calc(100vw - 32px)); padding: 24px; border-radius: 22px;
  border: 1px solid var(--line); background: #10172b; color: var(--text);
}
.dlg::backdrop { background: rgba(3, 6, 15, .7); backdrop-filter: blur(4px); }
.dlg h2 { margin: 0 0 14px; font: 700 20px var(--display); }
.dlg h2.sub { margin-top: 22px; }
.dlg h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dlg .x-btn {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--panel); font-size: 22px; line-height: 1;
}
.how { padding-left: 20px; margin: 0 0 14px; display: grid; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sq { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.sq.good { background: var(--green); } .sq.close { background: var(--yellow); }
.sq.bad { background: var(--red); } .sq.skip { background: #5b6584; }
.muted { color: var(--muted); font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat-grid div { padding: 10px 4px; border-radius: 12px; background: var(--panel); }
.stat-grid b { display: block; font: 700 22px var(--display); }
.stat-grid span { font-size: 11px; color: var(--muted); }
.dist { display: grid; gap: 5px; }
.dist .row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.dist .b {
  min-width: 26px; padding: 2px 8px; border-radius: 6px; text-align: right; font-weight: 700;
  background: var(--panel-2); color: var(--text);
}
.dist .b.hi { background: linear-gradient(90deg, var(--green), var(--teal)); color: #06121a; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 420px) {
  .result { grid-template-columns: 84px 1fr; }
  .cover { width: 84px; height: 84px; }
  .result h2 { font-size: 19px; }
  .stages small { font-size: 11px; }
}

/* daily quiz progress */
.day-dots { list-style: none; margin: -4px 0 16px; padding: 0; display: flex; justify-content: center; gap: 8px; }
.day-dots li {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 700 14px var(--display); color: var(--muted); background: var(--panel); border: 1px solid var(--line);
}
.day-dots li.cur { color: var(--text); border-color: var(--teal); box-shadow: 0 0 0 3px rgba(76,201,240,.18); }
.day-dots li.good { color: #06121a; background: var(--green); border-color: transparent; }
.day-dots li.bad { color: #fff; background: rgba(255,107,129,.75); border-color: transparent; }

/* daily summary */
.summary {
  padding: 22px 18px 18px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  text-align: center; animation: pop .35s ease;
}
.sum-head { margin: 0; font: 800 26px/1.2 var(--display); }
.sum-score { margin: 6px 0 16px; color: var(--muted); font-size: 16px; }
.sum-score b { color: var(--text); font-size: 20px; }
.sum-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; text-align: left; }
.sum-list li {
  display: grid; grid-template-columns: 52px 1fr 40px; gap: 12px; align-items: center;
  padding: 8px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.sum-list li.good { border-color: rgba(94,242,181,.45); }
.sum-list li.bad { border-color: rgba(255,107,129,.35); }
.sum-list img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--panel-2); }
.sum-list div { min-width: 0; display: flex; flex-direction: column; }
.sum-list b, .sum-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-list b { font-size: 15px; }
.sum-list span { color: var(--muted); font-size: 13px; }
.sum-list i { display: flex; gap: 3px; margin-top: 5px; }
.sum-list em { width: 12px; height: 12px; border-radius: 3px; background: var(--panel-2); }
.sum-list em.good { background: var(--green); } .sum-list em.close { background: var(--yellow); }
.sum-list em.bad { background: var(--red); } .sum-list em.skip { background: #5b6584; }
.replay {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--green); font-size: 14px;
}
.replay:hover { background: var(--panel-2); }
.share-big { display: flex; align-items: center; justify-content: center; gap: 8px; height: 54px; font-size: 16px; }
.summary .countdown { margin-top: 14px; }

/* sponsor (same Ferðapakki HTML5 banners as the Puls Media campaign) */
.sponsor { position: relative; width: 300px; margin: 30px auto 0; }
.sponsor iframe { display: block; width: 300px; height: 250px; border: 0; border-radius: 12px; overflow: hidden; background: #0F172A; }
.ad-label {
  position: absolute; top: -9px; left: 12px; z-index: 1; padding: 1px 8px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
}

/* cookie consent */
.foot a { color: inherit; text-underline-offset: 3px; }
.consent {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  width: min(520px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 18px;
  background: #141b31; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0,0,0,.5);
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; font-size: 13px;
}
.consent p { margin: 0; color: #c9d2e8; }
.consent-btns { display: flex; gap: 8px; }
.consent .btn { height: 40px; font-size: 14px; padding: 0 14px; }
@media (max-width: 480px) {
  .consent { grid-template-columns: 1fr; }
  .consent-btns .btn { flex: 1; }
}
