/* Voyager — grimdark pixel UI. Muted rust, bone and soot, with sharp accents for danger and rarity. */
:root {
  --soot: #0c0b0a;
  --coal: #141210;
  --panel: #1a1714;
  --edge: #3a3028;
  --edge-hi: #5a4a3a;
  --bone: #d8c8a0;
  --ash: #8a8070;
  --rust: #b0592e;
  --gold: #d0a020;
  --blood: #a02a2a;
  --toxic: #7fbf3f;
  --void: #a35ad9;
  --font-head: 'Silkscreen', 'Courier New', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--soot); color: var(--bone); font-family: var(--font-body); font-size: 19px; line-height: 1.15; }
body { display: flex; flex-direction: column; overflow: hidden;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px); }
img.px, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
h2, h3, h4, .logo, .btn, #cycle, .nav-btn em, .card-kind, .tag { font-family: var(--font-head); font-weight: normal; letter-spacing: 1px; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--rust); text-transform: uppercase; }
h3 { font-size: 15px; margin: 0 0 4px; }
h4 { font-size: 12px; margin: 12px 0 6px; color: var(--ash); text-transform: uppercase; }
small, .small { font-size: 16px; }
.muted { color: var(--ash); }
.bad { color: #d05050; }
.flavor { color: #b8a888; font-style: italic; }

/* top bar */
#top { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--coal);
  border-bottom: 2px solid var(--edge); box-shadow: 0 2px 0 #000; flex-wrap: nowrap; }
.logo { font-size: 18px; color: var(--bone); text-shadow: 2px 2px 0 var(--blood); letter-spacing: 3px; }
#top-res { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 0; min-width: 0; }
#top .spacer { display: none; }
#top > .btn, #cycle, .logo, #btn-menu { flex-shrink: 0; }
.res { display: flex; align-items: baseline; gap: 3px; padding: 2px 5px; background: var(--soot); border: 1px solid var(--edge); }
.res .ico { font-size: 16px; }
.res b { font-size: 19px; font-weight: normal; }
.res small { color: #8aa070; font-size: 14px; }
.res small.neg { color: #d05050; }
.res-metal { color: #b8b8c4; } .res-rare { color: #60d0a8; } .res-organics { color: #9ac050; } .res-electronics { color: #d89a60; } .res-chemicals { color: #d8c860; }
.res-research { color: #80c8e0; } .res-shards { color: #c080f0; }
.res-power { color: #f0d060; } .res-infra { color: #d0a878; } .res-compute { color: #70c0c8; }
.res.cap { border-style: dashed; }
.res-sep { width: 1px; align-self: stretch; background: var(--edge); margin: 0 2px; }
.bar.cap-power i { background: repeating-linear-gradient(90deg, #c0a840 0 6px, #907c2c 6px 8px); }
.bar.cap-infra i { background: repeating-linear-gradient(90deg, #b08a58 0 6px, #86683e 6px 8px); }
.bar.cap-compute i { background: repeating-linear-gradient(90deg, #4a9aa0 0 6px, #3a7a80 6px 8px); }
.bar.over i { background: repeating-linear-gradient(90deg, #c04040 0 6px, #902828 6px 8px) !important; }
.res.over { border-color: var(--blood); background: #2a1010; }
.bar.infra i { background: repeating-linear-gradient(90deg, #b8a050 0 6px, #8a7838 6px 8px); }
.bar.infra.over i { background: repeating-linear-gradient(90deg, #c04040 0 6px, #902828 6px 8px); }
.spacer { flex: 1; }
#cycle { font-size: 13px; color: var(--ash); }

/* buttons */
.btn { background: #2a221c; color: var(--bone); border: 2px solid var(--edge-hi); padding: 5px 10px; font-size: 11px;
  cursor: pointer; box-shadow: inset -2px -2px 0 #120e0c, inset 2px 2px 0 #4a3e32; text-transform: uppercase; }
.btn:hover:not([disabled]) { background: #3a2e24; color: #fff; }
.btn:active:not([disabled]) { box-shadow: inset 2px 2px 0 #120e0c; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.gold { border-color: var(--gold); color: #f0d070; background: #2e2410; }
.btn.danger { border-color: var(--blood); color: #f08080; background: #2a1010; }
.btn.on { border-color: var(--bone); background: #4a3a28; }
.btn.small { font-size: 9px; padding: 3px 6px; }
.btn small { font-family: var(--font-body); font-size: 15px; text-transform: none; display: block; color: var(--ash); }
.icon-btn { background: none; border: none; color: var(--ash); font-size: 22px; cursor: pointer; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btnrow.col { flex-direction: column; }
.btnrow.big .btn { font-size: 13px; padding: 10px 16px; }

/* layout */
#body { flex: 1; display: flex; min-height: 0; }
#nav { width: 170px; background: var(--coal); border-right: 2px solid var(--edge); padding: 8px 6px; display: flex; flex-direction: column; gap: 3px; transition: width .15s; overflow: hidden; }
.nav-collapsed #nav { width: 48px; }
.nav-collapsed .nav-btn em { display: none; }
.nav-btn { display: flex; gap: 10px; align-items: center; background: none; border: 1px solid transparent; color: var(--ash); padding: 7px 8px; cursor: pointer; text-align: left; white-space: nowrap; }
.nav-btn span { width: 20px; text-align: center; font-size: 18px; }
.nav-btn em { font-style: normal; font-size: 11px; text-transform: uppercase; }
.nav-btn:hover { color: var(--bone); background: #1e1a16; }
.nav-btn.active { color: var(--bone); border-color: var(--edge-hi); background: #241e18; box-shadow: inset 3px 0 0 var(--rust); }
#center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#main { flex: 1; overflow: auto; padding: 12px; }
#ticker { height: 116px; overflow: hidden; border-top: 2px solid var(--edge); background: var(--coal); padding: 4px 12px; }
.log { padding: 1px 0; color: #a89a80; }
.log i { font-style: normal; color: #5a5048; margin-right: 6px; }
.log.good { color: #9ac070; } .log.bad { color: #e06060; } .log.story { color: #c8b890; font-style: italic; } .log.mythic { color: var(--gold); }

/* panels */
.panel { background: var(--panel); border: 2px solid var(--edge); box-shadow: inset 0 0 0 2px #0e0c0a, 4px 4px 0 #000; padding: 12px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.grid2 .panel { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.stats div { background: var(--soot); border: 1px solid var(--edge); padding: 6px 8px; }
.stats small { display: block; color: var(--ash); font-size: 15px; }
.stats b { font-size: 24px; font-weight: normal; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed #2a2420; }
.kv b { font-weight: normal; }
.row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.dot { width: 10px; height: 10px; display: inline-block; }
.report { border-left: 3px solid var(--edge-hi); padding: 4px 8px; margin-bottom: 6px; background: var(--soot); }
.report.good { border-color: #6a9040; } .report.bad { border-color: var(--blood); }
.bar { height: 14px; background: var(--soot); border: 1px solid var(--edge); margin: 6px 0; }
.bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, #4a9aa0 0 6px, #3a7a80 6px 8px); }
.lvl { color: var(--gold); font-size: 16px; }
.right { text-align: right; white-space: nowrap; }

/* map */
.mapwrap { display: flex; gap: 12px; height: 100%; min-height: 400px; }
.mapbox { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#mapcanvas { width: 100%; height: auto; max-height: calc(100vh - 230px); object-fit: contain; border: 2px solid var(--edge); box-shadow: 4px 4px 0 #000; cursor: crosshair; background: #070606; }
.maphint { color: var(--ash); padding: 6px 2px; font-size: 17px; }
.side { width: 320px; flex-shrink: 0; overflow: auto; }
.sys-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.fleet { border: 1px solid var(--edge); border-left-width: 3px; padding: 6px 8px; margin-bottom: 6px; background: var(--soot); }
.ships { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.ship { display: inline-flex; align-items: center; gap: 2px; }

/* lists */
.bld, .tech { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px; border: 1px solid #2a2420; margin-bottom: 6px; background: #141210; }
.bld.locked { opacity: .55; }
.tech.cur { border-color: #4a9aa0; box-shadow: inset 3px 0 0 #4a9aa0; }
.tech.done { opacity: .45; }
.shiprow { display: flex; gap: 10px; align-items: center; }
.colony .sys-head { border-bottom: 1px dashed var(--edge); padding-bottom: 8px; }

/* planets */
.star-line { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; }
.star-dot { width: 10px; height: 10px; display: inline-block; }
.planet-frame { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.planet-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border: 1px solid #2a2420; margin-bottom: 4px; background: #141210; }
.planet-row.settled { border-color: var(--edge-hi); }
.planet-row.sel { border-color: var(--bone); box-shadow: inset 3px 0 0 var(--bone); }
.maptabs { margin: 0 0 6px; flex-wrap: nowrap; }
.maptabs .btn { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planet-panel.unsettled { opacity: .75; }
.layers { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; margin-top: 10px; }
.layer { background: var(--soot); border: 1px solid var(--edge); padding: 8px; }
.layer h4 { margin-top: 0; display: flex; justify-content: space-between; }
.bld.new { opacity: .85; border-style: dashed; }
details summary { cursor: pointer; color: var(--ash); font-family: var(--font-head); font-size: 10px; text-transform: uppercase; padding: 6px 0; }
details summary:hover { color: var(--bone); }

/* gacha cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.card { background: var(--soot); border: 2px solid; padding: 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative; animation: reveal .35s steps(4); }
.card img { border: 1px solid var(--edge); }
.card b { font-size: 19px; font-weight: normal; }
.card small { color: var(--ash); font-size: 15px; }
.card-kind { font-size: 8px; text-transform: uppercase; }
.card.r-mythic { box-shadow: 0 0 0 2px #000, 0 0 14px #d0a02088; }
.card.r-rare { box-shadow: 0 0 0 2px #000, 0 0 8px #4a8ad055; }
.card.cursed { background: repeating-linear-gradient(45deg, #1a0c0c 0 4px, #0c0b0a 4px 8px); }
.tag { font-size: 8px; background: #2a221c; padding: 2px 4px; border: 1px solid var(--edge-hi); }
@keyframes reveal { from { transform: scale(.6); } to { transform: scale(1); } }

/* music */
.btn.icon { font-family: var(--font-body); font-size: 18px; padding: 1px 10px; text-transform: none; }
.btn.icon.off { opacity: .45; text-decoration: line-through; }
.slider { accent-color: var(--rust); width: 140px; vertical-align: middle; }
.tracks { margin: 6px 0 12px; }
.track { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid #2a2420; background: #141210; margin-bottom: 4px; }
.track.now { border-color: var(--edge-hi); box-shadow: inset 3px 0 0 var(--rust); }

/* version tag, bottom right */
#version { position: fixed; right: 8px; bottom: 6px; z-index: 5; font-family: var(--font-head); font-size: 10px; letter-spacing: 1px; color: #8a8070; background: rgba(12, 11, 10, .85); border: 1px solid var(--edge); padding: 2px 6px; pointer-events: none; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: none; align-items: center; justify-content: center; z-index: 10; }
#modal.show { display: flex; }
.modal-box { background: var(--panel); border: 2px solid var(--edge-hi); box-shadow: inset 0 0 0 2px #0e0c0a, 6px 6px 0 #000; padding: 18px; width: min(480px, 92vw); max-height: 90vh; overflow: auto; text-align: center; }
.modal-box .btnrow { justify-content: center; }
.modal-box .kv { text-align: left; }
.event-img { display: block; margin: 10px auto; border: 2px solid var(--edge); }
textarea { width: 100%; height: 70px; background: var(--soot); color: var(--bone); border: 1px solid var(--edge); font-family: var(--font-body); font-size: 15px; margin-top: 8px; }

@media (max-width: 820px) {
  .mapwrap { flex-direction: column; }
  .side { width: auto; }
  #nav { width: 48px; } .nav-btn em { display: none; }
}
