* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #111827; color: #f3f4f6;
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
header { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; }
#prog { font-weight: 600; font-size: 15px; }
.hbtns { display: flex; gap: 6px; }
#info { font-size: 13px; color: #9ca3af; padding: 0 10px 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
main { position: relative; flex: 1; min-height: 0; background: #f8fafc; touch-action: none; }
svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none;
  -webkit-user-select: none; }
.fab { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 20px;
  border: 0; background: rgba(17,24,39,.75); color: #fff; font-size: 20px; }
#modeHint { position: absolute; left: 10px; top: 12px; font-size: 13px; color: #111827;
  background: rgba(255,255,255,.85); border-radius: 8px; padding: 3px 8px; pointer-events: none; }
#modeHint:empty { display: none; }
.panel { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: #1f2937;
  display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }
.q { font-weight: 600; text-align: center; }
button { font: inherit; color: inherit; cursor: pointer; }
.big { border: 0; border-radius: 12px; padding: 14px; font-size: 18px; font-weight: 600; color: #fff; }
.big.ok { background: #15803d; } .big.fix { background: #b45309; } .big.bad { background: #b91c1c; }
.big:active, .mid:active, .tool:active { filter: brightness(1.25); }
.link { background: none; border: 0; color: #9ca3af; font-size: 14px; padding: 4px; }
.ghost { background: #374151; border: 0; border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.tools { display: flex; gap: 6px; }
.tool { flex: 1; border: 2px solid #374151; background: #111827; border-radius: 10px;
  padding: 10px 4px; font-size: 15px; }
.tool.on { border-color: #60a5fa; background: #1e3a8a; }
.tool.rec { border-color: #ef4444; background: #7f1d1d; }
.hint { font-size: 13px; color: #d1d5db; text-align: center; min-height: 18px; }
.row { display: flex; gap: 8px; }
.mid { flex: 1; border: 0; border-radius: 10px; padding: 12px; background: #374151; font-size: 16px; }
.mid.primary { background: #2563eb; font-weight: 600; }
.mid.danger { background: #7f1d1d; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #1f2937; border-radius: 16px 16px 0 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.sheetHead { font-weight: 600; } .sheetHead small { color: #9ca3af; font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid #4b5563; background: #111827; border-radius: 18px; padding: 8px 11px; font-size: 15px; }
.chip.on { border-color: #f59e0b; background: #78350f; }
#note { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #4b5563; background: #111827;
  color: #fff; font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); background: #111827;
  border: 1px solid #4b5563; border-radius: 10px; padding: 8px 14px; z-index: 30; font-size: 15px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex;
  align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px 12px; }
.card { background: #1f2937; border-radius: 14px; padding: 16px; max-width: 520px; width: 100%; }
.card h2 { margin: 0 0 8px; } .card h3 { margin: 14px 0 6px; font-size: 16px; }
.card ol { padding-left: 20px; } .card li { margin-bottom: 6px; }
.legend { list-style: none; padding: 0; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 26px; height: 14px; border-radius: 3px; flex: none; }
.sw.entry { background: #16a34a; border-radius: 7px; width: 14px; }
.sw.cable { height: 3px; background: #dc2626; } .sw.tour { height: 3px; background: #ea580c; }
.sw.zone { background: #fde68a; border: 1px solid #d97706; }
.sw.obst { background: repeating-linear-gradient(45deg,#fff 0 3px,#e11d48 3px 4px); border: 1px solid #e11d48; }
.sw.cold { background: rgba(239,68,68,.45); }
.sw.end { background: #dc2626; width: 12px; height: 12px; border: 1px solid #000; border-radius: 0; }
.sw.kink { width: 14px; height: 14px; border: 2px solid #b91c1c; border-radius: 7px; }
