/* A.R.T Explorer - Stylesheet
 * Algebraic Rational Trigonometry Polyhedra Visualization
 * Author: Andy Ross Thomson
 */

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  background: #1a1a1a;
  color: #e0e0e0;
}

#container {
  display: flex;
  height: 100vh;
}

#canvas-container {
  flex: 1;
  position: relative;
}

#controls-panel {
  width: 330px;
  background: #2a2a2a;
  padding: 15px;
  overflow-y: auto;
  border-left: 1px solid #444;
}

/* Panel header with info icon */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0;
}

.info-icon-btn {
  background: transparent;
  border: none;
  color: #7ab8ff;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 50%;
  flex-shrink: 0;
}

.info-icon-btn:hover {
  background: rgba(74, 158, 255, 0.1);
  color: #4a9eff;
  transform: scale(1.1);
}

.info-icon-btn:active {
  transform: scale(0.95);
}

.info-icon-btn svg {
  display: block;
}

h1 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #4a9eff;
  text-align: center;
}

.control-group {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #444;
}

.control-group:last-child {
  border-bottom: none;
}

.control-group h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #7ab8ff;
  font-weight: 600;
}

.control-item {
  margin-bottom: 8px;
}

.control-item label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #b0b0b0;
}

.control-item input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.control-item select {
  width: 100%;
  padding: 8px;
  background: #1a1a1a;
  border: 1px solid #555;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.control-item select:focus {
  outline: none;
  border-color: #4a9eff;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-container input[type="range"] {
  flex: 1;
  cursor: pointer;
}

.slider-value {
  min-width: 40px;
  text-align: right;
  font-size: 11px;
  color: #7ab8ff;
}

.info-text {
  font-size: 11px;
  color: #888;
  font-style: italic;
  margin-top: 8px;
}

