/* Upcycle – Werkstatt-Look: warmes Grau, Signal-Orange, flache Flächen, kleine Ecken */
:root {
  --bg: #1c1b19; --bg2: #22201d; --panel: #282622; --panel2: #312e29; --rand: #3b3731; --rand2: #4a453d;
  --text: #ece6da; --leise: #a39b8c; --akzent: #e8892f; --akzent-dunkel: #b8651c; --gold: #f0c24a;
  --gut: #8fbf5a; --schlecht: #e0574a; --radius: 4px;
  --schrift: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--text); font: 14px/1.45 var(--schrift); }
body { background: var(--bg); display: flex; flex-direction: column; }
[hidden] { display: none !important; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--rand2); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { background: #3a362f; }
button:disabled { opacity: .45; cursor: default; }
button.leise { background: transparent; border-color: transparent; color: var(--leise); }
button.leise:hover:not(:disabled) { color: var(--text); background: transparent; }
button.gefahr { color: var(--schlecht); }
button.kauf { background: var(--akzent); color: #1c1206; border-color: var(--akzent-dunkel); font-weight: 600; }
button.kauf:hover:not(:disabled) { background: #f09a45; }
button.kauf:disabled { background: var(--panel2); color: var(--leise); border-color: var(--rand2); opacity: 1; }
.klein { color: var(--leise); font-size: 12.5px; }
.klein.warnung { color: var(--schlecht); }
.reihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ober { font-size: 12px; color: var(--leise); }

/* ---------- Kopfzeile */
header { display: flex; align-items: center; gap: 28px; padding: 10px 18px; border-bottom: 1px solid var(--rand); background: var(--bg2); }
.marke { display: flex; align-items: center; gap: 10px; }
.marke strong { display: block; font-size: 20px; font-weight: 700; }
.marke span { display: block; color: var(--leise); font-size: 12px; }
.werte { display: flex; gap: 26px; flex: 1; }
.wert { display: flex; flex-direction: column; min-width: 90px; }
.wert .lbl { font-size: 11.5px; color: var(--leise); }
.wert b { font-size: 17px; font-variant-numeric: tabular-nums; font-weight: 600; }
.wert.gross b { font-size: 20px; color: var(--gold); }
.wert.knapp b { color: var(--schlecht); }
.konto { display: flex; align-items: center; gap: 8px; color: var(--leise); }
.konto #spieler { color: var(--text); font-weight: 600; }

/* ---------- Spielfeld */
main { flex: 1; min-height: 0; display: flex; gap: 0; }
.buehne { position: relative; flex: 1; min-width: 0; background: #181715; overflow: hidden; }
.feldbox { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 64px 16px 56px; }
canvas { touch-action: none; cursor: pointer; }
.ziel { position: absolute; top: 12px; left: 12px; background: var(--panel); border: 1px solid var(--rand2); border-left: 3px solid var(--akzent); border-radius: var(--radius); padding: 8px 12px; min-width: 240px; max-width: 340px; }
.ziel-text { font-weight: 600; margin: 1px 0 6px; }
.balken { height: 5px; background: var(--bg); overflow: hidden; margin-bottom: 4px; }
.balken div { height: 100%; background: var(--akzent); transition: width .3s; }
.werkzeugleiste { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--rand2); border-radius: var(--radius); padding: 6px 6px 6px 14px; white-space: nowrap; }

/* ---------- Seitenleiste */
aside { width: 350px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--rand); display: flex; flex-direction: column; overflow: hidden; }
.reiter { display: flex; border-bottom: 1px solid var(--rand); }
.reiter button { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--leise); padding: 10px 4px 8px; position: relative; }
.reiter button.aktiv { color: var(--text); border-bottom-color: var(--akzent); }
.reiter button.punkt::after { content: ''; position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--akzent); }
.seite { padding: 12px; overflow: auto; flex: 1; }

