/* Snurrigt i Gamla Stan – spelvyn */
:root {
  --plum: #4b1d6b; --plum-2: #2c0f45; --pink: #ff3d7f; --red: #e8174a; --red-dark: #a30d34;
  --cream: #fff7ee; --mint: #2fd1ae; --mint-dark: #16977c; --teal: #16a39a; --gold: #ffc93c; --gold-dark: #c98f00;
  --ink: #2a1838; --muted: #7d6a8a;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: "Nunito", system-ui, -apple-system, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(circle at 20% 0%, rgba(255,61,127,.35), transparent 45%), radial-gradient(circle at 100% 90%, rgba(47,209,174,.25), transparent 45%), linear-gradient(160deg, var(--plum), var(--plum-2));
  background-attachment: fixed; overflow: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3, .btn, b.big, .timer b, .fredoka { font-family: "Fredoka", "Nunito", sans-serif; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.screen { position: fixed; inset: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 20px; font-size: 17px; font-weight: 600;
  color: #fff; background: linear-gradient(180deg, var(--pink), var(--red)); box-shadow: 0 4px 0 var(--red-dark); cursor: pointer; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn:disabled { opacity: .55; }
.btn.big { width: 100%; padding: 16px; font-size: 21px; }
.btn.mint { background: linear-gradient(180deg, #4de8c6, var(--mint)); box-shadow: 0 4px 0 var(--mint-dark); color: #073d33; }
.btn.gold { background: linear-gradient(180deg, #ffe08a, var(--gold)); box-shadow: 0 4px 0 var(--gold-dark); color: #5a3b00; }
.btn.ghost { background: #fff; color: var(--red); box-shadow: 0 3px 0 #f0c9d5, inset 0 0 0 2px #ffd1df; }
input { width: 100%; font: inherit; font-size: 17px; color: var(--ink); border: 2px solid #eadff0; border-radius: 16px; padding: 12px 14px; background: #fff; outline: none; }
input:focus { border-color: var(--pink); }
.row { display: flex; gap: 8px; } .row input { flex: 1; min-width: 0; }
.err { color: #b3123e; background: #ffe8ef; border-radius: 12px; padding: 8px 12px; font-weight: 700; margin: 8px 0 0; }

/* --- Förladdning --- */
.boot { display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px; text-align: center; color: #fff; }
.boot-logo { width: min(86vw, 420px); filter: drop-shadow(0 10px 20px rgba(0,0,0,.35)); animation: floaty 3s ease-in-out infinite; }
.boot-bar { width: min(76vw, 340px); height: 18px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.3); }
.boot-bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s;
  background: repeating-linear-gradient(135deg, var(--red) 0 10px, #fff 10px 20px); animation: stripes 1s linear infinite; background-size: 28px 28px; }
.boot p { margin: 0; font-weight: 800; }
@keyframes stripes { to { background-position: 28px 0; } }
@keyframes floaty { 50% { transform: translateY(-8px) rotate(-1deg); } }

/* --- Lobby --- */
.lobby { overflow-y: auto; padding: calc(12px + var(--st)) 16px calc(100px + var(--sb)); display: flex; flex-direction: column; align-items: center; }
.lobby-logo { width: min(80vw, 380px); filter: drop-shadow(0 8px 16px rgba(0,0,0,.35)); }
.lobby-logo.small { width: min(56vw, 260px); }
.lobby > * { flex-shrink: 0; }
.lobby-logo { width: min(88vw, 420px); margin-top: 4px; }
.lobby-bubble { width: 100%; max-width: 440px; margin: 14px 0 26px; }
#lobbyBubble.up::before { left: 50%; }
.lobby-card { width: 100%; max-width: 440px; background: var(--cream); border-radius: 26px; padding: 16px; box-shadow: 0 8px 0 rgba(0,0,0,.2); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.facts div { background: #fff; border-radius: 16px; padding: 8px 4px; box-shadow: 0 3px 0 #efdfe8; }
.facts b { display: block; font-family: "Fredoka"; font-size: 28px; color: var(--red); line-height: 1.1; }
.facts small { font-weight: 800; color: var(--muted); }
.goal-line { text-align: center; font-weight: 700; margin: 12px 0; }
.login-box label { display: block; font-weight: 800; margin-bottom: 6px; }
.ok-line { background: #e3faf3; color: #0d6e5a; font-weight: 800; padding: 10px 12px; border-radius: 14px; text-align: center; }
.waiting { margin-top: 12px; text-align: center; font-weight: 800; color: var(--plum); }
.dots i { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--pink); animation: bob 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 50% { transform: translateY(-5px); opacity: .5; } }

/* --- Randi-sprite och pratbubblor --- */
.randi-sprite { width: 150px; aspect-ratio: 2 / 3; }
.randi-sprite.big { width: 170px; }
.randi-sprite img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 8px 10px rgba(0,0,0,.3)); }
.bubble { display: flex; flex-direction: column; justify-content: center; background: #fff; color: var(--ink); border-radius: 22px; padding: 12px 15px; font-weight: 700; font-size: 16px; line-height: 1.35; position: relative;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); animation: pop .35s cubic-bezier(.2,1.6,.4,1) both; min-height: 1.35em; }
.bubble.left::before { content: ""; position: absolute; left: -12px; bottom: 22px; border: 8px solid transparent; border-right: 14px solid #fff; border-left: 0; }
.bubble.up::before { content: ""; position: absolute; top: -12px; left: 50%; margin-left: -9px; border: 9px solid transparent; border-bottom: 14px solid #fff; border-top: 0; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- Spelvyn --- */
.play { display: flex; flex-direction: column; }
.hud { position: relative; z-index: 900; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: calc(8px + var(--st)) 10px 8px; background: linear-gradient(180deg, rgba(44,15,69,.98), rgba(44,15,69,.9)); color: #fff; }
.timer { background: #fff; color: var(--plum); border-radius: 18px; padding: 4px 12px 6px; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.25); min-width: 112px; transition: background .3s, color .3s; }
.timer small { display: block; font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; opacity: .7; }
.timer b { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.timer.warn { background: var(--gold); color: #5a3b00; }
.timer.hot { background: var(--red); color: #fff; animation: pulse 1s infinite; }
.timer.over { background: #b3123e; color: #fff; animation: pulse .6s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.candy-hud { justify-self: center; display: grid; grid-template-columns: auto auto auto; grid-template-rows: auto auto; align-items: end; column-gap: 4px;
  border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 18px; padding: 6px 12px; cursor: pointer; }
.candy-hud { grid-template-rows: auto auto auto; }
.candy-hud img { grid-row: 1 / 4; width: 34px; height: 34px; animation: wiggle 4s ease-in-out infinite; }
.candy-hud .lvl-txt { grid-column: 2 / 4; grid-row: 1; font: 800 11px "Nunito", sans-serif; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); line-height: 1; text-align: left; }
.candy-hud b, .candy-hud > small { grid-row: 2; }
.candy-hud .lvl-bar { grid-row: 3; }
.candy-hud b { font-family: "Fredoka"; font-size: 30px; line-height: 1; }
.candy-hud small { font-weight: 800; opacity: .8; font-size: 16px; }
.candy-hud .lvl-bar { grid-column: 2 / 4; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 100%; height: 7px; margin-top: 4px; }
.lvl-bar i { display: block; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; position: relative; }
.lvl-bar i::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: repeating-linear-gradient(135deg, var(--red) 0 4px, #fff 4px 8px); transition: width .6s; }
.candy-hud.bump { animation: bump .6s cubic-bezier(.2,1.8,.4,1); }
@keyframes bump { 30% { transform: scale(1.25) rotate(-4deg); } }
@keyframes wiggle { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.pts { text-align: center; }
.pts b { display: block; font-family: "Fredoka"; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.pts small { font-weight: 800; opacity: .75; font-size: 11px; }
.pts.roll b { animation: roll .7s ease-out; color: var(--gold); }
@keyframes roll { 0% { transform: translateY(-40%) scale(1.4); } 60% { transform: translateY(6%) scale(1.1); } }
.penalty { position: relative; z-index: 850; background: #b3123e; color: #fff; text-align: center; font-weight: 800; padding: 6px 10px; font-size: 14px; }
.map { flex: 1; z-index: 1; }
.map-btn { position: fixed; right: 16px; bottom: calc(96px + var(--sb)); z-index: 800; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; color: var(--plum);
  font-size: 24px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.who-btn { position: fixed; left: 12px; bottom: calc(16px + var(--sb)); z-index: 800; border: 0; border-radius: 999px; padding: 10px 14px; font: 800 14px "Nunito", sans-serif;
  background: #fff; color: var(--plum); box-shadow: 0 4px 0 rgba(0,0,0,.25); max-width: calc(100vw - 110px); }
.who-btn.player { background: #e3faf3; color: #0d6e5a; }
.gps-warn { position: fixed; left: 12px; right: 90px; bottom: calc(66px + var(--sb)); z-index: 800; background: var(--gold); color: #5a3b00; font-weight: 800; font-size: 13px; padding: 8px 12px; border-radius: 14px; }

/* Kartnålar */
.pin { width: 38px; height: 46px; position: relative; }
.pin b { position: absolute; inset: 0 0 8px 0; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: repeating-linear-gradient(90deg, var(--red) 0 5px, var(--pink) 5px 10px); border: 3px solid #fff; box-shadow: 0 3px 6px rgba(0,0,0,.35); }
.pin span { position: absolute; top: 6px; left: 0; right: 0; text-align: center; color: #fff; font: 700 15px "Fredoka"; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.pin.text b { background: repeating-linear-gradient(90deg, #7a3fc4 0 5px, #9b5de5 5px 10px); }
.pin.done b { background: linear-gradient(135deg, #ffe08a, var(--gold)); }
.pin.done span { color: #5a3b00; text-shadow: none; }
/* Nära: en tydlig men stilla ring – ingen animation, så att kartan förblir läsbar och telefonen pigg */
.pin.near b { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,201,60,.55), 0 3px 6px rgba(0,0,0,.35); }
.pin .star { position: absolute; right: -6px; top: -6px; font-size: 15px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.goal-pin { width: 54px; height: 54px; border-radius: 50%; background: #fff url(../img/icon-192.png) center / 86% no-repeat; border: 3px solid var(--gold); box-shadow: 0 0 0 4px rgba(255,201,60,.4), 0 4px 10px rgba(0,0,0,.4); }
.goal-pin::after { content: "MÅL"; position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); background: var(--gold); color: #5a3b00; font: 700 11px "Fredoka"; padding: 1px 6px; border-radius: 8px; }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #3a8dff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(58,141,255,.25); }

/* --- Blad (frågekort m.m.) --- */
.sheet { position: fixed; inset: 0; z-index: 1550; background: rgba(20,6,32,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--cream); border-radius: 28px 28px 0 0;
  padding: 18px 16px calc(18px + var(--sb)); animation: up .3s cubic-bezier(.2,.9,.3,1.1); }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-card { border-radius: 28px; } }
@keyframes up { from { transform: translateY(40px); opacity: .3; } }
.sheet-card h2 { margin: 0 40px 6px 0; color: var(--plum); }
.sheet-card .x { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #f1e4ec; color: var(--plum); font-size: 17px; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-num { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 20px "Fredoka"; flex: none;
  background: repeating-linear-gradient(135deg, var(--red) 0 7px, var(--pink) 7px 14px); box-shadow: 0 3px 0 var(--red-dark); }
.q-num.done { background: linear-gradient(135deg, #ffe08a, var(--gold)); color: #5a3b00; box-shadow: 0 3px 0 var(--gold-dark); }
.q-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 9px; background: #f3eaf7; color: var(--plum); }
.tag.gold { background: #fff1c4; color: #8a5a00; }
.q-text { font-size: 20px; font-weight: 800; line-height: 1.35; background: #fff; border-radius: 18px; padding: 14px; box-shadow: 0 3px 0 #efdfe8; margin: 0 0 12px; }
.answer-area { display: grid; gap: 10px; }
.photo-btn { display: grid; place-items: center; gap: 4px; min-height: 150px; border-radius: 22px; border: 3px dashed var(--pink); cursor: pointer; text-align: center;
  background: repeating-linear-gradient(135deg, #ffe3ec 0 18px, #fff 18px 36px); color: var(--red-dark); font-weight: 800; }
.photo-btn .cam { font-size: 44px; }
.photo-prev { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 18px; background: #2a1838; }
.far { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: end; }
.far .randi-sprite { width: 120px; }
.done-box { background: #fff9e6; border-radius: 18px; padding: 12px 14px; font-weight: 800; color: #8a5a00; box-shadow: inset 0 0 0 2px var(--gold); }
.bonus-card { margin-top: 12px; background: linear-gradient(180deg, #fff9e6, #fff); border-radius: 20px; padding: 12px 14px; box-shadow: inset 0 0 0 2px var(--gold), 0 3px 0 #f5e2a8; }
.bonus-card h3 { margin: 0 0 6px; color: #8a5a00; }
.pending { background: #eef6ff; color: #1e4f8c; border-radius: 14px; padding: 10px 12px; font-weight: 800; }

/* --- Scen (Randi, emblem, nivåer) --- */
.stage { position: fixed; inset: 0; z-index: 1580; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(75,29,107,.85), rgba(20,6,32,.94)); animation: fade .25s; overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
.stage-inner { position: relative; display: grid; justify-items: center; gap: 10px; width: 100%; max-width: 440px; padding: 20px 16px calc(20px + var(--sb)); }
.stage-title { margin: 0; color: #fff; font-size: 34px; text-align: center; text-shadow: 0 4px 0 var(--red-dark), 0 8px 20px rgba(0,0,0,.4); animation: pop .5s cubic-bezier(.2,1.8,.4,1) both; }
.stage-title.gold { color: var(--gold); text-shadow: 0 4px 0 #8a5a00, 0 8px 20px rgba(0,0,0,.4); }
.stage .randi-sprite { width: 190px; animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; }
.stage .bubble { width: 100%; }
.stage-actions { display: flex; gap: 10px; width: 100%; } .stage-actions .btn { flex: 1; }
.rays { position: absolute; left: 50%; top: 32%; width: 900px; height: 900px; margin: -450px 0 0 -450px; pointer-events: none; opacity: .5;
  background: repeating-conic-gradient(from 0deg, rgba(255,201,60,.55) 0 10deg, transparent 10deg 20deg); border-radius: 50%;
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%); mask: radial-gradient(circle, #000 20%, transparent 65%); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.emblem-img { width: min(62vw, 260px); filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)); animation: emblemIn 1s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes emblemIn { 0% { transform: scale(0) rotate(-200deg); opacity: 0; } 70% { transform: scale(1.12) rotate(10deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.emblem-img.shine { animation: emblemIn 1s cubic-bezier(.2,1.4,.4,1) both, glow 2s 1s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 28px rgba(255,201,60,.9)); } }
.big-plus { font: 700 64px "Fredoka"; color: var(--gold); text-shadow: 0 5px 0 #8a5a00; animation: pop .5s cubic-bezier(.2,1.8,.4,1) both; }

/* --- Godishyllor --- */
.shelf { margin: 12px 0 18px; }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; color: var(--plum); }
.shelf-head b { font-family: "Nunito", sans-serif; font-weight: 800; font-size: 15px; color: var(--plum); }
.shelf-head .lvl-name { font-style: normal; font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 20px; color: var(--red); margin-right: 6px; }
.shelf-row { display: flex; justify-content: space-around; align-items: flex-end; padding: 10px 8px 0; min-height: 76px;
  border-bottom: 12px solid #c98a5a; border-radius: 6px; background: linear-gradient(180deg, transparent 60%, rgba(201,138,90,.15)); box-shadow: 0 6px 0 #8e5a33; }
.slot { width: 38px; height: 64px; display: grid; place-items: end center; }
.slot img { width: 58px; height: 58px; transform: rotate(-45deg) translate(6px, 0); transition: filter .4s, opacity .4s; }
.slot.empty img { filter: grayscale(1) brightness(1.6); opacity: .28; }
.slot.new img { animation: drop .8s cubic-bezier(.2,1.6,.4,1); }
@keyframes drop { from { transform: rotate(-45deg) translate(6px, -80px); opacity: 0; } }
.next-bar { height: 16px; border-radius: 999px; background: #f1e4ec; overflow: hidden; margin: 4px 0 2px; }
.next-bar i { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--red) 0 8px, #fff 8px 16px); border-radius: 999px; transition: width .6s; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-top: 8px; }
.stats div { background: #fff; border-radius: 14px; padding: 8px 4px; box-shadow: 0 3px 0 #efdfe8; }
.stats b { display: block; font: 700 22px "Fredoka"; color: var(--red); }
.stats small { font-weight: 800; color: var(--muted); font-size: 12px; }

/* --- Toast-händelser --- */
.toasts { position: fixed; left: 10px; right: 10px; top: calc(80px + var(--st)); z-index: 1650; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 20px; padding: 8px 14px 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  font-weight: 800; max-width: 440px; animation: pop .35s cubic-bezier(.2,1.6,.4,1) both; pointer-events: auto; }
.toast img { width: 42px; height: 42px; border-radius: 50%; background: #fff1e2; flex: none; }
.toast.good { box-shadow: 0 8px 24px rgba(0,0,0,.3), inset 0 0 0 3px var(--mint); }
.toast.bad { box-shadow: 0 8px 24px rgba(0,0,0,.3), inset 0 0 0 3px #ffb3c6; }
.toast.out { animation: fadeout .4s forwards; }
@keyframes fadeout { to { opacity: 0; transform: translateY(-10px); } }

.pause { position: fixed; inset: 0; z-index: 1560; display: grid; place-items: center; background: rgba(20,6,32,.7); color: #fff; text-align: center; padding: 24px; }
.pause b { font: 700 40px "Fredoka"; }

/* --- Final --- */
.finale { overflow-y: auto; padding: calc(12px + var(--st)) 16px calc(40px + var(--sb)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.finale .bubble { max-width: 440px; width: 100%; }
.finale-card { width: 100%; max-width: 440px; background: var(--cream); border-radius: 26px; padding: 16px; box-shadow: 0 8px 0 rgba(0,0,0,.2); text-align: center; }
.finale-card .huge { font: 700 64px "Fredoka"; color: var(--red); line-height: 1; }
.candy-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 10px 0; }
.candy-row img { width: 34px; height: 34px; animation: drop .6s both; }

/* Konfetti */
.confetti { position: fixed; top: -14px; width: 10px; height: 16px; z-index: 3000; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(760deg); } }

.leaflet-container { font-family: "Nunito", sans-serif; background: #e8e0d8; }
/* Låt Randi-chatten ligga ovanför who-knappen */
.randi-fab { bottom: calc(14px + var(--sb)) !important; }

.randi-panel { z-index: 1700 !important; }

/* Framskriven text: osynliga kopior håller bubblans storlek, texten centreras vertikalt */
.tt { display: grid; }
.tt > span { grid-area: 1 / 1; }
.tt-ghost { visibility: hidden; }
.tt-live { align-self: center; }

.demo-bar { position: relative; z-index: 850; background: #16a39a; color: #fff; text-align: center; font-weight: 800; font-size: 13px; padding: 6px 10px; }
.demo-bar a, .demo-bar button { color: #fff; font: inherit; background: none; border: 0; text-decoration: underline; padding: 0; cursor: pointer; }

.q-photo { display: block; width: 100%; max-height: 38vh; object-fit: contain; border-radius: 18px; background: #2a1838; margin: -2px 0 12px; box-shadow: 0 3px 0 #efdfe8; cursor: zoom-in; }
.q-photo.zoom { max-height: 80vh; cursor: zoom-out; }

.pin span { font-size: 14px; }
.retry-note { display: flex; gap: 8px; align-items: center; background: #ffe8ef; color: #8c0f31; border-radius: 16px; padding: 8px 12px 8px 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.retry-note img { width: 40px; height: 40px; border-radius: 50%; background: #fff1e2; flex: none; }
.q-num { font-size: 22px; }

.key-row { display: flex; justify-content: flex-end; margin-top: 6px; min-height: 30px; }
.key-btn { border: 0; background: transparent; font-size: 20px; opacity: .45; cursor: pointer; padding: 2px 6px; }
.key-ok { border: 0; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 800; color: #0d6e5a; background: #e3faf3; border-radius: 999px; padding: 4px 10px; }
.login-box { margin-top: 6px; }

.demo-note { margin: 10px 0 0; text-align: center; font-size: 13px; font-weight: 700; color: #0e7c86; background: #e3f7f5; border-radius: 12px; padding: 8px 10px; }
.demo-note a { color: #0e7c86; }

/* Godishyllan i firandet */
.stage-extra { width: 100%; }
.pop-shelf { background: var(--cream); border-radius: 22px; padding: 12px 14px 16px; margin: 0; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; }
.pop-shelf .shelf-row { min-height: 84px; }
.slot.new img { animation: dropIn 1s .35s cubic-bezier(.3,1.5,.5,1) both, candyGlow 1.6s 1.3s ease-in-out 2; }
@keyframes dropIn { from { transform: rotate(-45deg) translate(6px, -140px) scale(1.4); opacity: 0; } to { transform: rotate(-45deg) translate(6px, 0) scale(1); opacity: 1; } }
@keyframes candyGlow { 50% { filter: drop-shadow(0 0 12px rgba(255,201,60,1)); } }

/* Nästa godisbit fylls på underifrån */
.slot > img { grid-area: 1 / 1; }
.slot.partial .ghost { filter: grayscale(1) brightness(1.6); opacity: .28; }
.slot.partial .fill { clip-path: inset(calc(100% - var(--fill, 0%)) 0 0 0); transition: clip-path .8s ease-out; filter: drop-shadow(0 0 6px rgba(255,201,60,.8)); }

/* Klar nivå på godishyllan */
.shelf.done .shelf-head .per { color: var(--mint-dark); font-size: 18px; font-weight: 800; }
.shelf.done .shelf-head .klar { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: var(--mint); color: #073d33; font: 700 14px "Fredoka", sans-serif; vertical-align: 2px; }

.candy-hud #candyPer { font-size: 13px; line-height: 1.1; align-self: center; max-width: 70px; text-align: left; opacity: .9; }

.gps-line { margin: 10px 0 0; text-align: center; font-size: 14px; font-weight: 800; color: var(--plum); background: #f3eaf7; border-radius: 12px; padding: 8px 10px; }
.gps-line.ok { background: #e3faf3; color: #0d6e5a; }
.gps-line.bad { background: #ffe8ef; color: #b3123e; }

/* Luft i botten av startskärmen så att man kan skrolla förbi Randi-cirkeln (Safari ignorerar ofta padding-bottom i skrollande flex-behållare) */
.lobby { padding-bottom: var(--sb); }
.lobby::after { content: ""; display: block; flex: 0 0 80px; height: 80px; }

.login-lbl { display: block; font-weight: 800; color: var(--plum); margin: 4px 0 6px; }

/* Slutskärmen */
.finale > * { flex-shrink: 0; }
.finale::after { content: ""; display: block; flex: 0 0 80px; height: 80px; }
.finale .lobby-logo.small { width: min(60vw, 260px); }
.finale .randi-sprite.big { width: 140px; }
.finale-card { padding: 18px 16px; }
.fin-emblem { width: 110px; height: 110px; object-fit: contain; display: block; margin: -4px auto 4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); animation: emblemIn 1s cubic-bezier(.2,1.4,.4,1) both; }
.fin-big { display: flex; align-items: center; justify-content: center; gap: 10px; }
.fin-big .huge { font: 700 76px/1 "Fredoka"; color: var(--red); }
.fin-per { text-align: left; font: 700 22px/1.1 "Fredoka"; color: var(--plum); }
.fin-level { margin: 6px 0 14px; font: 700 18px "Fredoka"; color: var(--mint-dark); }

/* Slutskärm: logga vänster, räv höger, pilen pekar på räven */
.fin-head { width: 100%; max-width: 440px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fin-logo { flex: 1 1 auto; min-width: 0; max-width: 260px; width: 100%; filter: drop-shadow(0 8px 16px rgba(0,0,0,.35)); }
.fin-head .randi-sprite.big { flex: 0 0 140px; width: 140px; }
.finale .fin-bubble { margin-top: 4px; }
.finale .fin-bubble.up::before { left: auto; right: 61px; margin-left: 0; }
