/* Reining pattern simulator — global styles (elements are created dynamically by
   PatternSimulator.razor.js, so these can't live in a scoped .razor.css). All
   selectors are namespaced under .sim to avoid leaking into the rest of the site. */

.sim {
    display: grid;
    /* One row: arena | pattern panel | controls. */
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) max-content;
    gap: 24px;
    align-items: start;
}

.sim-stage {
    min-width: 0;
}

.sim-canvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 940px;
    margin-inline: auto;
    aspect-ratio: 940 / 760; /* overwritten per-pattern by the script */
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(60, 40, 25, 0.12);
    background: rgb(242, 238, 230);
    outline: none;
}

.sim-canvas:focus-visible {
    box-shadow: 0 0 0 3px rgba(31, 81, 53, 0.35), 0 4px 18px rgba(60, 40, 25, 0.12);
}

.sim-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    order: 3; /* far right: arena | panel | controls */
}

.sim-btn {
    padding: 8px 16px;
}

.sim-btn-icon {
    min-width: 40px;
    font-weight: 700;
    line-height: 1;
}

.sim-speed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sim-speed-val {
    min-width: 78px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #6f7a70;
}

.sim-scrub {
    display: block;
    width: 100%;
    margin-top: 14px;
    accent-color: #96703f;
    cursor: pointer;
}

/* Instruction panel ------------------------------------------------- */
.sim-panel {
    border: 1px solid #e3dac8;
    border-radius: 12px;
    padding: 22px;
    background: #fbfaf6;
    order: 2; /* middle column */
}

.sim-select-label {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a8a80;
    margin-bottom: 6px;
}

.sim-select {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 18px;
    border: 1px solid #d8cdb4;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: #35352f;
    cursor: pointer;
}

.sim-diagram {
    margin: 0 0 18px;
}

.sim-diagram[hidden] {
    display: none;
}

.sim-diagram img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #e3dac8;
    border-radius: 8px;
    background: #fff;
}

.sim-diagram figcaption {
    margin-top: 6px;
    font-size: 0.78rem;
    color: #8a8a80;
    text-align: center;
}

.sim-status {
    margin: 0 0 16px;
    color: #35352f;
    font-weight: 600;
}

.sim-status.is-done {
    color: #a92828;
}

.sim-steps {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sim-steps li {
    color: #8a8a80;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.sim-steps li.is-done {
    color: #35352f;
}

.sim-steps li.is-active {
    color: #a92828;
    font-weight: 700;
}

.sim-hint {
    margin: 18px 0 0;
    font-size: 0.85rem;
    color: #8a8a80;
}

.sim kbd {
    font-family: inherit;
    font-size: 0.82em;
    background: #efe9dc;
    border: 1px solid #d8cdb4;
    border-radius: 4px;
    padding: 1px 6px;
}

/* Stack only on genuinely small screens; keep the single row otherwise. When stacked, restore the
   natural source order (arena, controls, steps) so the controls sit right under the arena. */
@media (max-width: 640px) {
    .sim {
        grid-template-columns: 1fr;
    }

    .sim-controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        order: 0;
    }

    .sim-panel {
        order: 0;
    }
}
