/* Rubik's cube tool — Maths Vault */

.rc-page {
    background: #f4f4f2;
}

.rc-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", Georgia, serif;
    color: #1d1d1b;
}

.rc-back {
    display: inline-block;
    margin-bottom: 0.75rem;
    color: #c90c0f;
    text-decoration: none;
    font-size: 0.95rem;
}

.rc-back:hover {
    text-decoration: underline;
}

.rc-wrap h1 {
    color: #c90c0f;
    margin: 0 0 0.35rem;
    font-size: clamp(1.6rem, 3vw, 2.15rem);
}

.rc-wrap h1 i {
    color: #fab719;
    margin-right: 0.35rem;
}

.rc-lead {
    margin: 0 0 1.25rem;
    max-width: 46rem;
    line-height: 1.5;
    color: #444;
}

.rc-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20.5rem;
    gap: 1.1rem;
    align-items: start;
}

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

.rc-stage {
    position: relative;
    background: #16181d;
    border-radius: 16px;
    min-height: 28rem;
    height: min(68vh, 640px);
    overflow: hidden;
    border: 3px solid #c90c0f;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.rc-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.rc-stage canvas:active {
    cursor: grabbing;
}

.rc-hud {
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    top: 0.75rem;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    pointer-events: none;
    color: #e8eaed;
    font-size: 0.85rem;
    font-family: "Segoe UI", system-ui, sans-serif;
}

.rc-hud strong {
    color: #fab719;
}

.rc-solved {
    position: absolute;
    left: 50%;
    bottom: 5.6rem;
    transform: translateX(-50%);
    background: #009e60;
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    z-index: 2;
}

.rc-hint {
    position: absolute;
    left: 0.85rem;
    right: 7.5rem;
    bottom: 5.5rem;
    color: rgba(255, 255, 255, 0.62);
    font: 0.78rem/1.3 "Segoe UI", system-ui, sans-serif;
    pointer-events: none;
    z-index: 2;
}

.rc-inspect {
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.65rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.6rem;
    pointer-events: none;
    z-index: 3;
}

.rc-inspect > * {
    pointer-events: auto;
}

.rc-look-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    max-width: 14rem;
}

.rc-look,
.rc-orbit,
.rc-spin-toggle {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
}

