/* Rush Hour — sliding-block puzzle. All sizing is driven from the square
   board; vehicles are absolutely positioned in pixels by rushhour.js. */

.rh-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 1rem;
}

.rh-title {
  text-align: center;
  margin-bottom: 0.25rem;
}

.rh-intro {
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

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

.rh-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.rh-select {
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--surface-2, #262232);
  color: var(--text-main, #e7e4ee);
  font: inherit;
}

.rh-moves {
  font-size: 0.95rem;
}

.rh-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--surface-2, #262232);
  color: var(--text-main, #e7e4ee);
  cursor: pointer;
  font: inherit;
}

.rh-btn:hover { background: #322d42; }
.rh-btn:active { transform: translateY(1px); }
.rh-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.rh-btn-sm { padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.rh-status {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1rem;
}

.rh-optimal { color: var(--text-muted, #94a3b8); font-size: 0.95rem; }

.rh-board-wrap {
  display: flex;
  justify-content: center;
}

/* The board is a square. Cells are drawn as a grid background; the right
   wall has a notch in the exit row, rendered by the .rh-exit marker. */
.rh-board {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  background-color: #15131c;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: calc(100% / 6) calc(100% / 6);
  border: 4px solid #2f2a3d;
  border-radius: 10px;
  touch-action: none;          /* let us own touch drags, no page scroll */
  user-select: none;
  -webkit-user-select: none;
}

.rh-part {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: box-shadow 0.12s ease;
}

.rh-icon {
  line-height: 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.rh-vertical .rh-icon { transform: rotate(90deg); }

/* Cars: smooth coloured body, grabbable, slide along their long axis only. */
.rh-car {
  border-radius: 9px;
  background: #4a90d9;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.4),
              0 2px 4px rgba(0, 0, 0, 0.22);
  cursor: grab;
}
.rh-car.rh-target { background: #e0322e; }

/* Free blocks: wooden-crate look + dashed edge => slide in any direction. */
.rh-free {
  border-radius: 5px;
  background: repeating-linear-gradient(45deg,
    #cf9355, #cf9355 9px, #c0823f 9px, #c0823f 18px);
  border: 2px dashed #e0b074;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22),
              0 2px 4px rgba(0, 0, 0, 0.22);
  cursor: grab;
}

/* Walls: brick pattern, square corners, not interactive (fixed). */
.rh-wall {
  border-radius: 2px;
  background-color: #4a4658;
  background-image:
    linear-gradient(#34313f 2px, transparent 2px),
    linear-gradient(90deg, #34313f 2px, transparent 2px);
  background-size: 100% 50%, 33.33% 100%;
  border: 2px solid #2a2833;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.55);
}

.rh-part.rh-dragging {
  cursor: grabbing;
  z-index: 5;
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.4),
              0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Exit arrow on the right edge, aligned to the target row by JS. */
.rh-exit {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: #e0322e;
  font-weight: 700;
  pointer-events: none;
}

.rh-message {
  text-align: center;
  min-height: 1.6em;
  margin-top: 1rem;
  font-size: 1.05rem;
}

.rh-message.rh-win {
  color: #34d399;
  font-weight: 700;
}
