:root {
  --bg: #140907;
  --panel: #22100c;
  --panel-2: #2d1611;
  --line: #4a241b;
  --text: #f6e9dc;
  --muted: #b89c8a;
  --red: #ff3b2f;
  --red-deep: #a3160f;
  --gold: #f2b84b;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }

.view { max-width: 560px; margin: 0 auto; }

.pp {
  color: var(--red);
  font-weight: 900;
  text-shadow: 0 0 8px rgba(255, 59, 47, .9), 0 0 24px rgba(255, 59, 47, .6);
  letter-spacing: -.05em;
}

.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }

/* ---------- Flikar ---------- */
.tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 6px;
  max-width: 560px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(20, 9, 7, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit; font-weight: 700;
  cursor: pointer;
}
.tab[aria-selected="true"] {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--red-deep);
}

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero img { display: block; width: 100%; height: auto; }
.hero::after {
  content: ""; position: absolute; inset: 40% 0 0 0;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.hero-text {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 0 20px 4px; text-align: center;
}
.kicker {
  text-transform: uppercase; letter-spacing: .2em;
  font-size: .75rem; color: var(--gold);
}
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 15vw, 4.6rem);
  line-height: 1; font-weight: 900;
  text-shadow: 0 2px 20px #000;
}
.tagline { color: var(--muted); font-style: italic; margin-top: 4px; }

/* ---------- Block ---------- */
.block { padding: 22px 20px; }
.block h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem; color: var(--gold); margin-bottom: 10px;
}
.lead { font-size: 1.1rem; }

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 22px;
}
.countdown div {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 4px; text-align: center;
}
.countdown b {
  display: block; font-size: 2rem; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--red);
  text-shadow: 0 0 14px rgba(255, 59, 47, .6);
}
.countdown span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.countdown.live { display: block; text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--gold); }
.when { text-align: center; margin-top: 10px; color: var(--muted); }

.dress {
  margin: 6px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--red-deep), #5c0d08);
  border: 1px solid var(--red);
}
.dress h2 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .15em; font-family: inherit; }
.dress .big { font-family: Georgia, serif; font-size: 2.4rem; font-weight: 900; line-height: 1.1; margin-bottom: 6px; }

/* ---------- Tidslinje ---------- */
.timeline { border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "+"; position: absolute; left: -11px; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); color: var(--red);
  font-weight: 900; line-height: 20px; text-align: center;
  text-shadow: 0 0 8px var(--red);
}
.timeline time { color: var(--gold); font-weight: 800; font-size: .9rem; letter-spacing: .05em; }
.timeline h3 { font-size: 1.15rem; }
.timeline p { color: var(--muted); }

.faq dt { font-weight: 800; margin-top: 14px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { color: var(--muted); }

.foot { padding: 10px 20px 40px; text-align: center; color: var(--muted); font-size: .8rem; }
.foot .btn { margin-bottom: 16px; }

/* ---------- Knappar och fält ---------- */
.btn {
  display: inline-block; width: 100%;
  padding: 15px 18px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #d9261c, var(--red-deep));
  color: #fff; font: inherit; font-weight: 800; font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 59, 47, .25);
}
.btn .pp { color: #fff; text-shadow: 0 0 10px #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); box-shadow: none; }

input[type="text"] {
  width: 100%; padding: 15px 18px; margin: 14px 0 10px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 1.1rem; text-align: center;
}
input[type="text"]:focus, .btn:focus-visible, .tab:focus-visible, .give:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.error { color: #ff8a80; min-height: 1.5em; margin-top: 8px; }

/* ---------- Leken ---------- */
.lock-pp { font-size: 5rem; line-height: 1; margin: 30px 0 10px; }

.me {
  display: flex; justify-content: space-between; align-items: center;
  margin: 10px 20px 0; padding: 14px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.me-name { font-weight: 800; font-size: 1.2rem; overflow-wrap: anywhere; }
.me-title { color: var(--gold); font-size: .9rem; }
.me-score { font-size: 2rem; font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.me-score .pp { font-size: 1.3rem; margin-left: 4px; }

.mission {
  min-height: 190px;
  display: flex; flex-direction: column; justify-content: center;
  padding: 22px 20px; text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--red-deep); border-radius: var(--radius);
  box-shadow: inset 0 0 40px rgba(255, 59, 47, .08);
}
.mission-cat { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); }
.mission-text { font-size: 1.25rem; font-weight: 700; margin: 10px 0; line-height: 1.35; }
.mission-points { color: var(--red); font-weight: 900; font-size: 1.2rem; text-shadow: 0 0 10px rgba(255, 59, 47, .7); }
.mission.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: .3; } to { transform: none; opacity: 1; } }

.actions { display: grid; gap: 10px; margin-top: 14px; }
#mission-note { min-height: 1.4em; margin-top: 8px; }

.board li {
  display: grid; grid-template-columns: 2em 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.board li:last-child { border-bottom: 0; }
.board .rank { color: var(--muted); font-weight: 800; text-align: center; }
.board li:first-child .rank { color: var(--gold); }
.board .who { min-width: 0; }
.board .name { font-weight: 700; overflow-wrap: anywhere; }
.board .title { font-size: .8rem; color: var(--muted); }
.board .score { font-weight: 900; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.board li.is-me .name { color: var(--gold); }
.give {
  min-width: 48px; min-height: 40px;
  border-radius: 999px; border: 1px solid var(--red-deep);
  background: transparent; font: inherit; cursor: pointer;
}
.give:disabled { opacity: .3; cursor: default; }
.board .empty, .feed .empty { display: block; color: var(--muted); border: 0; padding: 6px 0; }

.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.feed li:last-child { border-bottom: 0; }
.feed b { color: var(--text); }
.feed .what { color: var(--muted); }
.feed .ago { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* ---------- Toast och plusregn ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px;
  background: #fff; color: #1b0c09; font-weight: 700; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fly {
  position: fixed; z-index: 30; pointer-events: none;
  font-weight: 900; font-size: 2rem; color: var(--red);
  text-shadow: 0 0 12px var(--red);
  animation: fly 1.2s ease-out forwards;
}
@keyframes fly {
  from { transform: translateY(0) scale(.6); opacity: 1; }
  to { transform: translateY(-55vh) scale(1.6) rotate(20deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fly, .mission.pop { animation: none; }
  .fly { display: none; }
}

/* ---------- Vinnarskärmen ---------- */
.winner {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 900; line-height: 1.1;
  margin: 10px 0 6px; overflow-wrap: anywhere;
  color: #fff; text-shadow: 0 0 24px rgba(255, 59, 47, .8);
}
.final-head { margin: 28px 0 4px; color: var(--gold); font-size: 1rem; text-transform: uppercase; letter-spacing: .12em; }
.board.final { text-align: left; }
.board.final li { grid-template-columns: 2em 1fr auto; }

/* ---------- Sångbladet ---------- */
.sheet-title { margin-top: 14px; }
.song { margin-top: 26px; text-align: center; }
.song h3 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.song .mel { font-style: italic; color: var(--muted); margin-top: 2px; }
.song .lyrics { white-space: pre-line; font-size: 1.15rem; line-height: 1.7; margin-top: 8px; }
a.btn { text-decoration: none; text-align: center; }
.tab { padding: 10px 6px; white-space: nowrap; }
