body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background-color: #e0e0e0;
  max-width: 1400px;
  margin: 0 auto;
}

.main-section {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  justify-content: center;
  width: 100%;
}

.group-container {
  background-color: #fff;
  border-radius: 4px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 48%;
  box-sizing: border-box;
}

.group-container h3 {
  margin-top: 0;
  font-size: 1.1em;
}

label {
  margin-bottom: 4px;
  font-size: 13px;
  display: block;
}

.input-row {
  position: relative;
  margin-bottom: 10px;
}

.input-row input {
  width: calc(100% - 70px);
  padding: 4px;
  font-family: monospace;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-sizing: border-box;
}

.copy-btn,
.paste-btn {
  position: absolute;
  background-color: #007bff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  padding: 4px 8px;
}

.copy-btn {
  right: 34px;
}

.paste-btn {
  right: 0;
}

button {
  padding: 6px 12px;
  cursor: pointer;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  margin-bottom: 5px;
  font-size: 13px;
}

.dynamic-container {
  width: 100%;
  margin-top: 20px;
}

.seq-block {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  background-color: #f9f9f9;
  padding: 10px;
  border-radius: 4px;
}

.seq-subblock {
  flex: 1 1 45%;
  background-color: #fff;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.seq-subblock h4 {
  margin-top: 0;
  margin-bottom: 5px;
  font-size: 1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.seq-label-group {
  flex: 1;
  min-width: 0;
}

.seq-subblock-right h4 {
  flex-direction: row-reverse;
}

.seq-subblock textarea {
  width: 100%;
  height: 60px;
  font-family: monospace;
  font-size: 11px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.mini-copy-btn {
  padding: 0px 6px !important;
  font-size: 11px !important;
  background-color: #6c757d !important;
  margin: 0 !important;
  height: 18px;
  line-height: 18px;
  vertical-align: middle;
}

.mini-copy-btn:hover {
  background-color: #5a6268 !important;
}

.chartCanvas {
  margin: 5px 0;
  border: 1px solid #ccc;
  background-color: #fff;
  width: 100%;
  flex-basis: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.animation-player {
  background-color: #fff;
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}

.animation-player.sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 4px solid #0056b3;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  padding: 5px 15px;
}

.animation-player.sticky h3 {
  display: none;
}

.animation-player.sticky .controls {
  margin-bottom: 5px;
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

.lights-container {
  display: flex;
  flex-direction: row;
  gap: 40px;
  justify-content: center;
  width: fit-content;
  padding: 15px 20px;
  background-color: #111;
  border-radius: 10px;
  border: 1px solid #444;
  margin-top: 10px;
  flex-wrap: wrap;
}

.animation-player.sticky .lights-container {
  margin-top: 5px;
  padding: 5px 10px;
}

.light-group {
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: center;
  width: auto;
}

/* Right group needs to be reversed so lights are close to center and label is on far right */
.light-group.right-group {
  flex-direction: row-reverse;
}

.light-group h4 {
  color: #fff;
  min-width: 20px;
  margin: 0;
  font-weight: bold;
  font-size: 1.2em;
}

.lights-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

/* Right lights mirrored — row-reverse makes flex-end align to the left (center) */
#rightLights {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

#leftLights {
  justify-content: flex-end;
}

.light-bulb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #000;
  border: 2px solid #555;
  position: relative;
  flex-shrink: 0;
}

.light-bulb.focused {
  border: 2px solid #ff0000 !important;
  transform: scale(1.1);
  z-index: 10;
}

/* SVG elements focused state */
svg .focused,
svg .focused > * {
  stroke: #ff0000 !important;
  stroke-width: 4px !important;
}
svg .focused {
  filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.8)) !important;
}

.light-bulb::after {
  content: attr(data-index);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 10px;
  pointer-events: none;
  z-index: 2;
}

input[type=range] {
  flex-grow: 1;
  min-width: 200px;
}

