/* DS11 Starmap. Theme matches the comms panel: #333 / #516D7F / #EEC00D / #FFF. */
:root {
  --bg: #2b2b2b; --bar: #333333; --box: #516D7F; --accent: #EEC00D; --text: #ffffff;
  --muted: #b9c4cc; --line: rgba(255,255,255,.12); --bad: #ff8a7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { display: flex; flex-direction: column; height: 100%; }
a { color: var(--accent); }
button { font: inherit; color: var(--text); background: var(--box); border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { filter: brightness(1.15); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: #1d1d1d; border-color: var(--accent); font-weight: 600; }
button.link { background: none; border: 0; padding: 0 4px; color: var(--accent); text-decoration: underline; }
input { font: inherit; color: var(--text); background: #262626; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }

#topbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--bar);
  border-bottom: 1px solid var(--line); flex: none; }
#topbar .title { font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
#topbar .clock { color: var(--muted); font-variant-numeric: tabular-nums; }
#topbar .who { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#topbar .admin { color: var(--muted); }

#main { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; min-width: 0; background: #05070d; }
#map.targeting, #map.targeting .leaflet-interactive { cursor: crosshair; }
#panel { width: 340px; flex: none; overflow-y: auto; background: var(--bar); border-left: 1px solid var(--line); padding: 12px; }
#panel section { margin-bottom: 16px; }
#panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 8px 0; }
#panel h3 { font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.muted { color: var(--muted); }
.card { background: rgba(81,109,127,.35); border: 1px solid rgba(81,109,127,.9); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.card-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 18px; font-weight: 700; }
.card-title .reg { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: uppercase; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }
.card .desc { white-space: pre-wrap; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.manage { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.manage summary { cursor: pointer; color: var(--accent); }
.manage .field { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.manage .field label { width: 100%; color: var(--muted); font-size: 13px; }
.manage .field input { flex: 1; }
.manage ul.crew { list-style: none; margin: 0; padding: 0; width: 100%; }
.manage ul.crew li { display: flex; justify-content: space-between; padding: 2px 0; }

ul.ships { list-style: none; margin: 0; padding: 0; }
.ship-row { display: grid; grid-template-columns: 12px 1fr; gap: 0 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ship-row:hover { background: rgba(255,255,255,.06); }
.ship-row .swatch { width: 10px; height: 10px; border-radius: 2px; margin-top: 5px; grid-row: span 2; }
.ship-row .nm { font-weight: 600; }
.ship-row .meta { color: var(--muted); font-size: 13px; }
.ship-row.mine .nm { color: var(--accent); }
.eta { font-variant-numeric: tabular-nums; color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

#targetbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex; gap: 10px; align-items: center;
  background: var(--bar); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.5); }
#targetbar.hidden { display: none; }
#toast { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); z-index: 1001; background: var(--box); padding: 8px 14px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
#toast.bad { background: #7a2e27; }
#coords { position: fixed; left: 10px; bottom: 10px; z-index: 999; background: rgba(0,0,0,.6); padding: 2px 8px; border-radius: 4px;
  font: 12px ui-monospace, monospace; color: var(--muted); display: none; }
#coords.show { display: block; }

/* ---- map features ---- */
.leaflet-container { font: inherit; background: transparent; }
.loc-icon .dot { display: block; width: 10px; height: 10px; margin: 2px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.6), 0 0 10px currentColor; cursor: pointer; }
.loc-icon.kind-star .dot { width: 14px; height: 14px; margin: 0; }
.leaflet-tooltip.loc-label, .leaflet-tooltip.ship-label { background: rgba(10,14,20,.72); border: 0; box-shadow: none; color: var(--text); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.leaflet-tooltip.loc-label { font-weight: 600; color: #f5e6a8; }
.leaflet-tooltip.loc-label::before, .leaflet-tooltip.ship-label::before { display: none; }
.loc-label .badge { margin-left: 6px; background: var(--box); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.ship-label { font-size: 12px !important; color: var(--muted) !important; }
.ship-label.mine { color: var(--accent) !important; }
.ship-icon { background: none; border: 0; }
.ship-glyph { transform-origin: 50% 50%; filter: drop-shadow(0 0 3px rgba(0,0,0,.8)); cursor: pointer; }
.ship-glyph.sel { filter: drop-shadow(0 0 6px #EEC00D) drop-shadow(0 0 2px #fff); }
.ship-glyph svg { display: block; }

/* Zoomed out: hide small-place labels and other people's ship names. */
#map.z-far .loc-label.kind-moon, #map.z-far .loc-label.kind-outpost, #map.z-far .loc-label.kind-poi,
#map.z-far .ship-label:not(.mine) { display: none; }
#map:not(.z-near) .ship-label:not(.mine) { opacity: .0; }

/* Phone: panel becomes a bottom sheet. */
@media (max-width: 760px) {
  #main { flex-direction: column; }
  #panel { width: auto; height: 42%; border-left: 0; border-top: 1px solid var(--line); }
  #topbar { gap: 10px; padding: 8px 12px; font-size: 14px; }
  #topbar .clock { display: none; }
  #targetbar { bottom: calc(42% + 12px); flex-wrap: wrap; }
}

/* In-world display board: no controls, bigger type. */
body.board { font-size: 20px; }
body.board #panel { width: 400px; }
body.board .leaflet-tooltip.loc-label { font-size: 18px; }
body.board .ship-label { font-size: 15px !important; }
body.board #map .ship-label { opacity: 1 !important; }
body.board .ship-row { cursor: default; }

/* ---- ship profile pop-up ---- */
a.button { display: inline-block; text-decoration: none; color: var(--text); background: var(--box); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 6px 12px; }
a.button.primary { background: var(--accent); color: #1d1d1d; border-color: var(--accent); font-weight: 600; }
.card-thumb { width: 100%; max-height: 150px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; cursor: pointer; display: block; }
#profile { position: fixed; inset: 0; z-index: 1002; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
#profile.hidden { display: none; }
.profile-box { position: relative; width: 560px; max-width: 100%; max-height: calc(100% - 16px); overflow-y: auto; background: var(--bar);
  border: 1px solid var(--box); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.profile-box .close { position: absolute; top: 8px; right: 8px; z-index: 1; width: 36px; height: 36px; padding: 0; font-size: 22px; line-height: 1;
  background: rgba(0,0,0,.55); border-radius: 50%; }
.profile-img { display: block; background: #111; border-radius: 12px 12px 0 0; overflow: hidden; }
.profile-img img { display: block; width: 100%; max-height: 340px; object-fit: contain; background: #0b0d12; }
.profile-img.empty { height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
  background: repeating-linear-gradient(45deg, #2a2f36, #2a2f36 10px, #262a30 10px, #262a30 20px); }
.profile-body { padding: 16px 20px 20px; }
.profile-reg { font: 600 13px ui-monospace, monospace; letter-spacing: .08em; color: var(--accent); }
.profile-name { margin: 2px 0 10px; font-size: 26px; line-height: 1.2; }
.profile-body dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 14px; }
.profile-body dt { color: var(--muted); }
.profile-body dd { margin: 0; }
.profile-form { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.profile-form h2 { margin: 0 40px 0 0; font-size: 20px; }
.profile-form label { margin-top: 10px; color: var(--muted); font-size: 13px; }
.profile-form .hint { margin: 2px 0 0; font-size: 13px; }
.pf-image-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pf-image-row > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pf-preview { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; background: #222; }
.pf-preview.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
body.board .profile-name { font-size: 32px; }

/* ---- ship radio ---- */
.range-tip.leaflet-tooltip { background: none; border: 0; box-shadow: none; color: #8fdcff; font-size: 12px; opacity: .8 !important; padding: 0; }
.range-tip.leaflet-tooltip::before { display: none; }
#map.z-far .range-tip { font-size: 11px; }
#radio { position: fixed; left: 12px; bottom: 12px; z-index: 1001; width: 380px; max-width: calc(100% - 24px); height: 440px; max-height: calc(100% - 80px);
  display: flex; flex-direction: column; gap: 6px; background: var(--bar); border: 1px solid var(--box); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.55); }
#radio.hidden { display: none; }
#radio header { display: flex; justify-content: space-between; align-items: flex-start; }
#radio .r-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
#radio .r-ship { font-weight: 700; font-size: 17px; }
#radio .close { width: 32px; height: 32px; padding: 0; font-size: 20px; line-height: 1; border-radius: 50%; }
#radio .r-freq { display: flex; gap: 10px; align-items: baseline; font: 600 15px ui-monospace, monospace; color: #8fdcff; }
#radio .r-cs-line { font-size: 13px; color: var(--muted); }
#radio .r-tune { display: flex; gap: 6px; }
#radio .r-tune input { flex: 1; }
#radio .hidden { display: none !important; }
#radio .r-range { font-size: 13px; color: var(--muted); }
#radio .r-range.ok { color: #8fe0a0; }
#radio .r-range.bad { color: var(--bad); font-weight: 600; }
#radio .r-feed { flex: 1; min-height: 80px; overflow-y: auto; list-style: none; margin: 0; padding: 6px; background: #262626; border-radius: 6px; }
#radio .r-feed li { padding: 4px 6px; border-radius: 6px; margin-bottom: 4px; }
#radio .r-feed .meta { display: block; font-size: 12px; color: var(--muted); }
#radio .r-feed .meta b { color: var(--text); }
#radio .r-feed .ship .meta b { color: #8fdcff; }
#radio .r-feed .mine { background: rgba(81,109,127,.45); }
#radio .r-feed .staff .meta b { color: var(--accent); }
#radio .r-feed .sys { color: var(--muted); font-style: italic; text-align: center; font-size: 13px; }
#radio .r-send { display: flex; gap: 6px; }
#radio .r-send input { flex: 1; }
#radio input:disabled, #radio button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) {
  #radio { left: 8px; right: 8px; width: auto; top: 56px; bottom: auto; height: auto; max-height: 55%; }
}
