:root {
  --navy: #12324a; --navy2: #1c4663; --ink: #1d2733; --muted: #66727f; --line: #dde3ea;
  --bg: #eef1f4; --card: #fff; --amber: #f2a541; --green: #2f9e6e; --red: #d6455d; --blue: #2f6fb7;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: .55em 1em; background: var(--navy); color: #fff; font-weight: 600; }
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
button.amber { background: var(--amber); color: #3a2405; }
button.green { background: var(--green); }
button.red { background: var(--red); }
button.small { padding: .35em .7em; font-size: 13px; }
input, select { font: inherit; padding: .55em .7em; border: 1px solid #c8d0d9; border-radius: 8px; width: 100%; background: #fff; }
input:focus, select:focus { outline: 2px solid #9cc3ea; border-color: var(--blue); }
h1, h2, h3 { margin: 0 0 .5em; }
.muted { color: var(--muted); }
.chip { display: inline-block; padding: .15em .55em; border-radius: 99px; background: #e8eef5; color: #2c4a66; font-size: 12px; font-weight: 600; margin: 0 .25em .25em 0; }
.chip.t1 { background: #e6f4ea; color: #24663f; } .chip.t2 { background: #e5eefc; color: #234e8c; } .chip.t3 { background: #fdf0dc; color: #8a5110; }

/* Anmeldung */
.auth { min-height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #1f5175, var(--navy) 60%); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 28px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card .logo { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.auth-card .logo img { width: 48px; }
.auth-card .logo b { font-size: 22px; display: block; }
.auth-tabs { display: flex; gap: 6px; margin: 10px 0 16px; }
.auth-tabs button { flex: 1; background: #eef2f6; color: var(--navy); }
.auth-tabs button.on { background: var(--navy); color: #fff; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: #44515e; }
.auth-card .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-card .go { width: 100%; margin-top: 18px; padding: .8em; }
.err { color: var(--red); font-weight: 600; min-height: 1.2em; margin-top: 10px; }

/* Spiel */
.game { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.top { display: flex; align-items: center; gap: 18px; padding: 10px 18px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.top .brand { font-weight: 800; letter-spacing: .3px; display: flex; gap: 8px; align-items: center; }
.top .brand img { width: 28px; }
.top .firm { font-size: 17px; font-weight: 700; color: var(--amber); }
.top .stat { display: flex; flex-direction: column; line-height: 1.15; }
.top .stat small { color: #a9bccd; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.top .stat b { font-size: 17px; }
.top .grow { flex: 1; }
.rufbar { width: 110px; height: 8px; background: #0b2233; border-radius: 9px; overflow: hidden; margin-top: 4px; }
.rufbar i { display: block; height: 100%; background: linear-gradient(90deg, #f2a541, #4ade80); }
.top button.ghost { color: #fff; border-color: #3d6383; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; min-height: 0; }
.office { position: relative; min-height: 0; background: linear-gradient(#dde6ee, #eef1f4); }
.office canvas { position: absolute; inset: 0; }
.office .hud { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; max-width: 70%; }
.hud .pill { background: rgba(255,255,255,.92); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.1); font-size: 13px; cursor: pointer; }
.hud .pill b { display: block; }
.panel { background: #f8fafc; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: #fff; }
.tabs button { flex: 1; background: none; color: var(--muted); border-radius: 0; padding: 12px 4px; border-bottom: 3px solid transparent; font-size: 13px; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--amber); }
.tabs .badge { background: var(--red); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.tabbody { overflow: auto; padding: 14px; flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: 16px; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.card .ico { font-size: 22px; }
.card p { margin: .4em 0; line-height: 1.4; }
.card .meta { display: flex; gap: 14px; margin: 8px 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.card .meta b { color: var(--ink); }
.card .actions { display: flex; gap: 8px; margin-top: 10px; }
.card.locked { opacity: .6; }
.hint { background: #fff8ea; border: 1px solid #f3d9a6; color: #6b4a12; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.progress { display: flex; gap: 4px; margin: 8px 0; }
.progress i { flex: 1; height: 6px; border-radius: 4px; background: #e3e8ee; }
.progress i.ok { background: var(--green); } .progress i.cur { background: var(--amber); } .progress i.bad { background: var(--red); }
.shopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shopgrid .card { margin: 0; display: flex; flex-direction: column; }
.shopgrid .card p { font-size: 13px; flex: 1; }
.owned { color: var(--green); font-weight: 700; font-size: 13px; }
table.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rank td, table.rank th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.rank tr.me { background: #fff4df; }
table.rank td.num { text-align: right; font-variant-numeric: tabular-nums; }
.feed { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.feed li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.feed time { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.feed .good { color: #1e6b49; } .feed .bad { color: #a32a3f; } .feed .day { font-weight: 700; color: var(--navy); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10,25,40,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 16px; width: min(860px, 100%); max-height: 94vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.sheet header { position: sticky; top: 0; background: var(--navy); color: #fff; padding: 14px 18px; display: flex; gap: 12px; align-items: center; z-index: 2; }
.sheet header .ico { font-size: 30px; }
.sheet header b { font-size: 18px; display: block; }
.sheet header small { color: #b7c8d8; }
.sheet header .grow { flex: 1; }
.sheet header .money { text-align: right; }
.sheet header .money b { color: var(--amber); }
.sheet .body { padding: 18px; }
.situation { background: #f2f6fa; border-left: 4px solid var(--navy2); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; line-height: 1.45; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.steps span { font-size: 12px; padding: 4px 9px; border-radius: 99px; background: #eef2f6; color: var(--muted); }
.steps span.ok { background: #e3f4ea; color: #1e6b49; } .steps span.cur { background: var(--amber); color: #3a2405; font-weight: 700; }
.task h2 { font-size: 19px; }
.task .prompt { white-space: pre-line; line-height: 1.5; margin-bottom: 12px; }
pre.code { background: #0f1720; color: #d4e3f1; padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 13px; line-height: 1.45; font-family: Consolas, "Cascadia Mono", monospace; }
.field { margin: 12px 0; }
.field > label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .inrow { display: flex; align-items: center; gap: 8px; max-width: 360px; }
.field .unit { color: var(--muted); font-weight: 600; white-space: nowrap; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin: 6px 0; cursor: pointer; line-height: 1.35; }
.opt:hover { background: #f6f9fc; }
.opt input { width: auto; margin-top: 3px; }
.matchrow { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; align-items: center; margin: 6px 0; }
.field.right .inrow input, .field.right .opt:has(input:checked), .field.right select { border-color: var(--green); background: #effaf3; }
.field.wrong .inrow input, .field.wrong .opt:has(input:checked), .field.wrong select { border-color: var(--red); background: #fdf0f2; }
.result { border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.result.ok { background: #e7f6ee; border: 1px solid #b6e2c8; }
.result.bad { background: #fdeef1; border: 1px solid #f2c0ca; }
.result h3 { margin-bottom: 6px; }
.result .sol { white-space: pre-line; margin: 8px 0; }
.result .explain { white-space: pre-line; background: #fff; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.5; font-family: Consolas, "Cascadia Mono", monospace; }
.sheet .foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 18px 18px; flex-wrap: wrap; }
.done-big { text-align: center; padding: 24px; }
.done-big .big { font-size: 54px; }
.formel h3 { color: var(--navy); margin-top: 14px; }
.formel pre { white-space: pre-wrap; background: #f6f8fa; padding: 10px; border-radius: 8px; font-family: inherit; line-height: 1.5; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #1d2733; color: #fff; padding: 10px 18px; border-radius: 10px; transition: .25s; z-index: 60; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--red); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .shopgrid { grid-template-columns: 1fr; }
}
