@font-face { font-family: 'Gabarito'; src: url('./fonts/gabarito.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
:root {
  /* Hof bei Tag: tiefes Waldgrün für Tafeln, Sonnengelb für Geld und Auswahl, Papier für Fenster */
  --ink: #14281a; --ink2: #1e3a25; --ink3: #2a4c31; --line: rgba(255, 238, 200, .13);
  --pnl: rgba(17, 35, 23, .9);
  --cream: #fff7e4; --paper: #f5ecd5; --paper2: #ebdfc0; --card: #fffdf7; --edge: #e6d9b8;
  --sun: #ffc93c; --sun2: #f2a51f; --sunlip: #b26b00; --leaf: #8fd651; --leaf2: #4f9e3a; --lawn: #2f6b25; --clay: #c2553a;
  --t: #1c2b1e; --t2: #55664f; --t3: #7d8b74; --dim: #b4cfa6;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc6e8; color: var(--t); font-family: 'Gabarito', system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
kbd { font: inherit; font-size: 11px; font-weight: 800; line-height: 1; padding: 3px 5px 2px; border-radius: 5px; background: rgba(255, 255, 255, .14); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); display: inline-block; }

.btn { border: 0; border-radius: 13px; padding: 12px 20px; font-weight: 800; font-size: 17px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s ease, filter .12s ease, background .12s; }
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--sun); color: #3a2300; box-shadow: 0 4px 0 var(--sunlip); }
.btn.primary:active { box-shadow: 0 2px 0 var(--sunlip); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { background: #d9ccaa; color: #7a6c4c; box-shadow: 0 4px 0 #a99a76; cursor: default; }
.btn.big { font-size: 22px; padding: 14px 28px; width: 100%; letter-spacing: .02em; }
.btn.ghost { background: transparent; color: var(--t); box-shadow: inset 0 0 0 2px rgba(28, 43, 30, .18); }
.btn.ghost:hover { background: rgba(28, 43, 30, .06); }
.btn.danger { color: #9c3420; box-shadow: inset 0 0 0 2px rgba(194, 85, 58, .4); }
.btn:focus-visible, .seg button:focus-visible, .tabs button:focus-visible, .buy:focus-visible, .hbtn:focus-visible { outline: 3px solid #4fb0ff; outline-offset: 2px; }

/* ---------- Menü ---------- */
.screen { position: fixed; inset: 0; z-index: 20; }
.menu-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.menu-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 247, 228, .96) 0%, rgba(255, 247, 228, .86) 34%, rgba(255, 247, 228, .25) 60%, rgba(255, 247, 228, 0) 74%); pointer-events: none; }
.back { position: absolute; top: calc(14px + var(--st)); right: calc(16px + var(--sr)); display: inline-flex; align-items: center; gap: 4px; color: var(--cream); text-decoration: none; font-weight: 800; font-size: 15px; background: var(--pnl); padding: 8px 14px 8px 10px; border-radius: 11px; z-index: 2; }
.back .ic { font-size: 18px; }
.menu-panel { position: absolute; left: calc(4vw + var(--sl)); top: 0; bottom: 0; width: min(500px, 92vw); display: flex; flex-direction: column; gap: 12px; padding: calc(28px + var(--st)) 4px calc(40px + var(--sb)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; justify-content: safe center; }
.menu-panel::-webkit-scrollbar { display: none; }
.kicker { margin: 0; color: var(--leaf2); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: 13px; }
h1 { margin: 0; font-size: clamp(46px, 5.4vw, 80px); line-height: .9; font-weight: 900; letter-spacing: -.03em; color: var(--ink); }
h1 span { color: var(--leaf2); }
.lede { margin: 2px 0 2px; font-size: 17px; line-height: 1.5; color: #3b4f3c; max-width: 44ch; }
.loop { list-style: none; margin: 2px 0 4px; padding: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.loop li { display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: var(--cream); padding: 6px 10px 6px 8px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.loop li .ic { font-size: 18px; color: var(--sun); }
.loop li:not(:last-child)::after { content: ''; width: 6px; height: 6px; border: solid var(--leaf); border-width: 2px 2px 0 0; transform: rotate(45deg); margin: 0 -2px 0 6px; }
.load { height: 4px; border-radius: 3px; background: rgba(28, 43, 30, .12); overflow: hidden; transition: opacity .4s; }
.load i { display: block; height: 100%; width: 0; background: var(--leaf2); transition: width .3s; }
body.ready .load { opacity: 0; }
.menu-row { display: flex; gap: 10px; }
.menu-row .btn { flex: 1; }
.best { margin: 0; color: #4b6650; font-size: 14px; font-weight: 600; min-height: 1em; }
.legal { position: absolute; bottom: calc(10px + var(--sb)); right: calc(16px + var(--sr)); margin: 0; font-size: 13px; color: #fff; z-index: 2; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.legal a { color: inherit; }
.legal a[data-consent-settings]::before { content: '·'; margin: 0 .4em; display: inline-block; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; color: var(--cream); }
#hud button, #hud .order, #goal { pointer-events: auto; }
.pnl { background: var(--pnl); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line), 0 3px 0 rgba(0, 0, 0, .22), 0 10px 24px rgba(0, 0, 0, .14); }
.bar { height: 8px; border-radius: 5px; background: rgba(255, 255, 255, .13); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--leaf); border-radius: 5px; transition: width .25s ease; }

#cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#cross i { position: absolute; inset: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .35); transition: inset .12s, background .12s; }
#cross.ok i { inset: 4px; background: transparent; box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px rgba(0, 0, 0, .3); }
#cross.build i { inset: 3px; border-radius: 3px; background: transparent; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(0, 0, 0, .3); }

#topl { position: absolute; left: calc(14px + var(--sl)); top: calc(12px + var(--st)); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: min(310px, 44vw); }
#money { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
#money .coin { font-size: 30px; color: var(--sun); stroke-width: 2.4; }
.m-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#cash { font-size: 28px; font-weight: 900; letter-spacing: -.01em; line-height: 1.02; font-variant-numeric: tabular-nums; white-space: nowrap; }
#cash.pop { animation: cpop .35s ease; }
@keyframes cpop { 40% { transform: scale(1.06); color: var(--sun); } }
#rate { color: var(--dim); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lvl { position: relative; flex: none; width: 50px; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#lvl svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#lvl circle { fill: none; stroke-width: 5; }
#lvl .trk { stroke: rgba(255, 255, 255, .13); }
#lvl .val { stroke: var(--leaf); stroke-linecap: round; stroke-dasharray: 125.66; stroke-dashoffset: 125.66; transition: stroke-dashoffset .4s ease; }
#lvl b { position: relative; font-size: 18px; font-weight: 900; line-height: 1; margin-top: 3px; }
#lvl small { position: relative; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

#goal { width: 100%; padding: 10px 12px 10px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: transform .2s ease; }
.g-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.g-k { display: inline-flex; align-items: center; gap: 5px; color: var(--sun); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.g-k .ic { font-size: 14px; }
.g-r { display: inline-flex; align-items: center; gap: 4px; background: var(--sun); color: #3a2300; font-size: 12px; font-weight: 900; padding: 3px 8px 3px 5px; border-radius: 8px; white-space: nowrap; }
.g-r .ic { font-size: 14px; stroke-width: 2.6; }
#goalT { font-size: 16px; font-weight: 800; line-height: 1.2; }
#goalH { margin: 0; font-size: 13px; line-height: 1.35; color: var(--dim); }
#goal .bar { margin-top: 3px; }
#goalN { font-size: 12px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }
#goal.ready #goalN { color: var(--sun); }
#goal.ready .bar i { background: var(--sun); }
#goal.done { box-shadow: inset 0 0 0 2px var(--sun), 0 3px 0 rgba(0, 0, 0, .22), 0 0 30px rgba(255, 201, 60, .45); animation: gdone .7s ease; }
#goal.done .bar i { background: var(--sun); }
#goal.done #goalH { color: var(--sun); font-weight: 800; font-size: 15px; }
#goal.next { animation: gnext .45s ease; }
@keyframes gdone { 0% { transform: scale(1); } 30% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes gnext { from { opacity: 0; transform: translateX(-24px); } }

.chip { margin: 0; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; border-radius: 11px; font-size: 13px; font-weight: 700; background: var(--pnl); box-shadow: inset 0 0 0 1px var(--line), 0 3px 0 rgba(0, 0, 0, .2); max-width: 100%; }
.chip .ic { font-size: 16px; }
.chip img { width: 22px; height: 22px; flex: none; }
.chip b { color: var(--sun); }
.chip em { font-style: normal; color: var(--dim); font-variant-numeric: tabular-nums; font-size: 12px; }
.chip.mk { box-shadow: inset 0 0 0 1.5px rgba(255, 201, 60, .7), 0 3px 0 rgba(0, 0, 0, .2); }
.chip.mk .ic { color: var(--sun); }
.chip.ss .ic { color: #ffd76e; }
/* Testmodus (nur mit ?test) */
.chip.tst { border: 0; color: var(--cream); cursor: pointer; box-shadow: inset 0 0 0 1.5px rgba(255, 140, 110, .75), 0 3px 0 rgba(0, 0, 0, .2); }
.chip.tst .ic { color: #ff9a7a; }
.chip.tst b { color: #ffb39b; margin-right: 3px; }
.chip.tst kbd { margin-left: 2px; }
body.touch .chip.tst kbd { display: none; }
.chip.tst:hover { filter: brightness(1.12); }
.testnote { display: flex; gap: 10px; align-items: flex-start; background: rgba(194, 85, 58, .1); box-shadow: inset 0 0 0 1.5px rgba(194, 85, 58, .35); border-radius: 13px; padding: 10px 12px; color: #6e2c1c; }
.testnote .ic { font-size: 22px; margin-top: 1px; color: var(--clay); }
.testnote p { margin: 0; font-size: 14px; line-height: 1.45; }
.testnote kbd { background: rgba(110, 44, 28, .12); box-shadow: none; }
.testnote a { color: inherit; font-weight: 800; }
.card.testcard { width: min(560px, 100%); }
.testcard .kicker { color: var(--clay); }
.tgrp { background: var(--paper); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tg-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tg-h h3 { font-size: 17px; font-weight: 900; }
.tg-h .cashpill { margin-left: 0; font-size: 17px; }
.tg-v { font-size: 14px; font-weight: 700; color: var(--t2); font-variant-numeric: tabular-nums; }
.tg-b { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tg-b.four { grid-template-columns: repeat(4, 1fr); }
.tg-b .btn { min-height: 44px; padding: 9px 10px; font-size: 15px; white-space: nowrap; }
.tg-b .btn.ghost { background: var(--card); }
.tg-b .btn:disabled { opacity: .45; cursor: default; }
.tg-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.tg-foot .btn { flex: 1 1 140px; white-space: nowrap; }
a.btn { text-decoration: none; }
@media (max-width: 560px) { .tg-b.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-height: 520px) {
  .card.testcard { width: min(720px, 100%); display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .testcard > * { grid-column: 1 / -1; }
  .testcard section:nth-of-type(2), .testcard section:nth-of-type(3) { grid-column: auto; }
  .testcard > .muted, .testcard > .kicker { display: none; }
  .tg-foot .btn { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .tgrp { padding: 9px 10px; gap: 6px; }
  .tgrp .muted { display: none; }
  .tg-b .btn { min-height: 38px; padding: 6px 8px; font-size: 14px; }
  .testnote { padding: 7px 10px; }
  .testnote p { font-size: 12px; }
}

#orders { position: absolute; right: calc(14px + var(--sr)); top: calc(12px + var(--st)); width: min(290px, 40vw); display: flex; flex-direction: column; gap: 6px; }
#orders:not(:empty)::before { content: 'Aufträge'; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); padding-left: 4px; }
.order { display: flex; align-items: center; gap: 9px; padding: 7px 8px 7px 7px; background: var(--pnl); border-radius: 13px; box-shadow: inset 0 0 0 1px var(--line), 0 3px 0 rgba(0, 0, 0, .2); }
.order img { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--paper); padding: 2px; }
.o-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.o-mid b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-mid span { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-mid .bar { height: 5px; margin-top: 3px; }
.o-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.o-end em { font-style: normal; font-weight: 900; font-size: 13px; color: var(--sun); white-space: nowrap; }
.o-end button { border: 0; background: rgba(255, 255, 255, .08); color: var(--dim); width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; padding: 0; font-size: 13px; }
.o-end button:hover { background: rgba(255, 255, 255, .16); color: #fff; }

#toasts { position: absolute; left: 50%; top: calc(14px + var(--st)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(460px, 46vw); }
.toast { background: var(--cream); color: var(--t); padding: 10px 16px 10px 14px; border-radius: 13px; font-weight: 700; font-size: 15px; line-height: 1.35; text-align: center; box-shadow: inset 4px 0 0 var(--leaf2), 0 3px 0 rgba(0, 0, 0, .12), 0 10px 26px rgba(0, 0, 0, .16); animation: tin .25s ease; transition: opacity .4s, transform .4s; }
.toast b { color: var(--lawn); }
.toast kbd { background: var(--ink); color: var(--cream); }
.toast.gold { box-shadow: inset 4px 0 0 var(--sun2), 0 3px 0 rgba(0, 0, 0, .12), 0 10px 26px rgba(0, 0, 0, .16); background: #fff3cc; }
.toast.gold b { color: #8a5400; }
.toast.level { font-size: 16px; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px) scale(.96); } }

#banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); min-width: 260px; max-width: min(520px, 80vw); text-align: center; padding: 16px 26px 18px; border-radius: 20px; background: var(--pnl); box-shadow: inset 0 0 0 2px var(--sun), 0 4px 0 rgba(0, 0, 0, .25), 0 0 60px rgba(255, 201, 60, .35); animation: bin .5s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .4s, transform .4s; }
#banner small { display: block; color: var(--sun); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
#banner b { display: block; font-size: 64px; font-weight: 900; line-height: 1; color: var(--sun); margin: 2px 0 4px; }
#banner p { margin: 0; font-size: 15px; font-weight: 600; color: var(--cream); line-height: 1.4; }
#banner.out { opacity: 0; transform: translate(-50%, -12px); }
@keyframes bin { from { opacity: 0; transform: translate(-50%, 10px) scale(.85); } }

#floaters { position: absolute; left: 50%; top: 50%; }
.floater { position: absolute; left: 0; top: -30px; transform: translateX(-50%); white-space: nowrap; font-weight: 900; font-size: 22px; color: #fff3b0; text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 12px rgba(0, 0, 0, .25); animation: fl 1.25s ease-out forwards; }
.floater.kg { color: #e2ffc9; font-size: 17px; }
.floater.miss { color: #fff; font-size: 14px; font-weight: 700; opacity: .9; }
@keyframes fl { to { transform: translate(calc(-50% + var(--dx)), -90px); opacity: 0; } }
#prompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); margin: 0; background: var(--pnl); padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
#prompt kbd { background: var(--sun); color: #3a2300; margin: 0 5px 0 4px; box-shadow: none; }
#prompt kbd:first-child { margin-left: 0; }
#hint { position: absolute; left: 50%; bottom: calc(108px + var(--sb)); transform: translateX(-50%); margin: 0; max-width: min(620px, 90vw); text-align: center; background: var(--cream); color: var(--t); padding: 10px 16px; border-radius: 13px; font-size: 15px; font-weight: 600; line-height: 1.35; box-shadow: inset 0 0 0 2px var(--sun), 0 3px 0 rgba(0, 0, 0, .12), 0 10px 24px rgba(0, 0, 0, .16); }
#hint b { color: var(--lawn); }
#hint kbd { background: var(--ink); color: var(--cream); }
body.building #hint { display: none; }

#dock { position: absolute; left: 50%; bottom: calc(16px + var(--sb)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(980px, calc(100vw - 340px)); }
#bag { width: min(440px, 100%); padding: 8px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.bag-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; font-weight: 700; }
#toolName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bag-n { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bag-top small { color: var(--sun); font-weight: 700; }
#bag .bar { height: 10px; }
#bag.full .bar i { background: var(--sun); }
#bag.full { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 2px var(--sun), 0 3px 0 rgba(0, 0, 0, .22); } }
#hotbar { display: flex; gap: 5px; justify-content: center; }
#hotbar:empty { display: none; }
.hs { position: relative; width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; }
.hs img { width: 34px; height: 34px; object-fit: contain; }
.hs kbd { position: absolute; left: 2px; top: 2px; font-size: 9px; padding: 1px 3px; background: rgba(0, 0, 0, .35); box-shadow: none; }
.hs.on { background: rgba(255, 201, 60, .18); box-shadow: inset 0 0 0 2px var(--sun); }
body.building #hotbar, body.building #bag { display: none; }

.tr { position: absolute; right: calc(14px + var(--sr)); bottom: calc(16px + var(--sb)); display: flex; gap: 7px; }
.hbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: var(--pnl); color: var(--cream); border-radius: 13px; padding: 8px 10px 6px; min-width: 64px; font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line), 0 3px 0 rgba(0, 0, 0, .22); }
.hbtn .ic { font-size: 23px; }
.hbtn kbd { font-size: 10px; margin-top: 1px; }
.hbtn.icon { min-width: 48px; justify-content: center; }
.hbtn:hover { background: var(--ink3); }
.hbtn.on { background: var(--sun); color: #3a2300; }
.hbtn.on kbd { background: rgba(58, 35, 0, .15); }
#lockHint { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); margin: 0; background: var(--pnl); padding: 10px 16px; border-radius: 12px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }

/* Baumodus */
#buildBar { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
#buildInfo { margin: 0; background: var(--sun); color: #3a2300; padding: 6px 14px; border-radius: 10px; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 var(--sunlip); }
.bb-row { display: flex; align-items: stretch; gap: 6px; max-width: 100%; }
#buildItems { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 4px 4px 6px; scrollbar-width: thin; touch-action: pan-x; }
.bi { flex: none; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 88px; border: 0; border-radius: 12px; background: var(--cream); color: var(--t); padding: 6px 4px 5px; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); transition: transform .12s; }
.bi img, .bi .gl { width: 44px; height: 44px; object-fit: contain; }
.bi .gl { display: grid; place-items: center; border-radius: 10px; background: var(--ink2); color: var(--sun); font-size: 28px; }
.bi span { font-size: 12px; font-weight: 800; line-height: 1.1; text-align: center; }
.bi small { font-size: 11px; color: var(--t2); white-space: nowrap; font-weight: 700; }
.bi kbd { position: absolute; left: 4px; top: 4px; background: rgba(28, 43, 30, .1); box-shadow: none; color: var(--t2); font-size: 10px; }
.bi.on { box-shadow: inset 0 0 0 3px var(--sun), 0 3px 0 var(--sunlip); transform: translateY(-3px); background: #fff; }
.bi.poor small { color: var(--clay); }
.bdone { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 12px; background: var(--leaf2); color: #fff; padding: 6px 12px; margin: 4px 0 6px; font-size: 12px; font-weight: 800; box-shadow: 0 3px 0 var(--lawn); }
.bdone .ic { font-size: 22px; stroke-width: 2.8; }
.bhelp { margin: 0; background: var(--pnl); padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; text-align: center; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px; box-shadow: inset 0 0 0 1px var(--line); }
.bhelp kbd { background: var(--sun); color: #3a2300; box-shadow: none; }

/* ---------- Touch ---------- */
#touch { position: fixed; inset: 0; z-index: 9; }
#tzone { position: absolute; inset: 0; touch-action: none; }
#stick { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; background: rgba(17, 35, 23, .28); box-shadow: inset 0 0 0 2px rgba(255, 247, 228, .4); left: 90px; top: calc(100% - 150px); opacity: .6; pointer-events: none; transition: opacity .2s; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 247, 228, .85); transform: translate(-50%, -50%); }
.tb { position: absolute; border: 0; border-radius: 50%; background: rgba(17, 35, 23, .72); color: var(--cream); display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px rgba(255, 238, 200, .22), 0 3px 0 rgba(0, 0, 0, .25); touch-action: none; }
.tb .ic { font-size: 26px; }
.tb.use { width: 92px; height: 92px; right: calc(26px + var(--sr)); bottom: calc(110px + var(--sb)); background: rgba(79, 158, 58, .88); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25), 0 4px 0 rgba(30, 70, 25, .7); }
.tb.use .ic { font-size: 44px; stroke-width: 2.6; }
.tb.small { width: 54px; height: 54px; }
.tb.red { background: rgba(160, 52, 32, .82); }
.tb.on { background: rgba(255, 201, 60, .9); color: #3a2300; }
#tAct { right: calc(128px + var(--sr)); bottom: calc(180px + var(--sb)); }
#tRot { right: calc(128px + var(--sr)); bottom: calc(112px + var(--sb)); }
#tDel { right: calc(40px + var(--sr)); bottom: calc(216px + var(--sb)); }
#tPrev { right: calc(128px + var(--sr)); bottom: calc(112px + var(--sb)); }
#tNext { right: calc(40px + var(--sr)); bottom: calc(216px + var(--sb)); }
body.touch .hbtn kbd, body.touch #buildHelp, body.touch .keyonly, body.touch #hotbar, body.touch .bi kbd { display: none; }
body.touch #dock { width: min(560px, calc(100vw - 420px)); left: calc(50% - 40px); bottom: calc(12px + var(--sb)); }
body.touch .tr { bottom: auto; top: calc(var(--st) + 12px); right: calc(10px + var(--sr)); flex-direction: column; }
body.touch #orders { width: min(240px, 34vw); right: calc(84px + var(--sr)); }
body.touch .hbtn { min-width: 60px; padding: 7px 6px 6px; }
body.touch .tb.use { right: calc(92px + var(--sr)); bottom: calc(92px + var(--sb)); }
body.touch #tAct { right: calc(192px + var(--sr)); bottom: calc(158px + var(--sb)); }
body.touch #tPrev, body.touch #tRot { right: calc(252px + var(--sr)); bottom: calc(94px + var(--sb)); }
body.touch #tNext, body.touch #tDel { right: calc(192px + var(--sr)); bottom: calc(94px + var(--sb)); }
body.touch #hint { bottom: calc(84px + var(--sb)); max-width: min(520px, calc(100vw - 440px)); left: calc(50% - 40px); }

/* ---------- Fenster ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 22, 14, .55); padding: 16px; }
.card { position: relative; background: var(--cream); color: var(--t); border-radius: 20px; padding: 22px 22px 20px; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 0 rgba(0, 0, 0, .2), 0 24px 70px rgba(0, 0, 0, .3); touch-action: pan-y; overscroll-behavior: contain; animation: cin .22s ease; }
@keyframes cin { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.card h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.015em; line-height: 1.1; }
.card h3 { margin: 0; }
.muted { color: var(--t2); margin: 0; font-size: 15px; line-height: 1.45; }
.small { font-size: 13px; }
.x { position: absolute; right: 12px; top: 12px; border: 0; background: rgba(28, 43, 30, .07); width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--t); z-index: 2; padding: 0; }
.x .ic { font-size: 20px; stroke-width: 2.6; }
.x:hover { background: rgba(28, 43, 30, .13); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; font-size: 15px; }
.steps li::marker { font-weight: 900; color: var(--leaf2); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.keys div { background: var(--paper); border-radius: 14px; padding: 10px 12px; }
.keys h3 { font-size: 14px; margin-bottom: 4px; }
.keys p { margin: 0; font-size: 13px; line-height: 1.45; color: #3f5a43; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--paper); border-radius: 13px; padding: 8px 10px 8px 14px; font-weight: 700; font-size: 15px; }
.row input[type=range] { width: 46%; accent-color: var(--leaf2); }
.seg { display: inline-flex; background: rgba(28, 43, 30, .08); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; color: #3f5a43; min-height: 36px; }
.seg button.on { background: var(--ink); color: var(--cream); }
.rows { display: flex; flex-direction: column; gap: 4px; }
.rows div { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--paper); border-radius: 10px; padding: 7px 12px; font-size: 14px; }
.rows div span { display: inline-flex; align-items: center; gap: 8px; }
.rows img { width: 24px; height: 24px; }
.bigmoney { margin: 4px 0; font-size: 40px; font-weight: 900; color: var(--lawn); text-align: center; }

/* Einkauf */
.sheet.wide .card { width: min(840px, 100%); }
.shopcard { padding: 18px 18px 14px; height: min(760px, calc(100dvh - 32px)); }
.shop-head { display: flex; align-items: center; gap: 14px; padding-right: 48px; }
.cashpill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: var(--sun); font-size: 19px; font-weight: 900; padding: 6px 12px; border-radius: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; touch-action: pan-x; flex: none; border-bottom: 2px solid var(--paper2); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 10px; padding: 8px 11px; font-weight: 800; font-size: 14px; color: var(--t2); }
.tabs button .ic { font-size: 17px; }
.tabs button:hover { background: rgba(28, 43, 30, .06); }
.tabs button.on { background: var(--ink); color: var(--cream); }
.tabs button.on .ic { color: var(--sun); }
.list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 6px; touch-action: pan-y; overscroll-behavior: contain; }
.item { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 8px 10px 8px 8px; box-shadow: inset 0 0 0 1px var(--edge), 0 2px 0 rgba(28, 43, 30, .06); }
.item img, .cap { flex: none; width: 76px; height: 76px; object-fit: contain; border-radius: 11px; background: radial-gradient(circle at 50% 40%, #f6f6e6, #e4e6cc); }
.item.dim { opacity: .6; }
.item.own { box-shadow: inset 0 0 0 1.5px rgba(79, 158, 58, .45), 0 2px 0 rgba(28, 43, 30, .06); }
.i-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.i-mid b { font-size: 17px; }
.i-mid p { margin: 0; font-size: 14px; color: var(--t2); line-height: 1.35; }
.i-mid small { font-size: 12px; color: var(--t3); font-weight: 700; }
.cap { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: var(--lawn); line-height: 1; }
.cap small { font-size: 12px; color: var(--t3); margin-top: 3px; }
.cap.fld { font-size: 18px; }
.cap.up { font-size: 28px; }
.cap.gl { background: var(--ink2); color: var(--sun); font-size: 40px; }
.buy { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; min-width: 112px; min-height: 44px; padding: 8px 12px; font-weight: 900; font-size: 15px; background: var(--sun); color: #3a2300; box-shadow: 0 3px 0 var(--sunlip); font-variant-numeric: tabular-nums; }
.buy:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sunlip); }
.buy.poor { background: #eadfc2; box-shadow: 0 3px 0 #bfae86; color: #7b6a42; }
.buy.ghost { background: transparent; color: var(--lawn); box-shadow: inset 0 0 0 2px rgba(79, 158, 58, .5); }
.buy.on { background: var(--leaf2); color: #fff; box-shadow: none; }
.buy.locked { background: rgba(28, 43, 30, .06); color: var(--t3); box-shadow: none; font-size: 13px; cursor: default; }
.buy .ic { font-size: 16px; }
.pips { display: flex; gap: 4px; margin-top: 3px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: rgba(28, 43, 30, .12); }
.pips i.on { background: var(--leaf2); }
.note { margin: 0 0 2px; font-size: 14px; color: var(--t2); background: var(--paper); border-radius: 12px; padding: 9px 12px; line-height: 1.4; }
.empty { margin: 20px 10px; text-align: center; color: var(--t2); font-size: 16px; line-height: 1.5; }
.season-card { background: var(--card); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center; box-shadow: inset 0 0 0 1px var(--edge); }
.season-card img { align-self: center; }
.season-card p { margin: 0; color: var(--t2); line-height: 1.45; }
.srow { display: flex; justify-content: space-between; background: var(--paper); border-radius: 10px; padding: 8px 12px; }

/* Hofladen-Stufen */
.stages { display: flex; flex-direction: column; gap: 6px; }
.stage { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 10px 10px 10px 10px; box-shadow: inset 0 0 0 1px var(--edge); }
.st-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 15px; background: var(--paper); color: var(--t2); }
.st-n .ic { font-size: 18px; stroke-width: 2.8; }
.stage.done .st-n { background: var(--leaf2); color: #fff; }
.stage.cur { box-shadow: inset 0 0 0 2.5px var(--leaf2); background: #f5fbea; }
.stage.cur .st-n { background: var(--ink); color: var(--sun); }
.stage.next { box-shadow: inset 0 0 0 2.5px var(--sun); background: #fffaea; }
.stage.far { opacity: .55; }
.mul { flex: none; font-weight: 900; font-size: 16px; color: var(--lawn); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.tag { flex: none; min-width: 112px; text-align: center; font-size: 13px; font-weight: 800; color: var(--t3); }
.tag.on { color: var(--lawn); }

/* Karte */
.mapcard { padding: 18px; height: min(720px, calc(100dvh - 32px)); }
#mapCv { flex: 1; width: 100%; min-height: 0; border-radius: 14px; background: #7da350; cursor: pointer; touch-action: none; }

/* Maschinenfenster */
.panelcard { width: min(500px, 100%); }
.p-head { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.p-head .p-ic { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--ink); color: var(--sun); font-size: 26px; }
.p-head img.p-ic { background: radial-gradient(circle at 50% 40%, #f6f6e6, #e4e6cc); object-fit: contain; }
.p-head small { display: block; color: var(--t3); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lbl { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--t3); font-weight: 800; }
.recipes { display: flex; flex-direction: column; gap: 6px; }
.recipe { border: 0; text-align: left; background: var(--card); border-radius: 13px; padding: 8px 10px; box-shadow: inset 0 0 0 1.5px var(--edge); display: flex; flex-direction: column; gap: 3px; }
.recipe span { display: flex; align-items: center; gap: 4px; }
.recipe i { font-style: normal; font-weight: 900; color: var(--t2); }
.recipe small { color: var(--t2); font-size: 13px; }
.recipe.on { box-shadow: inset 0 0 0 3px var(--leaf2); background: #f5fbea; }
.state { margin: 0; background: var(--paper); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.pbar { height: 7px; border-radius: 4px; background: rgba(28, 43, 30, .12); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--leaf2); border-radius: 4px; transition: width .2s; }
.uprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--edge); }
.uprow div { display: flex; flex-direction: column; }
.uprow small { color: var(--t2); font-size: 13px; }
.prow { display: flex; gap: 8px; }
.prow .btn { flex: 1; }
.prow .btn .ic { font-size: 18px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; }
.filters button { border: 0; background: var(--card); border-radius: 12px; padding: 6px 8px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; text-align: left; box-shadow: inset 0 0 0 1.5px var(--edge); }
.filters button.on { box-shadow: inset 0 0 0 3px #8a55c4; background: #f6efff; }
.warn { margin: 0; background: #fff1cf; color: #6d4a00; border-radius: 12px; padding: 9px 12px; font-size: 14px; font-weight: 600; line-height: 1.4; box-shadow: inset 3px 0 0 var(--sun2); }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; font-weight: 800; color: var(--t2); }
.flow span { display: inline-flex; align-items: center; gap: 5px; background: var(--paper); padding: 5px 9px; border-radius: 9px; }
.flow span.on { background: var(--ink); color: var(--cream); }
.flow span.on .ic { color: var(--sun); }
.flow .ic { font-size: 16px; }
.flow i { width: 6px; height: 6px; border: solid var(--leaf2); border-width: 2px 2px 0 0; transform: rotate(45deg); }

@media (max-width: 700px) {
  .menu-shade { background: linear-gradient(180deg, rgba(255, 247, 228, .55) 0%, rgba(255, 247, 228, .93) 45%, rgba(255, 247, 228, .97) 100%); }
  .menu-panel { left: 0; right: 0; width: auto; padding-left: calc(18px + var(--sl)); padding-right: calc(18px + var(--sr)); justify-content: flex-end; }
  .keys { grid-template-columns: 1fr; }
  .item img, .cap { width: 60px; height: 60px; }
  .buy, .tag { min-width: 92px; font-size: 14px; }
  #cash { font-size: 24px; }
  #toasts { top: auto; bottom: calc(150px + var(--sb)); width: 80vw; }
}
@media (max-width: 1000px) {
  .tr { flex-direction: column; }
  .hbtn { min-width: 58px; }
  #dock { width: min(560px, calc(100vw - 420px)); }
  #hint { bottom: calc(96px + var(--sb)); max-width: calc(100vw - 420px); }
  #toasts { width: min(400px, calc(100vw - 680px)); min-width: 260px; }
}
/* Handy quer: alles kleiner, nur das Wichtigste */
@media (max-height: 520px) {
  #topl { width: min(250px, 36vw); gap: 6px; top: calc(8px + var(--st)); left: calc(10px + var(--sl)); }
  #money { padding: 5px 6px 5px 9px; gap: 7px; }
  #money .coin { font-size: 22px; }
  #cash { font-size: 21px; }
  #rate { font-size: 11px; }
  #lvl { width: 40px; height: 40px; }
  #lvl b { font-size: 15px; }
  #lvl small { display: none; }
  #goal { padding: 7px 10px; gap: 3px; }
  #goalT { font-size: 14px; }
  #goalH { display: none; }
  #goal.done #goalH { display: block; font-size: 13px; }
  .chip { font-size: 12px; padding: 4px 8px 4px 6px; }
  #orders { top: calc(8px + var(--st)); }
  #orders .order:nth-child(n+3) { display: none; }
  #orders:not(:empty)::before { display: none; }
  .order { padding: 5px 6px; }
  .order img { width: 30px; height: 30px; }
  #toasts { top: calc(8px + var(--st)); width: min(340px, 36vw); }
  .toast { font-size: 13px; padding: 7px 12px; }
  #banner { top: 14%; padding: 10px 20px 12px; }
  #banner b { font-size: 44px; }
  #banner p { font-size: 13px; }
  #bag { padding: 6px 10px; gap: 4px; }
  .bag-top { font-size: 12px; }
  #bag .bar { height: 8px; }
  .bi { width: 74px; padding: 4px 3px; }
  .bi img, .bi .gl { width: 34px; height: 34px; }
  .bi .gl { font-size: 22px; }
  .bi span { font-size: 11px; }
  .card { padding: 16px; gap: 8px; }
  .card h2 { font-size: 22px; }
  .shopcard, .mapcard { height: calc(100dvh - 20px); }
  .sheet { padding: 10px; }
  .item img, .cap { width: 56px; height: 56px; }
  .i-mid b { font-size: 15px; }
  .i-mid p { font-size: 13px; }
  .tabs button { padding: 6px 9px; font-size: 13px; }
  .menu-panel { gap: 7px; padding-top: calc(12px + var(--st)); padding-bottom: calc(26px + var(--sb)); width: min(440px, 56vw); }
  .menu-panel h1 { font-size: clamp(34px, 9vh, 52px); }
  .kicker { font-size: 11px; }
  .menu-panel .lede { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .loop { margin: 0; }
  .loop li { font-size: 11px; padding: 4px 8px 4px 6px; }
  .menu-panel .btn.big { padding-top: 10px; padding-bottom: 10px; font-size: 19px; }
  .menu-panel .btn { padding-top: 9px; padding-bottom: 9px; min-height: 42px; }
  .menu-shade { background: linear-gradient(90deg, rgba(255, 247, 228, .96) 0%, rgba(255, 247, 228, .88) 45%, rgba(255, 247, 228, .2) 68%, rgba(255, 247, 228, 0) 80%); }
  body.touch .tb.use { width: 80px; height: 80px; right: calc(84px + var(--sr)); bottom: calc(70px + var(--sb)); }
  body.touch .tb.small { width: 48px; height: 48px; }
  body.touch #tAct { right: calc(172px + var(--sr)); bottom: calc(128px + var(--sb)); }
  body.touch #tPrev, body.touch #tRot { right: calc(226px + var(--sr)); bottom: calc(70px + var(--sb)); }
  body.touch #tNext, body.touch #tDel { right: calc(172px + var(--sr)); bottom: calc(70px + var(--sb)); }
  body.touch .hbtn { min-width: 52px; padding: 5px 5px 4px; font-size: 10px; }
  body.touch .hbtn .ic { font-size: 20px; }
  body.touch .tr { gap: 5px; top: calc(var(--st) + 8px); }
  body.touch #orders { right: calc(74px + var(--sr)); width: min(220px, 30vw); }
  body.touch #dock { width: min(400px, calc(100vw - 520px)); min-width: 220px; left: calc(50% - 50px); bottom: calc(8px + var(--sb)); }
  body.touch #hint { bottom: calc(66px + var(--sb)); font-size: 13px; padding: 7px 12px; max-width: min(420px, calc(100vw - 500px)); min-width: 240px; left: calc(50% - 50px); }
  body.touch #toasts { top: calc(var(--st) + 8px); left: calc(50% - 30px); width: min(300px, 30vw); }
}

/* Hochformat auf dem Handy: Hinweis zum Querdrehen */
#rotate { display: none; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; background: var(--paper); color: var(--t); touch-action: none; }
#rotate svg { width: 96px; height: 96px; color: var(--leaf2); }
#rotate .ph { transform-origin: 32px 26px; animation: rot 2.4s ease-in-out infinite; }
#rotate p { margin: 6px 0 0; font-size: 24px; font-weight: 900; letter-spacing: -.01em; }
#rotate small { font-size: 15px; font-weight: 600; opacity: .7; }
@keyframes rot { 0%, 25% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@media (orientation: portrait) and (max-width: 900px) { body.touch #rotate { display: flex; } }
@media (prefers-reduced-motion: reduce) {
  #rotate .ph { animation: none; transform: rotate(-90deg); }
  .toast, #banner, .card, #goal.done, #goal.next, #cash.pop, #bag.full { animation: none; }
}
