/* ============================================================
   Restaurant Tycoon – UI im eckigen Krunker-Look
   ============================================================ */
:root {
  --bg: #15181f;
  --panel: #1d2129;
  --panel2: #262b36;
  --line: #3a4150;
  --text: #f2f4f8;
  --muted: #9aa3b5;
  --accent: #ffc53d;
  --accent2: #37d4ff;
  --ok: #4ade80;
  --warn: #fb923c;
  --err: #f87171;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
b { font-weight: 800; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: var(--panel2); color: var(--text); border: 2px solid var(--line);
  padding: 9px 16px; cursor: pointer; transition: transform .08s, background .12s, border-color .12s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.btn:hover { background: #313847; border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.btn.primary:hover { background: #ffd56a; }
.btn.ghost { background: transparent; border-color: transparent; font-size: 18px; padding: 4px 10px; }
.btn.ghost:hover { border-color: var(--line); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { border-color: #7a2e2e; }
.btn.danger:hover { border-color: var(--err); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
input {
  font: inherit; background: #0f1218; color: var(--text); border: 2px solid var(--line); padding: 10px 12px; outline: none; width: 100%;
}
input:focus { border-color: var(--accent2); }

/* ---------- Login ---------- */
#login { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 0;
  background: radial-gradient(1200px 600px at 50% 30%, #2a3142 0%, #12141a 70%); z-index: 50; }
.login-box { width: 380px; margin: auto; box-sizing: border-box; background: var(--panel); border: 2px solid var(--line); padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.login-box h1 { margin: 0; font-size: 34px; letter-spacing: .06em; line-height: 1; }
.login-box h1 span { color: var(--accent); display: block; font-size: 42px; }
.login-box .sub { color: var(--muted); margin: 10px 0 18px; }
.login-box input { margin-bottom: 10px; }
.login-btns { display: flex; gap: 8px; margin-top: 4px; }
.login-btns .btn { flex: 1; }
.login-msg { min-height: 22px; margin-top: 12px; color: var(--err); font-weight: 700; }
.login-msg.ok { color: var(--ok); }
.login-keys { margin-top: 14px; color: var(--muted); font-size: 12px; }
.login-keys b { color: var(--text); background: #2b3140; padding: 1px 5px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: none; }
.hud-tl { position: absolute; left: 16px; top: 14px; background: rgba(21,24,31,.82); border-left: 4px solid var(--accent); padding: 10px 14px; min-width: 250px; }
.money { font-size: 30px; font-weight: 900; color: var(--accent); line-height: 1; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-weight: 700; }
.tag { background: var(--panel2); font-size: 11px; padding: 2px 6px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); min-width: 56px; text-align: center; }
.small { font-size: 12px; color: var(--muted); font-weight: 600; }
.bar { width: 110px; height: 10px; background: #0f1218; border: 1px solid var(--line); overflow: hidden; }
.bar > div { height: 100%; width: 0; transition: width .25s; }
.bar.xp > div { background: var(--accent2); }
.bar.stock > div { background: var(--accent); }
.bar.clean > div { background: var(--ok); }
.hud-tr { position: absolute; right: 16px; top: 14px; text-align: right; background: rgba(21,24,31,.82); border-right: 4px solid var(--accent2); padding: 8px 14px; }
#clock { font-size: 26px; font-weight: 900; letter-spacing: .05em; }
.hint { margin-top: 4px; }

#prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(21,24,31,.9); border: 2px solid var(--accent);
  padding: 10px 18px; font-weight: 800; font-size: 16px; letter-spacing: .02em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
#prompt .key { display: inline-block; background: var(--accent); color: #1a1400; padding: 1px 8px; margin-right: 8px; }
#prompt.off { border-color: var(--line); opacity: .85; }
.ingredients { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.ing { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.ing .bar { width: 110px; }
.ing.low .small { color: var(--err); }
.ing.low .ing-icon { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.ing-icon { width: 20px; text-align: center; }
.quest { position: absolute; left: 16px; top: 262px; width: 282px; background: rgba(21,24,31,.86); border-left: 4px solid var(--accent); padding: 8px 12px; pointer-events: auto !important; cursor: pointer; }
.quest:hover { background: rgba(31,36,46,.95); }
.q-head { font-size: 11px; letter-spacing: .08em; color: var(--accent); font-weight: 800; display: flex; justify-content: space-between; }
.q-reward { color: var(--ok); }
.q-text { font-weight: 700; font-size: 14px; margin-top: 3px; }
.setup-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(21,24,31,.9); border: 2px solid var(--warn); padding: 8px 16px; font-weight: 700; font-size: 14px; max-width: 520px; text-align: center; }
.hud-btns { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; pointer-events: auto; }
.hud-btns .btn { pointer-events: auto; }
.k { display: inline-block; background: rgba(255,255,255,.12); padding: 0 5px; margin-left: 4px; font-size: 10px; border-radius: 2px; }
.kbd { background: #2b3140; padding: 1px 6px; font-weight: 800; }
.good { color: var(--ok); } .bad { color: var(--err); }
#hud.building .hud-tl, #hud.building #quest, #hud.building #orders, #hud.building #prompt, #hud.building #carry, #hud.building #minimap, #hud.building #setup-hint { display: none !important; }
#carry .dot { display: inline-block; width: 12px; height: 12px; vertical-align: middle; }

/* ---------- Baumodus ---------- */
#build { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
.b-panel { position: absolute; left: 16px; top: 14px; bottom: 16px; width: 300px; background: rgba(21,24,31,.94); border: 2px solid var(--line); border-left: 4px solid var(--accent); padding: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; overflow: hidden; }
.b-head { display: flex; justify-content: space-between; align-items: center; letter-spacing: .08em; }
.b-money { color: var(--accent); font-weight: 900; }
.b-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.b-hint:empty { display: none; }
.b-cats { display: flex; gap: 2px; border-bottom: 2px solid var(--line); }
.b-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow-y: auto; scrollbar-width: thin; flex: 1; align-content: start; padding-top: 6px; }
#build-palette { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.b-item { background: var(--panel2); border: 2px solid var(--line); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.b-item:hover { border-color: var(--accent2); }
.b-item.sel { border-color: var(--accent); background: #2f2d20; }
.b-item.off { opacity: .45; }
.b-swatch { width: 100%; height: 22px; }
.b-name { font-weight: 800; font-size: 12px; }
.b-meta { font-size: 11px; color: var(--muted); }
.b-actions { display: flex; gap: 6px; }
.b-actions .btn { flex: 1; padding: 6px 4px; font-size: 11px; }
.b-info { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); background: rgba(21,24,31,.92); border: 2px solid var(--line); padding: 8px 16px; font-weight: 700; font-size: 14px; min-width: 300px; text-align: center; }
.b-info:empty { display: none; }
.b-keys { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); color: var(--muted); font-size: 12px; font-weight: 600; background: rgba(21,24,31,.7); padding: 4px 12px; }

/* ---------- Willkommen ---------- */
#welcome { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); }
.w-box { width: 520px; background: var(--panel); border: 2px solid var(--line); border-top: 4px solid var(--accent); padding: 24px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.w-box h2 { margin: 0 0 10px; font-size: 24px; letter-spacing: .03em; }
.w-box h2 span { color: var(--accent); }
.w-box p { color: var(--muted); line-height: 1.5; }
.w-box ul { padding-left: 0; list-style: none; margin: 12px 0 18px; }
.w-box li { margin: 6px 0; font-weight: 600; }
.w-btns { display: flex; gap: 8px; }
.w-btns .btn { flex: 1; }
.w-btns .btn.ghost { flex: 0 0 auto; font-size: 13px; }

/* Aufgaben-Tab */
.quests { display: flex; flex-direction: column; gap: 4px; }
.qrow { display: grid; grid-template-columns: 32px 1fr 80px; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel2); border-left: 3px solid var(--line); font-weight: 700; }
.qrow .qi { width: 24px; height: 24px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.qrow.done { opacity: .5; border-color: var(--ok); }
.qrow.done .qi { border-color: var(--ok); color: var(--ok); }
.qrow.cur { border-color: var(--accent); background: #2a2a24; }
.qrow .q-reward { text-align: right; }
.card.offer { border-color: var(--accent); }
.bar.wide { width: 100%; height: 12px; margin: 4px 0; }
.toast.quest { border-color: var(--ok); color: var(--ok); }

#carry { position: absolute; left: 50%; bottom: 170px; transform: translateX(-50%); background: rgba(21,24,31,.9); border: 2px solid var(--accent2);
  padding: 6px 14px; font-weight: 700; font-size: 14px; }
#orders { position: absolute; left: 16px; top: 345px; background: rgba(21,24,31,.82); padding: 8px 12px; font-size: 13px; font-weight: 700; border-left: 4px solid var(--warn); }
#orders .o { color: var(--muted); }
#orders .o b { color: var(--text); }
#center-msg { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); font-size: 42px; font-weight: 900; color: var(--accent); text-shadow: 0 4px 20px rgba(0,0,0,.6); letter-spacing: .05em;
  animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: translateX(-50%) scale(.4); opacity: 0; } 60% { transform: translateX(-50%) scale(1.15); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } }

/* Toasts */
#toasts { position: absolute; right: 16px; top: 110px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.toast { background: rgba(29,33,41,.95); border-right: 4px solid var(--accent2); padding: 8px 14px; font-weight: 700; font-size: 14px; max-width: 360px;
  animation: slidein .2s ease-out; }
.toast.ok { border-color: var(--ok); }
.toast.error { border-color: var(--err); }
.toast.warn { border-color: var(--warn); }
.toast.levelup { border-color: var(--accent); color: var(--accent); }
.toast.fade { opacity: 0; transition: opacity .4s; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Münz-Popups */
#coins { position: absolute; inset: 0; overflow: hidden; }
.coin { position: absolute; transform: translate(-50%, -50%); color: var(--accent); font-weight: 900; font-size: 20px; text-shadow: 0 2px 6px rgba(0,0,0,.7);
  animation: coinup 1.3s ease-out forwards; white-space: nowrap; }
@keyframes coinup { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -70px; } }

/* Chat */
#chat { position: absolute; left: 16px; bottom: 16px; width: 340px; pointer-events: auto; }
#chatlog { max-height: 150px; overflow-y: auto; font-size: 13px; background: rgba(21,24,31,.6); padding: 6px 8px; margin-bottom: 4px; scrollbar-width: thin; }
#chatlog div { margin: 2px 0; word-wrap: break-word; }
#chatlog .sys { color: var(--muted); font-style: italic; }
#chatlog .from { color: var(--accent2); font-weight: 800; }
#chatin { background: rgba(15,18,24,.85); padding: 7px 10px; font-size: 13px; opacity: .6; }
#chatin:focus { opacity: 1; }

/* Minimap */
#minimap { position: absolute; right: 16px; bottom: 16px; border: 2px solid var(--line); background: #0f1218; }
#minimap canvas { display: block; }

/* Welt-Labels */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.label { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 800; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,.8); }
.label.shop { font-size: 15px; letter-spacing: .03em; color: #fff; background: rgba(21,24,31,.75); padding: 2px 8px; border-left: 3px solid var(--accent); }
.label.shop.mine { border-color: var(--ok); }
.label.shop small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.label.player { color: var(--accent2); }

/* ---------- Koch-Minigame ---------- */
#cook { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; z-index: 20; pointer-events: none; padding-bottom: 200px; }
.cook-box { width: 460px; background: rgba(21,24,31,.95); border: 2px solid var(--accent); padding: 16px 20px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.cook-title { font-weight: 900; letter-spacing: .06em; font-size: 16px; }
.cook-title span { color: var(--accent); }
.cook-steps { display: flex; gap: 6px; margin: 10px 0; }
.cook-steps div { flex: 1; height: 8px; background: #0f1218; border: 1px solid var(--line); }
.cook-steps div.good { background: var(--ok); }
.cook-steps div.mid { background: var(--warn); }
.cook-steps div.bad { background: var(--err); }
.cook-track { position: relative; height: 26px; background: #0f1218; border: 2px solid var(--line); }
.cook-zone { position: absolute; left: 40%; width: 20%; top: 0; bottom: 0; background: rgba(74,222,128,.35); border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.cook-marker { position: absolute; top: -4px; width: 6px; height: 30px; background: var(--accent); left: 50%; transform: translateX(-50%); }
.cook-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.cook-hint b { color: var(--text); background: #2b3140; padding: 0 5px; }
.cook-result { min-height: 20px; margin-top: 6px; font-weight: 900; color: var(--ok); }

/* Minigame-Bühne */
.cook-game { float: right; font-size: 11px; color: var(--muted); background: #2b3140; padding: 2px 8px; letter-spacing: .08em; }
.cook-stage { min-height: 60px; margin: 4px 0; position: relative; }
.mg-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.mg-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mg-glass { position: relative; width: 70px; height: 120px; border: 3px solid #cfd8dc; border-top: none; background: #0f1218; overflow: visible; }
.mg-liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#4fc3f7, #0288d1); }
.mg-line { position: absolute; left: -10px; right: -10px; height: 3px; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.mg-gauge { position: relative; width: 44px; height: 130px; border: 2px solid var(--line); background: #0f1218; }
.mg-gauge-zone { position: absolute; left: 0; right: 0; background: rgba(255,179,0,.35); border-top: 2px solid #ffb300; border-bottom: 2px solid #ffb300; }
.mg-gauge-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #ffe082; }
.mg-stack { position: relative; width: 320px; height: 150px; margin: 0 auto; background: #0f1218; border: 2px solid var(--line); overflow: hidden; }
.mg-block { position: absolute; height: 20px; line-height: 20px; font-size: 11px; font-weight: 800; text-align: center; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.mg-block.mg-moving { bottom: 110px; width: 100px; display: block; }
.mg-cuke { position: relative; height: 34px; border: 2px solid var(--line); background: #7cb342; }
.mg-mark { position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; background: rgba(0,0,0,.45); }
.mg-mark.cut { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.mg-knife { position: absolute; top: -8px; width: 4px; height: 50px; background: #eceff1; margin-left: -2px; box-shadow: 0 0 4px #000; }
.mg-knife::after { content: ''; position: absolute; top: -8px; left: -4px; width: 12px; height: 10px; background: #5d4037; }
.mg-stir { height: 26px; }
.mg-stir-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: var(--ok); opacity: .85; }
.mg-timer { height: 6px; background: #0f1218; border: 1px solid var(--line); margin-top: 8px; }
.mg-timer > div { height: 100%; width: 100%; background: var(--accent2); }
.mg-seq { display: flex; gap: 8px; justify-content: center; margin: 6px 0; }
.mg-key { width: 44px; height: 44px; border: 2px solid var(--line); background: #0f1218; font-size: 24px; font-weight: 900; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.mg-key.cur { border-color: var(--accent); color: var(--accent); background: #2b2a1a; }
.mg-key.done { border-color: var(--ok); color: var(--ok); }
.mg-key.shake { animation: shake .25s; border-color: var(--err); color: var(--err); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Menü ---------- */
#menu { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
.panel { width: min(860px, 94vw); height: min(600px, 90vh); background: var(--panel); border: 2px solid var(--line); display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--line); padding: 8px 10px 0 10px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tab { font: inherit; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; background: transparent; color: var(--muted);
  border: none; border-bottom: 3px solid transparent; padding: 10px 12px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-body { padding: 16px 18px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.panel-body h2 { margin: 0 0 10px; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; }
.panel-body h2 span { color: var(--muted); font-size: 13px; text-transform: none; letter-spacing: 0; margin-left: 10px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.card { background: var(--panel2); border: 2px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card.locked { opacity: .55; }
.card .title { font-weight: 900; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.card .title .price { color: var(--accent); font-size: 13px; }
.card .desc { color: var(--muted); font-size: 12px; min-height: 30px; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .actions { display: flex; gap: 6px; margin-top: auto; }
.swatch { width: 100%; aspect-ratio: 1; border: 3px solid transparent; cursor: pointer; }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; max-width: 420px; margin-bottom: 14px; }
.dishrow { display: grid; grid-template-columns: 24px 1fr 60px 120px 100px 90px; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
.dishrow.head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.dishrow.locked { opacity: .45; }
.dishrow .dot { width: 16px; height: 16px; }
table.board { width: 100%; border-collapse: collapse; }
table.board th, table.board td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.board th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.board td.num { text-align: right; font-weight: 800; color: var(--accent); }
.setting { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting select, .setting input[type=range] { width: 200px; }
select { font: inherit; background: #0f1218; color: var(--text); border: 2px solid var(--line); padding: 6px; }
.help p { color: var(--muted); line-height: 1.5; }
.help b { color: var(--text); }
.kbd { background: #2b3140; padding: 1px 6px; font-weight: 800; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); }

/* ---------- Discord-Login ---------- */
.btn.discord { background: #5865f2; color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 13px 16px; font-size: 15px; letter-spacing: .06em; }
.btn.discord:hover { background: #4752c4; }
.login-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); }
.login-user img { border: 2px solid var(--line); background: #0f1218; }
.login-foot { margin-top: 10px; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
button.link:hover { color: var(--text); }

/* ---------- Touch-Steuerung (Handy / Tablet) ---------- */
#touch { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#touch.hidden { display: none; }
#t-look { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
#t-stick { position: absolute; left: 22px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 132px; height: 132px; border-radius: 50%; background: rgba(21,24,31,.45); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
#t-stick i { position: absolute; left: 40px; top: 40px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,197,61,.9); border: 3px solid #1a1400; box-sizing: border-box; }
#t-btns { position: absolute; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: auto auto; gap: 10px; align-items: end; justify-items: end; pointer-events: auto; }
.t-btn { font: inherit; font-weight: 900; letter-spacing: .04em; background: rgba(29,33,41,.9); color: var(--text); border: 2px solid var(--line); border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.t-btn:active { background: var(--panel2); }
.t-sm { width: 62px; height: 62px; font-size: 10px; }
.t-sm.on { border-color: var(--accent); color: var(--accent); }
.t-big { width: 86px; height: 86px; font-size: 32px; background: var(--accent); color: #1a1400; border-color: #1a1400; grid-column: 2; grid-row: 1 / span 3; }
#t-run { grid-column: 1; grid-row: 1; } #t-build { grid-column: 1; grid-row: 2; } #t-chat { grid-column: 1; grid-row: 3; }
#t-pad { position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; grid-template-columns: 56px 56px 56px; grid-template-rows: 56px 56px; gap: 4px; pointer-events: auto; }
#t-pad.hidden { display: none; }
.t-arrow { width: 56px; height: 56px; border-radius: 8px; font-size: 20px; }
.t-arrow[data-dir="up"] { grid-column: 2; grid-row: 1; } .t-arrow[data-dir="left"] { grid-column: 1; grid-row: 2; } .t-arrow[data-dir="down"] { grid-column: 2; grid-row: 2; } .t-arrow[data-dir="right"] { grid-column: 3; grid-row: 2; }
#touch.building #t-stick, #touch.building #t-btns, #touch.menu #t-stick, #touch.menu #t-btns, #touch.cooking #t-stick { display: none; }
#touch.cooking #t-run, #touch.cooking #t-build, #touch.cooking #t-chat { visibility: hidden; }
#touch.menu #t-look { pointer-events: none; }
body.touch .hint, body.touch .login-keys, body.touch .b-keys, body.touch .k, body.touch .kbd { display: none; }
body.touch #chatin { opacity: 1; }
body.touch .cook-box { pointer-events: auto; touch-action: none; }
body.touch #prompt { bottom: auto; top: 120px; font-size: 14px; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 820px) {
  .hud-tl { left: 8px; top: 8px; min-width: 0; padding: 6px 8px; transform: scale(.78); transform-origin: top left; }
  .hud-tr { right: 8px; top: 8px; padding: 6px 8px; transform: scale(.85); transform-origin: top right; }
  #quest { top: 150px; left: 8px; max-width: 46vw; transform: scale(.85); transform-origin: top left; }
  #orders { top: 215px; left: 8px; transform: scale(.85); transform-origin: top left; }
  #setup-hint { top: 70px; max-width: 70vw; font-size: 12px; }
  #chat { left: 8px; bottom: calc(170px + env(safe-area-inset-bottom, 0px)); width: min(260px, 55vw); }
  #chatlog { max-height: 80px; font-size: 12px; }
  #minimap { right: 8px; bottom: auto; top: 112px; transform: scale(.6); transform-origin: top right; }
  #toasts { max-width: 60vw; }
  .toast { font-size: 12px; max-width: 60vw; }
  .panel { width: 100vw; height: 100vh; height: 100dvh; }
  .panel-body { padding: 12px; }
  .tab { font-size: 11px; padding: 8px 8px; }
  .w-box { width: 92vw; padding: 16px; max-height: 90vh; overflow-y: auto; }
  .cook-box { width: 92vw; }
  #cook { padding-bottom: 150px; align-items: flex-start; padding-top: 70px; }
  .login-box { width: 92vw; padding: 20px; }
  .b-panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 46vh; padding: 8px; border-left: 0; border-top: 4px solid var(--accent); }
  .b-items { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .b-info { bottom: calc(46vh + 10px); min-width: 0; max-width: 92vw; font-size: 12px; }
  .b-actions .btn { font-size: 12px; padding: 10px 4px; }
}

/* ---------- Alternativer Passwort-Login ---------- */
.login-alt { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); text-align: left; }
.login-alt .link { font-size: 12px; }
#pw-form { margin-top: 10px; }
#pw-form.hidden { display: none; }
#pw-form .btn { width: 100%; margin-top: 2px; }

/* ---------- Handy: Login & Feinschliff ---------- */
body.touch input, body.touch #chatin { font-size: 16px; }   /* verhindert Auto-Zoom beim Tippen (iOS) */
@media (max-width: 820px) {
  .login-box { width: 94vw; padding: 18px 16px; }
  .login-box h1 { font-size: 26px; } .login-box h1 span { font-size: 32px; }
  .login-box .sub { margin: 6px 0 12px; font-size: 13px; }
  .btn.discord { padding: 12px 10px; font-size: 14px; }
  #pw-form .btn { padding: 12px; }
  body.touch #prompt { top: 96px; max-width: 90vw; white-space: normal; text-align: center; }
  .b-panel { height: 38vh; }
  .b-info { bottom: calc(38vh + 8px); }
  .b-items { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }
  .b-item { padding: 6px; }
  #quest { max-width: 44vw; }
  .ingredients { max-width: 60vw; }
}
@media (max-height: 460px) { /* Querformat am Handy */
  .hud-tl { transform: scale(.65); }
  .hud-tr { transform: scale(.75); }
  #t-stick { width: 104px; height: 104px; } #t-stick i { left: 28px; top: 28px; }
  .t-big { width: 70px; height: 70px; font-size: 26px; } .t-sm { width: 52px; height: 52px; }
  #chat { bottom: calc(130px + env(safe-area-inset-bottom, 0px)); } #chatlog { max-height: 50px; }
  .b-panel { height: 48vh; } .b-info { bottom: calc(48vh + 6px); }
}

/* ---------- Handy: Chat als Overlay, Finger-Button, Minimap, Menü ---------- */
body.touch #chat { display: none; }
body.touch #chat.open { display: block; position: absolute; left: 8px; right: 8px; bottom: auto; top: calc(56px + env(safe-area-inset-top, 0px)); width: auto; z-index: 12; background: rgba(21,24,31,.96); border: 2px solid var(--line); padding: 8px; }
body.touch #chat.open #chatlog { max-height: 34vh; font-size: 14px; }
body.touch #chat.open #chatin { opacity: 1; font-size: 16px; }
#t-chat { position: relative; }
#t-chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--err); color: #fff; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
#t-chat-badge.hidden { display: none; }
.t-big { display: flex; align-items: center; justify-content: center; padding: 0; transition: transform .12s, box-shadow .12s; }
.t-big svg { display: block; }
.t-big.ready { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(255,197,61,.35), 0 0 24px rgba(255,197,61,.6); animation: tpulse 1.1s ease-in-out infinite; }
@keyframes tpulse { 0%,100% { box-shadow: 0 0 0 6px rgba(255,197,61,.35), 0 0 24px rgba(255,197,61,.6); } 50% { box-shadow: 0 0 0 10px rgba(255,197,61,.15), 0 0 30px rgba(255,197,61,.8); } }
@media (prefers-reduced-motion: reduce) { .t-big.ready { animation: none; } }
body.touch #minimap { right: 8px; bottom: auto; top: calc(104px + env(safe-area-inset-top, 0px)); transform: scale(.42); transform-origin: top right; opacity: .85; }
body.touch #btn-build { display: none; }
body.touch .hud-btns .btn.sm { padding: 10px 12px; font-size: 13px; }
body.touch .hud-tr { transform: none; padding: 6px 8px; }
body.touch #clock { font-size: 20px; }
body.touch .hud-tr .small { font-size: 11px; }
/* Menü (TAB) auf dem Handy */
@media (max-width: 820px) {
  .panel-head { padding: 6px 6px 0 6px; gap: 6px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 12px 12px; font-size: 13px; flex: none; }
  #menuclose { width: 44px; height: 44px; font-size: 22px; padding: 0; flex: none; }
  .panel-body { padding: 10px; }
  .panel-body .btn.sm { min-height: 42px; font-size: 13px; padding: 8px 12px; }
  .panel-body input, .panel-body select { min-height: 42px; font-size: 16px; }
  .grid { grid-template-columns: 1fr; gap: 8px; }
  .card .desc { min-height: 0; }
  .card .actions { flex-wrap: wrap; }
  .card .actions .btn { flex: 1 1 45%; }
  .dishrow { grid-template-columns: 20px 1fr 54px 90px 80px 70px; gap: 6px; font-size: 12px; padding: 8px 6px; min-width: 520px; }
  .dishwrap, .panel-body > .dishrows { overflow-x: auto; }
  .qrow { grid-template-columns: 28px 1fr 70px; padding: 10px 8px; }
  .setting { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; }
  .swatches span, .swatches button { width: 36px; height: 36px; }
}

/* ---------- Einstellungen: Zurücksetzen ---------- */
.danger-zone { margin-top: 22px; padding: 12px 14px; border: 2px solid var(--err); background: rgba(248,113,113,.06); }
.danger-zone h3 { margin: 0 0 6px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--err); }
.danger-zone .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn.danger { background: #5a2323; border-color: #8a2f2f; color: #fde2e2; }
.btn.danger:hover { background: #7a2b2b; }


/* ---------- Supermarkt ---------- */
#shop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
.shop-box { width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 2px solid var(--line); border-top: 4px solid #ef5350; padding: 16px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.shop-head { display: flex; justify-content: space-between; align-items: center; font-size: 20px; font-weight: 900; letter-spacing: .06em; }
.shop-head span { color: var(--accent); }
.shop-items { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.shop-item { background: var(--panel2); border: 2px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.shop-item.offer { border-color: var(--accent); }
.shop-item.have { opacity: .7; }
.shop-item .si-name { font-weight: 900; }
.shop-item .si-name em { color: var(--accent); font-style: normal; font-size: 12px; }
.shop-item .si-meta { font-size: 12px; color: var(--muted); }
.shop-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.shop-foot span { margin-right: auto; }
#openstate.open { color: var(--ok); font-weight: 800; }
#openstate.closed { color: var(--err); font-weight: 800; }
.label.sign { font-size: 12px; font-weight: 900; letter-spacing: .08em; padding: 1px 6px; background: rgba(21,24,31,.8); }
.label.sign.open { color: #4ade80; }
.label.sign.closed { color: #f87171; }
@media (max-width: 820px) { .shop-items { grid-template-columns: 1fr; } .b-actions .btn { font-size: 11px; } }


/* ---------- V5: Karten, Freunde, Tutorial, Autohaus, Lager, Namen ---------- */
.b-icon { width: 100%; aspect-ratio: 1; object-fit: cover; background: #262b36; border: 1px solid var(--line); margin-bottom: 4px; display: block; }
.zone { display: inline-block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; margin-right: 6px; background: #37474f; color: #fff; }
.zone.z-kueche { background: #b8860b; } .zone.z-lager { background: #607d8b; } .zone.z-buero { background: #8d6e63; } .zone.z-gast { background: #2e7d32; }
.label.player.admin, .label.me.admin { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,.8), 0 1px 3px #000; font-size: 14px; }
.label.bubble { background: rgba(255,255,255,.95); color: #1d2129; padding: 4px 10px; border-radius: 12px; font-weight: 700; font-size: 12px; max-width: 220px; white-space: normal; text-shadow: none; }
.label.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: rgba(255,255,255,.95); border-bottom: 0; }
#chatlog .from.admin { color: #ffd700; }
#coop { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); background: rgba(21,24,31,.9); border: 2px solid var(--ok); padding: 6px 12px; font-size: 13px; font-weight: 700; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
#coop .btn { pointer-events: auto; }
#tutorial { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: min(520px, 92vw); background: rgba(21,24,31,.94); border: 2px solid var(--accent); border-left: 6px solid var(--accent); padding: 10px 14px; pointer-events: auto; }
#tutorial.min .tut-hint { display: none; }
.tut-head { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .1em; color: var(--accent); font-weight: 900; }
.tut-text { font-size: 15px; font-weight: 800; margin: 4px 0; }
.tut-hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 6px; }
#tutorial .btn { margin-right: 6px; pointer-events: auto; }
#invite { position: fixed; left: 50%; top: 20%; transform: translateX(-50%); z-index: 35; }
#invite.hidden { display: none; }
.inv-box { background: var(--panel); border: 2px solid var(--accent2); padding: 14px 18px; min-width: 280px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.inv-box .actions { display: flex; gap: 8px; }
#dealer { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
#dealer .shop-box { border-top-color: #ffb300; }
.car-icon { width: 100%; aspect-ratio: 1; object-fit: cover; background: #262b36; border: 1px solid var(--line); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.stock-card { background: var(--panel2); border: 2px solid var(--line); border-top: 4px solid var(--c); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.stock-card.offer { box-shadow: 0 0 0 2px var(--accent) inset; }
.stock-card.low { border-color: var(--err); }
.stock-head { display: flex; gap: 10px; align-items: center; }
.stock-icon { font-size: 30px; }
.stock-head small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.crates { display: flex; gap: 4px; }
.crates i { flex: 1; height: 22px; background: #0f1218; border: 1px solid var(--line); position: relative; }
.crates i.on { background: var(--c); border-color: rgba(0,0,0,.3); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.25); }
.crates i.on::after { content: ""; position: absolute; left: 30%; right: 30%; top: 40%; height: 3px; background: rgba(0,0,0,.25); }
.stock-bar { height: 8px; background: #0f1218; border: 1px solid var(--line); }
.stock-bar div { height: 100%; background: var(--c); }
.stock-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.stock-meta em { color: var(--err); font-style: normal; font-weight: 800; }
.stock-uses { font-size: 11px; color: var(--muted); line-height: 1.6; }
.stock-uses .dot { display: inline-block; width: 9px; height: 9px; margin-right: 3px; vertical-align: -1px; }
.rarity-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.rar { font-size: 11px; font-weight: 800; padding: 2px 8px; border: 1px solid; }
.r-common { color: #4ade80; border-color: #4ade80; } .r-rare { color: #42a5f5; border-color: #42a5f5; } .r-epic { color: #ab47bc; border-color: #ab47bc; } .r-legendary { color: #ffd700; border-color: #ffd700; } .r-mythic { color: #fff; border-color: #fff; background: linear-gradient(135deg, #000, #444); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.ccard { position: relative; background: var(--panel2); border: 2px solid var(--line); padding: 8px; cursor: default; overflow: hidden; }
.ccard.owned { cursor: pointer; }
.ccard.owned.r-common { border-color: #4ade80; } .ccard.owned.r-rare { border-color: #42a5f5; } .ccard.owned.r-epic { border-color: #ab47bc; } .ccard.owned.r-legendary { border-color: #ffd700; } .ccard.owned.r-mythic { border-color: #fff; }
.ccard.owned::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(255,255,255,.28) 78%, transparent 86%); animation: shine 3.2s linear infinite; pointer-events: none; }
.ccard.owned.r-mythic::before { background: conic-gradient(from 0deg, transparent 0 60%, #fff 70%, #000 78%, transparent 88%); animation-duration: 2s; }
@keyframes shine { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ccard.owned::before { animation: none; } }
.ccard-art { aspect-ratio: 3 / 4; background: linear-gradient(160deg, var(--cc), #1d2129 140%); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; color: rgba(255,255,255,.85); text-shadow: 0 2px 6px #000; }
.ccard.locked .ccard-art { background: #0f1218; color: #3a4150; }
.ccard-name { font-weight: 900; font-size: 13px; margin-top: 6px; }
.ccard-rar { font-size: 11px; color: var(--muted); }
.ccard-text { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.ccard-btn { margin-top: 6px; font-size: 11px; font-weight: 800; color: var(--accent); }
.ccard.shown { box-shadow: 0 0 0 3px var(--accent); }
body.touch .keys-only, body.touch .login-keys { display: none; }
@media (max-width: 820px) { #tutorial { top: 60px; width: 94vw; } #coop { top: 118px; font-size: 11px; } .cards-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } }

/* Einkäufer-Einstellungen in der Personal-Karte */
.buyer-cfg { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; padding: 8px; background: rgba(255,255,255,.05); border-radius: 6px; font-size: 12px; }
.buyer-cfg label { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; }
.buyer-cfg label span { display: flex; align-items: center; gap: 4px; white-space: nowrap; margin-left: auto; }
.buyer-cfg input { width: 54px !important; }
.buyer-cfg input { width: 64px; padding: 3px 4px; text-align: right; background: rgba(0,0,0,.35); color: inherit; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; font: inherit; }
.buyer-cfg small { color: var(--muted); }
