/* Overall wrapper */
#cube-trainer {
  max-width: 840px;
  margin: 1.5rem auto;
  padding: 1.2rem;
  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;
}

/* Fullscreen overlay behaviour */
body.cube-fullscreen-open {
  overflow: hidden;
}

#cube-trainer.cube-fullscreen {
  position: fixed;
  inset: 0;
  margin: 0;
  max-width: none;
  max-height: none;
  height: 100vh;
  border-radius: 0;
  z-index: 9999;
  background: #111;
  overflow-y: auto;
  padding: 1rem 1rem 1.5rem;
}

/* In fullscreen, give the cube even more height */
#cube-trainer.cube-fullscreen #cube3d-container {
  height: 420px;
}

@media (max-width: 600px) {
  #cube-trainer.cube-fullscreen #cube3d-container {
    height: 340px;
  }
}

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

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

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

/* 3D cube area */
.cube-3d-wrapper {
  display: block;
  margin-bottom: 0.6rem;
}

#cube3d-container {
  width: 100%;
  height: 300px;
  border-radius: 16px;
  background: radial-gradient(circle at top, #303030 0, #000000 60%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

#cube3d-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Step arrows inside canvas */
.cube-step-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(238, 238, 238, 0.95);
  color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.cube-step-arrow-left {
  left: 8px;
}

.cube-step-arrow-right {
  right: 8px;
}

.cube-step-arrow:hover {
  background: #e0e0e0;
}

/* Overlays in canvas */
.cube-overlay-top {
  position: absolute;
  top: 6px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: center;
}

.cube-overlay-bottom {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Move pills */
.cube-move-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.cube-move-pill {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: #607d8b;
  opacity: 0.82;
  user-select: none;
}

.cube-move-pill.active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  opacity: 1;
}

/* Pill colours by face */
.pill-face-R { background: #f44336; }
.pill-face-L { background: #ff9800; }
.pill-face-F { background: #4caf50; }
.pill-face-B { background: #2196f3; }
.pill-face-U { background: #cfd8dc; color: #000; }
.pill-face-D { background: #ffeb3b; color: #000; }

/* Bottom overlay rows */
.cube-overlay-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #f5f5f5;
}

.cube-current-move-inline span {
  font-weight: 700;
}

.cube-voice-toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.cube-voice-toggle-label input {
  transform: scale(0.9);
}

.cube-speech-transcript {
  font-size: 0.75rem;
  color: #f5f5f5;
  min-height: 1.1em;
  font-style: italic;
  text-align: center;
}

/* Controls under canvas */
.cube-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

/* Play/Stop buttons */
.cube-buttons {
  display: flex;
  gap: 0.5rem;
}

#cube-play,
#cube-stop {
  flex: 1;
  padding: 0.5rem 0.7rem;
  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;
}

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

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

.cube-progress-bar {
  flex: 1;
  height: 5px;
  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: 0.8rem 0.9rem;
  background: #fafafa;
  margin-bottom: 0.7rem;
}

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

.cube-step-description {
  margin: 0 0 0.6rem;
  color: #333;
  font-size: 0.9rem;
  line-height: 1.4;
}

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

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

.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.8rem;
  white-space: pre-line;
}

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

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

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

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

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

.cube-btn {
  flex: 1;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  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.3rem;
  font-size: 0.8rem;
  color: #777;
}

/* Visualiser header + fullscreen button */
.cube-visualiser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.cube-fullscreen-btn:hover {
  background: #1b272d;
}

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

  #cube3d-container {
    height: 280px;
  }

  .cube-section-title,
  .cube-tutorial-title {
    font-size: 1.25rem;
  }

  .cube-step-arrow {
    width: 34px;
    height: 34px;
  }

  .cube-step-description {
    font-size: 0.86rem;
  }

  .cube-step-notes {
    font-size: 0.82rem;
  }
}