:root {
    --bg: #17120d;
    --panel: rgba(38, 30, 22, 0.92);
    --panel-border: #5a4630;
    --text: #efe4cf;
    --muted: #a8977c;
    --accent: #e0a84a;
    --accent-2: #8fc46a;
    --good: #8fd16a;
    --bad: #ff7a66;
    --warn: #f0c94a;
    --own: #4aa8ff;
    --guild: #5fdc8a;
    --other: #ff5a4a;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at 10% 0%, #3a2a17 0%, transparent 55%),
        radial-gradient(ellipse at 100% 100%, #1d2a17 0%, transparent 50%);
    background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; font-weight: 600; letter-spacing: .02em; }
h1 { font-size: 1.6rem; }
h1 span { color: var(--accent); }
h2 { font-size: 1.15rem; color: var(--accent); margin-top: 1em; }
h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; margin-top: 1em; }
code { background: #0005; padding: .1em .35em; border-radius: 4px; }

.topbar {
    display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
    padding: .6rem 1.2rem;
    background: rgba(15, 11, 7, .9);
    border-bottom: 1px solid var(--panel-border);
}
.brand { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: .03em; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.mainnav a { padding: .3rem .7rem; border-radius: 6px; color: var(--muted); }
.mainnav a:hover { color: var(--text); background: #ffffff10; text-decoration: none; }
.mainnav a.active { color: var(--bg); background: var(--accent); }
.who { color: var(--muted); font-size: .9rem; }
.logout { font-size: .9rem; }

.resbar {
    display: flex; gap: 1rem; flex-wrap: wrap;
    padding: .4rem 1.2rem;
    background: rgba(28, 21, 14, .9);
    border-bottom: 1px solid var(--panel-border);
    font-size: .9rem;
}
.resbar .gold { color: var(--warn); font-weight: bold; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.2rem 16px; }

.card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 6px 18px #0006;
}
.card.narrow { max-width: 560px; margin: 2rem auto; }
.intro p { color: var(--muted); }

.grid { display: grid; gap: 1.2rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid > * { min-width: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
    display: inline-block;
    padding: .4rem .9rem;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background: #3a2d1f;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.btn:hover { background: #4a3a28; text-decoration: none; }
.btn.primary { background: var(--accent); color: #1c140a; border-color: var(--accent); font-weight: bold; }
.btn.primary:hover { background: #f0bb5e; }
.btn.danger { background: #7a2a20; border-color: #a5402f; }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.form { display: grid; gap: .8rem; }
.form label { display: grid; gap: .25rem; }
input, select, textarea {
    font: inherit; color: var(--text);
    background: #120e09; border: 1px solid var(--panel-border); border-radius: 6px;
    padding: .4rem .55rem; max-width: 100%;
}
input.qty { width: 5.5em; }
fieldset { border: 1px solid var(--panel-border); border-radius: 6px; padding: .6rem; }
form.inline { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .15rem 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.choice { display: grid; gap: .2rem; padding: .5rem; border: 1px solid var(--panel-border); border-radius: 6px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: #e0a84a18; }
.choice small { color: var(--muted); }

.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.flash.success { background: #2e4a1f; border-color: #5f8f3c; }
.flash.error { background: #4f1f18; border-color: #a5402f; }
.flash.info { background: #2a3442; border-color: #4f6a8a; }

.table { width: 100%; border-collapse: collapse; margin: .4rem 0 .8rem; }
.table th, .table td { padding: .4rem .5rem; border-bottom: 1px solid #5a463055; text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: normal; }
.table.compact th, .table.compact td { padding: .25rem .4rem; }
.table tr.locked { opacity: .55; }
.table tr.me { background: #e0a84a18; }
.table tr.fallen td { opacity: .55; text-decoration: line-through; }

.inline-list { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding: 0; list-style: none; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin-bottom: .5rem; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { padding: .3rem 0; border-bottom: 1px solid #5a463033; }
.log { margin: .3rem 0 .6rem; padding-left: 1.2rem; }

.bar { position: relative; display: inline-block; width: 130px; height: 1.15em; background: #0008; border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #a5302a, #d9573b); }
.bar.mana > span { background: linear-gradient(90deg, #2a4fa5, #3b8ad9); }
.bar em { position: relative; display: block; text-align: center; font-size: .75rem; font-style: normal; line-height: 1.15em; }

.rel-own { color: var(--own); }
.rel-guild { color: var(--guild); }
.rel-other { color: var(--other); }
.tier { font-size: .75rem; padding: 0 .35em; border-radius: 4px; background: #0006; }
.tier.t1, .tier.t2 { color: var(--good); }
.tier.t3, .tier.t4 { color: var(--warn); }
.tier.t5, .tier.t6 { color: var(--bad); }

.share input { width: 100%; }
.error-code { font-size: 3rem; margin: 0; color: var(--accent); }

/* Karte */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.map-card { padding: .8rem; }
.map-toolbar { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.map { overflow: auto; background: #0c0a07; border-radius: 6px; height: calc(100vh - 270px); min-height: 320px; resize: vertical; }
.hexmap { display: block; user-select: none; }
.hex { stroke: #00000055; stroke-width: 1; cursor: pointer; transition: filter .1s; }
.hex:hover { filter: brightness(1.25); }
.hex.fog { filter: brightness(.45) saturate(.5); }
.hex.fog:hover { filter: brightness(.65) saturate(.6); }
.hex.unknown { stroke: #2a231a; }
.hex.selected { stroke: #fff; stroke-width: 3; }
.hexmap .icon { text-anchor: middle; pointer-events: none; }
.hexmap .count { fill: #fff; font-family: sans-serif; font-weight: bold; pointer-events: none; }
.hexmap .ring { fill: #0004; stroke-width: 2.5; pointer-events: none; }
.hexmap .ring.own { stroke: var(--own); }
.hexmap .ring.guild { stroke: var(--guild); }
.hexmap .ring.other { stroke: var(--other); }
.hexmap .ring.building { stroke-dasharray: 4 3; }
.hexmap .unit { fill: #000a; stroke-width: 2; pointer-events: none; }
.hexmap .unit.own { stroke: var(--own); }
.hexmap .unit.guild { stroke: var(--guild); }
.hexmap .unit.other { stroke: var(--other); }
.hexmap .unit.monster { stroke: #c33; fill: #400a; }
.hexmap .unit.active { stroke: #fff; stroke-width: 3; }
.hexmap .path { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .35; pointer-events: none; }
.hexmap .path.active { stroke-width: 2.5; stroke-dasharray: 6 5; opacity: .9; stroke: #ffe08a; }
.hexmap .step { fill: #ffe08a; stroke: #000a; stroke-width: 1; pointer-events: none; }
.hexmap .step.goal { fill: #fff; stroke: #e0a84a; stroke-width: 2; }
.hexmap .eta { text-anchor: middle; fill: #fff; font-family: sans-serif; font-weight: bold; paint-order: stroke; stroke: #000; stroke-width: 3px; pointer-events: none; }
.hexmap .eta.goal { fill: #ffe08a; }
.side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.side .table.build td:last-child { width: 1%; white-space: nowrap; }

body.map-wide .container { max-width: none; }
body.map-wide .map-layout { grid-template-columns: minmax(0, 1fr) 300px; }
.map-toolbar .spacer { flex: 1; }

.resbar a { color: var(--text); }
.alertbar { display: flex; gap: 1rem; flex-wrap: wrap; padding: .45rem 1.2rem; background: #5a1f17; border-bottom: 1px solid #a5402f; }
.alertbar a { color: #ffd9cf; font-weight: bold; }
.count-badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--bad); color: #fff; font-size: .75rem; text-align: center; }
.table tr.unread td { background: #a5402f22; }
.hexmap .battle { text-anchor: middle; pointer-events: none; }
.groups-list { list-style: none; padding: 0; margin: 0; }
.level-group { display: inline-block; margin-right: 1rem; }
.table-scroll { overflow-x: auto; }
.table.stats tr.group-head th { color: var(--accent); padding-top: .7rem; }
.table.stats tr.sum td { font-weight: bold; border-top: 1px solid var(--panel-border); }
.resbar a.gold { color: var(--warn); }
.resbar a.more { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #0006; border: 1px solid var(--panel-border); color: var(--muted); vertical-align: middle; font-weight: normal; }
.badge.good { color: var(--good); border-color: #5f8f3c; }
.badge.bad { color: var(--bad); border-color: #a5402f; }
.badge.info { color: #7fb8ff; border-color: #4f6a8a; }
.check { display: flex !important; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.settings small { display: block; }
summary h2.inline { display: inline; }
a.thing { color: var(--text); border-bottom: 1px dotted var(--muted); }
a.thing:hover { color: var(--accent); text-decoration: none; }

.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.tech { border: 1px solid var(--panel-border); border-radius: 6px; padding: .6rem .8rem; background: #0003; }
.tech h3 { margin-top: 0; }
.tech p { margin: .3rem 0; }
.tech.built { border-color: #5f8f3c; }
.tech.open { border-color: #4f6a8a; }
.tech.locked { opacity: .65; }
.tech:target { box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 900px) {
    .map-layout, body.map-wide .map-layout { grid-template-columns: minmax(0, 1fr); }
    .map { height: 70vh; }
    .side { position: static; max-height: none; }
    .grid.two { grid-template-columns: minmax(0, 1fr); }
    .topbar { gap: .6rem; }
    .table { display: block; overflow-x: auto; }
}

.points-split { display: flex; height: 2.2rem; border-radius: 6px; overflow: hidden; margin: .8rem 0; border: 1px solid var(--panel-border); }
.points-split .seg { display: flex; align-items: center; justify-content: center; min-width: 7rem; font-size: .85rem; white-space: nowrap; overflow: hidden; }
.points-split .buildings { background: #4f6a8a; }
.points-split .heroes { background: #8a4f3c; }
.table tr.sum td { font-weight: bold; border-top: 1px solid var(--panel-border); }

.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .6rem; }
.subnav a { padding: .3rem .7rem; border-radius: 6px; color: var(--muted); }
.subnav a:hover { color: var(--text); background: #ffffff10; text-decoration: none; }
.subnav a.active { color: var(--bg); background: var(--accent); }
.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem 1rem; }
.data-grid label { display: grid; gap: .2rem; align-content: start; }
.data-grid label.check { display: flex; }
.data-grid textarea { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
.multi { display: flex; flex-wrap: wrap; gap: .2rem .8rem; }
