:root {
  --ink: #2f3550;
  --ink-soft: #6b7090;
  --cream: #fffaf0;
  --coral: #ff7a6b;
  --sky: #3fa7ef;
  --sun: #ffc93c;
  --rose: #ff6f9c;
  --panel: rgba(255, 251, 242, .93);
  --display: "Fredoka", "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: #4fb6ec; color: var(--ink); font-family: var(--body); overflow: hidden;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD */
/* Utrymmet för notchen eller Dynamic Island. --safe-top-test finns bara för testerna, som inte kan ge webbläsaren en notch. */
:root { --safe-top: max(env(safe-area-inset-top, 0px), var(--safe-top-test, 0px)); --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-bottom-test, 0px)); }
.hud { position: fixed; left: 0; right: 0; top: 0; z-index: 3; padding: calc(var(--safe-top) + 9px) 12px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; pointer-events: none; }
.hud > * { pointer-events: auto; }
.pill { background: var(--panel); border-radius: 999px; padding: 5px 12px 5px 6px; border: 0;
  box-shadow: 0 3px 0 rgba(30, 70, 110, .18), 0 8px 18px rgba(30, 70, 110, .16);
  font: 700 18px/1 var(--display); display: inline-flex; align-items: center; gap: 7px; min-height: 40px; box-sizing: border-box; }