button {
  width: 100%;
  padding: 10px;
  background: #4a9eff;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

button:hover {
  background: #357abd;
}

button:active {
  background: #2a5f94;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  color: #e0e0e0;
}

/* Collapsible geodesic controls */
.geodesic-toggle {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #7ab8ff;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.geodesic-toggle.collapsed {
  transform: rotate(-90deg);
}

.geodesic-options {
  margin-left: 20px;
  margin-top: 5px;
  max-height: 180px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.geodesic-options.collapsed {
  max-height: 0;
}

/* Node size selector */
.node-size-selector {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.node-size-btn {
  flex: 1;
  padding: 5px;
  background: #1a1a1a;
  border: 1px solid #555;
  color: #b0b0b0;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.node-size-btn:hover {
  border-color: #7ab8ff;
  color: #e0e0e0;
}

.node-size-btn.active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: white;
}

/* Plane toggle switches (iOS-style pill switches) */
.plane-toggle-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.plane-toggle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.plane-toggle-label {
  font-size: 10px;
  color: #b0b0b0;
  text-align: center;
  order: 2; /* Label below toggle */
}

.plane-toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: #555;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.plane-toggle-switch.active {
  background-color: #4a9eff;
}

.plane-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.plane-toggle-switch.active .plane-toggle-slider {
  transform: translateX(20px);
}

.stats {
  font-size: 11px;
  color: #999;
  margin-top: 8px;
  line-height: 1.5;
}

.coord-label {
  color: #7ab8ff;
  font-weight: 600;
}

/* Section Toggle (for h3 main sections) */
.section-toggle {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #7ab8ff;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  vertical-align: middle;
}

.section-toggle.collapsed {
  transform: rotate(-90deg);
}

.section-content {
  max-height: 2000px;
  overflow: hidden;
  transition:
    max-height 0.3s ease-out,
    opacity 0.3s ease-out;
  opacity: 1;
}

.section-content.collapsed {
  max-height: 0;
  opacity: 0;
}

h3 {
  cursor: pointer;
  user-select: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   ART GUMBALL CONTROLS
   ============================================ */

/* Gumball Tool Selector (Move/Scale/Rotate) */
.gumball-tool-selector {
  display: flex;
  gap: 5px;
}

.gumball-tool-btn {
  flex: 1;
  padding: 8px;
  font-size: 11px;
  background: #2a2a2a;
  color: #b0b0b0;
  border: 1px solid #444;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gumball-tool-btn:hover {
  background: #353535;
  border-color: #555;
}

.gumball-tool-btn.active {
  background: #4a9eff;
  color: white;
  border-color: #4a9eff;
}

/* Coordinate Input Fields */
.coordinate-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

/* Four-column layout for WXYZ (coordinates and rotation) */
.coordinate-inputs:has(#coordW),
.coordinate-inputs:has(#rotWDegrees),
.coordinate-inputs:has(#rotWSpread) {
  grid-template-columns: repeat(4, 1fr);
}

.coord-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 11px;
  background: #2a2a2a;
  color: #b0b0b0;
  border: 1px solid #444;
  border-radius: 3px;
  text-align: left;
  box-sizing: border-box;
}

.coord-input:focus {
  outline: none;
  border-color: #4a9eff;
  background: #353535;
}

.coord-input::placeholder {
  color: #666;
  font-weight: bold;
}

/* NOW Counter */
.now-counter {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: #b0b0b0;
}

.now-counter span {
  color: #00ff88;
  font-weight: bold;
}

/* ============================================
   CONSOLIDATED CSS CLASSES
   ============================================ */

/* Unified Toggle Button System */
.toggle-btn-group {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.toggle-btn {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid;
}

/* Variant: Standard (node-size, camera, file ops, print) */
.toggle-btn.variant-standard {
  background: #1a1a1a;
  border-color: #555;
  color: #b0b0b0;
  padding: 5px;
}

.toggle-btn.variant-standard:hover {
  border-color: #7ab8ff;
  color: #e0e0e0;
}

.toggle-btn.variant-standard.active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: white;
}

/* Variant: Tool mode (move/scale/rotate) */
.toggle-btn.variant-tool {
  padding: 8px;
  background: #2a2a2a;
  border-color: #444;
  color: #b0b0b0;
}

.toggle-btn.variant-tool:hover {
  background: #353535;
  border-color: #555;
}

.toggle-btn.variant-tool.active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: white;
}

/* Variant: Snap mode (free/xyz/wxyz) */
.toggle-btn.variant-snap {
  font-size: 12px;
  background: #222;
  border-color: #444;
  color: #888;
}

.toggle-btn.variant-snap:hover {
  background: #2a2a2a;
  border-color: #555;
}

.toggle-btn.variant-snap.active {
  background: #333;
  border-color: #00ff88;
  color: #00ff88;
}

/* Toggle variant (for generic toggles like Node Geometry) */
.toggle-btn.variant-toggle {
  background: #1a1a1a;
  border-color: #555;
  color: #b0b0b0;
}

.toggle-btn.variant-toggle:hover {
  border-color: #7ab8ff;
  color: #e0e0e0;
}

.toggle-btn.variant-toggle.active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: white;
}

/* Variant: Small (compact cutplane axis selectors) */
.toggle-btn.variant-small {
  background: #1a1a1a;
  border-color: #555;
  color: #b0b0b0;
  padding: 3px 6px;
  font-size: 10px;
  min-width: 28px;
}

.toggle-btn.variant-small:hover {
  border-color: #7ab8ff;
  color: #e0e0e0;
}

.toggle-btn.variant-small.active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: white;
}

/* Geodesic dropdown styling */
.toggle-btn.geodesic-dropdown {
  cursor: pointer;
}

.toggle-btn.geodesic-dropdown option {
  background: #1a1a1a;
  color: #e0e0e0;
  padding: 6px;
}

/* Label Variants */
.label-section {
  font-size: 12px;
  color: #b0b0b0;
  display: block;
  margin-bottom: 5px;
}

.label-subsection {
  font-size: 11px;
  color: #b0b0b0;
  display: block;
  margin-bottom: 3px;
}