.baugitter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bau { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; }
.bau canvas { flex-shrink: 0; }
.bau .txt { display: flex; flex-direction: column; min-width: 0; }
.bau .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bau .preis { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; }
.bau .preis.lagernd { color: var(--gut); }
.bau:disabled .preis { color: var(--leise); }
.bau.aktiv { border-color: var(--akzent); background: #3a2b1c; }
.bau.gesperrt { border: 1px dashed var(--rand2); background: transparent; color: var(--leise); font-size: 12px; cursor: default; }
.bau .schloss { width: 34px; height: 34px; background: var(--bg2); display: grid; place-items: center; font-weight: 700; color: var(--rand2); font-size: 16px; }
.abriss { width: 100%; margin-top: 8px; color: var(--leise); background: transparent; border-style: dashed; }
.abriss.aktiv { color: var(--schlecht); border-color: var(--schlecht); background: #2e1c18; }

.info { margin-top: 12px; padding: 12px; background: var(--bg2); border: 1px solid var(--rand); border-radius: var(--radius); }
.info-kopf { display: flex; gap: 12px; align-items: center; }
.info h3 { margin: 0; font-size: 15px; }
.info p { margin: 2px 0; }
.tipp { margin: 10px 0 0 !important; }
.rezept, .lager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lager .klein:first-child { width: 58px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border: 1px solid var(--rand); border-radius: var(--radius); padding: 2px 8px 2px 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
button.chip { cursor: pointer; }
button.chip.aktiv { border-color: var(--akzent); background: #3a2b1c; }
.pfeil { color: var(--akzent); font-weight: 700; }
.filterwahl { flex-wrap: wrap; }
.lager-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rand); }
.lager-kopf { margin-bottom: 6px; }
.lager-reihe { display: flex; flex-wrap: wrap; gap: 4px; }

.upg { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--rand); }
.upg .name { font-weight: 600; }
.upg .kauf { min-width: 96px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.upg.fertig { opacity: .55; }
.stufe-text { margin-top: 3px; }
.stufen-balken { height: 3px; background: var(--bg); margin-top: 3px; overflow: hidden; }
.stufen-balken i { display: block; height: 100%; background: var(--akzent); }

.kapitel { padding: 12px 0; border-bottom: 1px solid var(--rand); }
.kapitel h3 { margin: 2px 0 8px; font-size: 16px; }
.kapitel.fertig h3 { color: var(--leise); }
.kapitel.prestige .ober { color: var(--gold); }
.ziele { list-style: none; padding: 0; margin: 0 0 6px; }
.ziele li { padding: 4px 0 4px 22px; position: relative; }
.ziele li::before { content: ''; position: absolute; left: 3px; top: 9px; width: 9px; height: 9px; border: 1.5px solid var(--rand2); }
.ziele li.aktuell { font-weight: 600; }
.ziele li.aktuell::before { border-color: var(--akzent); }
.ziele li.erledigt { color: var(--leise); }
.ziele li.erledigt::before { background: var(--leise); border-color: var(--leise); }
button.link { background: none; border: 0; padding: 0 0 0 4px; color: var(--akzent); font-size: 12px; cursor: pointer; text-decoration: underline; }
button.link.neu { font-weight: 700; }

#liste h3 { margin: 4px 0 8px; font-size: 14px; }
h3.mit-umschalter { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.umschalter { display: inline-flex; border: 1px solid var(--rand2); border-radius: var(--radius); overflow: hidden; }
.umschalter button { font-size: 12px; padding: 3px 9px; border: 0; border-radius: 0; background: transparent; color: var(--leise); }
.umschalter button.aktiv { background: var(--panel2); color: var(--text); }
table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
td { padding: 6px; border-bottom: 1px solid var(--rand); }
td.platz { width: 28px; color: var(--leise); font-variant-numeric: tabular-nums; }
td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tr.ich td { color: var(--akzent); font-weight: 600; }

/* ---------- Meldungen & Dialoge */
#meldung { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--rand2); padding: 8px 16px; border-radius: var(--radius); max-width: 90vw; z-index: 20; }
#meldung.gut { border-left: 3px solid var(--gut); }
.overlay { position: fixed; inset: 0; background: rgba(10, 9, 8, .7); display: flex; align-items: center; justify-content: center; z-index: 10; }
.karte { background: var(--panel); border: 1px solid var(--rand2); border-radius: var(--radius); padding: 22px 24px; width: min(460px, 92vw); }
.karte h2 { margin: 2px 0 10px; font-size: 21px; }
.karte p { margin: 8px 0; }
/* Notizbuchseite für die Geschichte */
.erzaehlung { background: #ebe3d0; color: #2b2620; border: 0; border-left: 2px solid rgba(190, 60, 50, .35); border-radius: 2px; font-family: Georgia, "Times New Roman", serif;
  background-image: repeating-linear-gradient(transparent 0 25px, rgba(60, 90, 140, .14) 25px 26px); padding: 22px 26px 18px 34px; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.erzaehlung .ober { color: #7d6f58; font-family: var(--schrift); }
.erzaehlung h2 { font-size: 20px; font-weight: 600; }
.erzaehlung #dialog-text p { line-height: 26px; margin: 0; }
.erzaehlung .kauf { margin-top: 14px; font-family: var(--schrift); }
.login .karte { text-align: left; }
.login label { display: block; margin: 12px 0; color: var(--leise); font-size: 13px; }
.login input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--rand2); background: var(--bg); color: var(--text); font: inherit; }
.login input:focus { outline: none; border-color: var(--akzent); }
.fehler { color: var(--schlecht); min-height: 1em; }

@media (max-width: 980px) {
  body { height: auto; }
  header { flex-wrap: wrap; gap: 12px; }
  .werte { flex-wrap: wrap; order: 3; width: 100%; }
  main { flex-direction: column; }
  .buehne { height: 70vh; }
  aside { width: 100%; border-left: 0; border-top: 1px solid var(--rand); }
}
