/* ==========================================================================
   Merglin – Der Zauberhain · style.css
   ========================================================================== */

:root {
  --bg: #f6f3ec;
  --bg2: #eef1f7;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #2c2b38;
  --muted: #7b788b;
  --line: rgba(20, 18, 40, .08);
  --line-2: rgba(20, 18, 40, .14);

  --mint: #2ec08d;
  --grape: #7a6bf0;
  --peach: #ff8f5e;
  --sun: #ffc53d;
  --rose: #ff6b8a;
  --sky: #46b7e8;

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --sh-1: 0 1px 2px rgba(30, 25, 60, .05), 0 2px 8px rgba(30, 25, 60, .05);
  --sh-2: 0 2px 6px rgba(30, 25, 60, .07), 0 10px 24px rgba(30, 25, 60, .09);
  --sh-3: 0 8px 20px rgba(30, 25, 60, .12), 0 24px 60px rgba(30, 25, 60, .16);

  --tile-face: #ffffff;
  --nav-h: 62px;
  color-scheme: light;
}

:root:not([data-theme=light]) {
  @media (prefers-color-scheme: dark) {}
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #10121a;
    --bg2: #161a26;
    --surface: #1c2030;
    --surface-2: #222739;
    --ink: #ecebf6;
    --muted: #9793ac;
    --line: rgba(255, 255, 255, .09);
    --line-2: rgba(255, 255, 255, .16);
    --tile-face: #262b3d;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .3);
    --sh-2: 0 2px 8px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .35);
    --sh-3: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme=dark] {
  --bg: #10121a;
  --bg2: #161a26;
  --surface: #1c2030;
  --surface-2: #222739;
  --ink: #ecebf6;
  --muted: #9793ac;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --tile-face: #262b3d;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .3);
  --sh-2: 0 2px 8px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .35);
  --sh-3: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
  overflow: hidden;
}

body {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38% 28% at 12% 8%, hsl(160 70% 72% / .30), transparent 65%),
    radial-gradient(34% 26% at 88% 14%, hsl(265 80% 78% / .26), transparent 65%),
    radial-gradient(45% 32% at 50% 100%, hsl(28 90% 74% / .22), transparent 65%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
#app, .sheet, #popups { touch-action: manipulation; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; }

/* ==========================================================================
   Splash
   ========================================================================== */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: linear-gradient(170deg, var(--bg), var(--bg2));
  transition: opacity .45s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; }
.splash-logo { font-size: 76px; animation: bobble 2.2s ease-in-out infinite; }
.splash-inner h1 { font-size: 40px; margin-top: 6px; background: linear-gradient(100deg, var(--mint), var(--grape) 60%, var(--peach)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-inner p { margin: 2px 0 20px; color: var(--muted); font-weight: 600; }
.splash-bar { width: 150px; height: 6px; border-radius: 99px; background: var(--line-2); margin: 0 auto; overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--grape)); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }
@keyframes bobble { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

/* ==========================================================================
   App-Gerüst
   ========================================================================== */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

/* ---------- Kopfzeile ---------- */
#topbar {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px 6px;
}
.lvl-badge {
  position: relative; width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 15px; display: grid; place-items: center; line-height: 1;
  background: linear-gradient(150deg, var(--grape), var(--sky));
  color: #fff; box-shadow: var(--sh-2); transition: transform .15s;
}
.lvl-badge:active { transform: scale(.93); }
.lvl-num { font-size: 18px; font-weight: 900; }
.lvl-cap { font-size: 7.5px; font-weight: 800; letter-spacing: .12em; opacity: .8; margin-top: -1px; }

.xp-wrap { flex: 1 1 auto; min-width: 0; }
.xp-track { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.xp-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--sun)); transition: width .45s cubic-bezier(.2, .9, .3, 1); }
.xp-text { font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 3px; }

.currencies { display: flex; gap: 5px; flex: 0 0 auto; }
.cur {
  display: flex; align-items: center; gap: 3px;
  background: var(--surface); border-radius: 99px; padding: 5px 9px 5px 6px;
  box-shadow: var(--sh-1); font-weight: 800; font-size: 12px;
  transition: transform .18s;
}
.cur-ico { font-size: 14px; }
.cur.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.16); } }