.label-axis {
  font-size: 10px;
  font-weight: bold;
  text-align: center;
}

/* Axis-specific label colors */
.label-axis-x {
  color: #ff6666;
}
.label-axis-y {
  color: #66ff66;
}
.label-axis-z {
  color: #6666ff;
}
.label-axis-w {
  color: #ffff66;
}

/* Coordinate Input Axis Borders */
.coord-input.axis-x {
  border-left: 2px solid #ff6666;
}
.coord-input.axis-y {
  border-left: 2px solid #66ff66;
}
.coord-input.axis-z {
  border-left: 2px solid #6666ff;
}
.coord-input.axis-w {
  border-left: 2px solid #ffff66;
}

/* Nested Content Spacing */
.nested-content {
  margin-left: 20px;
  margin-top: 5px;
}

.nested-content-2 {
  margin-left: 40px;
  margin-top: 5px;
}

/* Spacing Utilities */
.spacing-top-small {
  margin-top: 5px;
}
.spacing-top-medium {
  margin-top: 8px;
}
.spacing-top-large {
  margin-top: 10px;
}

/* Button Grid Layouts */
.button-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 5px;
}

.button-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 5px;
}

/* Coordinate Input Containers */
.coord-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

/* Position the label inside the input field as a prefix */
.coord-container .label-axis {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: bold;
  pointer-events: none;
  z-index: 1;
}

/* Add left padding to inputs to make room for the prefix label */
.coord-input {
  padding-left: 24px !important;
  text-align: left;
}

/* Snap Toggle Container */
.snap-toggle-container {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Snap Description Text */
.snap-description {
  font-size: 10px;
  color: #666;
  margin-top: 5px;
  line-height: 1.4;
}

/* Gumball Action Button */
.gumball-action-btn {
  width: 100%;
  background: #00ff88;
  color: #1a1a1a;
  font-weight: bold;
  padding: 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.gumball-action-btn:hover {
  background: #00dd77;
}

.gumball-action-btn:active {
  background: #00bb66;
}
/* ========================================================================
   GEODESIC CONTROLS (CONSOLIDATED)
   ======================================================================== */

/* Geodesic control wrapper - consistent spacing */
.geodesic-control-wrapper {
  margin-left: 20px;
  margin-top: 8px;
}

/* Nested geodesic content */
.geodesic-nested {
  margin-left: 20px;
  margin-top: 5px;
}

/* Frequency input container */
.geodesic-frequency-container {
  margin-bottom: 0;
}

.geodesic-frequency-label {
  font-size: 11px;
  display: inline-block;
  margin-right: 5px;
}

.geodesic-frequency-input {
  width: 50px;
  margin-left: 5px;
  padding: 4px 6px;
  font-size: 11px;
  background: #1a1a1a;
  border: 1px solid #555;
  color: #e0e0e0;
  border-radius: 3px;
}

/* Projection options */
.geodesic-projection-container {
  margin-top: 8px;
}

.geodesic-projection-label {
  font-size: 11px;
  display: block;
  margin-bottom: 3px;
  color: #b0b0b0;
}

.geodesic-projection-option {
  font-size: 10px;
  display: block;
  margin-left: 5px;
  margin-bottom: 2px;
  color: #b0b0b0;
}

.geodesic-projection-option input[type="radio"] {
  margin-right: 6px;
}

/* ========================================================================
   MATRIX CONTROLS (CONSOLIDATED)
   ======================================================================== */

/* Matrix control wrapper */
.matrix-control-wrapper {
  margin-left: 20px;
  margin-top: 8px;
}

/* Matrix control item */
.matrix-control-item {
  margin-bottom: 8px;
}

/* Matrix size label */
.matrix-size-label {
  font-size: 11px;
  display: block;
  margin-bottom: 4px;
  color: #b0b0b0;
}

/* Matrix checkbox label - smaller font */
.matrix-checkbox-label {
  font-size: 11px;
  margin-left: 0;
}

/* Matrix info text */
.matrix-info-text {
  margin-left: 0;
  font-size: 10px;
  color: #888;
  font-style: italic;
  margin-top: 5px;
}

/* Matrix divider */
.matrix-divider {
  margin: 16px 0 12px 0;
  padding-top: 12px;
  border-top: 1px solid #333;
}

.matrix-divider-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

/* ========================================================================
   TEXT SIZE UTILITIES
   ======================================================================== */

.text-small {
  font-size: 10px;
}

.text-xsmall {
  font-size: 11px;
}

/* ========================================================================
   SPACING UTILITIES
   ======================================================================== */

.indent {
  margin-left: 20px;
}

.spacing-top-xs {
  margin-top: 5px;
}

.spacing-top-sm {
  margin-top: 8px;
}

/* ========================================================================
   INPUT UTILITIES
   ======================================================================== */

.input-narrow {
  width: 50px;
  margin-left: 5px;
}

/* ========================================================================
   BUTTON GROUP ITEMS
   ======================================================================== */

.btn-group-item {
  flex: 1;
  padding: 8px;
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-group-item:hover {
  background: var(--btn-hover-bg);
}

.btn-group-item.active {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-border);
}

.btn-group-item:first-child {
  border-radius: 5px 0 0 5px;
}

.btn-group-item:last-child {
  border-radius: 0 5px 5px 0;
}

.btn-group-item:not(:last-child) {
  border-right: none;
}

/* ========================================================================
   PASSWORD PROTECTION
   ======================================================================== */

#password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#password-modal {
  background: #2a2a2a;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
}

#password-modal h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 24px;
}

