/* Overall wrapper */
#cube-trainer {
  max-width: 760px;
  margin: 2rem auto;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Section headings */
.cube-section-title,
.cube-tutorial-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.cube-section-subtitle,
.cube-tutorial-subtitle {
  margin: 0 0 1rem;
  color: #666;
  font-size: 0.95rem;
}

/* Divider */
.cube-divider {
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid #eee;
}

/* Visualiser layout */
.cube-layout {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

#cube-net {
  display: grid;
  grid-template-columns: repeat(4, auto);
  grid-template-rows: repeat(3, auto);
  gap: 4px;
}

/* Each face is a 3x3 grid of stickers */
.cube-face {
  display: grid;
  grid-template-columns: repeat(3, 24px);
  grid-template-rows: repeat(3, 24px);
  gap: 2px;
}

/* Cube net positioning: T-shape */
.cube-face-U { grid-column: 2; grid-row: 1; }
.cube-face-L { grid-column: 1; grid-row: 2; }
.cube-face-F { grid-column: 2; grid-row: 2; }
.cube-face-R { grid-column: 3; grid-row: 2; }
.cube-face-B { grid-column: 4; grid-row: 2; }
.cube-face-D { grid-column: 2; grid-row: 3; }

/* Stickers */
.cube-sticker {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #555;
  box-sizing: border-box;
}

/* Base colours per face */
.cube-face-U .cube-sticker { background: #fffde7; }   /* white-ish */
.cube-face-D .cube-sticker { background: #fff9c4; }   /* yellow-ish */
.cube-face-F .cube-sticker { background: #c8e6c9; }   /* green-ish */
.cube-face-B .cube-sticker { background: #bbdefb; }   /* blue-ish */
.cube-face-L .cube-sticker { background: #ffe0b2; }   /* orange-ish */
.cube-face-R .cube-sticker { background: #ffcdd2; }   /* red-ish */

/* Highlight effect for current move */
.cube-face.highlight .cube-sticker {
  box-shadow: 0 0 8px 2px rgba(255, 193, 7, 0.9);
  border-color: #ff9800;
}

/* Visualiser controls */
.cube-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#alg-input {
  width: 100%;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.cube-buttons {
  display: flex;
  gap: 0.5rem;
}

#cube-play,
#cube-stop {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}

#cube-play { background: #1976d2; }
#cube-play:hover { background: #1565c0; }

#cube-stop { background: #d32f2f; }
#cube-stop:hover { background: #c62828; }

.cube-status {
  font-size: 0.9rem;
  color: #555;
}

/* Tutorial layout */
.cube-tutorial-header {
  text-align: left;
  margin-bottom: 1rem;
}

.cube-tutorial-progress {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.cube-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #f0f0f0;
  overflow: hidden;
}

.cube-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9800, #ff5722);
  transition: width 0.3s ease;
}

.cube-progress-label {
  white-space: nowrap;
  color: #444;
}

.cube-tutorial-card {
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  padding: 1rem 1.1rem;
  background: #fafafa;
  margin-bottom: 1rem;
}

.cube-step-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.cube-step-description {
  margin: 0 0 0.75rem;
  color: #333;
  font-size: 0.95rem;
  line-height: 1.5;
}

.cube-step-algorithm-container {
  margin: 0.8rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cube-step-alg-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.cube-step-algorithm {
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #272822;
  color: #f8f8f2;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  white-space: pre-line;
}

.cube-copy-btn {
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  background: #ff9800;
  color: #fff;
  font-weight: 600;
}

.cube-copy-btn:hover {
  background: #fb8c00;
}

.cube-copy-feedback {
  font-size: 0.8rem;
  color: #388e3c;
}

.cube-step-notes {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

.cube-tutorial-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.cube-btn {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: #1976d2;
  color: #fff;
  transition: background 0.2s ease, transform 0.05s ease;
}

.cube-btn:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  transform: none;
}

.cube-btn:hover:not(:disabled) {
  background: #1565c0;
}

.cube-tip {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #777;
}

/* Responsive */
@media (max-width: 600px) {
  #cube-trainer {
    margin: 1rem;
    padding: 1rem;
  }
}