html,
body {
  margin: 0;
  padding: 0;
}

canvas {
  display: block;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
:root {
  --primary-color: rgb(255, 0, 0);
}
#controls {
  position: fixed;
  top: 15px;
  right: 15px;
  background: #f9f9f9;
  color: #333;
  padding: 15px;
  border-radius: 10px;
  font-family: "Segoe UI", sans-serif;
  width: 230px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  border: 1px solid #ddd;
}

#controls p {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 500;
}

#controls label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #555;
}

#controls input {
  width: 100%;
  margin-top: 4px;
  padding: 5px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  color: rgb(55, 55, 55);
  box-sizing: border-box;
}

#controls input[type="range"] {
  height: 6px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

#controls button {
  margin-top: 15px;
  width: 100%;
  background: var(--primary-color);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

#controls button:hover {
  background: var(--primary-color);
}

#count {
  color: var(--primary-color);
  font-weight: bold;
}
#animation_speed_value {
  color: var(--primary-color);
}

.input-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 10px;
  gap: 10px;
}
.input-group button {
  border: none;
  margin: 0px !important;
  padding: 5px !important;
}
.input-group input {
  height: 100%;
  margin: 0px !important;
  padding: 5px !important;
}
#header {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: #f5f4f4;
  color: #121212;
  padding: 20px;
  border-radius: 10px;
  font-family: "Segoe UI", sans-serif;
  box-shadow: 0 2px 10px rgba(8, 8, 8, 0.655);
}

#header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary-color);
}
#header .sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: #555;
  font-weight: 400;
}
.audio-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
  font-size: 12px;
}

.audio-control span {
  font-weight: 500;
  flex: 1;
  color: #333;
}

.audio-control input[type="checkbox"] {
  flex: 1;
  accent-color: var(--primary-color);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Small heading and description below */
h5 {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #404040;
  text-align: left;
}

#algorithm-description {
  font-size: 13px;
  color: #555;
  background: #f4f4f4;
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid #ddd;
}

#toggle-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #444;
  transition: color 0.2s;
  z-index: 9999;
}

#toggle-btn:hover {
  color: #000;
}
/* Credits Styling */
.credits {
  margin-top: 10px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--primary-color);
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

/* Timer Widget Container */
#timer-container {
  position: fixed;
  top: 15px;
  left: 15px; /* Bumped to 15px to match the top spacing */
  background: #f3f3f3;
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--primary-color);
  z-index: 1000;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* The "Estimated Time to Solve" Text */
.timer-label {
  font-size: 0.85em;
  font-weight: bold;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #222222;
  margin-bottom: 5px;
}

/* The Numbers */
#timer-display {
  font-size: 48px;
  font-weight: 700;
  font-family: monospace;
  color: var(--primary-color);
  letter-spacing: 2px;
  line-height: 1; /* Keeps the box tight around the numbers */
}

/* Container */
#rules-box {
  position: fixed;
  top: 150px;
  left: 5px;
  background: #f0efef;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  border-left: 6px solid var(--primary-color);
  font-family: "Segoe UI", sans-serif;
  z-index: 1000;
  width: 320px;
}

/* Header (Title + Button) */
.rules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none; /* Prevents text highlighting when clicking rapidly */
}

#rules-box h3 {
  margin: 0;
  color: #121212;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Arrow Button */
.collapse-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  transition: transform 0.3s ease; /* Smooth rotation */
}

/* Rotates the arrow when the box is open */
.collapse-btn.open {
  transform: rotate(180deg);
}

/* The Rules List */
#rules-list {
  margin: 15px 0 0 0;
  padding-left: 20px;
  color: #444;
  font-size: 14px;
  line-height: 1.6;
}

#rules-box li {
  margin-bottom: 6px;
}

/* Utility Classes for Toggling */
.hidden {
  display: none;
}

.show {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* Soft fade-in effect for the text */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.formula-box {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(0, 120, 215, 0.05);
  border-radius: 6px;
  border: 1px dashed var(--primary-color);
  text-align: left;
}

.formula-label {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  display: block;
  text-transform: uppercase;
}

.formula-text {
  font-family: "Courier New", monospace;
  font-size: 18px;
  color: var(--primary-color);
  font-weight: bold;
}

.formula-sub {
  margin: 4px 0 0 0 !important;
  font-size: 12px !important;
  color: #666;
}

#move-result {
  color: var(--primary-color);
}
/* Styling for the Hide UI button inside the menu */
#hide-ui-btn {
  margin-top: 5px;
  margin-bottom: 15px;
  background: #666; /* Neutral color to distinguish from primary actions */
  font-size: 13px;
  padding: 6px 0;
}

#hide-ui-btn:hover {
  background: #444;
}

/* Class to fade out UI elements for the live stream */
.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.5s ease;
}