#password-modal p {
  color: #b0b0b0;
  margin-bottom: 30px;
  font-size: 14px;
}

#password-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #444;
  border-radius: 5px;
  background: #1a1a1a;
  color: #ffffff;
  margin-bottom: 20px;
  box-sizing: border-box;
}

#password-input:focus {
  outline: none;
  border-color: #4a9eff;
}

#password-submit {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  background: #4a9eff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

#password-submit:hover {
  background: #3a8eef;
}

#password-error {
  color: #ff4444;
  margin-top: 10px;
  font-size: 14px;
  display: none;
}

.hidden {
  display: none !important;
}

/* ========================================================================
   INFO MODAL
   ======================================================================== */

/* Modal overlay - semi-transparent to see app underneath */
#info-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* Below password modal (10000) */
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}

#info-modal-overlay.hidden {
  display: none;
}

/* Modal container - wider like math demos, semi-transparent */
#info-modal {
  background: rgba(42, 42, 42, 0.8);
  padding: 30px 40px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  max-width: 1200px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
  border: 1px solid rgba(74, 158, 255, 0.3);
}

#info-modal h2 {
  color: #ffffff;
  margin-bottom: 10px;
  font-size: 28px;
  text-align: center;
}

.modal-subtitle {
  color: #888;
  margin-bottom: 25px;
  font-size: 14px;
  text-align: center;
  font-style: italic;
}

/* Two-column grid layout */
.modal-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 25px;
}

.modal-column {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Section styling */
.modal-section {
  margin-bottom: 0;
}

.modal-section h3 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid #444;
  padding-bottom: 6px;
}

/* Shortcuts grid */
.shortcuts-grid {
  display: grid;
  gap: 4px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #333;
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-key {
  color: #4a9eff; /* Match app blue accent */
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: bold;
}

.shortcut-desc {
  color: #b0b0b0;
  font-size: 11px;
}

/* Educational content styling */
.modal-text {
  color: #b0b0b0;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.modal-text strong {
  color: #fff;
  font-weight: 600;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  color: #b0b0b0;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.feature-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #4a9eff; /* App blue accent */
  font-weight: bold;
}

.feature-list strong {
  color: #fff;
  font-weight: 600;
}

/* Credits list */
.credits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.credits-list li {
  color: #888;
  font-size: 11px;
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.credits-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #4a9eff;
  font-weight: bold;
}

/* Close button - reuses password submit styling */
.modal-close-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 20px;
}

