:root {
  --panel: rgba(22, 30, 18, 0.86);
  --panel2: rgba(40, 52, 32, 0.95);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f4f1e6;
  --muted: #b9b6a6;
  --accent: #f1c40f;
  --green: #2ecc71;
  --red: #e74c3c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2b17; color: var(--text); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
#game { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
kbd { display: inline-block; padding: 1px 6px; margin: 0 2px; border-radius: 4px; background: #f4f1e6; color: #222; font: 700 11px/16px 'Segoe UI', sans-serif; box-shadow: 0 2px 0 #8a8678; }

/* ---------- HUD ---------- */
#topbar { position: fixed; top: 10px; left: 10px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; max-width: calc(100vw - 380px); }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-weight: 700; font-size: 15px; color: var(--text); backdrop-filter: blur(4px); }
.pill.btn { cursor: pointer; }
.pill.btn:hover { background: var(--panel2); }
.speed button { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin-left: 3px; cursor: pointer; font-weight: 700; }
.speed button.on { background: var(--accent); color: #222; border-color: var(--accent); }

#quest { position: fixed; top: 10px; right: 10px; width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; z-index: 5; font-size: 13.5px; line-height: 1.4; }
#quest .qh { color: var(--accent); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
#quest .qt { font-size: 17px; font-weight: 800; margin: 2px 0 4px; }
#quest .qd { color: #e6e2d3; }
#quest .qp { margin-top: 6px; font-weight: 700; color: var(--green); }

#vehpanel { position: fixed; left: 10px; bottom: 10px; width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; z-index: 5; font-size: 13px; }
#vehpanel .vn { font-weight: 800; font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; }
#vehpanel .vn span { font-size: 12px; color: var(--muted); }
#vehpanel .spd { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
#vehpanel .spd b { font-size: 28px; color: var(--text); }
#vehpanel .spd em { font-style: normal; background: var(--red); color: #fff; padding: 0 6px; border-radius: 4px; font-weight: 800; }
#vehpanel .row { display: grid; grid-template-columns: 66px 1fr auto; align-items: center; gap: 8px; margin: 3px 0; }
#vehpanel .row small { color: var(--muted); white-space: nowrap; }
#vehpanel .impl { margin-top: 5px; }
#vehpanel .impl .on { color: var(--green); font-weight: 700; }
#vehpanel .warn { color: #f39c12; }
#vehpanel .loc { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); color: #e6e2d3; }
.mbar { height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
.mbar i { display: block; height: 100%; border-radius: 4px; }
.vcond { max-width: 240px; margin: 5px 0 3px; }        /* Fahrzeuge/Fahrzeugliste: Zustand als Linie */
.vcondcell .vcond { width: 110px; margin-left: auto; }

#hint { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-size: 15px; font-weight: 600; z-index: 5; max-width: 60vw; text-align: center; }
#hint .info { color: #f8e6a0; font-weight: 500; }
#progress { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); width: 240px; height: 12px; background: rgba(0,0,0,.5); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; z-index: 5; }
#progress div { height: 100%; width: 0; background: linear-gradient(90deg, #f1c40f, #2ecc71); }
#keys { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(22,30,18,.6); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); z-index: 4; white-space: nowrap; }
#minimap { position: fixed; right: 10px; bottom: 10px; border: 2px solid rgba(255,255,255,.35); border-radius: 8px; z-index: 5; background: #000; box-shadow: 0 4px 18px rgba(0,0,0,.4); }

#toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 30; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.35); animation: tin .25s ease-out; max-width: 70vw; transition: opacity .5s, transform .5s; }
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.warn { border-left-color: #e67e22; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- Menüs ---------- */
#menu { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
/* Rückfrage im Spiel (statt Browser-confirm, funktioniert auch im Vollbild) – über Menü und Startbildschirm */
#dlg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
#dlg .dlgbox { width: min(440px, 100%); background: #26321f; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); padding: 18px 20px 12px; animation: tin .15s ease-out; }
#dlg .dlgbox > p:first-child { font-size: 16px; font-weight: 600; line-height: 1.45; margin: 0 0 14px; }
#dlg .btns { display: flex; justify-content: flex-end; gap: 6px; }
#dlg .b { padding: 8px 16px; font-size: 14px; }
#dlg .muted { font-size: 12px; margin: 10px 0 0; text-align: right; }
.win { width: min(1080px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: #26321f; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.win header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #1c2617; border-bottom: 1px solid var(--line); }
.win header h2 { margin: 0; font-size: 20px; flex: 1; }
.win header .money { font-weight: 800; color: var(--accent); }
/* Goldähren (Premiumwährung) */
.gold { color: #f3c845; font-weight: 800; white-space: nowrap; }
#topbar .pill.gold { color: #f3c845; }
.win header .x { background: transparent; border: 0; color: var(--text); font-size: 20px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.win header .x:hover { background: rgba(255,255,255,.1); }
.win nav { display: flex; gap: 4px; padding: 8px 12px 0; background: #1c2617; flex-wrap: wrap; }
.win nav button { background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; font-weight: 700; font-size: 14px; cursor: pointer; }
.win nav button.on { color: var(--text); border-bottom-color: var(--accent); }
.win section { padding: 14px 16px 18px; overflow-y: auto; font-size: 14px; }
.win h3 { margin: 0 0 8px; font-size: 16px; }
.card { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.card.warnbox { border-color: #e67e22; background: rgba(230,126,34,.12); }
.card.shop { display: flex; flex-direction: column; }
.card.shop canvas { width: 100%; height: 90px; background: radial-gradient(circle, #6f9a4c, #4a6c33); border-radius: 8px; margin: 4px 0; }
.card.shop .price { font-size: 18px; font-weight: 800; color: var(--accent); margin: 6px 0; margin-top: auto; }
.card p { margin: 4px 0; }
.card .next { padding: 6px 8px; background: rgba(241,196,15,.08); border-radius: 6px; }
.spec { color: #cfe3b8; font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.row2 { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; margin: 8px 0 4px; }
table.stock td { padding: 2px 6px; font-size: 13px; }
.q { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.q.good { background: rgba(46,204,113,.2); color: #8ff0b4; }
.q.warnq { background: rgba(241,196,15,.2); color: #f7dc6f; }
.q.bad { background: rgba(231,76,60,.3); color: #ffb3a8; }
.row2 small { color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.tag.miss { background: rgba(231,76,60,.3); color: #ffb3a8; }
.tag { display: inline-block; background: rgba(255,255,255,.1); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; color: #ddd; margin: 2px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 6px 6px; vertical-align: middle; text-align: left; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
table.list tr { border-bottom: 1px solid var(--line); }
table.list tr.own td:first-child { border-left: 3px solid var(--green); }
td.r, th.r { text-align: right; }
td.good { color: var(--green); font-weight: 700; }
td.bad { color: #ff8a7a; font-weight: 700; }
.b { background: #3d5230; color: var(--text); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; margin: 2px; }
.b:hover:not(:disabled) { background: #4c6a3a; }
.b:disabled { opacity: .4; cursor: not-allowed; }
.b.prim { background: #c79a0c; color: #1c1c1c; border-color: #f1c40f; }
.b.prim:hover:not(:disabled) { background: #f1c40f; }
.b.danger { background: #7b2d26; }
.b.on { background: var(--accent); color: #222; }
.b.mini { padding: 2px 7px; font-size: 12px; }
.b.isdef { outline: 2px solid #fff3b0; outline-offset: 1px; box-shadow: 0 0 0 4px rgba(241,196,15,.35); }
.win footer { padding: 6px 16px; background: #1c2617; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); min-height: 30px; }
input.txt { background: #1c2617; color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; font-size: 14px; font-weight: 700; width: 210px; }
.tag.tier1 { background: rgba(165,113,63,.35); color: #f0d2a8; }
.tag.tier2 { background: rgba(127,140,141,.4); color: #e6ecee; }
.tag.tier3 { background: rgba(142,68,173,.4); color: #e8c8f5; }
.tag.spec { background: rgba(142,68,173,.35); color: #e8c8f5; }
table.fleet td { font-size: 13px; }
.btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
label { display: block; margin: 6px 0; font-size: 13px; color: var(--muted); }
select { width: 100%; margin-top: 2px; background: #1c2617; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px; font-size: 13px; }
canvas.pvs { width: 90px; height: 46px; background: rgba(110,150,75,.5); border-radius: 6px; }
.paints { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.paint { width: 44px; height: 44px; border-radius: 10px; border: 2px solid rgba(255,255,255,.4); cursor: pointer; }
ul { margin: 0; padding-left: 18px; } li { margin: 4px 0; }
/* Daueraufträge der Arbeiter */
.order { padding: 8px 10px; margin: 6px 0; border-left: 3px solid var(--accent); background: rgba(241,196,15,.07); border-radius: 6px; }
.order.off { border-left-color: #7f8c8d; background: rgba(127,140,141,.1); opacity: .8; }
.oform { padding: 4px 0; }
.warnline { margin: 2px 0 6px; font-size: 12px; color: #f5b041; }
.minmax { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chks { margin: 6px 0; font-size: 13px; }
.chks label.chk { display: inline-flex; align-items: center; gap: 5px; margin: 3px 14px 3px 0; color: var(--text); cursor: pointer; }
input.txt.num { width: 80px; }
b.bad { color: #ff8a7a; }
b.good { color: #7ee08a; }
/* Joystick-Tab: Knopfanzeige */
.padbtns { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.padbtn { min-width: 26px; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); text-align: center; font-size: 12px; }
.padbtn.on { background: #e67e22; color: #fff; border-color: #e67e22; }
/* Kassenbuch im Finanzen-Menü */
table.fin { width: 100%; border-collapse: collapse; margin: 10px 0 6px; font-size: 13px; }
table.fin th, table.fin td { padding: 3px 4px; border-bottom: 1px dashed var(--line); text-align: left; font-weight: normal; }
table.fin .num { text-align: right; white-space: nowrap; }
table.fin tr.head th { font-weight: 700; padding-top: 10px; border-bottom: 1px solid var(--line); }
table.fin tr.head th.num { font-weight: 600; opacity: 0.8; }
table.fin tr.sum td { font-weight: 700; border-bottom: 1px solid var(--line); }
table.fin tr.profit td { font-size: 14px; border-bottom: none; padding-top: 8px; }
table.fin td.pos { color: #7ee08a; }
table.fin td.neg { color: #ff8a7a; }
table.fin tr[title] td:first-child { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* ---------- Startbildschirm ---------- */
#start { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 30% 20%, #8fbf5a 0%, #4f7a30 45%, #233a18 100%); }
#start::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.06) 0 14px, transparent 14px 28px); }
.startbox { position: relative; max-width: 620px; background: rgba(22,30,18,.88); border: 1px solid var(--line); border-radius: 18px; padding: 28px 32px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.startbox .logo { font-size: 64px; line-height: 1; }
.startbox h1 { margin: 6px 0 0; font-size: 44px; letter-spacing: .02em; }
.startbox .sub { margin: 2px 0 14px; color: var(--accent); font-weight: 700; }
.startbtns { display: flex; gap: 10px; justify-content: center; margin: 18px 0 12px; flex-wrap: wrap; }
button.big { font-size: 18px; font-weight: 800; padding: 12px 26px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: #3d5230; color: var(--text); cursor: pointer; }
button.big.prim { background: #f1c40f; color: #222; }
button.big:hover { filter: brightness(1.1); }

@media (max-width: 900px) {
  #quest { width: 260px; font-size: 12px; }
  #minimap { display: none; }
  #keys { display: none; }
  #topbar { max-width: calc(100vw - 290px); }
}

/* Kennzeichen (Fahrzeugliste, HUD) und Umbenennen-Formular */
.plate { display: inline-block; font-style: normal; font-family: "DIN Alternate", "Arial Narrow", Arial, sans-serif; font-weight: 700; font-size: 11px; letter-spacing: .5px;
  color: #111; background: #fff; border: 1.5px solid #111; border-left: 7px solid #1f4fbf; border-radius: 3px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; }
.vn .plate { font-size: 10px; }
.vrename { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.vrename label { display: flex; flex-direction: column; font-size: 12px; gap: 2px; }
.vrename .txt { width: 150px; }
.vrename .plateIn { width: 110px; text-transform: uppercase; }
