/* Rubik's Cube Helper — feature styles */

.rubiks-page {
  max-width: 960px;
  margin: 0 auto;
}

.rubiks-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.rubiks-back:hover,
.rubiks-back:focus-visible {
  color: var(--color-coral);
  outline: none;
}

.rubiks-header {
  text-align: center;
  margin-bottom: 2rem;
}

.rubiks-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--color-coral);
  margin-bottom: 0.75rem;
}

.rubiks-instructions {
  background: var(--color-sun);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  line-height: 1.55;
  box-shadow: var(--shadow-soft);
}

.rubiks-instructions strong {
  color: var(--color-text);
}

.rubiks-layout {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 900px) {
  .rubiks-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.rubiks-panel {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.rubiks-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* Color palette */
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.color-swatch {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-sm);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.color-swatch:hover,
.color-swatch:focus-visible {
  transform: scale(1.08);
  outline: none;
}

.color-swatch.is-selected {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px var(--color-sky);
}

.color-swatch-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  margin-top: 0.35rem;
  color: var(--color-text-muted);
}

.palette-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* View toggle */
.cube-view-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.view-toggle-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border: 3px solid var(--color-sky);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.view-toggle-btn:hover,
.view-toggle-btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
  color: var(--color-text);
}

.view-toggle-btn.is-active {
  background: var(--color-sky);
  color: white;
  box-shadow: 0 4px 0 var(--color-sky-dark);
}

.view-toggle-btn.is-active:hover,
.view-toggle-btn.is-active:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-sky-dark);
}

/* Cube viewport */
.cube-viewport {
  position: relative;
  margin-bottom: 0.75rem;
}

.cube-3d-container {
  width: 100%;
  max-width: 380px;
  height: min(380px, 55vw);
  min-height: 260px;
  margin: 0 auto;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f8f4ff 0%, #e8f8f6 50%, #fff9e6 100%);
  box-shadow: inset 0 0 0 3px rgba(78, 205, 196, 0.25), var(--shadow-soft);
  overflow: hidden;
  touch-action: none;
}

.cube-3d-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.cube-3d-container[hidden],
.cube-net[hidden] {
  display: none;
}

.cube-view-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.cube-view-hint strong {
  color: var(--color-text);
}

/* Cube net */
.cube-net {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  gap: 0.35rem;
  max-width: 340px;
  margin: 0 auto 1.25rem;
}

.cube-net-spacer {
  aspect-ratio: 1;
}

.cube-face {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  aspect-ratio: 1;
  padding: 4px;
  background: #dfe6e9;
  border-radius: 8px;
}

.cube-face-label {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.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; }

.sticker {
  aspect-ratio: 1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.sticker:hover,
.sticker:focus-visible {
  transform: scale(1.06);
  outline: 2px solid var(--color-sky);
  outline-offset: 1px;
}

.sticker.is-center {
  cursor: default;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.sticker.is-center:hover,
.sticker.is-center:focus-visible {
  transform: none;
}

/* Sticker colors */
.sticker--U { background: #ffffff; }
.sticker--D { background: #ffd500; }
.sticker--F { background: #009b48; }
.sticker--B { background: #0046ad; }
.sticker--L { background: #ff5800; }
.sticker--R { background: #b71234; }

.rubiks-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn-secondary {
  background: var(--color-sky);
  color: white;
  box-shadow: 0 4px 0 var(--color-sky-dark);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-sky-dark);
  outline: none;
}

.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--color-sky-dark);
}

.btn-secondary:disabled,
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Messages */
.rubiks-message {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.rubiks-message--error {
  background: #ffe0e0;
  color: #c0392b;
  border: 2px solid #ff6b6b;
}

.rubiks-message--success {
  background: #dcfce7;
  color: #15803d;
  border: 2px solid var(--color-green);
}

.rubiks-message--info {
  background: #e0f7fa;
  color: #00695c;
  border: 2px solid var(--color-sky);
}

.rubiks-message[hidden] {
  display: none;
}

/* Solver loading */
.solver-status {
  text-align: center;
  padding: 1rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.solver-status .spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--color-sky);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Move legend */
.move-legend {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed #eee;
}

.move-legend h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.move-legend dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.move-legend dt {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-purple);
}

.move-legend dd {
  color: var(--color-text-muted);
  margin: 0;
}

/* Solution steps */
.solution-panel[hidden] {
  display: none;
}

.solution-summary {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.current-step {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 5px solid var(--color-purple);
}

.current-step-number {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.current-step-move {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-coral);
  margin-bottom: 0.5rem;
}

.current-step-desc {
  font-size: 1.05rem;
  line-height: 1.5;
}

.current-step-desc .face-highlight {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  color: white;
}

.face-highlight--U { background: #888; color: #fff; }
.face-highlight--D { background: #c9a800; color: #fff; }
.face-highlight--F { background: #009b48; }
.face-highlight--B { background: #0046ad; }
.face-highlight--L { background: #ff5800; }
.face-highlight--R { background: #b71234; }

.step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.step-counter {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 8rem;
  text-align: center;
}

.steps-list-toggle {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-sky-dark);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem;
}

.steps-list-toggle:hover,
.steps-list-toggle:focus-visible {
  color: var(--color-coral);
  outline: none;
}

.steps-list {
  max-height: 200px;
  overflow-y: auto;
  border: 2px solid #eee;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  margin-top: 0.75rem;
}

.steps-list[hidden] {
  display: none;
}

.steps-list ol {
  margin: 0;
  padding-left: 1.25rem;
}

.steps-list li {
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.steps-list li:hover,
.steps-list li.is-active {
  color: var(--color-text);
  font-weight: 600;
  background: var(--color-bg);
}

@media (max-width: 480px) {
  .cube-3d-container {
    min-height: 220px;
    height: min(320px, 70vw);
  }

  .cube-net {
    max-width: 280px;
  }

  .color-swatch {
    width: 2.35rem;
    height: 2.35rem;
  }

  .view-toggle-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
  }
}
