/* WARDOGS COMPASS — 深色指挥台主题，无外部依赖（离线可用） */
:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #18202b;
  --line: #24303e;
  --text: #dbe6f2;
  --muted: #7f8fa3;
  --accent: #4ea3ff;
  --accent-2: #33d17a;
  --warn: #ffb020;
  --bad: #ff5a5a;
}
* { box-sizing: border-box; }
/* hidden 属性必须永远生效：`.modal { display: flex }` 这类作者样式会盖掉
   UA 的 [hidden] { display: none }，导致弹窗关不掉（教程走不到「完成」）。 */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif; font-size: 14px; }
#app { display: flex; flex-direction: column; height: 100%; }
.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { letter-spacing: .5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad);
  box-shadow: 0 0 8px currentColor; }
.dot.on { background: var(--accent-2); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

select, button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; font-family: inherit; cursor: pointer; }
select:hover, button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #06131f; font-weight: 700; }
button.ghost { background: transparent; }
/* 浅色按钮：放车体 / 放目标 / 记录落点 / 清除点位 —— 比默认按钮更浅，降低视觉重量 */
button.soft, .tool.soft { background: rgba(78, 163, 255, .12); border-color: rgba(78, 163, 255, .32);
  color: #a8c8ea; font-weight: 500; }
button.soft:hover, .tool.soft:hover { background: rgba(78, 163, 255, .22); border-color: var(--accent);
  color: var(--text); }
button.tiny { padding: 2px 8px; font-size: 12px; margin-left: 8px; }
button.on { background: var(--accent-2); border-color: var(--accent-2); color: #04140b; font-weight: 700; }
button.wide { width: 100%; margin-bottom: 8px; }

/* 高度热力图图例 */
.legend { margin: 4px 0 2px; }
.legend-bar { height: 10px; border-radius: 5px; border: 1px solid var(--line);
  background: linear-gradient(90deg, #1a26ff, #00c8ff, #00e070, #ffe000, #ff2000); }
.legend-labels { display: flex; justify-content: space-between; font-size: 11px;
  color: var(--muted); font-family: Consolas, monospace; margin-top: 2px; }

/* 主区 */
main { flex: 1; display: flex; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-width: 0; background: #05080c; }
#map { display: block; width: 100%; height: 100%; cursor: crosshair;
  touch-action: none; }

.map-hud { position: absolute; left: 10px; top: 10px; display: flex; gap: 8px; pointer-events: none; }
.chip { background: rgba(10, 16, 24, .82); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; }
.map-tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; }
.tool.active { background: var(--accent); border-color: var(--accent); color: #06131f; font-weight: 700; }

/* 侧栏 */
.sidebar { width: 340px; flex-shrink: 0; overflow-y: auto; padding: 10px;
  background: var(--panel); border-left: 1px solid var(--line); }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px; }
.kv { display: flex; justify-content: space-between; align-items: baseline;
  padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.05); }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); font-size: 12px; }
.kv b { font-weight: 600; }
.kv.big b { font-size: 18px; color: var(--accent); }
.row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.row input { accent-color: var(--accent); }
.btn-row { display: flex; gap: 8px; margin-bottom: 8px; }
.btn-row button { flex: 1; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.list { max-height: 160px; overflow-y: auto; }
.list .item { padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.05);
  display: flex; justify-content: space-between; gap: 8px; }
.list .item:last-child { border-bottom: none; }
.list .item button { padding: 0 6px; font-size: 11px; }
.ok { color: var(--accent-2); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

/* 坐标输入行 */
.coord-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.coord-label { width: 34px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
input.coord { flex: 1; min-width: 0; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
input.coord:focus { outline: none; border-color: var(--accent); }
input.coord::-webkit-outer-spin-button, input.coord::-webkit-inner-spin-button { opacity: .35; }
.coord-row button.tiny { margin-left: 0; }

/* 量距提示 chip 与浮动提示 */
.chip.ruler { color: var(--warn); }
.chip.flash { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50; }
.chip.flash.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 底部实时日志（默认收起，点标题展开） */
.feed { flex-shrink: 0; background: var(--panel); border-top: 1px solid var(--line); }
.feed-head { display: flex; align-items: center; gap: 10px; padding: 4px 12px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
  cursor: pointer; user-select: none; }
.feed-head:hover { color: var(--text); }
.feed-head span:first-child { flex-shrink: 0; }
.feed-head span:last-child { cursor: pointer; }
.feed-head span:last-child:hover { color: var(--text); }
.feed-latest { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-transform: none; letter-spacing: 0; text-align: left;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.feed-latest.ok { color: var(--accent-2); }
.feed-latest.warn { color: var(--warn); }
.feed-latest.bad { color: var(--bad); }
.feed.collapsed .feed-list { display: none; }
.feed-list { max-height: 132px; overflow-y: auto; padding: 2px 12px 8px; }
.feed-item { display: flex; gap: 8px; font-size: 12px; line-height: 1.5;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.feed-item .t { color: var(--muted); flex-shrink: 0; }
.feed-item.ok { color: var(--accent-2); }
.feed-item.warn { color: var(--warn); }
.feed-item.bad { color: var(--bad); }
.feed-item.info { color: var(--text); }

/* 右下角署名 */
.credit { position: absolute; right: 10px; bottom: 10px; font-size: 11px;
  color: var(--muted); background: rgba(8, 13, 20, .72); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 8px; }
.credit a { color: var(--accent); text-decoration: none; }
.credit a:hover { text-decoration: underline; }

/* 教程 / 功能说明弹窗 */
.modal { position: fixed; inset: 0; background: rgba(3, 6, 10, .72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { width: 620px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 14px; }
.modal-body { padding: 14px 16px; overflow-y: auto; font-size: 13px; line-height: 1.7; }
.modal-body p { margin: 0 0 8px; }
.modal-body ul { margin: 4px 0 8px; padding-left: 20px; }
.modal-body li { margin: 2px 0; }
.modal-body b { color: var(--accent-2); }
.modal-body .muted { color: var(--muted); font-size: 12px; }
.modal-foot { display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.modal-foot button { min-width: 76px; }
.modal-foot button:disabled { opacity: .45; cursor: default; }

/* 手机竖屏提示弹窗 */
.rotate-box { width: 320px; text-align: center; padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rotate-icon { font-size: 42px; }
.rotate-box p { margin: 0; }

/* 手机 / 窄屏：横屏时地图在左、参数在右；竖屏提示横屏使用 */
@media (max-width: 920px) {
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .topbar-right { flex-wrap: wrap; gap: 6px; }
  .topbar button, .topbar select { padding: 5px 8px; font-size: 12px; }
  .brand #conn-text { display: none; }
  .map-hud { max-width: calc(100% - 20px); flex-wrap: wrap; }
  #cursor-pos { display: none; }
}
@media (max-width: 920px) and (orientation: landscape) {
  main { flex-direction: row; }
  .sidebar { width: 288px; padding: 6px; }
  .card { padding: 8px 10px; margin-bottom: 8px; }
  .map-wrap { min-height: 0; }
  .map-tools { bottom: 8px; left: 8px; }
}
@media (max-width: 920px) and (orientation: portrait) {
  main { flex-direction: column; }
  .sidebar { width: auto; max-height: 46%; border-left: none; border-top: 1px solid var(--line); }
  .map-wrap { min-height: 54%; }
}
