body {
  min-height: 100dvh;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 16px;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  animation: slide-up 0.25s ease;
}

.screen.active {
  display: flex;
}

#s-join {
  padding-bottom: 16px;
}

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.center h2 {
  font-size: 2rem;
  margin: 0;
}

.muted {
  color: var(--ink-soft);
  margin: 0;
  font-size: 1.1rem;
}

/* Bli med */
.join-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.logo.big {
  font-size: clamp(2.6rem, 13vw, 4rem);
  margin: 0;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.2);
  animation: pop-in 0.35s ease;
}

.label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #5b4a80;
}

.field {
  width: 100%;
  border: 3px solid #e3dcf2;
  border-radius: 12px;
  padding: 0.6em 0.7em;
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  color: var(--paper-ink);
  background: #faf8ff;
  outline: none;
}

.field:focus {
  border-color: var(--a3);
}

#pin {
  letter-spacing: 0.25em;
}

.btn.wide {
  width: 100%;
  font-size: 1.25rem;
  padding: 0.7em;
}

.link {
  background: none;
  border: 0;
  color: #6b5a90;
  font-weight: 500;
  padding: 4px;
}

.quiz-title {
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
}

/* Venter */
.big-emoji {
  font-size: 5rem;
  line-height: 1;
}

.bounce {
  animation: bounce 1.2s ease-in-out infinite;
}

.rocket {
  animation: rocket 1s ease-in-out infinite alternate;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes rocket {
  from { transform: translate(-4px, 4px) rotate(-4deg); }
  to { transform: translate(4px, -6px) rotate(4deg); }
}

.dots {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  animation: bounce 1s ease-in-out infinite;
}

.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
  margin-top: 12px;
}

/* Intro */
.qnum {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0;
}

.ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid var(--accent);
  display: grid;
  place-items: center;
  font-size: 3.4rem;
  font-weight: 700;
  margin: 8px 0;
}

.double-badge {
  background: var(--accent);
  color: #2b1500;
  font-weight: 700;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  animation: pop-in 0.4s ease;
}

.double-badge.small {
  font-size: 0.85rem;
  padding: 0.2em 0.6em;
}

/* Spørsmål */
#s-question {
  padding: 12px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  gap: 10px;
}

.qbar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
}

.qtime {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  background: var(--card-strong);
  border-radius: 999px;
  padding: 0.1em 0.7em;
  min-width: 3ch;
  text-align: center;
}

.timer-track {
  height: 8px;
  background: var(--card);
  border-radius: 999px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: inherit;
  transform-origin: left;
}

.answers {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.answers.two {
  grid-template-columns: 1fr;
}

.answers.three > :last-child {
  grid-column: span 2;
}

.ans {
  border: 0;
  border-radius: var(--radius);
  background: var(--c);
  box-shadow: inset 0 -8px 0 var(--cd);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px 18px;
  font-weight: 600;
  font-size: clamp(1rem, 4.5vw, 1.35rem);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, opacity 0.2s;
  word-break: break-word;
  min-height: 0;
}

.ans .shape {
  font-size: clamp(2.6rem, 14vw, 4.2rem);
}

.ans:active {
  transform: scale(0.96);
}

.answers.locked .ans {
  opacity: 0.35;
  pointer-events: none;
}

.answers.locked .ans.picked {
  opacity: 1;
  transform: scale(1.02);
  outline: 5px solid #fff;
}

/* Resultat */
#s-result.good {
  background: radial-gradient(circle at 50% 30%, #4be38f, #138a4b);
}

#s-result.bad {
  background: radial-gradient(circle at 50% 30%, #ff6b85, #a3173a);
}

#s-result.none {
  background: radial-gradient(circle at 50% 30%, #8a7cb3, #3c2f63);
}

.result-icon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 4.5rem;
  font-weight: 700;
  animation: pop-in 0.45s ease;
}

.good .result-icon { color: #138a4b; }
.bad .result-icon { color: #c71d48; }
.none .result-icon { color: #3c2f63; }

.points {
  font-size: 2.4rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 0.1em 0.6em;
  animation: pop-in 0.5s ease 0.1s backwards;
}

.streak {
  font-weight: 600;
  font-size: 1.2rem;
}

.rank-pill {
  margin-top: 10px;
  background: #fff;
  color: var(--paper-ink);
  font-weight: 700;
  font-size: 1.3rem;
  padding: 0.45em 1.1em;
  border-radius: 999px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

/* Slutt */
.final-medal {
  font-size: 7rem;
  line-height: 1;
  animation: pop-in 0.6s ease;
}

#f-again,
#e-again {
  margin-top: 20px;
}

/* Bunnlinje */
.me {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: rgba(10, 3, 30, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 600;
  font-size: 1.1rem;
}

.me-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-score {
  background: #fff;
  color: var(--paper-ink);
  border-radius: 10px;
  padding: 0.1em 0.7em;
  font-variant-numeric: tabular-nums;
}

.offline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bad);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-weight: 600;
  z-index: 50;
}
