*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #1a1a1a;
  color: #e8eaed;
  font-family: 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

/* version badge */
.version {
  position: fixed; top: 6px; left: 8px; z-index: 100;
  font-size: 11px; color: #9aa0a6; pointer-events: none;
}

/* layout */
#app { display: flex; height: 100%; }

#sidebar {
  width: 320px; min-width: 320px;
  background: #202124;
  display: flex; flex-direction: column;
  border-right: 1px solid #3c4043;
  overflow: hidden;
}

#layer-panel { flex: 0 0 auto; max-height: 200px; overflow-y: auto; }
#controls { flex: 1; overflow-y: auto; padding: 0 0 12px; }

#canvas-area {
  flex: 1;
  background: #000;
  position: relative;
  overflow: hidden;
}

#canvas-container {
  position: absolute;
  inset: 0;
}

#canvas-container canvas {
  display: block;
  position: absolute;
}

/* collapse toggle - flex item between sidebar and canvas area */
#collapse-btn {
  flex: 0 0 auto;
  width: 20px; height: 28px;
  margin-top: 8px;
  background: #292a2d; border: 1px solid #3c4043; border-radius: 0 4px 4px 0;
  color: #9aa0a6; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  align-self: flex-start;
  border-left: none;
  transition: transform 0.2s;
}
#collapse-btn:hover { color: #e8eaed; background: #3c4043; }
#sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; border-right: none; }
#sidebar.collapsed + #collapse-btn { transform: scaleX(-1); }

/* control sections */
.ctrl-section {
  border-top: 1px solid #3c4043;
  padding: 10px 12px;
}
.ctrl-section:first-child { border-top: none; }
.ctrl-section h3 {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  color: #9aa0a6; letter-spacing: 0.5px; margin-bottom: 8px;
}

/* form rows */
.ctrl-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.ctrl-row label {
  font-size: 12px; color: #9aa0a6;
  min-width: 60px; text-align: right;
}
.ctrl-row input[type="number"],
.ctrl-row input[type="text"],
.ctrl-row select {
  flex: 1;
  background: #292a2d; border: 1px solid #3c4043; border-radius: 4px;
  color: #e8eaed; padding: 4px 6px; font-size: 12px;
  font-family: inherit;
}
.ctrl-row input:focus, .ctrl-row select:focus {
  outline: none; border-color: #8ab4f8;
}

/* param rows with lock */
.param-row {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 5px;
}
.param-row label {
  font-size: 11px; color: #9aa0a6;
  min-width: 70px; text-align: right;
}
.param-row input[type="number"] {
  width: 80px;
  background: #292a2d; border: 1px solid #3c4043; border-radius: 4px;
  color: #e8eaed; padding: 3px 5px; font-size: 12px;
  font-family: 'Consolas', monospace;
}
.param-row input[type="number"]:focus {
  outline: none; border-color: #8ab4f8;
}
.param-row .lock-btn {
  width: 22px; height: 22px;
  background: none; border: 1px solid #3c4043; border-radius: 3px;
  color: #9aa0a6; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.param-row .lock-btn:hover { border-color: #8ab4f8; color: #8ab4f8; }
.param-row .lock-btn.locked { color: #f9ab00; border-color: #f9ab00; }
.param-row .solved-val {
  font-size: 11px; color: #8ab4f8; min-width: 60px;
  font-family: 'Consolas', monospace;
}

/* tie-point list */
.tie-table {
  width: 100%; font-size: 11px; border-collapse: collapse;
}
.tie-table th {
  text-align: left; color: #9aa0a6; font-weight: 500;
  padding: 3px 4px; border-bottom: 1px solid #3c4043;
}
.tie-table td { padding: 3px 4px; }
.tie-table tr:hover { background: #2d2e31; }

/* results */
.result-value {
  font-family: 'Consolas', monospace;
  color: #8ab4f8; font-size: 13px;
}

/* tooltip */
.star-tooltip {
  position: absolute; z-index: 200;
  background: #292a2d; border: 1px solid #3c4043; border-radius: 6px;
  padding: 6px 10px; font-size: 12px;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: none;
}
.star-tooltip .tt-name { color: #e8eaed; font-weight: 500; }
.star-tooltip .tt-info { color: #9aa0a6; font-size: 11px; }

/* frame slider */
input[type="range"] {
  width: 100%; height: 3px;
  accent-color: #8ab4f8;
}

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3c4043; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #5f6368; }
