:root {
  --bg: #f3f0ff;
  --bg-2: #e9e3ff;
  --surface: #ffffff;
  --surface-2: #f7f5ff;
  --text: #1d1640;
  --muted: #6b6390;
  --border: #ddd6fb;
  --primary: #6d4dff;
  --primary-dark: #4b2fd6;
  --green: #1fbf6a;
  --green-dark: #148a4b;
  --red: #f0445a;
  --red-dark: #b8263a;
  --yellow: #ffc42e;
  --yellow-dark: #d99a00;
  --orange: #ff7a1a;
  --shadow: 0 8px 24px rgba(60, 40, 160, 0.12);
  --radius: 18px;
  --font-display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e0b24;
    --bg-2: #171236;
    --surface: #1c1740;
    --surface-2: #241e52;
    --text: #f3f0ff;
    --muted: #a59ed0;
    --border: #322a6e;
    --primary: #8b6dff;
    --primary-dark: #5a3de0;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0e0b24;
  --bg-2: #171236;
  --surface: #1c1740;
  --surface-2: #241e52;
  --text: #f3f0ff;
  --muted: #a59ed0;
  --border: #322a6e;
  --primary: #8b6dff;
  --primary-dark: #5a3de0;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* Ingen zoom vid dubbeltryck på iOS (nypzoom fungerar fortfarande) */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* iOS zoomar in på textfält med mindre text än 16 px när man trycker i dem */
input,
select,
textarea {
  font-size: max(16px, 1em);
}

body {
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-2), transparent 60%), radial-gradient(900px 500px at 110% 10%, var(--bg-2), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.3px;
  margin: 0 0 0.4em;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 60px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ---------- Knappar ---------- */

.btn {
  --c: var(--primary);
  --cd: var(--primary-dark);
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  box-shadow: 0 5px 0 var(--cd);
  border-radius: 14px;
  padding: 12px 20px;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  filter: brightness(1.07);
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--cd);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.green {
  --c: var(--green);
  --cd: var(--green-dark);
}

.btn.red {
  --c: var(--red);
  --cd: var(--red-dark);
}

.btn.yellow {
  --c: var(--yellow);
  --cd: var(--yellow-dark);
  color: #3a2a00;
}

.btn.ghost {
  --c: var(--surface);
  --cd: var(--border);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn.big {
  font-size: 1.15rem;
  padding: 16px 24px;
}

.btn.wide {
  width: 100%;
}

.icon-btn {
  appearance: none;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex: none;
}

/* ---------- Logo & profilval ---------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
}

.brand img {
  width: 108px;
  height: 108px;
  border-radius: 26px;
  box-shadow: 0 10px 24px rgba(109, 77, 255, 0.35);
  animation: wiggle 3.5s ease-in-out infinite;
}

.brand .logo {
  margin-top: 10px;
}

@keyframes wiggle {
  0%,
  86%,
  100% {
    transform: rotate(0);
  }
  90% {
    transform: rotate(-6deg) scale(1.04);
  }
  95% {
    transform: rotate(5deg) scale(1.04);
  }
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  text-align: center;
  margin: 30px 0 4px;
  background: linear-gradient(90deg, var(--primary), #ff5fa2, var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  text-align: center;
  color: var(--muted);
  margin-bottom: 36px;
  font-weight: 700;
}

.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 640px;
  margin: 0 auto;
}

.profile-card {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 24px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.profile-card:hover {
  transform: translateY(-4px) rotate(-1deg);
  border-color: var(--primary);
}

.profile-card .avatar {
  font-size: 4.5rem;
  line-height: 1;
}

.profile-card .name {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-top: 8px;
}

.profile-card .lvl {
  color: var(--muted);
  font-weight: 800;
}

/* ---------- Pinkod ---------- */

.pin {
  max-width: 300px;
  margin: 0 auto;
  text-align: center;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.pin-dots.shake {
  animation: shake 0.35s;
}

.pin-dots span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  transition: background 0.1s, transform 0.1s;
}

.pin-dots span.on {
  background: var(--primary);
  transform: scale(1.1);
}

.pin-msg {
  min-height: 1.6em;
  color: var(--red);
  font-weight: 800;
  margin-bottom: 10px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pin-key {
  appearance: none;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--border);
  padding: 14px 0;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.pin-key:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--border);
}

/* ---------- Topbar / profilhuvud ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar .spacer {
  flex: 1;
}

.xpbar {
  height: 14px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.xpbar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #fff07a);
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Kortlekar ---------- */

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 0 12px;
}

.section-title h3 {
  font-size: 1.5rem;
  margin: 0;
}

.stars {
  font-size: 1.25rem;
  letter-spacing: 2px;
  white-space: nowrap;
}

.stars .off {
  filter: grayscale(1);
  opacity: 0.3;
}