.rc-look {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.78rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.rc-look[data-look='U'] { background: #6b6b6b; }
.rc-look[data-look='D'] { background: #c9a600; color: #1d1d1b; }
.rc-look[data-look='F'] { background: #009e60; }
.rc-look[data-look='B'] { background: #0051ba; }
.rc-look[data-look='L'] { background: #e05d00; }
.rc-look[data-look='R'] { background: #c41e3a; }

.rc-look:focus-visible,
.rc-orbit:focus-visible,
.rc-spin-toggle:focus-visible {
    outline: 2px solid #fab719;
    outline-offset: 2px;
}

.rc-orbit-pad {
    display: grid;
    grid-template-columns: 2rem 2rem 2rem;
    grid-template-rows: 2rem 2rem 2rem;
    gap: 0.2rem;
}

.rc-orbit {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(28, 30, 36, 0.88);
    color: #e8eaed;
    font-size: 0.75rem;
    touch-action: none;
}

.rc-orbit:hover {
    background: #c90c0f;
    color: #fff;
}

.rc-orbit[data-orbit='up'] { grid-column: 2; grid-row: 1; }
.rc-orbit[data-orbit='left'] { grid-column: 1; grid-row: 2; }
.rc-orbit[data-orbit='right'] { grid-column: 3; grid-row: 2; }
.rc-orbit[data-orbit='down'] { grid-column: 2; grid-row: 3; }

.rc-spin-toggle {
    position: absolute;
    left: 0;
    bottom: 2.25rem;
    background: rgba(28, 30, 36, 0.88);
    color: #e8eaed;
    border-radius: 999px;
    padding: 0.32rem 0.7rem;
    font-size: 0.78rem;
}

.rc-spin-toggle.is-on,
.rc-spin-toggle[aria-pressed='true'] {
    background: #c90c0f;
    color: #fff;
}

.rc-stage canvas.is-spinning {
    cursor: move;
}

.rc-dock {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.rc-panel {
    background: #fff;
    border: 3px solid #c90c0f;
    border-radius: 14px;
    padding: 0.9rem 1rem;
}

.rc-panel h2 {
    margin: 0 0 0.7rem;
    color: #c90c0f;
    font-size: 1.05rem;
}

.rc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rc-btn {
    appearance: none;
    border: 2px solid #c90c0f;
    background: #fff;
    color: #c90c0f;
    border-radius: 8px;
    padding: 0.42rem 0.7rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.rc-btn:hover,
.rc-btn:focus-visible {
    background: #c90c0f;
    color: #fff;
}

.rc-btn.primary {
    background: #c90c0f;
    color: #fff;
}

.rc-btn.primary:hover,
.rc-btn.primary:focus-visible {
    background: #a00a0c;
}

.rc-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.9rem;
}

.rc-size select {
    font: inherit;
    padding: 0.3rem 0.45rem;
    border: 2px solid #c90c0f;
    border-radius: 8px;
    background: #fff;
}

.rc-pad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

.rc-face {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.2rem;
}

.rc-face button {
    appearance: none;
    border: 0;
    border-radius: 7px;
    padding: 0.4rem 0.15rem;
    font: 700 0.85rem/1 "Segoe UI", system-ui, sans-serif;
    color: #fff;
    cursor: pointer;
}

.rc-face button:focus-visible {
    outline: 3px solid #1d1d1b;
    outline-offset: 1px;
}

.rc-face[data-face='U'] button { background: #5f5f5f; }
.rc-face[data-face='D'] button { background: #c9a600; }
.rc-face[data-face='R'] button { background: #c41e3a; }
.rc-face[data-face='L'] button { background: #e05d00; }
.rc-face[data-face='F'] button { background: #009e60; }
.rc-face[data-face='B'] button { background: #0051ba; }
.rc-face[data-face='M'] button,
.rc-face[data-face='E'] button,
.rc-face[data-face='S'] button,
.rc-face[data-face='x'] button,
.rc-face[data-face='y'] button,
.rc-face[data-face='z'] button { background: #3c4043; }

.rc-bottom-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.85rem;
}

.rc-bottom-label {
    font-weight: 700;
    margin-right: 0.15rem;
}

.rc-swatch {
    appearance: none;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 6px;
    border: 2px solid #1d1d1b;
    cursor: pointer;
    padding: 0;
}

.rc-swatch:hover,
.rc-swatch:focus-visible {
    outline: 2px solid #c90c0f;
    outline-offset: 2px;
}

.rc-swatch[data-bottom='U'] { background: #f5f5f5; }
.rc-swatch[data-bottom='D'] { background: #ffd500; }
.rc-swatch[data-bottom='F'] { background: #009e60; }
.rc-swatch[data-bottom='B'] { background: #0051ba; }
.rc-swatch[data-bottom='L'] { background: #ff6a00; }
.rc-swatch[data-bottom='R'] { background: #c41e3a; }
.rc-swatch.is-on {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #c90c0f;
}

.rc-alg-row {
    display: flex;
    gap: 0.4rem;
}

.rc-alg-row input {
    flex: 1;
    min-width: 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font: 0.9rem/1.2 ui-monospace, "Cascadia Code", monospace;
}

.rc-alg-row input:focus {
    border-color: #c90c0f;
    outline: none;
}

.rc-history {
    margin: 0.55rem 0 0;
    font: 0.8rem/1.35 ui-monospace, "Cascadia Code", monospace;
    color: #444;
    max-height: 4.2rem;
    overflow: auto;
    word-break: break-word;
}

.rc-law {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    margin-bottom: 0.65rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.86rem;
    line-height: 1.4;
}

.rc-law:last-child {
    margin-bottom: 0;
}

.rc-law p {
    margin: 0.15rem 0 0;
    color: #555;
}

.rc-law-mark {
    flex: 0 0 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    color: #fff;
    background: #009e60;
    margin-top: 0.1rem;
}

.rc-law.is-bad .rc-law-mark {
    background: #c90c0f;
}

.rc-laws-note {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #444;
}

.rc-help-panel {
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #333;
}

.rc-help-panel ul {
    margin: 0.4rem 0 0.6rem;
    padding-left: 1.15rem;
}

.rc-help-panel kbd {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border: 1px solid #ccc;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #f6f6f6;
    font: 0.8rem ui-monospace, monospace;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .rc-stage {
        min-height: 18rem;
        height: min(70vw, 28rem);
    }
    .rc-spin-toggle {
        bottom: 2.1rem;
        font-size: 0.72rem;
        padding: 0.28rem 0.55rem;
    }
    .rc-hint {
        bottom: 5.2rem;
        right: 6.5rem;
        font-size: 0.72rem;
    }
}
