:root {
  --wood: #3b2614;
  --wood-2: #5a3a21;
  --wood-3: #7a5230;
  --parch: #f5ead3;
  --parch-2: #eadcb9;
  --parch-3: #dcc99c;
  --ink: #2b1d12;
  --ink-2: #5c4631;
  --gold: #d4a017;
  --gold-2: #f1c94c;
  --green: #5f7f2e;
  --meadow: #9ccc65;
  --meadow-2: #8bbf52;
  --forest: #4b7a35;
  --rock: #9a9183;
  --water: #6fb3e0;
  --red: #a63a2a;
  --ok: #3f7d3a;
  --shadow: 0 2px 6px rgba(43, 29, 18, .25);
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--parch) radial-gradient(ellipse at top, #fbf3df, var(--parch) 60%, var(--parch-2));
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; letter-spacing: .01em; margin: .2em 0 .4em; color: var(--wood); }
h1 { font-size: 1.8rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
a { color: var(--wood-2); }
p { margin: .4em 0 .8em; }
small, .muted { color: var(--ink-2); }
.muted { font-size: .9em; }
svg.esel { width: 1.3em; height: 1.3em; vertical-align: -.3em; fill: currentColor; }

/* Kopf */
header.top {
  background: linear-gradient(180deg, var(--wood-2), var(--wood)); color: var(--parch);
  padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; box-shadow: var(--shadow);
}
.brand a { color: var(--gold-2); text-decoration: none; font-family: Georgia, serif; font-size: 1.35rem; font-weight: bold; white-space: nowrap; }
.brand svg.esel { width: 1.6em; height: 1.6em; vertical-align: -.4em; }
.resbar { display: flex; flex-wrap: wrap; gap: 6px 14px; flex: 1; }
.res { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.res .ico { font-size: 1.1em; }
.res .amt { font-weight: bold; }
.res .rate { font-size: .78em; opacity: .85; }
.res .rate.plus { color: #b9e38a; } .res .rate.minus { color: #f2a08d; }
.res.short .amt { color: #ff9f8a; } .res.full .amt { color: #ffe08a; }

@media (max-width: 700px) {
  header.top { padding: 6px 10px; gap: 4px; }
  .brand { width: 100%; text-align: center; }
  .brand a { font-size: 1.2rem; }
  .resbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 8px; font-size: .88em; }
  .res { gap: 3px; }
  .res .rate { font-size: .7em; }
}
nav.mainnav {
  display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; overflow-x: auto; padding: 4px 10px;
  background: var(--parch-3); border-bottom: 2px solid var(--wood-3); scrollbar-width: thin; font-size: .95em;
}
nav.mainnav a { padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--wood); white-space: nowrap; font-weight: 600; }
nav.mainnav svg.esel { width: 1.15em; height: 1.15em; }
nav.mainnav a.active, nav.mainnav a:hover { background: var(--wood); color: var(--gold-2); }
nav.mainnav .spacer { flex: 1; }
nav.mainnav .who { white-space: nowrap; padding: 0 8px; font-weight: 600; }
.badge { display: inline-block; background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; font-size: .75em; vertical-align: top; }
.badge.warn { background: #c7811a; }
.linkbtn { background: none; border: 0; padding: 6px 8px; color: var(--wood-2); text-decoration: underline; cursor: pointer; font: inherit; }
form.inline { display: inline; }

main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 14px 16px 30px; }
footer { padding: 14px 16px; color: var(--ink-2); font-size: .85em; text-align: center; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; border: 1px solid; }
.flash.ok { background: #e6f1dc; border-color: #9cc48a; }
.flash.err { background: #f7e0da; border-color: #d9958a; }
.flash.warn { background: #fde9c8; border-color: #e4b56b; }
.flash.short { background: #f9e5d0; border-color: #e6b58c; }

/* Karten & Raster */
.card { background: #fffaf0; border: 1px solid var(--parch-3); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .cols, .cols3 { grid-template-columns: 1fr; } }

/* Hof-Karte */
.hof { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .hof { grid-template-columns: 1fr; } }
.grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; background: var(--wood-3); padding: 6px; border-radius: 12px;
  border: 3px solid var(--wood); box-shadow: inset 0 0 20px rgba(0,0,0,.35), var(--shadow);
}
.tile {
  aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; position: relative;
  text-decoration: none; color: var(--ink); font-size: clamp(16px, 4vw, 30px); transition: transform .08s; overflow: hidden;
}
.tile:hover { transform: scale(1.06); z-index: 2; outline: 2px solid var(--gold-2); }
.tile.sel { outline: 3px solid var(--gold); z-index: 3; }
.tile.W { background: linear-gradient(160deg, var(--meadow), var(--meadow-2)); }
.tile.F { background: linear-gradient(160deg, #5f9a44, var(--forest)); }
.tile.S { background: linear-gradient(160deg, #b2aa9c, var(--rock)); }
.tile.B { background: linear-gradient(160deg, #8ec8ee, var(--water)); cursor: default; }
.tile.B:hover { transform: none; outline: none; }
.tile .lvl { position: absolute; right: 3px; bottom: 2px; font: bold 11px/1 system-ui; background: var(--wood); color: var(--gold-2); border-radius: 6px; padding: 2px 4px; }
.tile .busy { position: absolute; left: 0; right: 0; bottom: 0; font: 10px/1.2 system-ui; background: rgba(43,29,18,.8); color: #fff; text-align: center; padding: 2px; }
.tile.building { background-image: linear-gradient(160deg, #e9d9ad, #d4bf88); }
.tile.building.F { background-image: linear-gradient(160deg, #8fb86a, #5f8a46); }
.tile.building.S { background-image: linear-gradient(160deg, #c5bdb0, #a39a8c); }
.tile .terr { opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .85em; margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend .W::before { background: var(--meadow); } .legend .F::before { background: var(--forest); } .legend .S::before { background: var(--rock); } .legend .B::before { background: var(--water); }

.panel .bigicon { font-size: 2.4rem; float: right; margin: -4px 0 0 10px; }
.cost { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; font-variant-numeric: tabular-nums; }
.cost .lack { color: var(--red); font-weight: bold; }
.buildlist { list-style: none; padding: 0; margin: 0; }
.buildlist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--parch-2); }
.buildlist li:first-child { border-top: 0; }
.buildlist .ic { font-size: 1.6rem; width: 2rem; text-align: center; }
.buildlist .nm { flex: 1; min-width: 0; }
.buildlist .nm b { display: block; }
.buildlist .nm small { display: block; }
.buildlist li.locked { opacity: .6; }

/* Buttons & Formulare */
button, .btn {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink); border: 1px solid #a67c0e; border-radius: 8px;
  padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
button.sec, .btn.sec { background: linear-gradient(180deg, #f1e6cb, #dccaa0); border-color: #b9a376; }
button.danger { background: linear-gradient(180deg, #d9735f, var(--red)); color: #fff; border-color: #7a2a1e; }
button.small, .btn.small { padding: 4px 9px; font-size: .85em; }
input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #b9a376; border-radius: 8px; background: #fffdf7; color: var(--ink); max-width: 100%;
}
input[type=number] { width: 7em; }
label { display: block; margin: 8px 0 3px; font-weight: 600; font-size: .92em; }
.formrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.formrow > div { display: flex; flex-direction: column; }
.formrow label { margin: 0 0 3px; }
textarea { width: 100%; min-height: 90px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--parch-2); vertical-align: top; }
th { font-size: .85em; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me { background: #fdf4d6; }
.tablewrap { overflow-x: auto; }

/* Esel */
.herd { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.donkey { background: #fffaf0; border: 1px solid var(--parch-3); border-radius: var(--radius); padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.donkey svg.esel { width: 2.6em; height: 2.6em; flex: none; }
.donkey .nm { font-weight: 700; }
.donkey .tier { font-size: .85em; }
.donkey form { margin-top: 6px; }
.tierinfo { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tierinfo .t { border-left: 6px solid; padding: 6px 10px; background: #fffaf0; border-radius: 6px; }

/* Welt */
.world { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 16px; }
@media (max-width: 860px) { .world { grid-template-columns: 1fr; } }
.worldmap { width: 100%; height: auto; background: #d6e3c2; border: 3px solid var(--wood); border-radius: 10px; }
.worldmap circle { cursor: pointer; }
.worldmap text { font: 9px system-ui; fill: var(--ink); pointer-events: none; }

/* Start */
.hero { text-align: center; padding: 30px 10px 10px; }
.hero h1 { font-size: 2.6rem; margin-bottom: .1em; }
.hero .sub { font-size: 1.15rem; color: var(--ink-2); font-style: italic; }
.hero .cta { margin: 18px 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.story { max-width: 740px; margin: 0 auto; font-size: 1.05em; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 20px 0; }
.features .card { margin: 0; }
.features .card .ic { font-size: 2rem; }
.report { max-width: 820px; }
.report .vs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .report .vs { grid-template-columns: 1fr; } }
.win { color: var(--ok); font-weight: 700; } .lose { color: var(--red); font-weight: 700; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--parch-2); }
.unread { font-weight: 700; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
.progress { height: 8px; background: var(--parch-2); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--gold); }
