:root {
  --bg: #0d1520; --panel: #15212f; --panel2: #1b2a3b; --line: #2a3d52;
  --text: #dbe6f0; --muted: #7f93a8; --accent: #7cc7ff; --pos: #7fd99a; --neg: #ff8a80; --warn: #ffcf6b;
  font-family: system-ui, "Segoe UI", sans-serif; font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 .6rem; } h1 small { color: var(--muted); font-weight: normal; font-size: .9rem; }
h2 { font-size: 1.1rem; margin: .2rem 0 .6rem; color: var(--accent); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 1.2rem; color: #fff; }
header nav { display: flex; gap: .9rem; flex-wrap: wrap; }
header .user { margin-left: auto; display: flex; gap: .6rem; align-items: center; }

.resbar { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.res { flex: 1 1 100px; background: var(--panel2); padding: .35rem .6rem; display: flex; flex-direction: column; }
.res.full .ramount { color: var(--warn); }
.rname { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ramount { font-variant-numeric: tabular-nums; font-weight: 600; }
.rrate { font-size: .78rem; color: var(--pos); font-variant-numeric: tabular-nums; }
.rcap { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rbar { position: relative; display: block; height: 3px; margin-top: .2rem; background: var(--line); border-radius: 2px; }
.rbar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; }
.res.full .rbar > span { background: var(--warn); }
.rbar > i { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--pos); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 380px; margin: 3rem auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid2 > .card { margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.mine td { background: rgba(124,199,255,.08); }
tr.isdone td { opacity: .7; }
.tree td:first-child { width: 28%; }

.item { border-top: 1px solid var(--line); padding: .7rem 0; }
.item:first-of-type { border-top: 0; }
.item-head { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.count { color: var(--muted); font-size: .85rem; }
.desc { margin: .3rem 0; color: var(--muted); font-size: .9rem; }
.effects { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; align-items: center; font-size: .85rem; }
.item-foot { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; font-size: .88rem; }
.item-foot form { margin-left: auto; }

.tag { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 3px; padding: 0 .4rem; margin: 1px; font-size: .82rem; color: var(--text); }
.tag.pos, .pos { color: var(--pos); } .tag.neg, .neg { color: var(--neg); }
.tag.info { color: var(--accent); }
.badge { background: var(--neg); color: #1a0d0d; border-radius: 9px; padding: 0 .4rem; font-size: .75rem; font-weight: 700; }
tr.unread td { font-weight: 600; }
textarea { width: 100%; min-height: 8rem; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: .4rem; font: inherit; }
.msgbody { white-space: pre-wrap; background: var(--panel2); padding: .8rem; border-radius: 4px; }
.tag.done { border-color: #2f6b43; color: var(--pos); }
.tag.lack { border-color: #7a3a36; color: var(--neg); }
.cost { margin-right: .5rem; font-variant-numeric: tabular-nums; } .cost.lack { color: var(--neg); }
.muted { color: var(--muted); }
.running { color: var(--warn); }

.flash { padding: .6rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash.error { background: #3b1f22; border: 1px solid #7a3a36; }
.flash.success { background: #1d3527; border: 1px solid #2f6b43; }
.flash.warn { background: #3a3220; border: 1px solid #7a6530; }

form label { display: block; margin: .5rem 0; }
form.inline, form.inline label { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: .3rem .5rem; font: inherit; }
form label input:not([type=radio]):not([type=checkbox]) { display: block; width: 100%; margin-top: .2rem; }
form.inline input[type=number] { width: 4.5rem; }
form.tt-research { margin-left: .5rem; }
td > form.tt-research { display: flex; margin: .3rem 0 0; }
button { background: #2b6aa0; color: #fff; border: 0; border-radius: 4px; padding: .35rem .9rem; font: inherit; cursor: pointer; }
button:hover { background: #3580c0; }
button:disabled { background: #34404d; color: #7f8a96; cursor: not-allowed; }
button.secondary { background: #4a3a2a; }
button.link { background: none; color: var(--accent); padding: 0; }
.mapnav { margin-bottom: .8rem; flex-wrap: wrap; }
.inline-fields { display: flex; gap: .6rem; flex-wrap: wrap; }
.inline-fields label { display: inline-flex; flex-direction: column; margin: 0; }
.inline-fields input { width: 5rem; }
label.radio { display: flex; gap: .4rem; align-items: center; margin: .2rem 0; }
td input[type=number] { width: 5.5rem; text-align: right; }
code { background: var(--panel2); padding: 0 .3rem; border-radius: 3px; }

.countdown { font-variant-numeric: tabular-nums; }
.countdown.done { color: var(--warn); }

/* Techtree-Detailseiten */
table.facts th { text-align: left; white-space: nowrap; vertical-align: top; width: 1%; padding-right: 1rem; color: var(--muted); font-weight: 500; }
table.facts td, table.effects-table td { vertical-align: top; }
table.effects-table th.eff-label { text-align: left; font-weight: normal; vertical-align: top; white-space: nowrap; width: 1%; padding-right: 1rem; }
@media (max-width: 600px) { table.facts th, table.effects-table th.eff-label { white-space: normal; } }

/* Flotte senden */
.fleet-status { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; color: var(--muted); }
.fleet-status strong { color: var(--text); }
.fleet-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .fleet-layout { grid-template-columns: minmax(0, 1fr); } }
.step { border: 1px solid var(--line); border-radius: 6px; padding: .4rem .8rem .8rem; margin: 0 0 1rem; min-width: 0; }
.step legend { display: flex; align-items: center; gap: .5rem; padding: 0 .4rem; color: var(--accent); font-weight: 600; }
.step-no { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: var(--accent); color: var(--bg); font-size: .8rem; font-weight: 700; }
.legend-actions { font-weight: normal; font-size: .85rem; color: var(--muted); margin-left: .4rem; }
.step.dimmed { opacity: .45; }
.coords { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem; }
.coords label { margin: 0; font-size: .85rem; color: var(--muted); }
.coords input { width: 5rem; }
.coords .sep { padding-bottom: .4rem; color: var(--muted); }
.coords .own-pick { margin-left: auto; }
.coords .own-pick select { display: block; margin-top: .2rem; max-width: 16rem; }
.target-info { margin: .5rem 0 0; font-size: .88rem; }
.missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
label.mission { position: relative; display: block; margin: 0; cursor: pointer; }
label.mission input { position: absolute; opacity: 0; pointer-events: none; }
.mission-body { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); }
.mission-body small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
label.mission:hover .mission-body { border-color: var(--muted); }
label.mission input:checked + .mission-body { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: rgba(124,199,255,.1); }
label.mission input:focus-visible + .mission-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.nowrap { white-space: nowrap; }
table.ships td, table.cargo-table td { vertical-align: middle; }
table.ships td input, table.cargo-table td input { width: 6rem; }
.fleet-summary { position: sticky; top: 1rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: .8rem; }
.fleet-summary td { padding: .25rem .2rem; font-size: .9rem; }
.cargo-bar { height: 6px; background: var(--bg); border-radius: 3px; margin: .5rem 0; overflow: hidden; }
.cargo-bar div { height: 100%; width: 0; background: var(--pos); transition: width .15s; }
.cargo-bar div.over { background: var(--neg); }
ul.checks { list-style: none; padding: 0; margin: .5rem 0; font-size: .85rem; }
ul.checks li { margin: .25rem 0; padding-left: 1.1rem; position: relative; }
ul.checks li.neg::before { content: "✕"; position: absolute; left: 0; }
ul.checks li.muted::before { content: "ⓘ"; position: absolute; left: 0; }
button.wide { width: 100%; padding: .55rem; font-weight: 600; }
.coords label:not(.own-pick) { width: 5.5rem; }
button.link:disabled { background: none; color: var(--muted); }
input:disabled { opacity: .45; }
@media (max-width: 600px) {
  .fleet-form .step { padding: .3rem .5rem .6rem; }
  .missions { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
  .coords label:not(.own-pick) { width: 4.3rem; }
  .coords .own-pick { margin-left: 0; width: 100%; }
  .coords .own-pick select { max-width: none; width: 100%; }
  table.ships td input, table.cargo-table td input { width: 4.5rem; }
  .hide-sm { display: none; }
}

/* Gebäudeseite */
.badge.new { background: var(--accent); color: var(--bg); }
.tag.new { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; font-size: .7rem; letter-spacing: .04em; }
.small { font-size: .82rem; }
.bnav { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .5rem 0; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }
.bnav-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { position: relative; display: inline-flex; gap: .35rem; align-items: baseline; padding: .2rem .6rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); color: var(--text); font-size: .88rem; white-space: nowrap; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip small { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.dim { opacity: .55; }
.chip.off { display: none; }
.chip .dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bnav-tools { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .45rem; font-size: .88rem; }
.bnav-tools label { display: inline-flex; gap: .3rem; align-items: center; margin: 0; color: var(--muted); }
.bnav-tools input[type=search] { width: 14rem; padding: .2rem .5rem; }
details.cat { scroll-margin-top: 6.5rem; padding: .5rem 1rem; }
details.cat > summary { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; cursor: pointer; list-style: none; padding: .3rem 0; }
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary::before { content: "▾"; color: var(--muted); width: .8rem; }
details.cat:not([open]) > summary::before { content: "▸"; }
details.cat > summary h2 { margin: 0; }
details.cat > summary .muted { font-size: .85rem; }
.brow { display: grid; grid-template-columns: 1.3rem minmax(11rem, 1fr) minmax(0, 2fr) auto; gap: .2rem .8rem; align-items: center;
  padding: .45rem 0; border-top: 1px solid var(--line); scroll-margin-top: 7rem; }
.brow.fresh { background: linear-gradient(90deg, rgba(124,199,255,.12), transparent 60%); }
.brow.flash-row { box-shadow: inset 3px 0 0 var(--accent); }
.more-toggle { background: none; color: var(--muted); padding: 0; width: 1.3rem; font-size: .8rem; align-self: start; margin-top: .2rem; }
.more-toggle:hover { background: none; color: var(--accent); }
.brow.open .more-toggle, .bdetail .more-toggle { transform: rotate(90deg); }
.brow-name .count { margin-top: .1rem; font-size: .8rem; }
.brow-info .effects { margin: 0 0 .15rem; }
.brow-cost { font-size: .84rem; }
.brow-cost .cost { margin-right: .4rem; }
.brow-act { display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; justify-content: flex-end; }
.brow-act .why { flex-basis: 100%; text-align: right; font-size: .76rem; max-width: 13rem; margin-left: auto; }
.brow-act select { padding: .2rem .3rem; font-size: .85rem; }
.brow-more { display: none; grid-column: 2 / -1; }
.brow-more .desc { margin: .1rem 0; }
.brow-more p.small { margin: .1rem 0; }
.brow.open .brow-more, .bdetail .brow-more { display: block; }
details.shelf { margin-top: .3rem; border-top: 1px dashed var(--line); }
details.shelf > summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: .45rem 0; }
details.shelf .brow { opacity: .8; }
@media (max-width: 760px) {
  .brow { grid-template-columns: 1.3rem minmax(0, 1fr) auto; }
  .brow-info { grid-column: 2 / -1; grid-row: 2; }
  .brow-act { grid-column: 3; grid-row: 1; }
  .bnav { position: static; }
  .bnav-tools input[type=search] { width: 100%; }
}
.brow.active { box-shadow: inset 3px 0 0 var(--warn); background: linear-gradient(90deg, rgba(255,207,107,.08), transparent 60%); }
.chip .running { font-size: .7rem; }

/* Angriffsalarm: oben über der Seite, pulsierend */
.attack-alarm { background: linear-gradient(90deg, #5a1418, #7a1c1f 50%, #5a1418); border-bottom: 2px solid var(--neg);
  color: #fff; padding: .6rem 1rem; animation: alarm-pulse 1.6s ease-in-out infinite; }
.attack-alarm .alarm-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: 1.1rem; }
.attack-alarm .alarm-icon { font-size: 1.6rem; line-height: 1; animation: alarm-blink 1s steps(2, start) infinite; }
.attack-alarm .alarm-link { margin-left: auto; background: var(--neg); color: #2a0a0b; font-weight: 700; padding: .25rem .7rem; border-radius: 4px; }
.attack-alarm ul { margin: .4rem 0 0; padding-left: 2.2rem; }
.attack-alarm li { margin: .15rem 0; }
.attack-alarm li a { color: #ffd2cc; font-weight: 600; }
.attack-alarm .countdown { font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.attack-alarm small.muted { color: #f0b8b2; }
.badge.alarm { background: var(--neg); color: #2a0a0b; font-weight: 700; animation: alarm-blink 1s steps(2, start) infinite; }
@keyframes alarm-pulse { 0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 138, 128, 0); } 50% { box-shadow: inset 0 0 1.2rem .2rem rgba(255, 138, 128, .45); } }
@keyframes alarm-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .attack-alarm, .attack-alarm .alarm-icon, .badge.alarm { animation: none; } }

/* Startseite: Infos links, Anmeldung rechts (auf schmalen Bildschirmen Anmeldung oben) */
.landing { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; margin-top: 1rem; }
.landing .card.narrow { margin: 0; max-width: none; position: sticky; top: 1rem; }
.landing .intro p, .landing .intro li { line-height: 1.5; }
.landing .intro ul { padding-left: 1.2rem; margin: .3rem 0 .8rem; }
.landing .status { background: #3a3220; border: 1px solid #7a6530; border-radius: 6px; padding: .8rem 1rem; margin-bottom: 1rem; }
.landing .status strong { color: var(--warn); }
.landing .stats { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 0; }
@media (max-width: 760px) {
  .landing { grid-template-columns: minmax(0, 1fr); }
  .landing .login { order: -1; }
  .landing .card.narrow { position: static; }
}

/* Impressum / Datenschutz */
.legal { max-width: 780px; margin: 0 auto 1rem; }
.legal p, .legal li { line-height: 1.55; }
.legal ul { padding-left: 1.2rem; }
.legal address { font-style: normal; line-height: 1.55; margin: .3rem 0 .8rem; }
.legal .missing { color: var(--warn); }
