:root {
  --kite: #f2544a;
  --kite-dark: #c23b3f;
  --kite-accent: #ffc94a;
  --ink: #1a2947;
  --ink-soft: rgba(26, 41, 71, 0.68);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --shadow: 0 12px 32px rgba(18, 36, 78, 0.18), 0 2px 6px rgba(18, 36, 78, 0.08);
  --bg-bred: url("img/vejr/neutral-bred.jpg");
  --bg-hoej: url("img/vejr/neutral-hoej.jpg");
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Om natten: mørke glaskort og lys tekst */
:root[data-night="true"] {
  --ink: #f3f5ff;
  --ink-soft: rgba(243, 245, 255, 0.72);
  --glass: rgba(22, 30, 66, 0.58);
  --glass-strong: rgba(28, 38, 80, 0.86);
  --glass-edge: rgba(170, 190, 255, 0.28);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

/* Intet må stikke ud til siden – ellers kan siden skubbes frem og tilbage på iPhone */
html, body { overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #8fb7e8;
}

/* Vejr-baggrunden ligger fast bag alt (background-attachment: fixed virker ikke på iPhone) */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  /* Fast højde: baggrunden skal ikke hoppe, når Safaris adresselinje glider ind og ud */
  height: 100vh;
  height: 100lvh;
  z-index: -2;
  background: var(--bg-bred) center bottom / cover no-repeat;
  transition: background-image 0.8s;
}
@media (max-aspect-ratio: 1/1) {
  body::before { background-image: var(--bg-hoej); }
}

main {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(48px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

h1 { font-size: 3.2rem; font-weight: 900; margin: 0; text-align: center; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; margin: 0 0 6px; }
.tagline {
  text-align: center; font-size: 1.15rem; font-weight: 600; margin: -6px 0 0;
  color: #fff; text-shadow: 0 1px 8px rgba(10, 25, 60, 0.45);
}
.center { text-align: center; }
.small { font-size: 0.85rem; }
.muted { opacity: 0.7; }
.on-sky { color: #fff; text-shadow: 0 1px 6px rgba(10, 25, 60, 0.5); }

.logo-word { display: block; width: min(320px, 82%); margin: 0 auto; filter: drop-shadow(0 6px 14px rgba(15, 30, 70, 0.25)); }

/* ---------- Glaskort ---------- */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rules li { display: flex; gap: 12px; align-items: center; font-weight: 500; }
.rules li img { width: 34px; height: 34px; object-fit: contain; flex: none; }

/* ---------- Knapper ---------- */
button {
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 20px;
  padding: 16px 22px;
  color: #fff;
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  /* Dragestof fra Higgsfield + farveforløb + lys kant øverst */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%),
    url("img/ui/stof.jpg") center / cover,
    linear-gradient(180deg, #ff7a5c, var(--kite));
  background-blend-mode: normal, soft-light, normal;
  box-shadow: 0 5px 0 var(--kite-dark), 0 10px 22px rgba(194, 59, 63, 0.35);
  text-shadow: 0 1px 2px rgba(120, 20, 20, 0.35);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}
button img { width: 28px; height: 28px; object-fit: contain; margin: -4px 0; }
button:hover { filter: brightness(1.06) saturate(1.05); }
button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--kite-dark), 0 4px 10px rgba(194, 59, 63, 0.3); }
button:disabled { filter: grayscale(0.5) opacity(0.7); cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--kite-accent); outline-offset: 3px; }

button.secondary {
  background: var(--glass-strong);
  color: var(--ink);
  text-shadow: none;
  border: 1px solid var(--glass-edge);
  box-shadow: 0 4px 0 rgba(26, 41, 71, 0.15), 0 8px 18px rgba(18, 36, 78, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
button.secondary:active { box-shadow: 0 1px 0 rgba(26, 41, 71, 0.15); }
button.ghost { background: none; box-shadow: none; color: var(--ink); text-shadow: none; font-size: 0.95rem; padding: 8px; }

input[type="text"], input[type="password"] {
  font: inherit;
  font-size: 1.35rem;
  font-weight: 600;
  width: 100%;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 16px 18px;
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: inset 0 2px 6px rgba(18, 36, 78, 0.1);
}
input::placeholder { color: var(--ink-soft); font-weight: 500; }
input:focus { border-color: var(--kite-accent); outline: none; }

/* ---------- Drage ---------- */
.kite {
  width: 78px; height: auto; display: block;
  filter: drop-shadow(0 6px 8px rgba(20, 30, 60, 0.3));
  animation: sway 1.6s ease-in-out infinite alternate;
  transform-origin: 50% 0;
}
@keyframes sway { from { transform: rotate(-4deg) translateY(3px); } to { transform: rotate(4deg) translateY(-3px); } }
.hero-kite { display: flex; justify-content: center; margin-top: 8px; }
.hero-kite .kite { width: 116px; }

/* ---------- Himmel med højdemåler ---------- */
.sky {
  position: relative;
  height: 260px;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  background: #0d1a4d url("img/himmel-hoej.jpg") center / 100% 100% no-repeat;
}
.sky.tall { height: 440px; }
.sky .ground { display: none; }
.sky .mark {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  transform: translateY(-50%);
  opacity: 0.8;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.sky .mark::before { content: ""; width: 10px; height: 1.5px; background: currentColor; }
.sky .mark span { background: rgba(16, 28, 66, 0.45); padding: 2px 8px; border-radius: 999px; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sky .mark img { width: 28px; height: 22px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.sky .mark.reached { opacity: 1; }
.sky .mark.reached span { background: rgba(242, 84, 74, 0.85); }
.sky .flyer {
  position: absolute;
  right: 18%;
  transform: translate(50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sky .flyer .kite { width: 46px; }
.sky .altitude {
  background: rgba(255, 255, 255, 0.94);
  color: #1a2947;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.sky svg.string { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.gain {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  animation: pop 1.6s ease-out forwards;
  pointer-events: none;
  text-align: center;
}
.gain small { display: block; font-size: 1rem; font-weight: 700; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -90%); }
}

/* ---------- Spil ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; font-weight: 800;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 999px; padding: 6px 8px 6px 18px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.45); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); }
.progress div { height: 100%; background: linear-gradient(90deg, var(--kite-accent), var(--kite)); transition: width 0.3s; border-radius: 4px; }
.timer { position: relative; width: 48px; height: 48px; }
.timer svg { transform: rotate(-90deg); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.prompt { font-size: 1.85rem; font-weight: 900; text-align: center; margin: 4px 0; line-height: 1.15; }
.verdict { text-align: center; font-weight: 800; min-height: 1.4em; margin: 0; }

/* ---------- Resultat ---------- */
.big {
  font-size: 3.6rem; font-weight: 900; text-align: center; margin: 0; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--kite-accent), var(--kite)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.answers { display: grid; gap: 10px; }
.answer { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.answer .q { font-size: 0.8rem; color: var(--ink-soft); }
.answer .a { font-weight: 800; font-size: 1.1rem; }
.answer .d { font-size: 0.8rem; }
.points { text-align: center; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.points b {
  display: block;
  min-width: 50px;
  padding: 6px 8px;
  border-radius: 12px;
  color: white;
  font-size: 1.2rem;
  margin-bottom: 2px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.bell svg { width: 100%; height: 190px; overflow: visible; }
.bell .ends { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 700; opacity: 0.7; }

/* Gem resultatet (gæst) */
.save-card { display: grid; gap: 12px; text-align: center; border: 2px solid rgba(255, 201, 74, 0.8); }
.save-card h2 { font-size: 1.3rem; margin: 0; }
.save-card p { margin: 0; }

/* ---------- Vejr: regn, sne, lyn ---------- */
.weather-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.weather-fx i { position: absolute; top: -10%; display: block; }
.weather-fx i.regn {
  width: 1.5px; height: 18px; border-radius: 1px;
  background: linear-gradient(transparent, rgba(220, 235, 255, 0.9));
  animation: rain linear infinite;
}
.weather-fx i.sne {
  width: var(--s); height: var(--s); border-radius: 50%;
  background: white; box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: snow linear infinite;
}
@keyframes rain { to { transform: translate(-40px, 115vh); } }
@keyframes snow {
  25% { transform: translate(14px, 28vh); }
  50% { transform: translate(-10px, 56vh); }
  75% { transform: translate(12px, 84vh); }
  to { transform: translate(-6px, 115vh); }
}
.weather-fx.thunder::after {
  content: ""; position: absolute; inset: 0; background: white; opacity: 0;
  animation: flash 9s infinite;
}
@keyframes flash { 0%, 91%, 100% { opacity: 0; } 92% { opacity: 0.55; } 93% { opacity: 0; } 95% { opacity: 0.35; } 96% { opacity: 0; } }

.weather-ask { display: grid; gap: 10px; text-align: center; }
.weather-ask p { margin: 0; }
.weather-ask .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.weather-ask button { font-size: 1rem; padding: 12px; }

/* ---------- Skyer, der driver ---------- */
.clouds { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.cloud { position: absolute; height: auto; opacity: 0.7; animation: drift 40s ease-in-out infinite alternate; }
.c1 { width: 220px; top: 8%; left: 3%; }
.c2 { width: 150px; top: 30%; right: 5%; animation-duration: 55s; animation-direction: alternate-reverse; }
.c3 { width: 260px; top: 62%; left: -40px; opacity: 0.5; animation-duration: 70s; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(60px); } }
:root[data-sky="regn"] .clouds, :root[data-sky="torden"] .clouds, :root[data-sky="taage"] .clouds,
:root[data-sky="sne"] .clouds, :root[data-night="true"] .clouds { display: none; }

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

/* ---------- Navigation, login og scoreboard ---------- */
.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 999px; padding: 6px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.nav-right { display: flex; gap: 4px; }
button.link {
  width: auto;
  background: none;
  box-shadow: none;
  text-shadow: none;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  gap: 6px;
}
button.link:hover { background: rgba(255, 255, 255, 0.35); }
/* Sprogskift DA / EN */
button.link.lang-switch { gap: 3px; font-size: 0.78rem; letter-spacing: 0.02em; }
button.link.lang-switch span { opacity: 0.45; }
button.link.lang-switch span.on { opacity: 1; color: var(--kite-dark); }
button.link:active { transform: scale(0.96); box-shadow: none; }
button.link img { width: 22px; height: 22px; margin: 0; }
button.link.logo { font-weight: 900; font-size: 1.05rem; padding-left: 8px; }
button.link.logo img { width: 28px; height: 28px; }
.tabs { display: flex; gap: 4px; background: rgba(26, 41, 71, 0.08); border-radius: 999px; padding: 4px; }
:root[data-night="true"] .tabs { background: rgba(255, 255, 255, 0.1); }
.tabs button { background: none; box-shadow: none; text-shadow: none; color: var(--ink); font-size: 0.95rem; padding: 9px 10px; border-radius: 999px; }
.tabs button:active { transform: none; }
.tabs button.active { background: var(--glass-strong); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.login { display: grid; gap: 12px; }
.login input { font-size: 1.1rem; }
.error { color: #c0262d; font-weight: 700; margin: 0; min-height: 1.2em; text-align: center; }
:root[data-night="true"] .error { color: #ff9b93; }
.board-title { font-size: 2.2rem; color: #fff; text-shadow: 0 2px 10px rgba(10, 25, 60, 0.45); display: flex; align-items: center; justify-content: center; gap: 10px; }
.board-title img { width: 48px; height: 48px; }
.board { list-style: none; margin: 0; padding: 6px 12px; }
.board .row { display: grid; grid-template-columns: 2.4em 1fr auto; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 1px solid rgba(26, 41, 71, 0.08); }
.board .row:last-child { border-bottom: none; }
.board .row.me { background: rgba(242, 84, 74, 0.14); border-radius: 12px; font-weight: 800; }
.board .rank { text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }
.board .rank img { width: 30px; height: 30px; display: block; margin: 0 auto; }
.board .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .meters { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.board .meters small { display: block; font-weight: 500; font-size: 0.72rem; opacity: 0.7; }

.nav-right { min-width: 0; }
.nav-right button.link { flex: none; }
.nav-label { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Smal skærm: kun ikoner i topbaren, så alt kan være der (teksten står i aria-label/title) */
@media (max-width: 560px) {
  .nav-label { display: none; }
}
@media (max-width: 420px) {
  .wide-only { display: none; }
  button.link { padding: 7px 9px; }
}
@media (max-width: 350px) {
  .weather-ask button { font-size: 0.92rem; padding: 12px 6px; white-space: nowrap; }
  .tabs button { font-size: 0.88rem; padding: 9px 6px; white-space: nowrap; }
  button.link { padding: 7px 6px; }
  .nav { gap: 2px; }
  .nav-right { gap: 0; }
}

/* Ukendt svar: beskeden ryster kort, så man ser, at man skal prøve igen */
.verdict.shake { color: var(--kite); animation: ryst 0.4s ease; }
@keyframes ryst {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) { .verdict.shake { animation: none; } }

/* Sådan spiller du */
.steps { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 12px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.8); border-radius: 20px; padding: 14px 16px; }
.steps p { margin: 4px 0 0; }
.step-no { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--kite); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 1.15rem; }
.example ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.example li { display: flex; justify-content: space-between; align-items: center; }
.example small { display: block; color: var(--ink-soft); }
.example .pts { font-weight: 800; }
.example .pts.strong { color: var(--kite); }
.howto-link { color: var(--kite-dark); font-weight: 800; text-decoration: underline; }
