/* ==========================================================================
   Stavningsäventyret – CSS
   Pedagogiskt spel för stavning, bokstäver och meningsbyggnad (Åk 1–4)
   ========================================================================== */

:root {
  --advent-primary: #10b981;
  --advent-primary-dark: #047857;
  --advent-accent: #f59e0b;
  --advent-blue: #3b82f6;
  --advent-purple: #8b5cf6;
  --advent-rose: #f43f5e;
  --advent-bg: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 50%, #e0f2fe 100%);
  --advent-card-bg: #ffffff;
  --advent-border: #cbd5e1;
  --advent-text: #0f172a;
  --advent-text-muted: #64748b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body.stavningsaventyr-page {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--advent-bg);
  color: var(--advent-text);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

/* ─────────────────────────── HEADER ─────────────────────────── */
.advent-navbar {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  color: #ffffff;
  padding: 12px 24px;
  box-shadow: 0 4px 15px rgba(6, 78, 59, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.advent-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.tillbaka-lank {
  color: #a7f3d0;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.tillbaka-lank:hover {
  color: #fef08a;
  text-decoration: none;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 900;
  margin: 0;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: #d1fae5;
  margin: 0;
  font-weight: 600;
}

.nav-stats-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sound-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sound-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* ─────────────────────────── SPELVÄRLD / KARTA ─────────────────────────── */
.varld-sektion {
  background: #ffffff;
  border-bottom: 2px solid var(--advent-border);
  padding: 16px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.varld-karta-container {
  max-width: 980px;
  margin: 0 auto;
  position: relative;
}

.varld-stig-svg {
  width: 100%;
  height: 90px;
  display: block;
}

/* Stationer på kartan */
.station-punkt {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.station-punkt:hover {
  transform: scale(1.12);
}

.station-punkt.aktiv circle.station-bg {
  stroke: #f59e0b !important;
  stroke-width: 4 !important;
  fill: #fffbeb !important;
}

.station-punkt.klar circle.station-bg {
  fill: #d1fae5 !important;
  stroke: #10b981 !important;
}

/* Äventyrsfiguren */
#aventyrsFigur {
  transition: transform 0.8s cubic-bezier(0.34, 1.25, 0.64, 1);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
}

/* ─────────────────────────── NIVÅ-NAVBAR ─────────────────────────── */
.niva-bar {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.niva-knapp {
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  border-radius: 25px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.niva-knapp:hover {
  border-color: #10b981;
  color: #047857;
  transform: translateY(-1px);
}

.niva-knapp.aktiv {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.niva-nr-cirkel {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
}

.niva-knapp.aktiv .niva-nr-cirkel {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ─────────────────────────── HUVUDLAYOUT ─────────────────────────── */
.spel-container {
  max-width: 900px;
  margin: 28px auto 40px;
  padding: 0 16px;
}

.uppgifts-kort {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 3px solid var(--advent-border);
  box-shadow: var(--shadow-main);
  padding: 30px;
  position: relative;
  text-align: center;
}

.uppgift-topp-rad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
}

.uppgift-niva-namn {
  font-size: 1.25rem;
  font-weight: 900;
  color: #064e3b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fraga-rakning-badge {
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #a7f3d0;
}

.instruktion-text {
  font-size: 1.15rem;
  color: #334155;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ─────────────────────────── NIVÅ 1: VÄLJ RÄTT ORD ─────────────────────────── */
.valj-ord-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto 24px;
}

.ord-val-knapp {
  background: #f8fafc;
  border: 3px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ord-val-knapp:hover {
  background: #f0fdf4;
  border-color: #10b981;
  color: #047857;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.18);
}

.ord-val-knapp.ratt {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4) !important;
}

.ord-val-knapp.fel {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
  animation: skaka 0.4s ease;
}

@keyframes skaka {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ─────────────────────────── NIVÅ 2: FYLL I BOKSTAV ─────────────────────────── */
.lucka-ord-visning {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #0f172a;
  margin: 20px 0 30px;
}

.lucka-ruta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 68px;
  background: #fef08a;
  border: 3px dashed #ca8a04;
  border-radius: 12px;
  color: #854d0e;
  vertical-align: middle;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
  animation: pulsera-lucka 1.8s infinite;
}

@keyframes pulsera-lucka {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.bokstav-val-rad {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.bokstav-knapp {
  width: 72px;
  height: 72px;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 3px solid #cbd5e1;
  border-radius: 16px;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
}

.bokstav-knapp:hover {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #10b981;
  color: #047857;
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.25);
}

.bokstav-knapp.fel {
  border-color: #ef4444;
  background: #fee2e2;
  color: #991b1b;
  animation: skaka 0.4s ease;
}

/* ─────────────────────────── NIVÅ 3: BYGG ORD ─────────────────────────── */
.bygg-ord-sektion {
  margin: 20px 0;
}

.bygg-slots-rad {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.bygg-slot {
  width: 64px;
  height: 72px;
  background: #f1f5f9;
  border: 3px dashed #94a3b8;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  color: #0f172a;
  transition: all 0.15s;
  cursor: pointer;
}

.bygg-slot.fylld {
  background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
  border: 3px solid #ca8a04;
  color: #713f12;
  box-shadow: 0 4px 10px rgba(202, 138, 4, 0.25);
}

.bygg-slot.drag-over {
  border-color: #10b981;
  background: #ecfdf5;
}

.bygg-brickor-bank {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  min-height: 90px;
}

.bokstav-bricka {
  width: 64px;
  height: 72px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 3px solid #3b82f6;
  border-radius: 14px;
  color: #1d4ed8;
  font-size: 2.2rem;
  font-weight: 900;
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
  transition: transform 0.15s, box-shadow 0.15s;
}

.bokstav-bricka:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.bokstav-bricka:active {
  cursor: grabbing;
}

/* ─────────────────────────── NIVÅ 4: HITTA STAVFEL ─────────────────────────── */
.stavfel-mening-box {
  background: #f8fafc;
  border: 3px solid #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  margin: 20px auto 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 680px;
}

.klickbart-ord {
  font-size: 1.55rem;
  font-weight: 800;
  color: #1e293b;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}

.klickbart-ord:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.klickbart-ord.markerat-stavfel {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  animation: pulsera-fel 1.2s infinite;
}

@keyframes pulsera-fel {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.klickbart-ord.korrigerat {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
}

.korrigerings-dialog {
  margin-top: 20px;
  padding: 20px;
  background: #eff6ff;
  border: 2px solid #93c5fd;
  border-radius: 16px;
}

.korrigerings-titel {
  font-size: 1rem;
  font-weight: 800;
  color: #1e40af;
  margin-bottom: 12px;
}

.korrigerings-alternativ-rad {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-korrigering {
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1d4ed8;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-korrigering:hover {
  background: #2563eb;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

/* ─────────────────────────── NIVÅ 5: MENINGSBYGGNAD ─────────────────────────── */
.meningsbygg-sektion {
  margin: 20px 0;
}

.menings-remsa {
  min-height: 80px;
  background: #f1f5f9;
  border: 3px dashed #94a3b8;
  border-radius: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.menings-ord-bank {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ord-bricka {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 3px solid #8b5cf6;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #5b21b6;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 4px 8px rgba(139, 92, 246, 0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}

.ord-bricka:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 16px rgba(139, 92, 246, 0.3);
}

.ord-bricka:active {
  cursor: grabbing;
}

.ord-bricka.i-mening {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border-color: #7c3aed;
  color: #4c1d95;
}

/* ─────────────────────────── FEEDBACK & KNAPPAR ─────────────────────────── */
.feedback-banner {
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 18px 0;
  animation: dropDown 0.25s ease;
}

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-banner.dold {
  display: none;
}

.feedback-banner.ratt {
  background: #ecfdf5;
  color: #065f46;
  border: 2px solid #10b981;
}

.feedback-banner.fel {
  background: #fef2f2;
  color: #991b1b;
  border: 2px solid #ef4444;
}

.kontroll-knapp-rad {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.btn-advent {
  border: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-nasta {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-nasta:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.btn-nasta:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ledtrad {
  background: #fffbeb;
  border: 2px solid #fde68a;
  color: #b45309;
}

.btn-ledtrad:hover {
  background: #fef3c7;
}

.btn-aterstall {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #475569;
}

.btn-aterstall:hover {
  background: #e2e8f0;
}

/* ─────────────────────────── SVÄVANDE DRAG GHOST ─────────────────────────── */
.drag-svavare-ord {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.35rem;
  padding: 12px 22px;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%) rotate(-4deg) scale(1.08);
}

/* ─────────────────────────── MODAL KANVAS ─────────────────────────── */
.modal-aventyr {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-aventyr.oppen {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: 24px;
  border: 4px solid #10b981;
  max-width: 500px;
  width: 100%;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-ikon {
  font-size: 4.5rem;
  margin-bottom: 12px;
}

.modal-titel {
  font-size: 1.7rem;
  font-weight: 900;
  color: #064e3b;
  margin-bottom: 10px;
}

.modal-text {
  color: #475569;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ─────────────────────────── FOOTER ─────────────────────────── */
.spel-footer {
  background: #064e3b;
  color: #a7f3d0;
  padding: 16px 24px;
  font-size: 0.85rem;
  border-top: 1px solid #047857;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-link {
  color: #fef08a;
  text-decoration: none;
  font-weight: 700;
}

.footer-link:hover {
  text-decoration: underline;
}