/* Visual Editor Styles */
.editor-toggle {
  display: inline-flex;
  gap: 0;
  margin: 0;
  flex-shrink: 0;
}

.editor-toggle button {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 0;
  margin: 0;
  background-color: #ddd;
  color: #333;
  border: 1px solid #ccc;
}

.editor-toggle button:first-child {
  border-radius: 4px 0 0 4px;
}

.editor-toggle button:last-child {
  border-radius: 0 4px 4px 0;
}

.editor-toggle button.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.visual-editor {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.step-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

.step-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.step-label {
  font-weight: bold;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  margin-right: 2px;
}

.step-action-btn {
  padding: 1px 5px;
  font-size: 10px;
  line-height: 1;
  margin: 0;
  min-width: 20px;
  background-color: #6c757d;
}

.step-action-btn:hover:not(:disabled) {
  background-color: #5a6268;
}

.step-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.step-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.step-field label {
  font-size: 11px;
  color: #666;
  margin: 0;
  min-width: 55px;
}

.step-field input[type="range"] {
  flex: 1;
  min-width: 60px;
  height: 6px;
}

.step-field .value-display {
  font-size: 11px;
  font-family: monospace;
  margin-left: -2px;
}

.step-field input[type="number"] {
  width: 55px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: monospace;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: right;
}

.step-field input[type="number"]:focus {
  outline: none;
  border-color: #007bff;
}

.step-action-btn.step-remove {
  background-color: #dc3545;
}

.step-action-btn.step-remove:hover {
  background-color: #c82333;
}

/* Insert step row between steps */
.insert-row {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}

.insert-step-btn {
  background: transparent;
  border: 1px dashed #e0e0e0;
  color: #ccc;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 10px;
  line-height: 8px;
  font-size: 10px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
}

.insert-step-btn:hover {
  background-color: #e8f5e9;
  border-color: #28a745;
  color: #28a745;
}

/* Hex editor locked info line */
.hex-info-line {
  font-size: 11px;
  font-family: monospace;
  color: #666;
  padding: 4px 6px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin-bottom: 4px;
}

/* RAW data message in visual mode */
.raw-data-msg {
  color: #999;
  font-size: 12px;
  margin: 0;
}

.add-step-btn {
  width: 100%;
  margin-top: 8px;
  background-color: #28a745;
  font-size: 12px;
}

.add-step-btn:hover {
  background-color: #218838;
}

.overflow-error {
  color: #dc3545 !important;
  font-weight: bold;
}

textarea.overflow-error {
  border: 2px solid #dc3545 !important;
  background-color: #fff8f8 !important;
}

.byte-counter-info {
  font-size: 11px;
  font-weight: bold;
  color: #333;
  background: #eee;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 10px;
  border: 1px solid #ccc;
}

.phase-timing-bar {
  background: #f0e8e0;
  border: 1px solid #d4c4b0;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 15px;
  font-size: 12px;
  font-family: monospace;
  color: #5a3e28;
}

.summary-charts-section {
  border: 2px solid #d4c4b0;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 20px;
  background: #faf6f1;
}

.summary-charts-section h3 {
  color: #5a3e28;
  font-size: 14px;
}

.cap-warning {
  color: #c44;
  font-size: 11px;
  font-weight: normal;
  margin-left: 8px;
}

.selector-row {
  margin-bottom: 20px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.selector-label {
  display: inline-block;
  margin-right: 10px;
}

.action-buttons {
  text-align: center;
  margin-bottom: 20px;
}

.speed-label {
  margin-left: 10px;
}

.side-label-left {
  color: #0000ff;
}

.side-label-right {
  color: #ff0000;
}

.hex-editor {
  width: 100%;
  height: 60px;
  font-family: monospace;
  font-size: 11px;
}

.sticky-toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  cursor: pointer;
}

.summary-header {
  margin: 10px 0 5px;
}

/* Timeline Editor */
.timeline-wrapper {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
}

.timeline-editor {
  display: block;
  width: 100%;
  cursor: default;
  outline: none;
  background-color: #fff;
  border-radius: 3px;
}

.timeline-editor.tl-dragging {
  cursor: grabbing;
}

.tl-grid line {
  shape-rendering: crispEdges;
}

.tl-grid text {
  font-family: Arial, sans-serif;
  user-select: none;
}

.tl-fill polygon {
  pointer-events: none;
}

.tl-curve polyline {
  pointer-events: none;
}

.tl-handles circle.tl-handle {
  cursor: grab;
  transition: r 0.1s;
}

.tl-handles circle.tl-handle:hover {
  r: 8;
}

.tl-handles circle.tl-handle.selected {
  r: 9;
  stroke-width: 3;
}

.tl-handles circle.tl-origin {
  cursor: default;
}

.tl-inspector {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  margin-top: 6px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  flex-wrap: wrap;
}

.tl-inspector-label {
  font-weight: bold;
  color: #555;
}

.tl-inspector-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 12px;
  margin: 0;
}

