/* Knee assembly — a hidden play page. Shares the hero scene's palette. */

:root {
    --ink: #dfe9ff;
    --dim: rgba(148, 180, 232, 0.8);
    --line: rgba(190, 215, 255, 0.28);
    --accent: #0ec8be;
    --red: #ff9e92;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    background: #060e1e;
    overflow: hidden;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    -webkit-user-select: none;
    user-select: none;
}

#board {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

#board.is-over { cursor: grab; }
#board.is-grabbing { cursor: grabbing; }

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 44%, rgba(0, 0, 0, 0) 42%, rgba(2, 5, 12, 0.6) 100%);
}

/* HUD corner brackets, as on the hero scene */
.corner {
    position: fixed;
    width: 26px;
    height: 26px;
    border: 1px solid var(--line);
    pointer-events: none;
}
.tl { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.tr { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.bl { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.br { bottom: 20px; right: 20px; border-left: none; border-top: none; }

/* ------------------------------------------------------------- header -- */
.masthead {
    position: fixed;
    top: 38px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 0 1.5rem;
    pointer-events: none;
}

.masthead a { pointer-events: auto; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--ink);
}

.brand img { width: 22px; height: 22px; }

.brand span {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.masthead h1 {
    /* styles.css colours headings navy; that disappears on this background */
    color: var(--ink);
    margin: 0.5rem 0 0;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.masthead p {
    margin: 0;
    max-width: 34ch;
    font-size: 0.875rem;
    color: var(--dim);
    line-height: 1.6;
}

/* --------------------------------------------------------------- hud --- */
.hud {
    position: fixed;
    left: 50%;
    bottom: 6%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    text-align: center;
}

.barwrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

.bar {
    position: relative;
    width: min(320px, 58vw);
    height: 1px;
    background: rgba(150, 180, 230, 0.18);
}

.fill {
    position: absolute;
    left: 0;
    top: -0.5px;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, rgba(120, 170, 255, 0.1), #cfe4ff);
    box-shadow: 0 0 10px rgba(150, 195, 255, 0.8);
    transition: width 0.45s ease;
}

.count {
    font-size: 0.6875rem;
    font-weight: 300;
    letter-spacing: 0.18em;
    color: #b9d0f5;
    font-variant-numeric: tabular-nums;
    width: 3rem;
    text-align: left;
}

.status {
    font-size: 0.5625rem;
    font-weight: 300;
    letter-spacing: 0.38em;
    text-indent: 0.38em;
    color: var(--dim);
    height: 0.75rem;
    pointer-events: none;
}

.hint {
    font-size: 0.8125rem;
    color: var(--red);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    height: 1.2rem;
}

.hint.is-shown { opacity: 1; }

.controls {
    display: flex;
    gap: 0.75rem;
}

.btn {
    appearance: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 0.25rem;
    color: var(--ink);
    font: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.btn:hover {
    border-color: rgba(190, 215, 255, 0.7);
    background: rgba(190, 215, 255, 0.07);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* -------------------------------------------------------------- done --- */
.done {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s ease;
}

.done.is-shown {
    opacity: 1;
    pointer-events: auto;
}

.done__card {
    max-width: 30rem;
    text-align: center;
    background: rgba(6, 16, 34, 0.82);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 2rem 1.75rem;
    backdrop-filter: blur(6px);
}

.done__card h2 {
    color: var(--ink);
    margin: 0 0 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
}

.done__card p {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--dim);
}

.done__card .accent { color: var(--red); }

/* Narrow screens drop the card below the knee instead of over it. */
@media (max-width: 899px) {
    .done {
        align-items: flex-end;
        padding-bottom: 9.5rem;
    }
}

/* Wide screens put the card beside the finished knee, not on top of it. */
@media (min-width: 900px) {
    .done {
        justify-content: flex-end;
        padding-right: 6vw;
    }
}

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

.btn--solid {
    background: #cfe4ff;
    border-color: #cfe4ff;
    color: #06213d;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn--solid:hover {
    background: #fff;
    border-color: #fff;
}

@media (max-width: 720px) {
    .masthead { top: 26px; }
    .masthead h1 { font-size: 1.25rem; }
    .masthead p { display: none; }
    .hud { bottom: 4%; }
}

@media (prefers-reduced-motion: reduce) {
    .fill, .done, .hint { transition-duration: 0.01ms; }
}

/* A way into the site for anyone who would rather not play. */
.skip {
    position: fixed;
    top: 24px;
    right: 56px;
    z-index: 3;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--dim);
    text-decoration: none;
    padding: 0.4rem 0.2rem;
    transition: color 0.3s ease;
}

.skip:hover { color: var(--ink); }

.skip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (max-width: 720px) {
    .skip { top: 20px; right: 50px; font-size: 0.6875rem; }
}
