.animation-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .animation-layout {
    grid-template-columns: 1fr;
  }
}

.canvas-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.canvas-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

#squareCanvas {
  max-width: 100%;
  height: auto;
}

.info-display {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  width: 100%;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.info-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', monospace;
}

.graph-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.graph-section h3 {
  margin: 0;
  text-align: center;
}

.graph-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

#graphCanvas {
  max-width: 100%;
  height: auto;
}

.graph-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-edge {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.legend-edge[data-edge="AB"] {
  background: rgba(108, 117, 125, 0.2);
  color: #6c757d;
}

.legend-edge[data-edge="BC"] {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
}

.legend-edge[data-edge="CD"] {
  background: rgba(0, 123, 255, 0.2);
  color: #007bff;
}

.legend-edge[data-edge="DA"] {
  background: rgba(255, 193, 7, 0.2);
  color: #d39e00;
}

.controls-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.setting-item label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.number-input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
}

.number-input:focus {
  outline: none;
  border-color: var(--primary);
}

.time-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-small:hover {
  background: var(--border-color);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-weight: 500;
}

.slider-wrapper {
  position: relative;
}

.time-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.time-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button-group button {
  min-width: 100px;
}


.explanation-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.explanation-section h3 {
  margin: 0 0 1rem 0;
}

.explanation-content p {
  margin: 0 0 0.75rem 0;
  line-height: 1.6;
}

.explanation-content ul {
  margin: 0;
  padding-left: 1.5rem;
}

.explanation-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.explanation-content strong {
  color: var(--primary);
}
