:root {
  --bg: #0d0b09;
  --panel: rgba(22, 18, 14, 0.94);
  --panel2: rgba(34, 28, 21, 0.9);
  --line: #3a3024;
  --line2: #54452f;
  --gold: #d9b76c;
  --text: #ebe2cf;
  --muted: #9d927d;
  --dim: #6d6455;
  --me: #bff3df;
  --me-deep: #6fd9b8;
  --fly: #e2575e;
  --honey: #e6b14a;
  --sugar: #f1c95f;
  --mineral: #d98d52;
  --water: #72b9db;
  --spore: #d6c7f2;
  --good: #9fd57f;
  --bad: #e6705f;
  --warn: #ebb24c;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; overflow: hidden; }
button { font-family: var(--sans); }
.hidden { display: none !important; }

#app { display: grid; grid-template-rows: 48px 1fr 92px; height: 100vh; }
#topbar { display: flex; align-items: center; gap: 18px; padding: 0 14px; border-bottom: 1px solid var(--line); background: linear-gradient(#17130f, #120f0c); }
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: 6px; color: var(--me); text-shadow: 0 0 12px rgba(127, 224, 192, .35); white-space: nowrap; }
.brand .sub { font-size: 12px; letter-spacing: 1px; color: var(--muted); margin-left: 12px; text-shadow: none; font-style: italic; }
#calendar { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.cal-label { font-family: var(--serif); font-size: 16px; white-space: nowrap; }
.cal-label b { color: var(--gold); font-weight: normal; }
.timeline { display: flex; gap: 2px; flex: 1; max-width: 560px; }
.timeline .tl { flex: 1; height: 8px; border-radius: 2px; background: #2a241c; position: relative; }
.timeline .tl.s0 { background: #3d4a2c; } .timeline .tl.s1 { background: #2f4a2c; } .timeline .tl.s2 { background: #5a3d22; } .timeline .tl.s3 { background: #2e3540; }
.timeline .tl.past { opacity: .35; }
.timeline .tl.now { outline: 2px solid var(--gold); outline-offset: 1px; }
.timeline .tl.yearstart { margin-left: 6px; }
.top-actions { display: flex; gap: 6px; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
button.ghost:hover { color: var(--text); border-color: var(--line2); }

#main { display: grid; grid-template-columns: 1fr 350px; min-height: 0; }
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at center, #15110d 0%, #0b0907 75%); }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#side > div { padding: 10px 14px; border-bottom: 1px solid var(--line); }
#info { flex: 1; overflow-y: auto; min-height: 0; }
#endturn-wrap { display: flex; gap: 8px; border-bottom: none !important; padding: 12px 14px !important; }
#btn-end { flex: 1; background: linear-gradient(#2c4a3f, #1d362d); border: 1px solid #4f8a74; color: var(--me); font-family: var(--serif); font-size: 17px; letter-spacing: 1px; padding: 10px; border-radius: 5px; cursor: pointer; }
#btn-end:hover { background: linear-gradient(#36594b, #234237); box-shadow: 0 0 14px rgba(111, 217, 184, .25); }
#btn-end:disabled { opacity: .45; cursor: default; box-shadow: none; }
#btn-undo:disabled { opacity: .35; cursor: default; }

/* resources */
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.res { display: flex; align-items: center; gap: 8px; }
.res svg { width: 20px; height: 20px; flex: none; }
.res .val { font-family: var(--serif); font-size: 19px; }
.res .delta { font-size: 11px; color: var(--muted); }
.res .lbl { font-size: 11px; color: var(--muted); display: block; line-height: 1; }
.spore-row { margin-top: 8px; }
.bar { height: 7px; background: #241e17; border-radius: 4px; overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #8c78c2, var(--spore)); border-radius: 4px; }
.bar.health > i { background: linear-gradient(90deg, #b5523f, #d8b14c 45%, #8fcf6c); }
.spore-row .top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.spore-row .top b { color: var(--spore); font-weight: normal; font-family: var(--serif); font-size: 15px; }
.growth-pips { display: flex; gap: 4px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.pip { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--me-deep); }
.pip.on { background: var(--me); box-shadow: 0 0 6px var(--me-deep); }

/* weather */
.wx { display: flex; gap: 10px; align-items: stretch; }
.wx .card { flex: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; }
.wx .card .k { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.wx .card .v { font-family: var(--serif); font-size: 15px; }
.wx .card .v .ic { font-size: 17px; margin-right: 4px; }
.wx .card.now { border-color: var(--line2); }
.wx .card.uncertain .v { color: var(--muted); font-style: italic; }
.wx-note { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.35; }

/* tools */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tool { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px 2px 5px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }
.tool svg { width: 22px; height: 22px; }
.tool .key { font-size: 9px; color: var(--dim); }
.tool:hover { border-color: var(--line2); }
.tool.active { border-color: var(--me-deep); box-shadow: inset 0 0 0 1px var(--me-deep), 0 0 10px rgba(111, 217, 184, .2); color: var(--me); }
.tool.disabled { opacity: .4; }

/* info */
.info-title { font-family: var(--serif); font-size: 17px; color: var(--gold); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.info-title small { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 6px 0; }
.note.good { color: var(--good); } .note.bad { color: var(--bad); } .note.warn { color: var(--warn); }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 8px 0 4px; }
.mode { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 7px 4px; cursor: pointer; font-size: 12px; }
.mode.active.pflegen { border-color: var(--good); color: var(--good); }
.mode.active.handeln { border-color: var(--gold); color: var(--gold); }
.mode.active.ausbeuten { border-color: var(--bad); color: var(--bad); }
.trust { display: flex; gap: 2px; align-items: center; }
.trust i { width: 9px; height: 9px; border-radius: 2px; background: #2c251d; display: inline-block; }
.trust i.pos { background: var(--good); } .trust i.neg { background: var(--bad); }
.tree-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tree-row { display: grid; grid-template-columns: 1fr 52px 64px 26px; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; background: var(--panel2); border: 1px solid transparent; cursor: pointer; font-size: 12px; }
.tree-row:hover { border-color: var(--line2); }
.tree-row .m { text-align: center; border-radius: 3px; font-size: 11px; padding: 1px 0; }
.tree-row .m.pflegen { color: var(--good); border: 1px solid var(--good); }
.tree-row .m.handeln { color: var(--gold); border: 1px solid var(--gold); }
.tree-row .m.ausbeuten { color: var(--bad); border: 1px solid var(--bad); }
.tree-row .flag { color: var(--honey); }
.section-h { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); margin: 10px 0 4px; }
.report { font-size: 12.5px; }
.report .line { display: flex; justify-content: space-between; padding: 1px 0; }
.report .line .pos { color: var(--good); } .report .line .neg { color: var(--bad); }
.report .sum { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; font-weight: 600; }

/* chronicle */
#chronicle { border-top: 1px solid var(--line); background: #100d0a; padding: 6px 14px; overflow: hidden; }
#log { height: 100%; overflow-y: auto; font-size: 12.5px; line-height: 1.5; display: flex; flex-direction: column-reverse; }
#log .e { color: var(--muted); cursor: default; }
#log .e[data-hex] { cursor: pointer; }
#log .e .t { color: var(--dim); font-size: 11px; margin-right: 8px; font-family: var(--serif); }
#log .e.good { color: var(--good); } #log .e.bad { color: var(--bad); } #log .e.warn { color: var(--warn); } #log .e.big { color: var(--gold); }

/* overlays on stage */
#tooltip { position: absolute; pointer-events: none; background: rgba(16, 13, 10, .95); border: 1px solid var(--line2); border-radius: 5px; padding: 8px 10px; font-size: 12px; max-width: 290px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); z-index: 5; }
#tooltip .tt-h { font-family: var(--serif); font-size: 14px; color: var(--gold); margin-bottom: 2px; }
#tooltip .ok { color: var(--good); } #tooltip .no { color: var(--bad); } #tooltip .att { color: var(--warn); } #tooltip .mut { color: var(--muted); }
#hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); max-width: 620px; background: rgba(18, 26, 23, .94); border: 1px solid #3e6d5d; border-radius: 6px; padding: 10px 38px 10px 14px; font-size: 13px; line-height: 1.5; color: #d9efe6; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); z-index: 4; }
#hint b { color: var(--me); font-weight: 600; }
#hint .x { position: absolute; right: 8px; top: 6px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
#hint .hint-off { display: block; margin-top: 6px; font-size: 11px; color: var(--dim); cursor: pointer; text-decoration: underline; background: none; border: none; padding: 0; }
#banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--serif); font-size: 40px; letter-spacing: 4px; color: var(--text); text-shadow: 0 0 30px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .9); pointer-events: none; text-align: center; z-index: 3; animation: bannerIn 2.4s ease forwards; }
#banner small { display: block; font-size: 16px; letter-spacing: 1px; color: var(--muted); font-style: italic; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -40%); } 15% { opacity: 1; transform: translate(-50%, -50%); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* modal */
#overlay { position: fixed; inset: 0; background: rgba(5, 4, 3, .78); display: flex; align-items: center; justify-content: center; z-index: 20; backdrop-filter: blur(2px); }
#modal { background: linear-gradient(#1b1611, #14110d); border: 1px solid var(--line2); border-radius: 8px; padding: 26px 30px; max-width: 900px; width: calc(100% - 40px); max-height: calc(100vh - 60px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .7); }
#modal h1 { font-family: var(--serif); font-weight: normal; font-size: 40px; letter-spacing: 10px; color: var(--me); margin: 0; text-shadow: 0 0 22px rgba(127, 224, 192, .35); }
#modal h2 { font-family: var(--serif); font-weight: normal; font-size: 26px; color: var(--gold); margin: 0 0 6px; }
#modal h3 { font-family: var(--serif); font-weight: normal; font-size: 18px; color: var(--gold); margin: 18px 0 6px; }
#modal p { line-height: 1.6; color: #d5ccba; }
#modal .lead { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 16px; margin-top: 4px; }
.btn { background: linear-gradient(#2c4a3f, #1d362d); border: 1px solid #4f8a74; color: var(--me); font-family: var(--serif); font-size: 16px; padding: 9px 20px; border-radius: 5px; cursor: pointer; }
.btn:hover { box-shadow: 0 0 14px rgba(111, 217, 184, .3); }
.btn.secondary { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.choice { display: flex; gap: 8px; }
.choice button { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 10px; cursor: pointer; text-align: left; }
.choice button b { display: block; font-family: var(--serif); font-size: 16px; font-weight: normal; }
.choice button span { font-size: 11.5px; color: var(--muted); }
.choice button.active { border-color: var(--me-deep); box-shadow: inset 0 0 0 1px var(--me-deep); }
input[type=text] { background: #0f0d0a; border: 1px solid var(--line2); color: var(--text); padding: 8px 10px; border-radius: 4px; font-size: 14px; width: 160px; font-family: var(--serif); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.mcard { background: var(--panel2); border: 1px solid var(--line2); border-radius: 7px; padding: 16px; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; text-align: left; color: var(--text); }
.mcard:hover { transform: translateY(-3px); border-color: var(--me-deep); box-shadow: 0 0 20px rgba(111, 217, 184, .2); }
.mcard .mn { font-family: var(--serif); font-size: 19px; color: var(--me); margin: 8px 0 6px; }
.mcard .md { font-size: 13px; color: #cfc6b3; line-height: 1.5; }
.mcard svg { width: 42px; height: 42px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; }
.help-grid p, .help-grid li { font-size: 13.5px; }
.help-grid ul { padding-left: 18px; margin: 4px 0; color: #d5ccba; line-height: 1.55; }
kbd { background: #2a241c; border: 1px solid var(--line2); border-radius: 3px; padding: 0 5px; font-size: 12px; color: var(--text); }
.stars { font-size: 34px; color: var(--gold); letter-spacing: 6px; }
.stars .off { color: #3a3024; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; text-align: center; }
.stat .n { font-family: var(--serif); font-size: 24px; }
.stat .l { font-size: 11px; color: var(--muted); }
.title-art { width: 100%; height: 150px; display: block; margin: 8px 0 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 0; }
.legend span::before { content: ""; display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: currentColor; }
.lg-me { color: var(--me) !important; } .lg-fly { color: var(--fly) !important; } .lg-honey { color: var(--honey) !important; }
.c-sugar { color: var(--sugar); } .c-min { color: var(--mineral); } .c-water { color: var(--water); } .c-spore { color: var(--spore); } .c-good { color: var(--good); } .c-bad { color: var(--bad); } .c-warn { color: var(--warn); } .c-me { color: var(--me); } .c-fly { color: var(--fly); } .c-honey { color: var(--honey); }

::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: #3a3024; border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  #main { grid-template-columns: 1fr 300px; }
  .brand .sub { display: none; }
}
