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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

#connect-btn, #test-btn, #csv-btn {
  padding: 8px 20px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #533483;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

#connect-btn:hover, #test-btn:hover, #csv-btn:hover {
  background: #533483;
}

#connect-btn.connected {
  background: #1a5c2a;
  border-color: #2d8a4e;
}

#status {
  font-size: 12px;
  color: #888;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.lcd-panel {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: #1a1a2e;
  overflow-y: auto;
}

.lcd-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  width: 100%;
}

.lcd-frame {
  background: #3a3a3a;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  border: 2px solid #555;
  max-width: 620px;
  width: 100%;
}

.lcd-screen {
  background: #eeeae4;
  border-radius: 4px;
  padding: 8px 12px;
  border: 1px solid #d5d0c9;
}

#lcd {
  display: block;
  width: 100%;
  height: auto;
  max-width: 580px;
}

/* SVG segment styles */
.seg-off {
  fill: #ddd8d0;
  transition: fill 0.05s;
}

.seg-on {
  fill: #1a1a1a;
  transition: fill 0.05s;
}

.annunciator {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-weight: bold;
  transition: fill 0.05s;
}

.ann-off {
  fill: #ddd8d0;
}

.ann-on {
  fill: #1a1a1a;
}

/* Group annunciators (icons with paths/rects) use currentColor */
g.ann-off { color: #ddd8d0; }
g.ann-on { color: #1a1a1a; }

.dp-off {
  fill: #ddd8d0;
}

.dp-on {
  fill: #1a1a1a;
}

.chart-container {
  background: #16213e;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #0f3460;
}

#chart {
  display: block;
  width: 100%;
  height: 200px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.chart-controls button {
  width: 32px;
  height: 28px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #533483;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.chart-controls button:hover {
  background: #533483;
}

.chart-controls input[type="range"] {
  flex: 1;
  accent-color: #533483;
}

.chart-y-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: #888;
}

.chart-y-controls input[type="number"] {
  width: 70px;
  padding: 4px 6px;
  margin-left: 4px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #533483;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.chart-y-controls input[type="number"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chart-y-controls input[type="checkbox"] {
  accent-color: #533483;
}

.data-panel {
  flex: 1;
  padding: 24px;
  background: #16213e;
  border-left: 1px solid #0f3460;
  overflow-y: auto;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.data-panel h2 {
  font-size: 16px;
  color: #888;
}

.log-interval {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #888;
}

.log-interval input {
  width: 50px;
  padding: 4px 6px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #533483;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.log-container {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.log-entry {
  white-space: nowrap;
}

.log-time {
  color: #666;
  margin-right: 8px;
}

.log-value {
  color: #e0e0e0;
}

.log-mode {
  color: #888;
  margin-left: 4px;
}
