/* Bike Builder only — the question bar, the SVG board and its moving parts.
   Everything else on this page comes from assets/css/game-shell.css. */

.game {
    /* the question bar above the board and the fact line below it */
    --above: 270px;
}
/* the board is 800 × 680 — a little taller than the shell's 4 : 3, to make
   room for two rows in the parts box */
.stage {
    width: min(100%, max(420px, calc((100vh - var(--above)) * 800 / 680)));
    width: min(100%, max(420px, calc((100dvh - var(--above)) * 800 / 680)));
}

.hud .stat b.stars {
    color: #e0a100;
    letter-spacing: 0.08em;
}

/* ---------- the question ---------- */
.ask {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--tint-warm);
    border-radius: var(--r-md);
    padding: 8px 10px;
    margin-bottom: 10px;
    min-height: 52px;
}
.ask p {
    flex: 1;
    margin: 0;
    font-family: "Bricolage Grotesque";
    font-size: 19px;
    font-weight: 600;
    line-height: 1.25;
}
.ask .new {
    display: inline-block;
    background: var(--coral);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: 2px;
    margin-right: 4px;
}
.ask p b {
    color: var(--coral);
    font-weight: 800;
}
.read-btn {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: var(--surface);
    font-size: 17px;
    display: grid;
    place-items: center;
}
.read-btn:hover {
    border-color: var(--blue);
}
.ask .mini:disabled {
    opacity: 0.45;
    cursor: default;
}

.say {
    min-height: 1.5em;
    margin: 10px 4px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-soft);
}
.say b {
    color: var(--ink);
}
.say[data-tone="warn"] {
    color: #b8391f;
}
.say[data-tone="good"] {
    color: #0b7a6d;
}

/* ---------- the board ---------- */
.stage {
    background: #eef1e8;
}
.stage svg {
    display: block;
    width: 100%;
    aspect-ratio: 800 / 680;
    touch-action: none; /* the finger drags parts, not the page */
    user-select: none;
    -webkit-user-select: none;
}
.tray-title {
    font: 500 11px "DM Mono", monospace;
    letter-spacing: 0.08em;
    fill: var(--ink-soft);
}

/* a part in the box, or in the hand */
.piece {
    cursor: grab;
    outline: none;
}
.piece .hit {
    fill: transparent;
}
.piece:focus-visible .hit {
    stroke: var(--blue);
    stroke-width: 3;
    stroke-dasharray: 6 4;
    rx: 10;
}
.piece.lifted {
    cursor: grabbing;
    filter: drop-shadow(0 10px 8px rgba(27, 34, 64, 0.25));
}
.piece.placed {
    cursor: default;
    pointer-events: none;
}
/* a part that comes already fitted, waiting for the part it hangs on */
.piece.fitted {
    transition: opacity 0.35s;
}
.piece.fitted.waiting {
    opacity: 0;
}
.peg {
    fill: var(--teal);
    stroke: #fff;
    stroke-width: 2.5;
}

/* the glowing dot where the part being asked for goes */
.socket {
    pointer-events: none;
}
.socket .dot {
    fill: var(--teal);
    stroke: #fff;
    stroke-width: 2.5;
}
.socket .ring {
    fill: none;
    stroke: var(--teal);
    stroke-width: 3;
    transform-box: fill-box;
    transform-origin: center;
    animation: pulse 1.2s ease-out infinite;
}
.socket.near .ring {
    stroke: var(--yellow);
    stroke-width: 5;
    animation-duration: 0.5s;
}
@keyframes pulse {
    from {
        transform: scale(0.6);
        opacity: 1;
    }
    to {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* a faint outline of the missing part (bike 1, or after a hint) */
.ghost {
    opacity: 0.16;
    filter: grayscale(1);
    pointer-events: none;
}

/* the name that goes up when a part clicks in */
.label {
    animation: pop 0.3s ease-out;
    pointer-events: none;
}
.label rect {
    fill: #fff;
    stroke: var(--ink);
    stroke-width: 1.5;
}
.label line {
    stroke: var(--ink);
    stroke-width: 1.5;
}
.label circle {
    fill: var(--ink);
}
.label text {
    font: 700 13px Inter, sans-serif;
    fill: var(--ink);
    text-anchor: middle;
}
@keyframes pop {
    from {
        opacity: 0;
    }
}

/* the right part, after a hint */
.inner.wiggle {
    transform-box: fill-box;
    transform-origin: center;
    animation: wiggle 0.5s ease-in-out infinite alternate;
}
@keyframes wiggle {
    from {
        transform: rotate(-7deg) scale(1.08);
    }
    to {
        transform: rotate(7deg) scale(1.08);
    }
}

/* the wrong part, shaking its head */
.inner.shake {
    animation: shake 0.4s;
}
@keyframes shake {
    20%,
    60% {
        transform: translateX(-8px);
    }
    40%,
    80% {
        transform: translateX(8px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .socket .ring,
    .inner.wiggle,
    .inner.shake,
    .label {
        animation: none;
    }
}

@media (max-width: 560px) {
    .ask p {
        font-size: 16px;
    }
    /* the board is short on a phone — keep the overlay's words inside it */
    .overlay {
        padding: 12px;
    }
    .overlay h2 {
        font-size: 22px;
    }
    .overlay p {
        font-size: 13px;
        margin-top: 6px;
    }
    .overlay .btn-primary {
        margin-top: 12px;
        padding: 10px 20px;
    }
    .final {
        margin-top: 10px;
        gap: 16px;
    }
    .final b {
        font-size: 22px;
    }
}