/* ---------- Auftragsleiste ---------- */
#orderStrip { padding: 2px 0 4px; }
.strip-scroll {
  display: flex; gap: 9px; overflow-x: auto; padding: 4px 12px 8px;
  scroll-snap-type: x mandatory; touch-action: pan-x;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.strip-scroll::-webkit-scrollbar { display: none; }

.order {
  flex: 0 0 auto; width: 152px; scroll-snap-align: start;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg);
  padding: 8px 9px 9px; box-shadow: var(--sh-1);
  border: 1.5px solid transparent; transition: border-color .25s, box-shadow .25s, transform .25s;
}
.order.ready { border-color: hsl(158 62% 52% / .55); box-shadow: var(--sh-2), 0 0 0 4px hsl(158 62% 52% / .1); }
.o-top { display: flex; align-items: center; gap: 5px; }
.o-npc { font-size: 19px; }
.o-name { font-size: 12px; font-weight: 800; flex: 1; }
.o-skip { font-size: 13px; color: var(--muted); padding: 2px 4px; border-radius: 8px; }
.o-skip:active { background: var(--line); }
.o-reqs { display: flex; gap: 5px; margin: 7px 0 6px; flex-wrap: wrap; }
.req {
  position: relative; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  background: hsl(var(--hue, 250) 65% 96%); border: 1.5px solid hsl(var(--hue, 250) 45% 88%);
}
.req-n { position: absolute; right: -3px; bottom: -4px; font-size: 9px; font-weight: 900; background: var(--ink); color: var(--surface); border-radius: 99px; padding: 1px 4px; }
.req.ok { background: hsl(158 62% 92%); border-color: hsl(158 52% 70%); }
.req.ok .req-n { background: var(--mint); color: #fff; }
.o-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.o-rew { font-size: 10.5px; font-weight: 800; color: var(--muted); line-height: 1.3; min-width: 0; }
.o-give {
  flex: 0 0 auto; white-space: nowrap;
  font-size: 11.5px; font-weight: 800; padding: 6px 11px; border-radius: 99px;
  background: linear-gradient(160deg, var(--mint), #1fa87a); color: #fff; box-shadow: var(--sh-1);
}
.o-give:disabled { background: var(--line-2); color: var(--muted); box-shadow: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .req { background: hsl(var(--hue, 250) 30% 24%); border-color: hsl(var(--hue, 250) 30% 34%); }
  :root:not([data-theme=light]) .req.ok { background: hsl(158 40% 26%); border-color: hsl(158 45% 42%); }
}
:root[data-theme=dark] .req { background: hsl(var(--hue, 250) 30% 24%); border-color: hsl(var(--hue, 250) 30% 34%); }
:root[data-theme=dark] .req.ok { background: hsl(158 40% 26%); border-color: hsl(158 45% 42%); }

/* ---------- Brett ---------- */
#boardWrap { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 2px 4px; }
#board { position: relative; touch-action: none; }
#board.shake { animation: shake .34s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

#cells, #items, #fxLayer { position: absolute; inset: 0; }
#fxLayer { pointer-events: none; z-index: 30; }

.cell {
  position: absolute; width: var(--tile); height: var(--tile);
  border-radius: 26%;
  background: hsl(250 20% 50% / .05);
  border: 1.5px dashed hsl(250 18% 50% / .16);
  transition: background .15s, border-color .15s, transform .18s;
}
.cell.hover { background: hsl(158 60% 50% / .16); border-color: hsl(158 60% 45% / .5); }

.tile {
  position: absolute; width: var(--tile); height: var(--tile);
  border-radius: 26%;
  background: var(--tile-face);
  box-shadow: var(--sh-1), inset 0 -2px 0 hsl(var(--hue, 250) 40% 60% / .18);
  border: 1.5px solid hsl(var(--hue, 250) 45% 72% / .35);
  display: grid; place-items: center;
  transition: transform .19s cubic-bezier(.25, 1.3, .45, 1), box-shadow .18s, opacity .15s, border-color .2s;
  will-change: transform;
  z-index: 10;
}
.t-body { display: grid; place-items: center; width: 100%; height: 100%; }
.t-emoji { font-size: calc(var(--tile) * .5); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .12)); pointer-events: none; }
.t-lvl {
  position: absolute; right: 4%; bottom: 3%;
  font-size: calc(var(--tile) * .19); font-weight: 900; line-height: 1;
  color: var(--muted); background: var(--surface-2);
  border-radius: 99px; padding: 1px 4px; box-shadow: var(--sh-1);
  pointer-events: none;
}
.t-badge {
  position: absolute; left: 4%; top: 2%;
  font-size: calc(var(--tile) * .22); font-weight: 900; line-height: 1;
  color: #fff; background: var(--mint); border-radius: 99px;
  min-width: calc(var(--tile) * .3); text-align: center; padding: 1px 3px;
  pointer-events: none;
}
.tile.k-gen {
  background: linear-gradient(165deg, hsl(var(--hue) 78% 94%), hsl(var(--hue) 62% 86%));
  border-color: hsl(var(--hue) 60% 62% / .6);
  box-shadow: var(--sh-2), 0 0 0 3px hsl(var(--hue) 70% 60% / .13);
}
.tile.k-chest { background: linear-gradient(165deg, #fff6e6, #ffe6c2); border-color: hsl(35 70% 62% / .55); }
.tile.k-chest .t-badge, .tile.k-coin .t-badge { background: var(--sun); color: #4a3800; }
.tile.k-coin { background: linear-gradient(165deg, #fffbe8, #ffeeb8); border-color: hsl(45 80% 60% / .6); }
.tile.k-event { box-shadow: var(--sh-1), 0 0 0 3px hsl(var(--hue) 85% 62% / .22); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .tile.k-gen { background: linear-gradient(165deg, hsl(var(--hue) 40% 30%), hsl(var(--hue) 35% 22%)); }
  :root:not([data-theme=light]) .tile.k-chest { background: linear-gradient(165deg, #3a2f1e, #2c2416); }
  :root:not([data-theme=light]) .tile.k-coin { background: linear-gradient(165deg, #3d3418, #2e2812); }
}
:root[data-theme=dark] .tile.k-gen { background: linear-gradient(165deg, hsl(var(--hue) 40% 30%), hsl(var(--hue) 35% 22%)); }
:root[data-theme=dark] .tile.k-chest { background: linear-gradient(165deg, #3a2f1e, #2c2416); }
:root[data-theme=dark] .tile.k-coin { background: linear-gradient(165deg, #3d3418, #2e2812); }

.tile.is-dragging { opacity: .28; transition: none; }
.tile.is-selected { border-color: var(--grape); box-shadow: var(--sh-2), 0 0 0 3px hsl(252 80% 68% / .3); }
.tile.is-hint { animation: hintPulse 1.05s ease-in-out infinite; border-color: hsl(158 62% 52%); }
@keyframes hintPulse { 0%, 100% { box-shadow: var(--sh-1), 0 0 0 0 hsl(158 62% 52% / .5); } 50% { box-shadow: var(--sh-1), 0 0 0 6px hsl(158 62% 52% / 0); } }
.tile.is-target { transform-origin: center; box-shadow: var(--sh-2), 0 0 0 4px hsl(158 62% 52% / .45); }
.tile.is-target.swapish { box-shadow: var(--sh-2), 0 0 0 4px hsl(252 70% 66% / .4); }

.tile.pop-in { animation: popIn .34s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } }
.tile.merge-pop { animation: mergePop .42s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes mergePop { 0% { } 35% { scale: 1.24; } 100% { scale: 1; } }
.tile.gen-pulse { animation: genPulse .3s ease; }
@keyframes genPulse { 40% { scale: .9; } 100% { scale: 1; } }

.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 500;
  pointer-events: none; transform-origin: center;
  opacity: .96;   /* Vergroesserung steckt im transform (js/ui.js: moveGhost) */
  box-shadow: var(--sh-3);
  transition: none;
}
body.dragging { cursor: grabbing; }

/* ---------- FX ---------- */
.ring {
  position: absolute; border-radius: 50%; translate: -50% -50%;
  border: 3px solid hsl(158 70% 55% / .8);
  animation: ringOut .5s ease-out forwards;
}
@keyframes ringOut { from { scale: .3; opacity: .9; } to { scale: 1.5; opacity: 0; } }
.spark {
  position: absolute; width: 7px; height: 7px; border-radius: 99px;
  translate: -50% -50%; animation: sparkOut .68s ease-out forwards;
}
.spark-e { width: auto; height: auto; font-size: 15px; background: none !important; }
@keyframes sparkOut {
  from { translate: -50% -50%; opacity: 1; }
  to { translate: calc(-50% + var(--dx)) calc(-50% + var(--dy)); opacity: 0; scale: .4; }
}
.float {
  position: absolute; translate: -50% -50%;
  font-weight: 900; font-size: 14px; color: var(--mint);
  text-shadow: 0 1px 3px rgba(255, 255, 255, .8);
  animation: floatUp .9s ease-out forwards; white-space: nowrap;
}
.float.xp { color: var(--grape); }
@keyframes floatUp { to { translate: -50% -220%; opacity: 0; } }
.combo {
  position: absolute; left: 50%; top: 10%; translate: -50% 0;
  font-weight: 900; font-size: 22px; color: var(--peach);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  animation: comboIn .9s cubic-bezier(.2, 1.5, .4, 1) forwards;
}
@keyframes comboIn { 0% { scale: .4; opacity: 0; } 30% { scale: 1.2; opacity: 1; } 100% { scale: 1; opacity: 0; translate: -50% -40%; } }

/* ---------- Lager ---------- */
#tray { padding: 4px 12px 2px; touch-action: none; }
.tray-row { display: flex; align-items: center; gap: 8px; }
.tray-slots { display: flex; gap: 6px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.tray-slots::-webkit-scrollbar { display: none; }
.slot {
  position: relative; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
}
.slot.empty, .slot.buy {
  background: hsl(250 20% 50% / .06);
  border: 1.5px dashed hsl(250 18% 50% / .22);
}
.slot.buy { color: var(--muted); font-size: 20px; font-weight: 800; }
.slot .tile.mini { position: relative; width: 44px; height: 44px; --tile: 44px; }
#tray.drop-ok .slot.empty { background: hsl(158 60% 50% / .18); border-color: hsl(158 60% 45% / .6); }

.tray-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  width: 46px; padding: 5px 0 4px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--sh-1);
  transition: transform .15s;
}
.tool:active { transform: scale(.92); }
.tool-ico { font-size: 19px; line-height: 1; }
.tool-cost { font-size: 9px; font-weight: 800; color: var(--muted); }

/* ---------- Navigation ---------- */
#nav {
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 20px rgba(30, 25, 60, .06);
}
.nav-btn {
  position: relative; flex: 1; height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); transition: color .2s;
}
.nav-btn span { font-size: 21px; line-height: 1; transition: transform .25s cubic-bezier(.2, 1.5, .4, 1); }
.nav-btn i { font-size: 10px; font-weight: 800; font-style: normal; }
.nav-btn.is-active { color: var(--ink); }
.nav-btn.is-active span { transform: translateY(-2px) scale(1.14); }
.nav-btn .dot {
  position: absolute; top: 8px; right: calc(50% - 18px);
  width: 9px; height: 9px; border-radius: 99px; background: var(--rose);
  box-shadow: 0 0 0 2px var(--surface); animation: dotPulse 1.6s ease-in-out infinite;
}
@keyframes dotPulse { 50% { transform: scale(1.3); } }

/* ---------- Auswahlleiste ---------- */
#selectBar {
  position: absolute; left: 10px; right: 10px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 62px);
  display: flex; align-items: center; gap: 10px; z-index: 40;
  background: var(--surface); border-radius: var(--r-lg);
  padding: 8px 10px; box-shadow: var(--sh-2);
  animation: slideUp .25s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }
.sel-info { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.sel-emoji { font-size: 26px; }
.sel-txt { display: flex; flex-direction: column; min-width: 0; }
.sel-txt b { font-size: 13.5px; }
.sel-txt i { font-size: 11px; color: var(--muted); font-style: normal; font-weight: 700; }
.sel-actions { display: flex; gap: 6px; }

/* ---------- Buttons ---------- */
.btn {
  padding: 9px 15px; border-radius: 99px; font-weight: 800; font-size: 13px;
  background: linear-gradient(160deg, var(--grape), #5b4ad8); color: #fff;
  box-shadow: var(--sh-1); transition: transform .14s, opacity .2s;
}
.btn:active { transform: scale(.95); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.big { padding: 12px 26px; font-size: 15px; width: 100%; margin-top: 14px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.ghost { background: var(--line); color: var(--muted); box-shadow: none; }
.btn.danger { background: linear-gradient(160deg, #ff6b6b, #e2444a); }
.btn:disabled { opacity: .55; }
.btn.hidden { display: none; }

/* ==========================================================================
   Sheet (Panels)
   ========================================================================== */
.sheet { position: fixed; inset: 0; z-index: 120; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(20, 18, 40, .38);
  opacity: 0; transition: opacity .28s; backdrop-filter: blur(2px);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-card {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-3);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.25, 1, .4, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open .sheet-card { transform: translateY(0); }
.sheet-grab { width: 42px; height: 4.5px; border-radius: 99px; background: var(--line-2); margin: 9px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 18px 8px; }
.sheet-head h2 { font-size: 20px; }
.sheet-x { width: 30px; height: 30px; border-radius: 99px; background: var(--line); color: var(--muted); font-size: 13px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 22px; }

.sec { font-size: 14px; margin: 20px 0 9px; display: flex; align-items: center; gap: 7px; }
.sec-sub { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 800; }
.hint-line { color: var(--muted); font-size: 12.5px; font-weight: 600; margin: 2px 0 12px; line-height: 1.45; }
.hint-line.big { font-size: 14px; color: var(--ink); background: var(--surface); padding: 12px 14px; border-radius: var(--r-md); box-shadow: var(--sh-1); }
.hint-line.small { font-size: 11px; text-align: center; margin-top: 16px; }

/* ---------- Aufgaben / Erfolge ---------- */
.task, .ach, .ms, .row-set {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border-radius: var(--r-md);
  padding: 11px 13px; margin-bottom: 8px; box-shadow: var(--sh-1);
}
.task-main, .ach-main, .ms-main { flex: 1; min-width: 0; }
.task > .btn, .ach > .btn, .ms > .btn, .row-set > .btn,
.task > .task-ok, .ms > .task-ok, .ach > .ach-stars,
.row-set > .switch, .row-set > select { flex: 0 0 auto; white-space: nowrap; }
.task-main b, .ach-main b { font-size: 13.5px; }
.task-sub { font-size: 11px; color: var(--muted); font-weight: 700; }
.bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin: 5px 0 4px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--sun)); transition: width .5s cubic-bezier(.2, .9, .3, 1); }
.task.done { box-shadow: var(--sh-1), 0 0 0 2px hsl(158 62% 52% / .4); }
.task.claimed { opacity: .55; }
.task-ok { color: var(--mint); font-size: 19px; font-weight: 900; }
.ach-i { font-size: 22px; }
.ach-stars { font-size: 11px; color: var(--sun); letter-spacing: 0; }

.sheet-body::-webkit-scrollbar { width: 6px; }
.sheet-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
.sheet-body::-webkit-scrollbar-track { background: transparent; }
.ach.maxed { box-shadow: var(--sh-1), 0 0 0 2px hsl(45 90% 55% / .45); }
.bonus { background: var(--surface); border-radius: var(--r-md); padding: 11px 13px; font-size: 12.5px; font-weight: 700; box-shadow: var(--sh-1); border: 1.5px dashed var(--line-2); }
.bonus.done { color: var(--muted); }

/* ---------- Event ---------- */
.event-hero {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(150deg, hsl(var(--hue) 80% 92%), hsl(var(--hue) 65% 84%));
  border-radius: var(--r-lg); padding: 14px; box-shadow: var(--sh-1);
  color: #2c2b38;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .event-hero { background: linear-gradient(150deg, hsl(var(--hue) 45% 30%), hsl(var(--hue) 40% 22%)); color: var(--ink); }
}
:root[data-theme=dark] .event-hero { background: linear-gradient(150deg, hsl(var(--hue) 45% 30%), hsl(var(--hue) 40% 22%)); color: var(--ink); }
.eh-ico { font-size: 38px; }
.eh-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.eh-txt b { font-size: 17px; }
.eh-txt span { font-size: 11.5px; font-weight: 700; opacity: .8; }
.eh-time { font-size: 11px !important; font-weight: 800 !important; opacity: 1 !important; margin-top: 3px; }
.eh-pts { text-align: center; font-size: 22px; font-weight: 900; line-height: 1; }
.eh-pts i { display: block; font-size: 9.5px; font-style: normal; font-weight: 800; opacity: .7; }
.ms.ready { box-shadow: var(--sh-1), 0 0 0 2px hsl(158 62% 52% / .45); }
.ms.claimed { opacity: .55; }
.ms-n { font-size: 13px; font-weight: 900; min-width: 40px; color: var(--grape); }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; width: 46px; height: 50px; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1.5px solid hsl(var(--hue, 250) 45% 72% / .3);
}
.chip span { font-size: 21px; line-height: 1; }
.chip i { font-size: 9px; font-style: normal; font-weight: 800; color: var(--muted); }
.chip.locked { opacity: .42; filter: grayscale(1); }
.chip-own {
  position: absolute; top: -4px; right: -4px; font-size: 9px; font-weight: 900;
  background: var(--mint); color: #fff; border-radius: 99px; padding: 1px 5px;
}

/* ---------- Laden ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 9px; }
.shop-card {
  background: var(--surface); border-radius: var(--r-md); padding: 12px 10px;
  box-shadow: var(--sh-1); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.sc-ico { font-size: 30px; }
.shop-card b { font-size: 12.5px; }
.sc-desc { font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.3; flex: 1; margin-bottom: 5px; }
.shop-card .btn { width: 100%; }
.shop-card.poor { opacity: .68; }

/* ---------- Profil ---------- */
.prof-head { display: flex; align-items: center; gap: 13px; background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--sh-1); margin-bottom: 14px; }
.prof-lvl {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--grape), var(--sky)); color: #fff; font-size: 22px; font-weight: 900;
}
.prof-head b { font-size: 16px; display: block; }
.prof-head span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.stat { background: var(--surface); border-radius: var(--r-md); padding: 10px; text-align: center; box-shadow: var(--sh-1); }
.stat span { font-size: 17px; }
.stat b { display: block; font-size: 15px; }
.stat i { font-size: 9.5px; color: var(--muted); font-style: normal; font-weight: 700; }
.row-set b { flex: 1; font-size: 13.5px; }
.row-set span { font-size: 18px; }
.row-set select { font: inherit; font-size: 12.5px; font-weight: 700; border: 0; background: var(--line); border-radius: 99px; padding: 6px 10px; color: var(--ink); }
.switch { width: 46px; height: 27px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .22s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 99px; background: #fff; box-shadow: var(--sh-1); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.switch.on { background: var(--mint); }
.switch.on i { transform: translateX(19px); }

/* ==========================================================================
   Popups & Toasts
   ========================================================================== */
#popups { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.pop-wrap {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(20, 18, 40, .42); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .26s; pointer-events: auto; padding: 22px;
}
.pop-wrap.in { opacity: 1; }
.pop-card {
  background: var(--surface); border-radius: var(--r-xl); padding: 24px 20px 20px;
  text-align: center; max-width: 340px; width: 100%; box-shadow: var(--sh-3);
  transform: scale(.82) translateY(16px); transition: transform .32s cubic-bezier(.2, 1.4, .4, 1);
  max-height: 84dvh; overflow-y: auto; overflow-x: hidden;
  display: block; overflow-wrap: break-word;
}
.pop-wrap.in .pop-card { transform: scale(1) translateY(0); }
.pop-hero { font-size: 58px; line-height: 1; margin-bottom: 6px; animation: heroIn .6s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes heroIn { from { scale: .3; rotate: -22deg; } }
.pop-card h3 { font-size: 21px; }
.pop-sub { color: var(--muted); font-size: 13px; font-weight: 600; margin: 6px 0 0; line-height: 1.45; }
.pop-rewards { display: flex; justify-content: center; gap: 9px; margin-top: 12px; }
.pop-rewards span { background: var(--line); border-radius: 99px; padding: 6px 13px; font-weight: 800; font-size: 13px; }
.loot-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 14px; }
.loot {
  background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 6px; min-width: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: var(--sh-1);
}
.loot span { font-size: 23px; line-height: 1; }
.loot i { font-size: 9.5px; font-style: normal; font-weight: 800; color: var(--muted); }
.intro-steps { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; text-align: left; }
.intro-steps > div { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.intro-steps span { grid-row: 1 / 3; font-size: 25px; }
.intro-steps b { font-size: 13px; }
.intro-steps i { font-size: 11.5px; color: var(--muted); font-style: normal; font-weight: 600; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--rot)); opacity: .2; } }

#toasts {
  position: fixed; left: 0; right: 0; z-index: 160;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 6px;
  pointer-events: none;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 124px);
}
.toast {
  display: flex; align-items: center; gap: 7px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 12.5px;
  padding: 9px 15px; border-radius: 99px; box-shadow: var(--sh-2);
  opacity: 0; transform: translateY(12px) scale(.94); transition: all .3s cubic-bezier(.2, 1.3, .4, 1);
  max-width: 88vw;
}
.toast.in { opacity: 1; transform: none; }
.t-ico { font-size: 15px; }

/* ---------- Größere Bildschirme ---------- */
@media (min-width: 640px) {
  #app { max-width: 520px; margin: 0 auto; box-shadow: var(--sh-3); background: var(--bg); }
  .sheet-card { max-width: 520px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .08ms !important; }
}