.modal-close-btn:hover {
  background: linear-gradient(135deg, #357abd 0%, #2a5f8f 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

.modal-close-btn:active {
  transform: translateY(0);
}

/* ========================================================================
   DEMO MODALS
   ======================================================================== */

.demo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.demo-modal-content {
  background: #2a2a2a;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  max-width: 95%;
  max-height: 95%;
  width: 1400px;
  height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-modal-header {
  padding: 20px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.demo-modal-header h2 {
  color: #ffffff;
  font-size: 20px;
  margin: 0;
}

.close-modal {
  background: transparent;
  border: none;
  color: #b0b0b0;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #ffffff;
}

.demo-modal-body {
  flex: 1;
  padding: 8px;
  overflow: hidden;
}

.demo-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #fafafa;
  border-radius: 2px;
}

/* ========================================================================
   RT CROSS DEMO STYLES
   ======================================================================== */

.cross-panel {
  position: absolute;
  background: rgba(26, 0, 26, 0.95);
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #cc00cc;
  box-shadow: 0 2px 8px rgba(255, 0, 255, 0.3);
  color: #ffffff;
  font-family: "Courier New", monospace;
}

.cross-formula-panel {
  top: 50px;
  right: 10px;
  width: 280px;
  font-size: 14px;
}

.cross-identity-bar {
  bottom: 50px;
  left: 10px;
  right: 10px;
  padding: 6px 10px;
}

.cross-section-divider {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #440044;
}

.cross-section-title {
  color: #cc00cc;
  font-size: 12px;
  font-weight: bold;
}

.cross-section-content {
  font-size: 12px;
  line-height: 1.4;
  margin-top: 3px;
}

.cross-color-x {
  color: #ff6666;
}

.cross-color-y {
  color: #66ff66;
}

.cross-color-cross {
  color: #4a9eff;
  font-weight: bold;
}

.cross-color-spread {
  color: #ff6600;
  font-weight: bold;
}

.cross-color-success {
  color: #00ff88;
  font-weight: bold;
}

.cross-color-error {
  color: #ff4444;
  font-weight: bold;
}

.cross-text-muted {
  color: #888;
  font-size: 11px;
}

.cross-text-submuted {
  color: #666;
  font-size: 10px;
}

.cross-text-small {
  font-size: 10px;
  color: #aaa;
  line-height: 1.4;
}

.cross-highlight-box {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  font-size: 11px;
  line-height: 1.4;
  border-left: 2px solid #cc00cc;
}

.cross-principle-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #440044;
  font-size: 10px;
  color: #aaa;
  line-height: 1.4;
}

.cross-identity-bar-content {
  display: flex;
  height: 12px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 4px rgba(255, 0, 255, 0.3);
}

.cross-identity-segment {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cross-identity-label {
  font-size: 9px;
  color: white;
  font-weight: bold;
  font-family: "Courier New", monospace;
}

.cross-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  transition: color 0.2s;
  z-index: 10;
}

/* ========================================================================
   COLOR THEORY MODAL
   ======================================================================== */

/* Color theory modal overlay - semi-transparent to see scene underneath */
#color-theory-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

#color-theory-modal.hidden {
  display: none;
}

.color-theory-modal-content {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  max-width: 1200px;
  max-height: 85vh;
  width: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.color-theory-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.color-theory-modal-header {
  padding: 20px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #2a2a2a;
  z-index: 10;
}

.color-theory-modal-header h2 {
  color: #4a9eff;
  font-size: 20px;
  margin: 0;
}

.color-theory-modal-subtitle {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin-top: 4px;
  font-style: italic;
}

.color-theory-modal-body {
  padding: 20px;
}

/* Info box at top of modal */
.color-info-box {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 13px;
}

.color-info-box strong {
  color: #4a9eff;
}

/* Global controls section */
.color-global-controls {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.color-global-controls h3 {
  color: #7ab8ff;
  font-size: 16px;
  margin-bottom: 15px;
}

/* Color sections (Platonic, Dual, Archimedean) */
.color-section {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 15px;
}

.color-section h3 {
  color: #7ab8ff;
  font-size: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid #444;
  padding-bottom: 8px;
}

/* Multi-column grid for sections */
#color-theory-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 15px;
  align-items: start;
}

/* Compact color item (no large swatch, just picker + label) */
.color-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #222;
  border-radius: 4px;
  border: 1px solid #333;
  transition: border-color 0.2s;
}

.color-item:hover {
  border-color: #555;
}

/* Color picker button (clickable square) */
.color-picker-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 2px solid #555;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.2s,
    transform 0.1s;
}

