
:root {
  --bg0: #061018;
  --bg1: #0a1b27;
  --panel: rgba(9, 24, 36, 0.94);
  --panel-2: rgba(11, 34, 48, 0.92);
  --line: rgba(110, 236, 255, 0.28);
  --line-strong: rgba(110, 236, 255, 0.62);
  --txt: #d8f7ff;
  --muted: #82a6b5;
  --cyan: #31e6ff;
  --cyan-soft: #8ff7ff;
  --warn: #ffbf3d;
  --bad: #ff6e5e;
  --ok: #75ffa8;
  --shadow: rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 0%, #113348 0%, var(--bg0) 55%); color: var(--txt); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { display: grid; grid-template-rows: 58px 1fr; }
header { display: flex; align-items: center; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(3, 16, 25, .96), rgba(9, 33, 47, .88)); box-shadow: 0 8px 28px var(--shadow); }
header h1 { margin: 0; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: #f3fdff; text-shadow: 0 0 14px rgba(49, 230, 255, .25); }
header .subtitle { color: var(--muted); font-size: 13px; }
#app { display: grid; grid-template-columns: 310px minmax(480px, 1fr) 340px; min-height: 0; }
aside, .rightbar { min-height: 0; overflow: hidden; background: var(--panel); border-right: 1px solid var(--line); }
.rightbar { border-right: none; border-left: 1px solid var(--line); }
.sidebar-inner, .right-inner { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.panel-section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-section h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan-soft); margin: 0 0 10px; }
.search { width: 100%; border: 1px solid var(--line); background: rgba(2, 12, 18, .78); color: var(--txt); border-radius: 8px; padding: 9px 10px; outline: none; }
.search:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(49,230,255,.16); }
.region-list { overflow: auto; min-height: 0; flex: 1; padding: 8px; }
.region-row { display: grid; grid-template-columns: 20px 12px 1fr; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 9px; border: 1px solid transparent; }
.region-row:hover { background: rgba(71, 224, 255, .07); border-color: rgba(71, 224, 255, .22); }
.region-row.selected { background: rgba(49, 230, 255, .14); border-color: rgba(49, 230, 255, .45); }
.swatch { width: 10px; height: 28px; border-radius: 8px; box-shadow: 0 0 12px rgba(49, 230, 255, .22); }
.region-label { text-align: left; display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto; gap: 0 6px; border: 0; background: transparent; color: var(--txt); cursor: pointer; padding: 2px 0; min-width: 0; }
.region-label strong { grid-row: 1 / span 2; color: #fff; font-variant-numeric: tabular-nums; }
.region-label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.region-label small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: #020b11; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; background: rgba(4, 15, 24, .92); border-bottom: 1px solid var(--line); align-items: center; }
.tool-group { display: flex; gap: 6px; align-items: center; padding-right: 6px; border-right: 1px solid var(--line); }
button, .file-button { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(34, 80, 100, .92), rgba(8, 30, 43, .92)); color: var(--txt); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-weight: 650; font-size: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
button:hover, .file-button:hover { border-color: var(--cyan); color: white; box-shadow: 0 0 16px rgba(49, 230, 255, .15); }
button.active { border-color: var(--cyan); color: #ffffff; background: linear-gradient(180deg, rgba(31, 155, 190, .95), rgba(10, 70, 96, .94)); box-shadow: 0 0 18px rgba(49, 230, 255, .22); }
button:disabled { opacity: .45; cursor: default; }
button.danger { border-color: rgba(255, 110, 94, .46); }
button.export { border-color: rgba(117, 255, 168, .45); }
.file-button input { display: none; }
.canvas-wrap { min-height: 0; overflow: hidden; position: relative; background: radial-gradient(circle at center, #092538, #020b11 72%); }
#mapSvg { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#mapSvg.panning, #mapSvg.space-pan { cursor: grab; }
#mapSvg.panning:active { cursor: grabbing; }
.region-polygon { cursor: pointer; transition: fill-opacity .12s ease, stroke-opacity .12s ease; }
.region-polygon:hover { fill-opacity: .62; stroke-opacity: 1; }
.vertex-handle { cursor: move; filter: drop-shadow(0 0 4px rgba(49,230,255,.65)); }
.bottom-status { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; min-height: 38px; padding: 8px 12px; border-top: 1px solid var(--line); background: rgba(4, 15, 24, .94); font-size: 12px; }
.status { color: var(--muted); }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.status.info { color: var(--cyan-soft); }
.view-info { color: var(--muted); font-variant-numeric: tabular-nums; }
.info-box { border: 1px solid var(--line); background: rgba(2, 12, 18, .52); border-radius: 10px; padding: 10px; font-size: 13px; line-height: 1.45; }
.info-box code { color: var(--cyan-soft); }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.control-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.control-row input[type="range"] { width: 126px; accent-color: var(--cyan); }
.control-row input[type="checkbox"] { accent-color: var(--cyan); }
.control-row input[type="number"] { width: 66px; border: 1px solid var(--line); background: rgba(2, 12, 18, .7); color: var(--txt); border-radius: 7px; padding: 6px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.button-stack { display: grid; gap: 8px; }
.help { font-size: 12px; line-height: 1.45; color: var(--muted); }
.help kbd { display: inline-block; padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.05); color: #dff9ff; font-size: 11px; }
.scroll { overflow: auto; min-height: 0; }
hr.soft { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
@media (max-width: 1100px) {
  #app { grid-template-columns: 250px 1fr 280px; }
  header .subtitle { display: none; }
  button, .file-button { padding: 7px 8px; }
}
