/* MusicQuiz base styles.
   Animation rules live here rather than in Blazor components on purpose: driving an
   animation from the server means a StateHasChanged per frame per circuit, which
   visibly stutters once several players are in a room. */

:root {
    --mq-bg: #0e0e16;
    --mq-surface: #161622;
    --mq-surface-2: #1c1c2e;
    --mq-primary: #7c4dff;
    --mq-secondary: #ff4081;
    --mq-success: #22c55e;
    --mq-error: #ef4444;
    --mq-text: #edeaff;
    --mq-text-dim: #a5a0c4;
    --mq-border: #262640;
}

html, body {
    background-color: var(--mq-bg);
    color: var(--mq-text);
    min-height: 100%;
}

body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

/* ---- layout ------------------------------------------------------------ */

.mq-appbar {
    border-bottom: 1px solid var(--mq-border);
    backdrop-filter: blur(8px);
}

.mq-wordmark {
    font-family: Outfit, "Segoe UI", system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(92deg, var(--mq-primary), var(--mq-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mq-main {
    min-height: calc(100vh - 64px);
}

.mq-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem 2rem;
    color: var(--mq-text-dim);
    font-size: 0.75rem;
}

.mq-footer-sep {
    opacity: 0.5;
}

/* ---- hero -------------------------------------------------------------- */

.mq-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--mq-border);
    background:
        radial-gradient(1100px 380px at 12% -20%, rgba(124, 77, 255, 0.30), transparent 60%),
        radial-gradient(900px 340px at 92% 0%, rgba(255, 64, 129, 0.22), transparent 60%),
        var(--mq-surface);
}

.mq-hero-title {
    font-size: clamp(2.25rem, 6vw, 4rem);
    line-height: 1.05;
}

.mq-gradient-text {
    background: linear-gradient(92deg, #a78bfa, #ff4081 65%, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---- join code --------------------------------------------------------- */

.mq-code-input input {
    font-family: "Outfit", ui-monospace, monospace;
    font-size: 1.75rem !important;
    font-weight: 700;
    letter-spacing: 0.4em;
    text-align: center;
    text-transform: uppercase;
}

/* ---- validation (kept from the template) ------------------------------- */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mq-success);
}

.invalid {
    outline: 1px solid var(--mq-error);
}

.validation-message {
    color: var(--mq-error);
}

.blazor-error-boundary {
    background: var(--mq-error);
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ---- answer grid -------------------------------------------------------- */

.mq-answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (max-width: 599px) {
    .mq-answers {
        grid-template-columns: 1fr;
    }
}

.mq-answer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--mq-border);
    border-radius: 14px;
    background: var(--mq-surface-2);
    color: var(--mq-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .08s ease, border-color .15s ease, background-color .15s ease;
}

.mq-answer:hover:not(:disabled) {
    border-color: var(--mq-primary);
    transform: translateY(-1px);
}

.mq-answer:disabled {
    cursor: default;
}

/* Each option gets a shape as well as a colour. Colour alone excludes colourblind players,
   and it is the single most common accessibility miss in games of this shape. */
.mq-answer-glyph {
    font-size: 1.15rem;
    line-height: 1;
}

.mq-answer-0 .mq-answer-glyph { color: #f87171; }
.mq-answer-1 .mq-answer-glyph { color: #60a5fa; }
.mq-answer-2 .mq-answer-glyph { color: #fbbf24; }
.mq-answer-3 .mq-answer-glyph { color: #34d399; }

.mq-answer-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.mq-answer-label {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.mq-answer-sub {
    font-size: 0.78rem;
    color: var(--mq-text-dim);
}

.mq-answer-key {
    font-size: 0.72rem;
    color: var(--mq-text-dim);
    border: 1px solid var(--mq-border);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
}

.mq-answer.is-chosen {
    border-color: var(--mq-primary);
    background: color-mix(in srgb, var(--mq-primary) 18%, var(--mq-surface-2));
}

.mq-answer.is-correct {
    border-color: var(--mq-success);
    background: color-mix(in srgb, var(--mq-success) 20%, var(--mq-surface-2));
}

.mq-answer.is-wrong {
    border-color: var(--mq-error);
    background: color-mix(in srgb, var(--mq-error) 18%, var(--mq-surface-2));
}

.mq-answer.is-dimmed {
    opacity: 0.45;
}

/* ---- countdown ---------------------------------------------------------- */

.mq-countdown {
    position: relative;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
}

.mq-countdown svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.mq-countdown circle {
    fill: none;
    stroke-width: 7;
}

.mq-countdown-track {
    stroke: var(--mq-border);
}

.mq-countdown-sweep {
    stroke: var(--mq-primary);
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
}

/* The sweep is driven entirely by the browser. A server-driven countdown would cost a render
   diff per frame per player over the circuit, which is exactly how these games end up stuttering. */
.mq-countdown.is-running .mq-countdown-sweep {
    animation: mq-sweep var(--mq-duration, 12000ms) linear forwards;
}

@keyframes mq-sweep {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: 283; }
}

.mq-countdown-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    color: var(--mq-text-dim);
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .mq-countdown.is-running .mq-countdown-sweep {
        animation: none;
    }
}

/* ---- reveal and scoreboard ---------------------------------------------- */

.mq-reveal-art {
    border-radius: 10px;
}

.mq-scoreboard .mq-place {
    color: var(--mq-text-dim);
    font-variant-numeric: tabular-nums;
}

.mq-scoreboard .mq-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mq-scoreboard tr.is-me {
    background: color-mix(in srgb, var(--mq-primary) 12%, transparent);
}

.mq-room-code {
    font-family: Outfit, ui-monospace, monospace;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: var(--mq-text);
}
