/* Sidequests: the stage a game plays on, the platform's screens laid over it, and the hub. Built on
   the site's tokens (tokens.css); the game inside the frame keeps its own styles. */

.mg {
    padding-block: calc(96px + var(--qr-announce-h, 0px)) 48px;
}

/* new-home.css, which holds .qr-wrap, is not loaded on these pages. */
.mg .qr-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: 16px;
    box-sizing: border-box;
}

.mg-wrap {
    display: grid;
    gap: 16px;
    padding-inline: 16px;
}

.mg-preview {
    margin: 0;
    padding: 10px 16px;
    border: 1px dashed var(--qr-mint);
    border-radius: var(--qr-radius-card);
    color: var(--qr-mint);
    font-weight: 700;
    text-align: center;
}

.mg-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--qr-hairline);
    border-radius: var(--qr-radius-panel);
    background: var(--qr-surface);
}

.mg-frame {
    display: block;
    width: 100%;
    height: min(78vh, 760px);
    border: 0;
    background: var(--qr-bg);
}

/* ---------- The platform's screens ---------- */

.mg-screen {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: color-mix(in srgb, var(--qr-bg) 88%, transparent);
    backdrop-filter: blur(6px);
}

.mg-screen[hidden] {
    display: none;
}

.mg-card {
    display: grid;
    gap: 12px;
    width: min(100%, 460px);
    padding: 28px 24px;
    border: 1px solid var(--qr-hairline-strong);
    border-radius: var(--qr-radius-panel);
    background: var(--qr-surface);
    text-align: center;
}

.qr-home .mg-title {
    margin: 0;
    font-family: var(--qr-display);
    font-size: var(--qr-text-data);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.qr-home .mg-text {
    margin: 0;
    color: var(--qr-muted);
}

.qr-home .mg-fine {
    margin: 0;
    color: var(--qr-faint);
    font-size: var(--qr-text-caption) !important;
}

.mg-fine a {
    color: inherit;
    text-decoration: underline;
}

.qr-home .mg-good {
    color: var(--qr-mint);
}

.qr-home .mg-error {
    margin: 0;
    color: var(--qr-danger);
}

.mg-label {
    color: var(--qr-faint);
    font-size: var(--qr-text-label);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: left;
    text-transform: uppercase;
}

.mg-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--qr-hairline-strong);
    border-radius: var(--qr-radius-card);
    background: var(--qr-surface-2);
    color: var(--qr-text);
    font: 400 16px/1.4 var(--qr-body);
}

.mg-input:focus {
    border-color: var(--qr-mint);
    box-shadow: var(--qr-focus-field);
    outline: none;
}

.mg-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--qr-muted);
    font-size: var(--qr-text-caption);
    text-align: left;
}

.mg-check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--qr-mint);
}

.mg-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.mg-inline {
    display: flex;
    gap: 8px;
}

.mg-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px 12px 18px;
    border: 1px dashed var(--qr-mint);
    border-radius: var(--qr-radius-card);
}

.mg-code-value {
    color: var(--qr-text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* ---------- Leaderboard ---------- */

.mg-board {
    display: grid;
    gap: 8px;
    text-align: left;
}

.mg-board[hidden] {
    display: none;
}

.qr-home .mg-board-title {
    margin: 8px 0 0;
    color: var(--qr-faint);
    font-size: var(--qr-text-label);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mg-board-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    counter-reset: board;
    list-style: none;
}

.mg-board-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--qr-surface-2);
    counter-increment: board;
}

.mg-board-list li::before {
    content: counter(board) ".";
    width: 24px;
    color: var(--qr-faint);
}

.mg-board-list li span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-board-list .mg-board-empty::before {
    content: none;
}

/* ---------- Hub ---------- */

.mg-hub-head {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
    text-align: center;
}

.mg-points {
    justify-self: center;
    padding: 10px 18px;
    border: 1px solid var(--qr-mint-border);
    border-radius: var(--qr-radius-pill);
    background: var(--qr-mint-soft);
    color: var(--qr-text);
}

.mg-points strong {
    color: var(--qr-mint);
}

.mg-hub-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

@media (min-width: 640px) {
    .mg-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Three across: five or six games fill two rows instead of leaving one card alone. */
@media (min-width: 992px) {
    .mg-hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.mg-hub-card {
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 20px;
    border: 1px solid var(--qr-hairline);
    border-radius: var(--qr-radius-panel);
    background: var(--qr-surface);
    color: var(--qr-text);
    text-decoration: none;
}

a.mg-hub-card:hover,
a.mg-hub-card:focus-visible {
    border-color: var(--qr-mint);
    color: var(--qr-text);
    text-decoration: none;
}

.mg-hub-card.is-soon {
    opacity: 0.6;
}

.mg-hub-icon {
    font-size: 32px;
    line-height: 1;
}

.qr-home .mg-hub-name {
    margin: 0;
    font-size: var(--qr-text-subheading);
    font-weight: 700;
}

.mg-hub-tag {
    justify-self: start;
    padding: 2px 10px;
    border-radius: var(--qr-radius-pill);
    background: var(--qr-mint);
    color: var(--qr-on-mint);
    font-size: var(--qr-text-label);
    font-weight: 700;
    text-transform: uppercase;
}

.mg-hub-card.is-soon .mg-hub-tag {
    background: var(--qr-surface-2);
    color: var(--qr-muted);
}

@media (max-width: 640px) {
    .mg-frame {
        height: min(72vh, 640px);
    }

    .mg-card {
        padding: 20px 16px;
    }
}