.mastery {
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.mastery > div {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #8cf0a8);
}

.empty {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Märken & liga ---------- */

.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.badge {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
}

.badge .i {
  font-size: 2rem;
}

.badge .n {
  font-weight: 900;
  font-size: 0.92rem;
}

.badge .d {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.25;
}

.badge.locked .i {
  filter: grayscale(1);
  opacity: 0.35;
}

.badge.locked .n {
  color: var(--muted);
}

.league {
  display: grid;
  gap: 8px;
}

.league-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
}

.league-row.me {
  border-color: var(--primary);
}

.league-row .a {
  font-size: 1.8rem;
}

.league-row .grow {
  flex: 1;
}

/* ---------- Modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 30, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
  animation: fade 0.15s;
}

.modal {
  background: var(--surface);
  border-radius: 24px;
  padding: 22px;
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: var(--shadow);
  animation: pop 0.2s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.modal h2 {
  font-size: 1.7rem;
}

.mode-list {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.mode {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  box-shadow: 0 4px 0 var(--border);
}

.mode:hover {
  border-color: var(--primary);
}

.mode .ic {
  font-size: 2rem;
}

.mode .nm {
  font-weight: 900;
  font-size: 1.1rem;
}

.mode .ds {
  font-size: 0.88rem;
  color: var(--muted);
}

.mode .xp {
  font-weight: 900;
  color: var(--primary);
  text-align: right;
  font-size: 0.9rem;
  white-space: nowrap;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.avatar-grid button {
  font-size: 2rem;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
}

.avatar-grid button.sel {
  border-color: var(--primary);
  background: var(--primary);
}

/* ---------- Spelvy ---------- */

.play {
  max-width: 680px;
  margin: 0 auto;
}

.play-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.progress {
  flex: 1;
  height: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #8cf0a8);
  transition: width 0.3s;
  border-radius: 999px;
}

.score {
  font-weight: 900;
  white-space: nowrap;
}

.combo {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  min-height: 1.8rem;
  color: var(--orange);
}

.combo.bump {
  animation: bump 0.3s;
}

.flip {
  perspective: 1400px;
  margin: 8px 0 20px;
}

.flip-inner {
  display: grid;
  min-height: 260px;
  cursor: pointer;
  transition: transform 0.55s cubic-bezier(0.3, 1.3, 0.5, 1);
  transform-style: preserve-3d;
}

.flip.flipped .flip-inner {
  transform: rotateY(180deg);
}

.answer-input {
  width: 100%;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 16px 18px;
  border-radius: 16px;
  border: 3px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.answer-input:focus {
  border-color: var(--primary);
}

.answer-input.right {
  border-color: var(--green);
}

.answer-input.wrong {
  border-color: var(--red);
  animation: shake 0.35s;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.actions > * {
  flex: 1;
  min-width: 140px;
}

.feedback {
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 14px;
  font-weight: 800;
  animation: pop 0.2s;
}

.feedback.good {
  background: color-mix(in srgb, var(--green) 18%, var(--surface));
  border: 2px solid var(--green);
}

.feedback.bad {
  background: color-mix(in srgb, var(--red) 15%, var(--surface));
  border: 2px solid var(--red);
}

.feedback .correct-answer {
  font-size: 1.15rem;
  color: var(--text);
}

.xp-float {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--yellow);
  text-shadow: 0 3px 0 var(--yellow-dark), 0 6px 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  animation: floatUp 0.9s ease-out forwards;
  z-index: 40;
}

.hint-keys {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 16px;
}

@media (hover: none) {
  .hint-keys {
    display: none;
  }
}

/* ---------- Resultat ---------- */

.result {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}

.result h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  margin-top: 20px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.stat {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 6px;
}

.stat .v {
  font-family: var(--font-display);
  font-size: 1.8rem;
}

.stat .l {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 800;
}

.breakdown {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.92rem;
}

.new-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
}

.new-badges .badge {
  width: 150px;
  border-color: var(--yellow);
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.missed {
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 6px 16px;
  margin: 18px 0;
}

.missed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.missed-item:last-child {
  border-bottom: 0;
}

.missed-item .mq {
  font-weight: 800;
}

.missed-item .ma {
  color: var(--primary);
  font-weight: 900;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 800;
  z-index: 100;
  box-shadow: var(--shadow);
  animation: pop 0.2s;
  max-width: calc(100% - 32px);
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

/* ---------- Animationer ---------- */

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(7px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@keyframes bump {
  50% {
    transform: scale(1.35);
  }
}

@keyframes floatUp {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.8);
  }
  30% {
    transform: translate(-50%, -20px) scale(1.15);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -90px) scale(1);
  }
}

@keyframes starIn {
  from {
    transform: scale(0) rotate(-120deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Urval & huvudfrågor ---------- */

.seg-label {
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 16px 0 6px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-opt {
  appearance: none;
  font: inherit;
  font-weight: 800;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

.seg-opt span {
  color: var(--muted);
  font-size: 0.85em;
  margin-left: 2px;
}

.seg-opt.on {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}

.seg-opt.on span {
  color: rgba(255, 255, 255, 0.8);
}

.tag-important {
  display: inline-block;
  background: color-mix(in srgb, var(--yellow) 30%, var(--surface));
  border: 2px solid var(--yellow);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.8rem;
  font-weight: 900;
  margin-bottom: 8px;
}


/* ---------- Startsida (design 2a) ---------- */

.home {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.me {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me-avatar {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  font-size: 2.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.me-info {
  flex: 1;
  min-width: 0;
}

.me-hello {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.1;
}

.me-level {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.me-bar {
  flex: 1;
  height: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.me-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #fff07a);
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.me-streak {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 4px 10px;
}

.me-streak .v {
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1.1;
  color: var(--orange);
}

.me-streak .l {
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mission {
  background: linear-gradient(135deg, var(--primary), #b14dff 60%, #ff5fa2);
  color: #fff;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 900;
  font-size: 0.9rem;
}

.mission-head span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.9;
}

.mission-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.1;
}

.mission .xpbar {
  margin-top: 0;
}

.mission-go {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 0;
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-dark);
  color: #3a2a00;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  transition: transform 0.08s, box-shadow 0.08s;
}

.mission-go:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--yellow-dark);
}

.mission-go .e {
  font-size: 1.8rem;
  line-height: 1;
}

.mission-go .txt {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mission-go b {
  font-weight: 900;
  font-size: 1.08rem;
  line-height: 1.2;
}

.mission-go small {
  font-weight: 800;
  font-size: 0.85rem;
}

.mission-go .play-icon {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.mission-empty {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 14px;
  font-weight: 800;
}

.panel-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 5px 0 var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.panel-head h3 {
  font-size: 1.25rem;
  margin: 0;
}

.panel-head .muted {
  font-size: 0.8rem;
  font-weight: 800;
}

.match-names,
.match-xp {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.match-names > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.match-names > span:last-child {
  flex-direction: row-reverse;
}

.match-names .a {
  font-size: 1.7rem;
}

.match-names .is-me {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  text-decoration-color: var(--yellow);
}

.match-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  gap: 3px;
}

.match-bar > div {
  transition: flex 0.8s;
}

.match-xp {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.home .section-title {
  margin: 4px 0 -6px;
}

.decks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .decks {
    grid-template-columns: repeat(3, 1fr);
  }
}

.deck {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, border-color 0.12s;
}

.deck:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.deck-top {
  height: 64px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.deck-top .subj {
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.deck-top .todo {
  background: #fff;
  color: #1d1640;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 900;
}

.deck-top .emoji {
  position: absolute;
  left: 10px;
  bottom: -18px;
  font-size: 2.2rem;
  line-height: 1;
}

.deck-body {
  padding: 22px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deck-body .t {
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.deck-body .stars {
  font-size: 1.05rem;
  letter-spacing: 1px;
}

.deck-mastery {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-mastery .mastery {
  flex: 1;
  height: 8px;
}

.deck-mastery span,
.deck-imp {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--muted);
}

.next-badge {
  background: var(--surface);
  border: 2px dashed var(--yellow);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.next-badge .i {
  font-size: 2rem;
}

.next-badge .grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-badge .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.next-badge .row .muted {
  font-weight: 900;
  font-size: 0.85rem;
}

.next-badge .mastery {
  height: 8px;
}

.next-badge small {
  font-size: 0.8rem;
  font-weight: 700;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 2px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px max(8px, calc((100% - 720px) / 2)) calc(10px + env(safe-area-inset-bottom));
}

.tabbar button {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
}

.tabbar button span {
  font-size: 1.5rem;
  line-height: 1.2;
}

.tabbar button.on {
  color: var(--primary);
  font-weight: 900;
}

/* ---------- Fråga (design 2b) ---------- */

.play-progress {
  flex: 1;
  min-width: 0;
}

.segs {
  display: grid;
  gap: 4px;
}

.segs span {
  height: 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

.segs span.ok {
  background: var(--green);
  border-color: var(--green-dark);
}

.segs span.bad {
  background: var(--red);
  border-color: var(--red-dark);
}

.segs span.now {
  border-color: var(--primary);
}

.combo {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 42px;
}

.combo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: #fff;
  border-radius: 999px;
  padding: 6px 16px;
  box-shadow: 0 4px 0 #c75400;
}

.combo-pill b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
}

.combo-pill .mult {
  background: #fff;
  color: #c75400;
  border-radius: 999px;
  padding: 0 8px;
  font-weight: 900;
  font-size: 0.85rem;
}

.qcard,
.face {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 8px 0 var(--border), var(--shadow);
  padding: 18px 20px 22px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qcard {
  margin: 4px 0 22px;
}

.face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face.back {
  transform: rotateY(180deg);
  border-color: var(--primary);
  box-shadow: 0 8px 0 var(--primary-dark), var(--shadow);
}

.qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.qhead .label {
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.qcard .q,
.face .q {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  font-size: clamp(1.3rem, 5vw, 1.75rem);
  font-weight: 900;
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.face .a {
  color: var(--primary);
}

.face .small-q {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

.face .think {
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.qfoot {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
}

.tag-important {
  margin: 0;
  background: color-mix(in srgb, var(--yellow) 25%, var(--surface));
  white-space: nowrap;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option {
  appearance: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--border);
  min-height: 92px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
  overflow-wrap: anywhere;
}

.option .k {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.option .t {
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.2;
}

.option:hover:not(:disabled) {
  border-color: var(--primary);
}

.option:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--border);
}

.option:disabled {
  cursor: default;
}

.option.right {
  background: var(--green);
  border-color: var(--green-dark);
  box-shadow: 0 5px 0 var(--green-dark);
  color: #fff;
}

.option.wrong {
  background: var(--red);
  border-color: var(--red-dark);
  box-shadow: 0 5px 0 var(--red-dark);
  color: #fff;
  animation: shake 0.35s;
}

.option.right .k,
.option.wrong .k {
  background: rgba(255, 255, 255, 0.25) !important;
}

.option.gone {
  opacity: 0.18;
}

.joker-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.joker {
  appearance: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 0 var(--border);
}

.joker:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- Resultat (design 2c) ---------- */

.result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result h1 {
  margin: 16px 0 0;
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.1;
}

.result-sub {
  font-weight: 800;
  margin-top: -10px;
}

.xp-card {
  background: linear-gradient(135deg, var(--primary), #b14dff 60%, #ff5fa2);
  color: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xp-big {
  font-family: var(--font-display);
  font-size: 3.4rem;
  line-height: 1;
  color: var(--yellow);
  text-shadow: 0 3px 0 var(--yellow-dark);
}

.xp-break {
  font-weight: 800;
  font-size: 0.9rem;
  opacity: 0.9;
}

.xp-card .xpbar {
  margin-top: 0;
}

.xp-left {
  font-weight: 900;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
}

.tile .v {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.tile .l {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}

.tile.good {
  background: color-mix(in srgb, var(--green) 14%, var(--surface));
  border-color: var(--green);
}

.tile.good .l {
  color: var(--green-dark);
}

.star-goal {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.3;
}

.stars-sm {
  font-size: 1.5rem;
  letter-spacing: 2px;
  white-space: nowrap;
}

.stars-sm span {
  display: inline-block;
}

.stars-sm .off {
  filter: grayscale(1);
  opacity: 0.3;
}

.stars-sm .new {
  animation: starIn 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.missed {
  margin: 0;
}

.missed h3 {
  font-size: 1.2rem;
  margin: 8px 0 2px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.result-actions .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Inloggning och registrering ---------- */

.auth {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  text-align: center;
}

.auth-back {
  position: absolute;
  left: 0;
  top: 0;
}

.auth-avatar {
  font-size: 4.5rem;
  line-height: 1;
  margin: 36px 0 8px;
}

.auth-title {
  font-size: 1.8rem;
  margin: 8px 0 4px;
}

.auth-sub {
  font-size: 1.4rem;
  margin: 0 0 14px;
}

.auth .tagline {
  margin-bottom: 24px;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  margin: 32px auto 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin: 20px auto 0;
  text-align: left;
}

.field-label {
  font-weight: 900;
  margin-top: 6px;
}

.code-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 6px;
  text-transform: uppercase;
}

/* ---------- Sidor: bibliotek, skapa, redigera ---------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-head h2 {
  margin: 0;
  font-size: 1.7rem;
}

.page > .muted {
  margin: 0;
  font-weight: 700;
}

.answer-input.small {
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 12px;
}

.answer-input.area {
  min-height: 200px;
  resize: vertical;
  font-size: 1rem;
  font-weight: 700;
}

.deck-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.deck-manage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.deck-manage .btn {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.deck-manage .muted {
  flex: 1;
  font-weight: 800;
  font-size: 0.9rem;
}

.lib-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lib-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.lib-emoji {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
}

.lib-row .grow {
  flex: 1;
  min-width: 0;
}

.lib-row .t {
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.lib-row .s {
  font-size: 0.82rem;
  font-weight: 700;
}

.lib-row .btn {
  padding: 8px 12px;
  font-size: 0.9rem;
  flex: none;
}

.create-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-drop {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 130px;
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 900;
  cursor: pointer;
  padding: 16px;
}

.photo-drop:hover {
  border-color: var(--primary);
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--border);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
}

.or {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(58, 42, 0, 0.25);
  border-top-color: #3a2a00;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.editor-meta {
  display: grid;
  grid-template-columns: 2fr 1fr 70px;
  gap: 10px;
}

@media (max-width: 520px) {
  .editor-meta {
    grid-template-columns: 1fr 70px;
  }
  .editor-meta #title {
    grid-column: 1 / -1;
  }
}

.emoji-input {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.edit-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-card .answer {
  color: var(--primary);
}

.edit-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-top .muted {
  flex: 1;
  font-weight: 900;
  font-size: 0.85rem;
}

.star-btn {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--muted);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  filter: grayscale(1);
}

.star-btn.on {
  filter: none;
  color: var(--text);
  border-color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 25%, var(--surface));
}

.icon-btn.small {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  border-radius: 10px;
}

.share-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  cursor: pointer;
  margin: 6px 0;
}

.share-toggle input {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- Meny och inbjudningar ---------- */

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invite-code {
  font-family: var(--font-display);
  font-size: 2.6rem;
  letter-spacing: 8px;
  text-align: center;
  background: var(--surface-2);
  border: 3px dashed var(--yellow);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.invite-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.invite-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.9rem;
}

.invite-row code {
  font-weight: 900;
  letter-spacing: 2px;
}

/* ---------- Provdatum ---------- */

.deck-top .todo.exam.soon {
  background: var(--orange);
  color: #fff;
}

.deck-top .todo.exam.urgent {
  background: var(--red);
  color: #fff;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
  }
}

.exam {
  margin-top: 12px;
}

.exam-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}

.exam-card .grow {
  flex: 1;
}

.exam-card.soon {
  border-color: var(--orange);
}

.exam-card.urgent {
  border-color: var(--red);
}

.exam-card.done {
  flex-direction: column;
  align-items: stretch;
  border-style: dashed;
  border-color: var(--green);
}

.exam-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.exam-results .btn {
  flex: 1;
  padding: 8px 10px;
}

.exam-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 900;
}

.exam-pick input {
  font: inherit;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: var(--surface-2);
  color: var(--text);
}

.exam-tip {
  margin-top: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.exam-tip .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ---------- Påminnelser ---------- */

.notice {
  background: var(--surface-2);
  border: 2px dashed var(--yellow);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0;
  font-weight: 700;
}

.notice.ok {
  border-color: var(--green);
}

.notice ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.notice li {
  margin: 4px 0;
}

.ios-share {
  display: inline-block;
  transform: rotate(-90deg);
}

/* ---------- Utmaningar ---------- */

.duels {
  margin: 14px 0;
  border-color: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-dark);
}

.duel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--surface-2);
}

.duel-row .a {
  font-size: 1.8rem;
  line-height: 1;
}

.duel-row .grow {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.duel-row small {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}

.duel-row .btn {
  padding: 8px 14px;
}

.duel-row.incoming {
  background: color-mix(in srgb, var(--yellow) 22%, var(--surface));
  animation: pulse 2s ease-in-out infinite;
}

.duel-row.won {
  background: color-mix(in srgb, var(--green) 18%, var(--surface));
}

.duel-row.lost {
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
}

.duel-score {
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.friend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.friend .a {
  font-size: 2rem;
  line-height: 1.1;
}

.friend.sel {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.duel-result {
  background: var(--surface);
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
  text-align: center;
}

.duel-result.won {
  border-color: var(--green);
}

.duel-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.duel-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0;
}

.duel-vs .vs {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--muted);
}

.duel-side {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid transparent;
}

.duel-side.win {
  border-color: var(--green);
}

.duel-side .a {
  font-size: 2.2rem;
  line-height: 1.1;
}

.duel-big {
  font-family: var(--font-display);
  font-size: 1.8rem;
}

.duel-side small {
  color: var(--muted);
  font-weight: 800;
}

/* ---------- Vänner ---------- */

.modal .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal .pair .btn {
  padding: 10px 12px;
}

.friend-add {
  display: flex;
  gap: 8px;
}

.friend-add input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

.friend-add input:focus {
  border-color: var(--primary);
}

.friend-add .btn {
  padding: 10px 14px;
}

.friend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface-2);
}

.friend-row .a {
  font-size: 1.6rem;
}

.friend-row .grow {
  flex: 1;
}

.icon-btn.danger {
  width: auto;
  padding: 0 10px;
  background: var(--red);
  border-color: var(--red-dark);
  color: #fff;
  font-weight: 900;
}

.empty-small {
  color: var(--muted);
  font-weight: 700;
  padding: 8px 0;
}

/* ---------- Förslag 3: startsidan ---------- */

.me-avatar {
  position: relative;
}

.me-avatar .gear {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}

.mission .days-pill {
  background: var(--orange);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
}

.mission .days-pill.urgent {
  background: var(--red);
  animation: pulse 1.4s ease-in-out infinite;
}

.ready {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ready-bar {
  height: 14px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
  position: relative;
}

.ready-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #fff07a);
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ready-mark {
  position: absolute;
  left: 80%;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: #fff;
  border-radius: 2px;
}

.ready-labels {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.85rem;
}

.mission-goal {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding-top: 10px;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
}

.goal-bar {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.goal-bar > div {
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.week-row {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  margin: 14px 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 5px 0 var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.week-row .a {
  font-size: 1.6rem;
}

.week-row .grow {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-text {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.week-text small {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.week-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  gap: 3px;
}

.week-bar > span:first-child {
  background: var(--primary);
}

.week-bar > span:last-child {
  flex: 1;
  background: #ff5fa2;
}

.deck.deck-new {
  border: 2px dashed #b9adf5;
  box-shadow: none;
  background: transparent;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 10px;
  color: var(--text);
}

.deck-new .plus {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.deck-new small {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.next-badge {
  margin-top: 14px;
}

/* ---------- Förslag 3: kortleken som bottenark ---------- */

.overlay-sheet {
  align-items: end;
  padding: 0;
}

.modal.sheet {
  padding: 0;
  width: min(560px, 100%);
  border-radius: 28px 28px 0 0;
  max-height: 92vh;
  animation: sheetUp 0.25s cubic-bezier(0.2, 1, 0.3, 1);
}

@media (min-width: 640px) {
  .overlay-sheet {
    align-items: center;
    padding: 16px;
  }
  .modal.sheet {
    border-radius: 28px;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.sheet-head {
  color: #fff;
  padding: 10px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-grab {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 0;
  padding: 0;
  align-self: center;
  cursor: pointer;
}

.sheet-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sheet-title .e {
  font-size: 3rem;
  line-height: 1;
}

.sheet-title .grow {
  flex: 1;
  min-width: 0;
}

.modal .sheet-title h2 {
  font-size: 1.8rem;
  line-height: 1.1;
  margin: 0;
  overflow-wrap: anywhere;
}

.sheet-meta {
  font-weight: 800;
  font-size: 0.9rem;
}

.sheet-more {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 900;
  font-size: 1.3rem;
  cursor: pointer;
}

.sheet-body {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sheet-body .seg-label {
  margin-top: 12px;
}

.sheet-body .exam {
  margin-top: 0;
}

.sheet-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid var(--border);
}

.sheet-menu.hidden {
  display: none;
}

.sheet-menu .btn {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.sheet-menu .muted {
  flex: 1;
  font-weight: 800;
  font-size: 0.9rem;
}

.exam-card:not(.done) {
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
  border-color: var(--orange);
}

.exam-card.urgent {
  border-color: var(--red);
}

.star-path {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 8px;
}

.path-step {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  position: relative;
  border-radius: 16px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  border: 2px solid var(--border);
  background: var(--surface-2);
}

.path-step small {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.path-step.earned {
  background: color-mix(in srgb, var(--green) 15%, var(--surface));
  border-color: var(--green);
}

.path-step.earned small {
  color: var(--green-dark);
}

.path-step.locked .path-stars {
  filter: grayscale(1);
  opacity: 0.45;
}

.path-step.locked b {
  color: var(--muted);
}

.path-step.sel {
  border: 3px solid var(--primary);
  box-shadow: 0 5px 0 var(--primary-dark);
  padding: 9px 5px;
  background: var(--surface);
}

.path-next {
  position: absolute;
  top: -11px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-opt {
  appearance: none;
  font: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 900;
}

.chip-opt.on {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}

.sheet-start {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 0;
  margin-top: 18px;
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-dark);
  color: #3a2a00;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.08s, box-shadow 0.08s;
}

.sheet-start:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--yellow-dark);
}

.sheet-start .txt {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sheet-start b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.45rem;
  line-height: 1.15;
}

.sheet-start small {
  font-weight: 800;
  font-size: 0.85rem;
}

.sheet-start .play-icon {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.sheet-hint {
  text-align: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 8px 0 10px;
}

/* ---------- Förslag 3: Medel ---------- */

.qcard.compact {
  min-height: 0;
  margin-bottom: 16px;
}

.qcard.compact .q {
  padding: 10px 0 6px;
}

.answer-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  animation: pop 0.2s;
}

.answer-box .t {
  flex: 1;
  font-size: 1.3rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.answer-box .mark {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 999px;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.answer-box.right {
  border-color: var(--green);
}

.answer-box.right .mark {
  background: var(--green);
}

.answer-box.wrong {
  border-color: var(--red);
  animation: shake 0.35s;
}

.answer-box.wrong .mark {
  background: var(--red);
}

.fb {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.fb-title,
.fb-xp {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.4rem;
}

.fb-xp {
  font-size: 1.2rem;
}

.feedback.good .fb-title,
.feedback.good .fb-xp {
  color: var(--green-dark);
}

.feedback.bad .fb-title {
  color: var(--red-dark);
}

.fb-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.fb-answer {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  overflow-wrap: anywhere;
}

.fb-answer mark {
  background: var(--yellow);
  color: #1d1640;
  border-radius: 6px;
  padding: 0 3px;
  box-shadow: 0 2px 0 var(--yellow-dark);
}

/* ---------- Förslag 3: Svår ---------- */

.flip {
  touch-action: pan-y;
  transition: transform 0.3s;
}

.flip.flipped {
  transform: rotate(-2deg);
}

.flip.lean-yes .face.back {
  border-color: var(--green);
  box-shadow: 0 8px 0 var(--green-dark), var(--shadow);
}

.flip.lean-no .face.back {
  border-color: var(--red);
  box-shadow: 0 8px 0 var(--red-dark), var(--shadow);
}

.back-q {
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  text-wrap: balance;
}

.back-a {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--font-display);
  line-height: 1.05;
  color: var(--primary);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.back-a.xl {
  font-size: clamp(2.8rem, 14vw, 4.2rem);
}

.back-a.l {
  font-size: clamp(2rem, 9vw, 2.8rem);
}

.back-a.m {
  font-size: clamp(1.4rem, 6vw, 1.9rem);
}

.swipe-hint {
  display: flex;
  justify-content: space-between;
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--muted);
}

.judge-q {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 2px 0 10px;
}

.judge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.judge-btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border: 0;
  color: #fff;
  border-radius: 18px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 900;
  font-size: 1.1rem;
  transition: transform 0.08s, box-shadow 0.08s;
}

.judge-btn span {
  font-size: 1.6rem;
  line-height: 1;
}

.judge-btn.no {
  background: var(--red);
  box-shadow: 0 5px 0 var(--red-dark);
}

.judge-btn.yes {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-dark);
}

.judge-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

.judge-note {
  text-align: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Dela en kod ---------- */

.share-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.share-row .btn {
  padding: 10px 8px;
  font-size: 0.95rem;
}

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  align-self: center;
}

/* ---------- Ledtrådar ---------- */

.hint-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin: -6px 0 14px;
}

.hint-row #hintBox {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-row #hintBox:empty {
  display: none;
}

.hint-btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--yellow) 25%, var(--surface));
  border: 2px solid var(--yellow);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 900;
}

.hint-btn small {
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--muted);
}

.hint-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.hint-text {
  background: color-mix(in srgb, var(--yellow) 18%, var(--surface));
  border: 2px dashed var(--yellow);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  animation: pop 0.2s;
}

.letters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  vertical-align: middle;
}

.letters b {
  min-width: 24px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-bottom: 3px solid var(--text);
  font-size: 1.2rem;
  font-weight: 900;
}

.letters .gap {
  width: 12px;
}

/* ---------- Förslag 4: känsla i rundan ---------- */

/* Stapel genom hela rundan */
.pbar {
  flex: 1;
  height: 18px;
  background: #e4dff7;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.pbar > div {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pbar > div::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.pbar.retry > div {
  background: var(--orange);
}

/* Combo-brickan växer vid 3, 5 och 10 i rad */
.combo-pill {
  transition: transform 0.2s;
}

.combo-pill.c2 {
  transform: scale(1.08);
}

.combo-pill.c3 {
  transform: scale(1.18);
  background: var(--red);
  box-shadow: 0 4px 0 var(--red-dark);
}

/* Fel svar får varm orange i stället för rött */
.option.wrong {
  background: var(--orange);
  border-color: #c75400;
  box-shadow: 0 5px 0 #c75400;
}

.option.dim {
  opacity: 0.4;
}

.answer-box.wrong {
  border-color: var(--orange);
}

.answer-box.wrong .t {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--orange);
}

.answer-box.wrong .mark {
  background: var(--orange);
}

/* Panelen som glider upp underifrån */
.play.has-panel {
  padding-bottom: 260px;
}

.fb-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  border-top: 3px solid;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  animation: panelUp 0.28s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes panelUp {
  from {
    transform: translateY(100%);
  }
}

.fbp-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fb-panel.ok {
  background: #d7f5e3;
  border-color: var(--green);
  color: var(--green-dark);
}

.fb-panel.bad {
  background: #ffe9d6;
  border-color: var(--orange);
  color: #c75400;
}

.fbp-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fbp-icon {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 999px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 900;
}

.fb-panel.ok .fbp-icon {
  background: var(--green);
  box-shadow: 0 4px 0 var(--green-dark);
  animation: bounceIn 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.fb-panel.bad .fbp-icon {
  background: var(--orange);
  box-shadow: 0 4px 0 #c75400;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
  }
  60% {
    transform: scale(1.2);
  }
}

.fbp-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fbp-title b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.8rem;
  line-height: 1.05;
}

.fbp-title small {
  font-weight: 800;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.fbp-xp {
  font-family: var(--font-display);
  font-size: 1.4rem;
  white-space: nowrap;
}

.fbp-answer {
  display: flex;
  flex-direction: column;
}

.fbp-answer small {
  font-weight: 800;
  font-size: 0.9rem;
}

.fbp-answer span {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  line-height: 1.1;
  color: var(--text);
  overflow-wrap: anywhere;
}

.fbp-answer mark {
  background: var(--yellow);
  color: #1d1640;
  border-radius: 6px;
  padding: 0 3px;
  box-shadow: 0 2px 0 var(--yellow-dark);
}

.fbp-note {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.85;
}

.fbp-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.fbp-go {
  flex: 1;
  padding: 16px;
  font-weight: 900;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fb-panel.ok .fbp-go {
  --c: var(--green);
  --cd: var(--green-dark);
}

.fb-panel.bad .fbp-go {
  --c: var(--orange);
  --cd: #c75400;
}

.fbp-override {
  --c: #fff;
  --cd: #ffc79c;
  color: var(--text);
  border: 2px solid #ffc79c;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 12px 14px;
}

@media (prefers-color-scheme: dark) {
  .fb-panel.ok {
    background: #123d28;
    color: #8cf0a8;
  }
  .fb-panel.bad {
    background: #46260c;
    color: #ffb27a;
  }
}

/* Ett till försök */
.btn.upper {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 900;
}

.retry-intro,
.done-screen {
  min-height: calc(100vh - 40px);
  min-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.retry-center,
.done-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 0 12px;
}

.retry-center h2 {
  font-size: 2.2rem;
  margin: 0;
}

.retry-center p {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
  max-width: 360px;
}

.retry-stack {
  position: relative;
  width: 200px;
  height: 150px;
}

.retry-stack span {
  position: absolute;
  left: 30px;
  top: 16px;
  width: 140px;
  height: 110px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--border);
  transform: rotate(-8deg);
}

.retry-stack span + span {
  border-color: var(--orange);
  box-shadow: 0 6px 0 #c75400;
  transform: rotate(5deg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--orange);
  animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* Runda klar */
.done-center {
  gap: 28px;
}

.done-center h1 {
  font-size: 2.6rem;
  line-height: 1.05;
  color: var(--primary);
  margin: 0;
}

.done-sub {
  font-weight: 800;
}

.done-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 420px;
}

.done-tile {
  border: 3px solid;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.done-tile.in {
  opacity: 1;
  transform: none;
}

.done-tile .h {
  font-weight: 900;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 0;
  color: #fff;
}

.done-tile .v {
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  padding: 14px 4px;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  white-space: nowrap;
}

.done-tile.xp {
  border-color: var(--yellow);
  background: var(--yellow);
}

.done-tile.xp .h {
  color: #3a2a00;
}

.done-tile.xp .v {
  color: var(--yellow-dark);
}

.done-tile.acc {
  border-color: var(--green);
  background: var(--green);
}

.done-tile.acc .v {
  color: var(--green-dark);
}

.done-tile.time {
  border-color: var(--primary);
  background: var(--primary);
}

.done-tile.time .v {
  color: var(--primary-dark);
}

.done-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 420px;
  opacity: 0;
  transition: opacity 0.4s;
}

.done-dots.in,
.done-screen #cont.in {
  opacity: 1;
}

.done-screen #cont {
  opacity: 0;
  transition: opacity 0.4s;
}

.done-dots span {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.done-dots .ok {
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
}

.done-dots .hint {
  background: var(--yellow);
  box-shadow: 0 3px 0 var(--yellow-dark);
}

.done-dots .bad {
  background: var(--orange);
  box-shadow: 0 3px 0 #c75400;
}

/* ---------- Tävling i realtid ---------- */

.center {
  text-align: center;
}

.live {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 24px;
}

.live-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-deck {
  flex: 1;
  min-width: 0;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-score {
  font-family: var(--font-display);
  font-size: 1.2rem;
  white-space: nowrap;
}

.live-code-box {
  text-align: center;
  background: linear-gradient(135deg, var(--primary), #b14dff 60%, #ff5fa2);
  color: #fff;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.live-code-box small {
  font-weight: 800;
  opacity: 0.9;
}

.live-code {
  font-family: var(--font-display);
  font-size: clamp(3rem, 16vw, 4.4rem);
  letter-spacing: 4px;
  line-height: 1.1;
}

.live-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
  font-weight: 900;
  animation: pop 0.25s;
}

.live-chip .a {
  font-size: 1.5rem;
  line-height: 1;
}

.live-chip small,
.live-row small {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 6px;
}

.live-wait {
  text-align: center;
  font-weight: 900;
  font-size: 1.05rem;
  margin: 8px 0;
}

.live-qhead {
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
}

.live-timer {
  position: relative;
  height: 26px;
  background: #e4dff7;
  border-radius: 999px;
  overflow: hidden;
}

.live-timer > div {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.live-timer.low > div {
  background: var(--orange);
}

.live-timer span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.live-options .option {
  min-height: 92px;
}

.live-options .option.picked {
  outline: 4px solid var(--text);
  outline-offset: 2px;
}

.live-options.reveal .option {
  position: relative;
  min-height: 70px;
}

.live-options.reveal .option.mine {
  outline: 4px solid var(--text);
  outline-offset: 2px;
}

.live-options .cnt {
  position: absolute;
  right: 10px;
  top: 8px;
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-width: 26px;
  padding: 0 8px;
  font-weight: 900;
  text-align: center;
}

.live-result {
  border-radius: 18px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  animation: pop 0.25s;
}

.live-result b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.6rem;
}

.live-result span {
  font-weight: 900;
}

.live-result.ok {
  background: #d7f5e3;
  color: var(--green-dark);
  border: 3px solid var(--green);
}

.live-result.bad,
.live-result.none {
  background: #ffe9d6;
  color: #c75400;
  border: 3px solid var(--orange);
}

.live-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  font-weight: 800;
}

.live-row.me {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.live-row .r {
  width: 28px;
  text-align: center;
  font-weight: 900;
}

.live-row .a {
  font-size: 1.4rem;
}

.live-row .n {
  flex: 1;
  min-width: 0;
}

.live-row .up {
  color: var(--green);
  margin-left: 6px;
  font-size: 0.8rem;
}

.live-row b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.15rem;
}

.live-gap {
  text-align: center;
  color: var(--muted);
  font-weight: 900;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 8px;
  margin-top: 8px;
}

.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.pod .a {
  font-size: 2.6rem;
  line-height: 1.1;
}

.pod .n {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.pod .s {
  font-family: var(--font-display);
  color: var(--muted);
}

.pod .block {
  width: 100%;
  border-radius: 16px 16px 6px 6px;
  display: grid;
  place-items: start center;
  padding-top: 8px;
  font-size: 2rem;
  margin-top: 4px;
}

.pod.p1 {
  animation-delay: 0.6s;
}

.pod.p1 .block {
  height: 130px;
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-dark);
}

.pod.p2 {
  animation-delay: 0.3s;
}

.pod.p2 .block {
  height: 95px;
  background: #cfd6e6;
  box-shadow: 0 5px 0 #a3adc2;
}

.pod.p3 .block {
  height: 70px;
  background: #f0b27a;
  box-shadow: 0 5px 0 #c57d3d;
}

.live-place {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 4px 0;
}

.pair-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.pair-actions .btn {
  flex: 1;
}

.live-join {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.live-join form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.live-join-icon {
  font-size: 4rem;
  line-height: 1;
  margin-top: 30px;
}

.live-code-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 6px;
}

.avatar-grid.small {
  margin: 0;
}

.avatar-grid.small button {
  font-size: 1.6rem;
}

.small-note {
  font-size: 0.85rem;
}

.live-join-btn {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 2px dashed var(--primary);
  border-radius: 18px;
  padding: 12px 16px;
  text-align: left;
}

.live-join-btn span {
  font-size: 1.6rem;
}

.live-join-btn b {
  flex: 1;
}

.live-join-btn small {
  color: var(--muted);
  font-weight: 800;
}

.sheet-extra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

/* ---------- Förslag 5a: modernare startsida ---------- */

/* Vit bakgrund och ett typsnitt (Nunito) på startsidan */
body:has(.home5) {
  background: var(--surface);
}

.home5 {
  gap: 26px;
}

.home5 h3,
.home5 .panel-head h3 {
  font-family: var(--font-body);
  font-weight: 900;
}

.home5 #tab {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.ic {
  fill: currentColor;
  flex: none;
}

.me5 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me5-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 999px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  font-size: 1.5rem;
  display: grid;
  place-items: center;
}

.me5-hello {
  flex: 1;
  min-width: 0;
  font-weight: 900;
  font-size: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me5-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  font-size: 1.1rem;
  white-space: nowrap;
}

.me5-stat.fire {
  color: var(--orange);
}

.me5-stat.bolt {
  color: var(--yellow-dark);
}

.me5-stat.bolt .ic {
  color: var(--yellow);
}

/* Den enda färgade ytan: dagens mål eller provet */
.m5 {
  background: var(--primary);
  border-radius: 28px;
  padding: 24px 22px 22px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m5-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.m5-label {
  font-weight: 800;
  font-size: 0.95rem;
  opacity: 0.85;
}

.m5-pill {
  background: var(--orange);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
}

.m5-pill.urgent {
  background: var(--red);
}

.m5-big {
  font-weight: 900;
  font-size: clamp(2rem, 9vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.5px;
  margin-top: -6px;
}

.m5-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  margin-top: 4px;
}

.m5-bar {
  flex: 1;
  height: 16px;
  background: var(--primary-dark);
  border-radius: 999px;
  position: relative;
}

.m5-bar > div {
  height: 100%;
  background: var(--yellow);
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.m5-mark {
  position: absolute;
  left: 80%;
  top: -4px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: #fff;
}

.m5-note,
.m5-goal {
  font-weight: 800;
  font-size: 0.95rem;
  opacity: 0.85;
  margin-top: -4px;
}

.m5-goal {
  margin: 2px 0 0;
}

.m5-go {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 0;
  background: var(--surface);
  color: var(--text);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--primary-dark);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  transition: transform 0.08s, box-shadow 0.08s;
}

.m5-go:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--primary-dark);
}

.m5-go .tile,
.row5 .tile {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  flex: none;
}

.m5-go .txt,
.row5 .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m5-go b {
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.2;
}

.m5-go small,
.row5 small {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
}

.m5-go .play {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
}

.m5-empty {
  font-weight: 800;
}

/* Veckans match som en mening */
.week5 {
  appearance: none;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.week5 .faces {
  display: flex;
  flex: none;
}

.week5 .faces span {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid var(--surface);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: color-mix(in srgb, var(--pink, #ff5fa2) 18%, var(--surface));
}

.week5 .faces span + span {
  margin-left: -10px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.week5 .t {
  flex: 1;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.3;
}

.chev {
  color: #b6afd3;
}

/* Kortlekar, tävling och märke som rader utan ramar */
.list5 {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list5-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.list5-head h3 {
  font-size: 1.35rem;
  margin: 0;
}

.link5 {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 900;
  font-size: 1rem;
  color: var(--primary);
  cursor: pointer;
  padding: 4px;
}

.row5 {
  appearance: none;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  width: 100%;
  cursor: pointer;
}

.row5 .tile {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 1.9rem;
}

.row5 b {
  font-weight: 900;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.row5 .end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}

.stars5 {
  display: flex;
  gap: 2px;
}

.stars5 .on {
  color: var(--yellow);
}

.stars5 .off {
  color: #e4dff7;
}

.exam5 {
  color: var(--primary);
  font-weight: 900;
}

.exam5.soon {
  color: var(--orange);
}

.exam5.urgent {
  color: var(--red);
}

.div5 {
  height: 2px;
  background: color-mix(in srgb, var(--border) 50%, var(--surface));
  border-radius: 2px;
}

.live5 .tile {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.badge5 {
  cursor: default;
}

.badge5 .tile {
  background: color-mix(in srgb, var(--yellow) 22%, var(--surface));
}

.badge-count {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--orange);
}

/* Flikraden med ikoner */
.tabbar5 {
  border-top-color: color-mix(in srgb, var(--border) 50%, var(--surface));
}

.tabbar5 button {
  gap: 4px;
  font-size: 0.85rem;
  color: #8a83ab;
}

.tabbar5 button span {
  width: 56px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #b6afd3;
  font-size: 1rem;
}

.tabbar5 button.on span {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}

.tabbar5 button small {
  font-weight: 800;
  opacity: 0.7;
}

/* Utmaningarna utan ram på den nya startsidan */
.home5 .duels {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}

.home5 .duels .panel-head h3 {
  font-size: 1.35rem;
}

.home5 .duel-row {
  border-radius: 18px;
  padding: 10px 12px;
}

.row5 .tile,
.m5-go .tile {
  border: 0;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  flex-direction: row;
}

/* ---------- Granskning ---------- */

.edit-card.flagged,
.answer-input.flagged {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent);
}

.notice.blocked {
  border-color: var(--red);
}
