/* Match’it uses the portfolio's palette, type and shared components. */
.matchit-page {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
}

.matchit-main {
    flex: 1;
    width: min(100%, 1164px);
    margin: 0 auto;
    padding: 32px clamp(18px, 4vw, 42px) 48px;
}

.matchit-nav,
.matchit-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 28px;
}

.matchit-intro {
    align-items: flex-end;
    margin-bottom: 24px;
}

.matchit-intro .eyebrow {
    margin-bottom: 10px;
}

.matchit-intro h1 {
    margin: 0;
    font-size: clamp(32px, 3.6vw, 48px);
    line-height: 1.1;
}

.matchit-byline {
    margin: 10px 0 0;
    color: var(--muted);
}

.matchit-intro .tags {
    margin: 0 0 3px;
}

.matchit-player {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

#screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 200px;
    background: #0e1212;
}

#screen canvas {
    display: block;
    width: min(100%, 960px, max(320px, calc((100svh - 400px) * 1.6)));
    height: auto;
    aspect-ratio: 8 / 5;
    image-rendering: pixelated;
    touch-action: manipulation;
}

#screen canvas:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: -3px;
}

#screen:fullscreen {
    width: 100vw;
    height: 100vh;
    background: #000;
}

#screen:fullscreen canvas {
    width: min(100vw, 160vh);
    height: auto;
}

.matchit-panel {
    padding: 18px 20px;
    border-top: 1px solid var(--line);
}

.matchit-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.matchit-controls button {
    gap: 6px;
    min-height: 44px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.matchit-controls button:disabled {
    opacity: .45;
    cursor: default;
    transform: none;
}

#sound[aria-pressed="true"],
#pause[aria-pressed="true"] {
    background: #b7eeea;
    border-color: var(--teal);
}

.matchit-page kbd {
    display: inline-block;
    padding: 1px 4px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--muted);
    background: var(--surface);
    font: 11px/1.4 ui-monospace, Consolas, monospace;
}

.matchit-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 18px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
}

#status {
    margin: 0;
}

#stage {
    color: var(--teal-dark);
    font-weight: 800;
}

.matchit-lead {
    margin: 24px 0;
}

.matchit-lead p {
    margin: 5px 0;
    color: var(--muted);
}

.matchit-lead p:first-child {
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
}

.matchit-rules {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.matchit-rules summary {
    padding: 18px 20px;
    color: var(--teal-dark);
    font-weight: 800;
    cursor: pointer;
}

.matchit-rules summary:focus-visible {
    outline: 3px solid rgba(0, 140, 149, .35);
    outline-offset: 3px;
}

.matchit-rules-body {
    max-width: 860px;
    padding: 0 20px 8px;
    color: var(--muted);
    font-size: 14px;
}

.matchit-rules-body p:first-child {
    margin-top: 0;
}

.matchit-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.matchit-shortcuts div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.matchit-shortcuts dd {
    margin: 0;
}

.matchit-credits {
    margin-top: 24px;
    color: var(--muted);
    font-size: 12px;
}

.matchit-credits p {
    margin: 6px 0;
}

.matchit-credits a {
    color: var(--teal-dark);
    font-weight: 800;
}

.matchit-credits a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .matchit-page .site-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .matchit-page .language-switch {
        align-self: center;
    }

    .matchit-main {
        padding-top: 24px;
        padding-bottom: 32px;
    }

    .matchit-nav {
        gap: 12px;
    }

    .matchit-nav .legal-back,
    .matchit-nav .button {
        font-size: 13px;
    }

    .matchit-panel {
        padding: 14px;
    }

    .matchit-controls {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .matchit-controls button {
        padding: 9px 6px;
        font-size: 12px;
    }

    .matchit-controls kbd {
        display: none;
    }

    #screen {
        min-height: 0;
    }

    #screen canvas {
        width: 100%;
    }

    .matchit-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .matchit-page .site-header {
        position: static;
        padding-inline: 14px;
    }

    .matchit-page .brand {
        gap: 8px;
        font-size: 14px;
    }

    .matchit-page .brand img {
        width: 34px;
        height: 34px;
    }

    .matchit-page .language-button {
        min-width: 34px;
    }

    .matchit-nav .button {
        width: auto;
    }

    .matchit-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