.pill.bump { animation: bump .22s; }
@keyframes bump { 50% { transform: scale(1.13); } }
.coin { display: inline-block; width: 26px; height: 26px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff7c2 0 16%, #ffd84a 17% 58%, #eaa91c 59%); box-shadow: inset 0 0 0 2px #d39212, 0 2px 0 #b8790c; }
.coin::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid rgba(190, 120, 10, .5); }
.coin.sm { width: 17px; height: 17px; box-shadow: inset 0 0 0 1.5px #d39212, 0 1px 0 #b8790c; }
.coin.sm::after { inset: 4px; border-width: 1.5px; }
.hudL { justify-self: start; min-width: 0; }
.hudR { justify-self: end; display: flex; gap: 6px; }
.mid { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.loc { font: 700 20px/1 var(--display); color: #fff; text-shadow: 0 2px 0 rgba(20, 70, 120, .45), 0 0 12px rgba(20, 70, 120, .25); white-space: nowrap; letter-spacing: .01em; }
.bar { width: 120px; height: 9px; border-radius: 999px; background: rgba(255, 255, 255, .5); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ffd84a, #ff9a3c); transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.icoBtn { width: 40px; height: 40px; padding: 0; justify-content: center; cursor: pointer; }
.icoBtn svg { width: 22px; height: 22px; }
.icoBtn.off { opacity: .5; }

/* arket nederst */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; background: linear-gradient(#fffaf0, #fff0d8);
  border-radius: 26px 26px 0 0; box-shadow: 0 -6px 24px rgba(20, 60, 100, .22); display: flex; flex-direction: column; }
.sheet::before { content: ''; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: rgba(160, 120, 70, .2); }
.views { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; gap: 9px; flex: 1; min-height: 0; }
.nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 10px calc(var(--safe-bottom) + 6px); border-top: 1.5px solid rgba(160, 120, 70, .14); }
.nav button { border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 3px; font: 600 12.5px/1 var(--display); color: var(--ink-soft);
  border-radius: 14px; cursor: pointer; position: relative; min-height: 50px; }
.nav button.on { color: var(--ink); background: rgba(255, 190, 110, .26); }
.nav svg { width: 26px; height: 26px; }
.badge { position: absolute; top: 2px; left: calc(50% + 8px); background: #ff5d73; color: #fff; font: 700 11px/1 var(--display); border-radius: 999px; padding: 3px 6px;
  box-shadow: 0 2px 0 #c93b50; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }

.status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rolls { display: flex; align-items: center; gap: 6px; font: 700 24px/1 var(--display); }
.rolls svg { width: 26px; height: 26px; }
.rolls small { font: 800 11px/1 var(--body); color: var(--ink-soft); letter-spacing: .06em; text-transform: uppercase; }
.chip { justify-self: center; border: 0; border-radius: 999px; padding: 9px 12px; font: 700 14px/1 var(--display); cursor: pointer; white-space: nowrap;
  background: #e5f3ff; color: #2a6fb0; box-shadow: 0 3px 0 #b7d6f2; }
.chip.m2 { background: #fff0c2; color: #a26b05; box-shadow: 0 3px 0 #ecd08a; }
.chip.m3 { background: #ffd8e6; color: #c2386d; box-shadow: 0 3px 0 #f2adc6; }
.chip:active { transform: translateY(2px); box-shadow: none; }
.precis { border: 0; border-radius: 16px; padding: 7px 11px; cursor: pointer; display: grid; justify-items: center; gap: 4px; font: 700 14px/1 var(--display);
  background: #f1ece4; color: #9a8f80; box-shadow: 0 3px 0 #ddd2c2; }
.precis.ready { background: linear-gradient(#ffe68a, #ffbf2e); color: #6b4300; box-shadow: 0 3px 0 #d69212, 0 0 0 0 rgba(255, 191, 46, .6); animation: glow 1.3s infinite; }
@keyframes glow { 50% { box-shadow: 0 3px 0 #d69212, 0 0 0 7px rgba(255, 191, 46, 0); } }
.pips { display: flex; gap: 3px; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(0, 0, 0, .14); }
.pips i.on { background: #ffaf1a; box-shadow: 0 0 4px #ffcf5a; }
.precis.ready .pips i { background: #fff; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: min-content; max-height: 200px; } /* min-content: korten ska aldrig krympa under sitt innehåll och lägga sig över tipsraden */
.opt { --c: #ff6f61; --sh: #f3c4bd; border: 0; border-radius: 22px; background: #fff; cursor: pointer; position: relative;
  box-shadow: 0 5px 0 var(--sh), 0 10px 18px rgba(80, 50, 20, .1); display: grid; align-content: center; justify-items: center; gap: 6px; padding: 10px 6px; min-width: 0; }
#optB { --c: #2f9be6; --sh: #bcd9f0; }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--sh); }
.opt:disabled { cursor: default; }
.opt.dim { opacity: .55; }
.opt .tag { position: absolute; top: 8px; left: 9px; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font: 700 13px/22px var(--display); text-align: center; }
.dice { display: flex; gap: 8px; }
.die { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(#fff, #f3eef7); box-shadow: inset 0 -3px 0 #ddd3e6, 0 2px 5px rgba(0, 0, 0, .16);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 5px; box-sizing: border-box; }
.die i { border-radius: 50%; margin: 1.3px; }
.die i.on { background: var(--c); }
.tumble .die { animation: tumble .6s cubic-bezier(.2, .8, .3, 1) both; }
.tumble .die + .die { animation-delay: .06s; }
@keyframes tumble { 0% { transform: translateY(-16px) rotate(-220deg) scale(.6); } 65% { transform: translateY(3px) rotate(14deg) scale(1.05); } 100% { transform: none; } }
.sum { font: 700 30px/1 var(--display); color: var(--c); }
.dest { display: flex; align-items: center; gap: 5px; font: 800 14px/1 var(--body); white-space: nowrap; }
.dest canvas { width: 24px; height: 24px; flex: none; }
.pass { font: 800 11px/1 var(--body); color: #b88a10; }
.what { font: 700 12px/1.15 var(--body); color: var(--ink-soft); text-align: center; padding: 0 4px; }
@media (min-height: 780px) { .die { width: 40px; height: 40px; padding: 6px; } .sum { font-size: 34px; } .opt { gap: 8px; } }
.hint { text-align: center; font: 700 13px/1.3 var(--body); color: var(--ink-soft); min-height: 17px; }
.hint b { color: #e8566a; font-weight: 800; }

.goal { border: 0; cursor: pointer; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 7px 12px 7px 7px; box-shadow: 0 3px 0 #eadfcb; text-align: left; }
.goal canvas { width: 40px; height: 40px; border-radius: 10px; background: #eef8ff; }
.goal b { font: 600 14px/1.1 var(--display); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal span { font: 700 13px/1 var(--display); color: var(--ink-soft); white-space: nowrap; }
.goal.can span { color: #2f8a3a; }
.gbar { height: 8px; border-radius: 4px; background: #efe7da; overflow: hidden; margin-top: 5px; }
.gbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd84a, #ff9a3c); border-radius: 4px; transition: width .5s; }
.goal.can .gbar i { background: linear-gradient(90deg, #7fd86a, #45b350); }
@media (max-height: 780px) { .goal { display: none; } }
.newday { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; background: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 5px 0 #eadfcb; }
.newday b { font: 700 19px/1.1 var(--display); }
.newday p { margin: 0; font-weight: 700; color: var(--ink-soft); font-size: 13px; }
.sunIc { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #ffe680 0 45%, #ffc93c 46% 62%, transparent 63%); position: relative; animation: spin 12s linear infinite; }
.sunIc::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; background: repeating-conic-gradient(#ffc93c 0 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%); }
@keyframes spin { to { transform: rotate(360deg); } }

.vhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vhead b { font: 700 19px/1 var(--display); }
.vhead span { font: 800 12px/1 var(--body); color: var(--ink-soft); }
.aimBox { flex: 1; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; background: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 5px 0 #eadfcb; }
.aimBox b { font: 700 19px/1.15 var(--display); }
.aimBox p { margin: 0; font-weight: 700; color: var(--ink-soft); font-size: 13.5px; }
.track { position: relative; width: 100%; height: 46px; border-radius: 23px; background: linear-gradient(90deg, #ffd1c9, #fff3d1 50%, #ffd1c9); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .13); overflow: hidden; }
.zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(#93e88a, #46c05a); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7) inset; }
.zone::after { content: ''; position: absolute; top: 0; bottom: 0; left: 35%; right: 35%; background: rgba(255, 255, 255, .45); }
.marker { position: absolute; top: 3px; bottom: 3px; width: 10px; margin-left: -5px; border-radius: 5px; background: var(--ink); box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, .3); }
.res { font: 700 22px/1 var(--display); min-height: 22px; }

.blist { display: grid; gap: 7px; }
.brow { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 9px; background: #fff; border-radius: 16px; padding: 4px 8px 4px 4px; box-shadow: 0 3px 0 #eadfcb; }
.brow canvas { width: 46px; height: 46px; border-radius: 12px; background: #eef8ff; }
.brow .nm { font: 700 15.5px/1.05 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv { display: flex; gap: 4px; margin-top: 4px; }
.lv i { width: 16px; height: 6px; border-radius: 3px; background: #ece3d4; }
.lv i.on { background: linear-gradient(90deg, #ffc93c, #ff9a3c); }
.bBtn { border: 0; border-radius: 13px; padding: 8px 10px; min-width: 84px; min-height: 38px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font: 700 15px/1 var(--display); color: #fff; background: linear-gradient(#7fd86a, #45b350); box-shadow: 0 3px 0 #2f8a3a; }
.bBtn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #2f8a3a; }
.bBtn.poor { background: #efe8dc; color: #a39887; box-shadow: 0 3px 0 #ddd2c0; cursor: default; }
.bBtn.done { background: none; box-shadow: none; color: #45b350; cursor: default; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(20, 55, 90, .45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); padding: 14px; box-sizing: border-box; }
.card { background: var(--cream); border-radius: 28px; padding: 20px 16px 16px; width: min(360px, 100%); max-height: 100%; box-sizing: border-box; overflow-y: auto; text-align: center;
  box-shadow: 0 6px 0 rgba(90, 60, 30, .15), 0 30px 60px rgba(20, 40, 60, .3); display: grid; gap: 12px; animation: pop .42s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.card h2 { margin: 0; font: 700 27px/1.05 var(--display); color: #e8566a; }
.card p { margin: 0; color: var(--ink-soft); font-weight: 700; line-height: 1.35; }
.card p b { color: var(--ink); }
.btn { font: 700 18px/1 var(--display); border: 0; border-radius: 16px; padding: 14px 18px; cursor: pointer; color: #fff;
  background: linear-gradient(#ff9a8a, #f2665a); box-shadow: 0 5px 0 #c04437, 0 10px 18px rgba(192, 68, 55, .28); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c04437; }
.btn.sun { background: linear-gradient(#ffe07a, #ffb52e); color: #6b4300; box-shadow: 0 5px 0 #cf8a12, 0 10px 18px rgba(207, 138, 18, .28); }
.btn.alt { background: linear-gradient(#fff, #f1e8da); color: var(--ink); box-shadow: 0 5px 0 #d9c7a8; }
.btn:focus-visible, .opt:focus-visible, .chip:focus-visible, .bBtn:focus-visible, .nav button:focus-visible { outline: 3px solid #2f9be6; outline-offset: 2px; }
#msgArt { width: 100%; height: 150px; }
.intro li { text-align: left; color: var(--ink-soft); font-weight: 700; margin: 4px 0; line-height: 1.3; }
.intro ul { margin: 0; padding-left: 20px; }

.packWrap { display: grid; justify-items: center; gap: 14px; width: min(360px, 100%); }
.packTitle { font: 700 26px/1 var(--display); color: #fff; text-shadow: 0 3px 0 rgba(20, 60, 100, .45); }
.packSub { font: 800 13px/1 var(--body); color: #e8f6ff; letter-spacing: .04em; min-height: 13px; }
.pack { width: 156px; height: 206px; border-radius: 20px; position: relative; cursor: pointer; border: 0; padding: 0;
  background: linear-gradient(160deg, #ffb2cf, #ff7aa8 45%, #ffb35c); box-shadow: 0 8px 0 #c94f7f, 0 24px 40px rgba(20, 40, 60, .4);
  display: grid; place-items: center; animation: wob 1.6s ease-in-out infinite; overflow: hidden; }
.pack::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 30px;
  background: radial-gradient(circle at 10px 30px, transparent 9px, rgba(255, 255, 255, .55) 10px) 0 0 / 20px 30px; }
.pack::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 45%, transparent 60%); background-size: 250% 100%; animation: shine 2.2s infinite; }
.pack .pSun { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, #fff6b0 0 50%, #ffd84a 51%); box-shadow: 0 0 0 8px rgba(255, 240, 160, .45); margin-top: -10px; }
.pack .pLbl { position: absolute; bottom: 30px; left: 0; right: 0; font: 700 19px/1 var(--display); color: #fff; text-shadow: 0 2px 0 #c94f7f; }
.pack .pTap { position: absolute; bottom: 12px; left: 0; right: 0; font: 800 11px/1 var(--body); color: #fff; opacity: .9; }
.pack.open { animation: tear .4s ease-in forwards; }
@keyframes wob { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) scale(1.03); } }
@keyframes tear { 40% { transform: scale(1.15) rotate(-6deg); } 100% { transform: scale(.2) rotate(30deg) translateY(-200px); opacity: 0; } }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.packCards { display: grid; gap: 10px; justify-content: center; }
.fcard { width: 100px; height: 134px; perspective: 700px; animation: deal .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes deal { from { transform: translateY(-120px) scale(.4) rotate(-20deg); opacity: 0; } }
.fcard .in { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.3, 1.5, .5, 1); transform-style: preserve-3d; }
.fcard.flip .in { transform: rotateY(180deg); }
.fcard .bk, .fcard .fr { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 14px; }
.fcard .fr { transform: rotateY(180deg); }
.fcard .bk { background: radial-gradient(circle at 50% 45%, #fff3a6 0 18%, transparent 19%), repeating-linear-gradient(45deg, #ff8fb5 0 10px, #ffa9c7 10px 20px);
  box-shadow: inset 0 0 0 4px #fff, 0 4px 0 rgba(0, 0, 0, .12); }
.fcard .fr .stk { width: 100%; height: 100%; }

.stk { --pg: linear-gradient(#d4f1ff, #9fdcff); position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; justify-items: center; align-items: center;
  padding: 6px 4px 7px; box-sizing: border-box; border-radius: 14px; background: var(--pg); box-shadow: inset 0 0 0 3px #fff, 0 3px 0 rgba(60, 40, 20, .13); overflow: hidden; }
.stk canvas { width: 74%; aspect-ratio: 1; height: auto; max-height: 100%; }
.stk .nm { font: 600 11.5px/1.05 var(--display); text-align: center; color: var(--ink); padding: 0 2px; }
.stk .st { font-size: 11px; line-height: 1.1; color: #ffb703; letter-spacing: 1px; text-shadow: 0 1px 0 #b77d00; }
.stk.miss { background: #ece5d9; }
.stk.miss .nm { color: #a59b8c; }
.stk.miss .st { color: #d6ccbc; text-shadow: none; }
.stk .cnt { position: absolute; top: 5px; right: 5px; background: #fff; border-radius: 999px; font: 700 11px/1 var(--display); padding: 3px 6px; color: #2f9be6; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); }
.stk .ny { position: absolute; top: 5px; left: 5px; background: #ff5d73; color: #fff; border-radius: 999px; font: 700 10.5px/1 var(--display); padding: 3px 6px; }
.stk.r3:not(.miss)::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%); background-size: 260% 100%; animation: shine 2.4s infinite; pointer-events: none; }
.dupl { font: 800 10.5px/1 var(--body); color: #fff; background: rgba(47, 53, 80, .55); border-radius: 999px; padding: 3px 7px; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.fcard .fr { overflow: visible; }

.album { width: min(400px, 100%); gap: 10px; padding: 16px 14px 14px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tabs button { border: 0; border-radius: 12px; padding: 8px 4px; font: 600 13.5px/1.1 var(--display); background: #f1e9db; color: var(--ink-soft); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 3px 0 #e2d4bc; }
.seasonBtn { border: 0; border-radius: 10px; margin-top: 4px; padding: 4px 10px; font: 700 12px/1.2 var(--body); background: #f1e9db; color: var(--ink-soft); cursor: pointer; }
.tabs button small { display: block; font: 800 10.5px/1 var(--body); margin-top: 3px; }
.agrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.agrid .stk { aspect-ratio: 4 / 5; }
.reward { font: 800 12.5px/1.3 var(--body); color: var(--ink-soft); background: #fff; border-radius: 12px; padding: 7px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.reward.ok { color: #2f8a3a; }
.ahead { display: flex; justify-content: space-between; align-items: center; }
.ahead h2 { font-size: 24px; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f1e9db; cursor: pointer; display: grid; place-items: center; }
.x svg { width: 18px; height: 18px; }

.friend { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; text-align: left; background: #fff; border-radius: 20px; padding: 12px; box-shadow: 0 3px 0 #eadfcb; }
.friend canvas { width: 52px; height: 52px; }
.friend .say { font: 700 13.5px/1.3 var(--body); color: var(--ink); }
.friend .say b { font-family: var(--display); font-weight: 600; font-size: 16px; display: block; margin-bottom: 2px; }
.swap { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; justify-items: center; }
.swap .stk { width: 84px; height: 106px; }
.swap .lab { font: 800 11px/1 var(--body); color: var(--ink-soft); margin-bottom: 4px; text-align: center; }
.swap svg { width: 28px; height: 28px; }
.frow { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.frow .btn { font-size: 16px; padding: 11px; }
.traded { animation: traded .6s; }
@keyframes traded { 30% { transform: scale(1.06) rotate(-2deg); } 60% { transform: scale(.97) rotate(1deg); } }

.fikaRow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fika { border: 0; background: none; padding: 0; cursor: pointer; display: grid; justify-items: center; gap: 2px; }
.fika canvas { width: 100%; aspect-ratio: 1; height: auto; }
.fika span { font: 600 12px/1.1 var(--display); min-height: 30px; overflow-wrap: anywhere; }
.fika span b { display: block; color: #c98a00; font-size: 15px; }
#wheelCv { width: min(270px, 70vw); height: min(270px, 70vw); justify-self: center; }


/* Tips dockas i panelen. Guiden (morfar Bosse) ligger bredvid det den pratar om, gärna över brädet. */
.bubble, .coach { position: fixed; box-sizing: border-box; background: var(--cream); color: var(--ink); border-radius: 16px;
  box-shadow: 0 3px 0 rgba(90, 60, 30, .14), 0 10px 26px rgba(20, 40, 60, .3); pointer-events: none; }
.bubble { z-index: 4; padding: 8px 12px; font: 700 13px/1.28 var(--body); text-align: center; transition: opacity .3s, transform .3s; }
.bubble b { font-family: var(--display); font-weight: 600; color: #e8566a; }
.bubble.hide { opacity: 0; transform: translateY(8px); }
.coach { z-index: 6; padding: 8px 10px 8px 12px; font: 700 13px/1.28 var(--body); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.coach b { font-family: var(--display); font-weight: 600; color: #e8566a; }
.coach button { pointer-events: auto; }
.cOk { border: 0; border-radius: 12px; padding: 9px 12px; font: 700 14px/1 var(--display); color: #6b4300; cursor: pointer; background: linear-gradient(#ffe07a, #ffb52e); box-shadow: 0 3px 0 #cf8a12; }
.cOk.later { background: #f1e9db; color: var(--ink-soft); box-shadow: 0 3px 0 #ddd2c2; }
.cOk:active { transform: translateY(2px); box-shadow: 0 1px 0 #cf8a12; }
.spot { position: fixed; z-index: 5; pointer-events: none; border-radius: 18px; box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(255, 111, 156, .9); animation: spot 1.3s ease-in-out infinite; }
@keyframes spot { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 13px rgba(255, 111, 156, 0); } }

/* Så spelar du */
.help { width: min(380px, 100%); gap: 10px; text-align: left; }
.help h2 { text-align: center; }
.help .kick { text-align: center; font: 800 11px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: #2f9be6; }
.help p { font-size: 14.5px; }
.help ul { margin: 0; padding-left: 20px; color: var(--ink-soft); font-weight: 700; line-height: 1.35; display: grid; gap: 5px; font-size: 14.5px; }
.help li b, .help p b { color: var(--ink); }
#helpArt { width: 100%; height: 130px; }
.legend { display: grid; gap: 6px; }
.legend div { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; align-items: center; background: #fff; border-radius: 12px; padding: 5px 9px 5px 5px; font: 700 13px/1.25 var(--body); color: var(--ink-soft); }
.legend canvas { width: 34px; height: 34px; border-radius: 9px; }
.legend b { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 14.5px; }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #e4d9c6; }
.dots i.on { background: #ff7a6b; }
.hrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hrow .btn { font-size: 16px; padding: 12px; }
.help .link { justify-self: center; background: none; border: 0; color: var(--ink-soft); font: 800 12px/1 var(--body); text-decoration: underline; cursor: pointer; padding: 4px; }
@media (prefers-reduced-motion: reduce) { .card, .pack, .badge, .precis.ready, .sunIc, .coach, .spot, .throw { animation: none; } }
@media (max-height: 700px) {
  .opts { min-height: 104px; } .die { width: 30px; height: 30px; padding: 4px; } .sum { font-size: 26px; } .opt { gap: 4px; padding: 8px 6px; }
  .views { padding-top: 12px; } .view { gap: 7px; } .rolls { font-size: 21px; } .nav button { min-height: 46px; }
  .brow canvas { width: 38px; height: 38px; } .brow { grid-template-columns: 38px minmax(0, 1fr) auto; } .bBtn { min-height: 34px; padding: 6px 9px; }
}

/* Listor och kort ska gå att dra i, resten av sidan står still. */
.views, .card { touch-action: pan-y; }
.evening { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 3px; align-content: center; align-items: center; text-align: left; border-radius: 22px; padding: 10px 14px; color: #5a3a2a;
  background: linear-gradient(#ffd9a0, #ff9f7a 70%, #e8748a); box-shadow: 0 5px 0 #c9705f; }
.evening .sunIc { grid-row: 1 / 5; background: radial-gradient(circle, #fff0a0 0 45%, #ffc93c 46% 62%, transparent 63%); animation: none; }
.evening b { font: 700 17px/1.1 var(--display); }
.evening p { margin: 0; font-weight: 800; font-size: 12.5px; line-height: 1.2; }
.evening #nextRoll { font: 700 22px/1 var(--display); }
/* På små skärmar får "vid Start" ersätta raden om vad rutan ger, så att korten inte växer. */
@media (max-height: 700px) { .opt:has(.pass:not([hidden])) .what { display: none; } }

/* Surfplatta liggande: brädet till vänster, valen till höger. */
body.land .sheet { top: 0 !important; left: auto; border-radius: 26px 0 0 26px; }
body.land .sheet::before { display: none; }
body.land .opts { max-height: 260px; }
/* Panelen är hög i liggande läge: målraden får plats även när skärmen är lägre än 780 punkter. */
body.land .goal { display: grid; }
body.land .views { justify-content: flex-start; }
@media (min-width: 700px) { .die { width: 44px; height: 44px; padding: 7px; } .sum { font-size: 38px; } .what { font-size: 14px; } .dest { font-size: 16px; } .hint { font-size: 15px; } .bubble, .coach { font-size: 15px; } }


/* Stor skärm men låg panel, som surfplatta stående: korten krymper och målraden får vika. */
body.tight .goal { display: none; }
body.tight .opt:has(.pass:not([hidden])) .what { display: none; }
@media (min-width: 700px) { body.tight .die { width: 36px; height: 36px; padding: 5px; } body.tight .sum { font-size: 30px; } body.tight .opt { gap: 4px; padding: 8px 6px; } }

/* Paket och meddelanden ligger över album och byten, som kan öppna dem. */
#packOv, #msgOv { z-index: 12; }

/* Ortens namn öppnar rese-kartan. */
button.mid { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; }
.loc { display: flex; align-items: center; gap: 4px; }
.loc svg { width: 13px; height: 17px; flex: none; }
.mapCard { width: min(400px, 100%); gap: 10px; }
.mapCard h2 { font-size: 24px; }
#mapCv { width: 100%; height: min(46vh, 380px); }
.mapPlaces { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.mapPlace { border: 0; border-radius: 14px; padding: 9px 10px; background: #fff; box-shadow: 0 3px 0 #eadfcb; cursor: pointer; display: grid; gap: 3px; }
.mapPlace span { font: 700 15px/1 var(--display); }
.mapPlace small { font: 800 11px/1 var(--body); color: var(--ink-soft); }

/* Stjärnbytet */
.starbar { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; align-items: center; background: #fff; border-radius: 12px; padding: 8px; }
.starN { grid-row: 1 / 3; display: grid; justify-items: center; font: 800 11px/1.1 var(--body); color: var(--ink-soft); padding: 0 6px; }
.starN span { color: #ffb703; font-size: 20px; line-height: 1; }
.starN b { font: 700 20px/1 var(--display); color: var(--ink); }
.starBtn { border: 0; border-radius: 10px; padding: 8px 4px; min-height: 34px; white-space: nowrap; font: 700 12.5px/1 var(--display); cursor: pointer; color: #6b4300; background: linear-gradient(#ffe07a, #ffb52e); box-shadow: 0 2px 0 #cf8a12; }
.starBtn:disabled { background: #efe8dc; color: #a39887; box-shadow: 0 2px 0 #ddd2c0; cursor: default; }
#starIn { grid-column: 2 / 4; }
@media (max-height: 700px) { .agrid .stk { aspect-ratio: 1.05; padding: 3px 4px 4px; } .agrid .stk canvas { width: 58%; } .album { gap: 7px; padding: 12px 12px 12px; } }
.stk.pickable { cursor: pointer; outline: 3px solid #ffb52e; outline-offset: -1px; }

/* Konto under Så spelar du */
.account { background: #fff; border-radius: 12px; padding: 10px; display: grid; gap: 8px; text-align: center; }
.account p { font-size: 13.5px; }
.logins { display: grid; gap: 6px; }
.logins .btn { font-size: 15px; padding: 10px; text-decoration: none; display: block; }

/* Riktiga vänner under Byt */
.tradeHead { margin: 6px 0 0; font: 700 17px/1 var(--display); color: var(--ink-soft); text-align: left; }
.tradeNote { margin: 0; font: 700 13px/1.35 var(--body); color: var(--ink-soft); background: #fff; border-radius: 14px; padding: 10px 12px; text-align: left; }
.tradeNote.warn { color: #b3261e; background: #fff0ee; }
.nameForm input { grid-column: 1 / -1; font: 700 16px var(--body); padding: 11px 12px; border-radius: 12px; border: 2px solid #eadfcb; background: #fffdf8; color: var(--ink); user-select: text; -webkit-user-select: text; }
.nameForm .btn { grid-column: 1 / -1; font-size: 16px; padding: 11px; }
.pickLab { grid-column: 1 / -1; text-align: left; }
.pickGrid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.pickGrid .stk { aspect-ratio: 4 / 5; }
.pickGrid .stk .nm { font-size: 10.5px; }

/* Nio albumsidor: flikarna går att dra i sidled. */
.tabs { display: flex; gap: 6px; overflow-x: auto; touch-action: pan-x; scrollbar-width: none; padding-bottom: 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-width: 92px; position: relative; }
.tabs button.news::after { content: ''; position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ff5d73; }
.album.gold { box-shadow: 0 0 0 5px #ffc93c, 0 0 0 8px #fff3c4, 0 30px 60px rgba(20, 40, 60, .3); }
.albumTitle { font: 700 13px/1.1 var(--display); color: #b77d00; margin-top: 3px; text-align: left; }
.ahead { gap: 8px; }
.ahead > div { min-width: 0; }
.achBtn { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff3c4; cursor: pointer; display: grid; place-items: center; box-shadow: 0 2px 0 #ecd08a; }
.achBtn svg { width: 24px; height: 24px; }

/* Prestationer */
.achCard { width: min(400px, 100%); text-align: left; }
.achCard p { font-size: 13.5px; }
.achList { display: grid; gap: 7px; }
.ach { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; align-items: center; background: #fff; border-radius: 14px; padding: 8px 10px; box-shadow: 0 2px 0 #eadfcb; }
.ach b { font: 700 14.5px/1.1 var(--display); display: block; }
.ach span { font: 700 12px/1.25 var(--body); color: var(--ink-soft); display: block; }
.ach small { font: 700 12px/1 var(--display); color: var(--ink-soft); white-space: nowrap; }
.ach.done small { color: #2f8a3a; }
.achMedals { display: grid; gap: 3px; justify-items: center; }
.achMedals i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }
.ach .gbar { margin-top: 5px; }

/* Händelsen under ortens namn */
.eventChip { max-width: 168px; font: 800 10.5px/1.2 var(--body); color: #8a4a00; background: #fff3c4; border-radius: 999px; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 0 rgba(180, 120, 20, .25); }

/* Prestationerna öppnas från albumet och ska ligga över det. */
#achOv { z-index: 11; }

/* Slå: korten ligger med baksidan upp tills spelaren kastar. */
.opts { position: relative; }
.throw { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 1; min-width: 150px; font-size: 22px; padding: 14px 22px; display: flex; align-items: center; justify-content: center; gap: 10px; animation: throwPulse 1.6s ease-in-out infinite; }
.throw[hidden] { display: none; }
.throw .tdice { width: 26px; height: 26px; border-radius: 7px; background: #fff; box-shadow: inset 0 -3px 0 #ddd3e6;
  background-image: radial-gradient(circle at 30% 30%, #ff6f61 3px, transparent 3.5px), radial-gradient(circle at 50% 50%, #ff6f61 3px, transparent 3.5px), radial-gradient(circle at 70% 70%, #ff6f61 3px, transparent 3.5px); }
@keyframes throwPulse { 50% { filter: brightness(1.08); box-shadow: 0 4px 0 #cf8a12, 0 0 0 6px rgba(255, 201, 60, .45); } }
.opts.back .opt > *:not(.tag) { visibility: hidden; }
.opts.back .opt { background: repeating-linear-gradient(45deg, #fff, #fff 10px, #fff6e6 10px, #fff6e6 20px); }
.opts.back .opt::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 44px/1 var(--display); color: var(--c); opacity: .55; }
.opts.back .opt:disabled { opacity: 1; }

/* Guiden: morfar Bosse med en pil mot det han pratar om. */
.coach { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: 'who txt' 'who nav'; gap: 4px 10px; padding: 12px 14px 12px 12px; font-size: 15px; line-height: 1.35; border: 3px solid #ff6f9c; }
.coach .cWho { grid-area: who; display: grid; justify-items: center; gap: 2px; align-self: start; }
.coach .cWho canvas { width: 44px; height: 44px; }
.coach .cWho b { font: 700 9.5px/1.1 var(--body); color: var(--ink-soft); text-align: center; }
.coach #coachTxt { grid-area: txt; }
.coach .cNav { grid-area: nav; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.coach #coachStep { margin-right: auto; font: 700 11px/1 var(--body); color: var(--ink-soft); }
.coach .cBack { border: 0; background: none; font: 700 13px/1 var(--body); color: var(--ink-soft); padding: 8px 4px; cursor: pointer; }
.coach .cSkip { position: absolute; top: -12px; right: -12px; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #ff6f9c; background: var(--cream); padding: 4px; cursor: pointer; }
.coach .cSkip svg { width: 100%; height: 100%; display: block; }
.coach [hidden] { display: none !important; }
.langRow { text-align: center; font: 700 12px/1.4 var(--body); color: var(--ink-soft); margin-top: 6px; }
.langRow button { padding: 4px 6px; }
.langRow button.on { color: var(--ink); text-decoration: underline; }
.help .tourBtn { width: 100%; margin: 4px 0 10px; }
.cArrow { position: absolute; width: 16px; height: 16px; background: var(--cream); border: 3px solid #ff6f9c; transform: rotate(45deg); }
.coach[data-side="top"] .cArrow { bottom: -11px; margin-left: -8px; border-top: 0; border-left: 0; }
.coach[data-side="bottom"] .cArrow { top: -11px; margin-left: -8px; border-bottom: 0; border-right: 0; }
.coach[data-side="left"] .cArrow { right: -11px; margin-top: -8px; border-bottom: 0; border-left: 0; }
@media (min-width: 700px) { .coach { font-size: 16px; } }

/* Uppdragskortet och byggena: vad bygget gör bättre. */
.goal small { display: block; font: 700 11.5px/1.2 var(--body); color: #2f8a3a; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .bx { font: 700 11.5px/1.2 var(--body); color: #2f8a3a; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Berättelsen och första starten */
.story p, .intro p { margin: 0 0 8px; font: 700 15px/1.4 var(--body); color: var(--ink); text-align: left; }
.story .mission { background: #fff6d6; border-radius: 12px; padding: 8px 10px; color: #8a5a00; }
.intro .steps { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.intro .steps i { width: 8px; height: 8px; border-radius: 50%; background: #e7dcc8; }
.intro .steps i.on { background: #ff6f61; }