.tl-inspector-input {
  width: 60px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: monospace;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: right;
}

.tl-inspector-input:focus {
  outline: none;
  border-color: #007bff;
}

.tl-inspector-delete {
  padding: 2px 10px;
  font-size: 11px;
  background-color: #dc3545;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  margin: 0 0 0 auto;
}

.tl-inspector-delete:hover:not(:disabled) {
  background-color: #c82333;
}

.tl-inspector-delete:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* SVG Chart (overlay L/R) */
.chart-wrapper {
  position: relative;
  flex-basis: 100%;
}

.chart-edit-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 10;
  align-items: center;
}

.chart-edit-toggle {
  padding: 2px 10px;
  font-size: 11px;
  background-color: rgba(108, 117, 125, 0.7);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  margin: 0;
}

.chart-edit-toggle:hover {
  background-color: rgba(90, 98, 104, 0.9);
}

.chart-edit-toggle.active {
  background-color: rgba(0, 123, 255, 0.85);
}

.chart-side-selector {
  display: inline-flex;
  gap: 0;
}

.chart-side-btn {
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 0;
  margin: 0;
  background-color: rgba(221, 221, 221, 0.8);
  color: #333;
  border: 1px solid #ccc;
  cursor: pointer;
}

.chart-side-btn:first-child {
  border-radius: 3px 0 0 3px;
}

.chart-side-btn:last-child {
  border-radius: 0 3px 3px 0;
}

.chart-side-btn.active {
  background-color: rgba(0, 123, 255, 0.85);
  color: #fff;
  border-color: rgba(0, 123, 255, 0.85);
}

.chart-svg {
  display: block;
  width: 100%;
  cursor: default;
  outline: none;
  background-color: #fff;
}

.chart-svg.tl-dragging {
  cursor: grabbing;
}

.summary-chart-svg {
  background-color: #faf6f1;
}

.chart-fill-area {
  pointer-events: none;
}

.chart-curve {
  pointer-events: none;
}

.chart-phase-line {
  pointer-events: none;
}

.chart-phase-label {
  user-select: none;
  pointer-events: none;
}

.chart-ref-line {
  pointer-events: none;
}

.chart-focused-step line,
.chart-focused-step circle,
.chart-focused-step text {
  pointer-events: none;
}

.chart-position line,
.chart-position polygon {
  pointer-events: none;
}

.chart-inspector {
  margin-top: 6px;
}

/* Keep staging fields available to the editor without displaying the input blocks. */
.main-section.staging-inputs { display: none; }
.project-credits { margin-top: 24px; font-size: 12px; text-align: center; color: #444444; }

/* The public page presents template selection and playback only. */
#dynamicContainer { display: none; }

.brand-logo { display: block; margin: 12px 0 0; }
.brand-logo img { display: block; width: 200px; height: auto; max-width: 100%; }