.color-picker-btn:hover {
  border-color: #4a9eff;
  transform: scale(1.05);
}

.color-picker-btn input[type="color"] {
  position: absolute;
  width: 100%;
  height: 100%;
  border: none;
  cursor: pointer;
  opacity: 0;
}

/* Color info (label + hex) */
.color-item-info {
  flex: 1;
  min-width: 0;
}

.color-item-label {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 500;
  margin-bottom: 2px;
}

.color-item-hex {
  font-size: 11px;
  color: #888;
  font-family: "Monaco", "Courier New", monospace;
}

/* Hex input field */
.color-hex-input {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #444;
  color: #4a9eff;
  padding: 4px 6px;
  font-size: 11px;
  font-family: "Monaco", "Courier New", monospace;
  border-radius: 3px;
}

.color-hex-input:focus {
  outline: none;
  border-color: #4a9eff;
}

/* LEGACY STYLES (kept for backward compatibility if needed) */
.color-polyhedron-group {
  margin-bottom: 15px;
}

.color-polyhedron-name {
  font-size: 14px;
  color: #e0e0e0;
  margin-bottom: 8px;
  font-weight: 600;
}

.color-pair {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-swatch-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* HIDDEN: Large color swatches removed for compact design */
.color-swatch {
  display: none;
  transition: all 0.3s;
  cursor: pointer;
}

.color-swatch:hover {
  border-color: #7ab8ff;
  transform: scale(1.02);
}

/* Color label (type + hex value) */
.color-label {
  font-size: 11px;
  color: #b0b0b0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-label .type {
  font-weight: 600;
  color: #7ab8ff;
}

.color-label .value {
  font-family: "Courier New", monospace;
  color: #888;
  font-size: 10px;
}

/* Color input group (picker button + hex input) */
.color-input-group {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.color-input {
  flex: 1;
  padding: 4px 6px;
  background: #0a0a0a;
  border: 1px solid #555;
  color: #e0e0e0;
  border-radius: 3px;
  font-size: 11px;
  font-family: "Courier New", monospace;
}

.color-input:focus {
  outline: none;
  border-color: #4a9eff;
}

/* Color picker button (macOS native picker) */
.color-picker-btn {
  width: 40px;
  height: 28px;
  padding: 0;
  border: 2px solid #555;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
  background: #2a2a2a;
}

.color-picker-btn:hover {
  border-color: #7ab8ff;
}

.color-picker-btn input[type="color"] {
  position: absolute;
  top: -5px;
  left: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  border: none;
  cursor: pointer;
  opacity: 1;
}

/* Brightness comparison bars (OLD vs NEW) */
.brightness-comparison {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: #0a0a0a;
  border-radius: 4px;
}

.brightness-swatch {
  flex: 1;
  height: 60px;
  border-radius: 3px;
  border: 1px solid #444;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 5px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Export section */
.color-export-section {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.color-export-section h3 {
  color: #7ab8ff;
  margin-bottom: 15px;
  font-size: 16px;
}

.color-code-output {
  background: #0a0a0a;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 15px;
  margin-top: 15px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #00ff88;
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}
