* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f141b;
  --panel: #171e28;
  --border: #2a3542;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #2f81f7;
  --accent2: #f85149;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar button {
  background: #212b38;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.toolbar button:hover { background: #2a3848; }
.toolbar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.stage { flex: 1; display: flex; min-height: 0; }
.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  min-width: 0;
}
canvas {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
}

.hint {
  width: 250px;
  padding: 16px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  overflow-y: auto;
}
.hint h3 { color: var(--text); font-size: 13px; margin: 12px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.hint h3:first-child { margin-top: 0; }
.hint ul { list-style: none; }
.hint li { margin-bottom: 8px; line-height: 1.45; }
.hint b { color: var(--text); }

.legend .l {
  display: inline-block;
  width: 34px;
  height: 0;
  border-top: 3px solid var(--text);
  vertical-align: middle;
  margin-right: 8px;
  position: relative;
}
.legend .l.dashed { border-top-style: dashed; }
.legend .l.thick { border-top-width: 5px; border-top-color: var(--accent2); }
.legend .l.dots::after {
  content: "• • •";
  position: absolute;
  top: -12px; left: 4px;
  font-size: 9px;
  letter-spacing: 2px;
}
.legend .l.arc { border-top-color: transparent; }
.legend .l.arc::before {
  content: "";
  position: absolute;
  left: 0; top: -8px;
  width: 34px; height: 10px;
  border-top: 3px dashed var(--text);
  border-radius: 50%;
}
.legend .l.wavy { border-top-color: transparent; }
.legend .l.wavy::before {
  content: "∿∿∿";
  position: absolute;
  top: -14px; left: 0;
  font-size: 16px;
  letter-spacing: -2px;
  color: var(--text);
}
.legend .l.vmark::after {
  content: "v v v";
  position: absolute;
  top: -11px; left: 3px;
  font-size: 8px;
  letter-spacing: 3px;
}

/* ---- Печать: только канвас, ландшафт, белый фон ---- */
@page { size: landscape; margin: 10mm; }
@media print {
  html, body { background: #ffffff !important; }
  body * { visibility: hidden; }
  .canvas-wrap, .canvas-wrap * { visibility: visible; }
  .canvas-wrap {
    position: fixed;
    inset: 0;
    padding: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .canvas-wrap canvas {
    width: 100% !important;
    height: auto !important;
  }
}

/* ---- Модалка списка схем ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-box {
  width: 420px;
  max-width: 92vw;
  max-height: 70vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-head button {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer;
}
.modal-head button:hover { color: var(--text); }
.modal-body { overflow-y: auto; padding: 8px; }
.modal-body .muted { color: var(--muted); padding: 12px; text-align: center; }

.drill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.drill-item:hover { background: #212b38; }
.drill-item .info { flex: 1; min-width: 0; }
.drill-item .name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drill-item .meta { font-size: 12px; color: var(--muted); }
.drill-item .del {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}
.drill-item .del:hover { color: #fff; background: var(--accent2); border-color: var(--accent2); }
