/* Number Matrix game page.
   (Controllers/GamesController.cs, Views/Games/NumberMatrix.cshtml)

   Loads alongside predict.css purely for the shared top bar, which is keyed on
   body:has(.predict-shell). The past-draw table reuses .history-result-table and
   the .pos-* prize badges from site.css, so it matches the past-result search.
   Nothing else on the site reads this file. */

.mtx-shell {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px 16px calc(126px + env(safe-area-inset-bottom));
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.mtx-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mtx-back {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    text-decoration: none;
}

.mtx-topbar h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 900;
}

.mtx-tagline {
    margin: 2px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

/* ── Board ──────────────────────────────────────────────────────────────── */

.mtx-board-card {
    padding: 16px;
    border: 1px solid rgba(216, 169, 63, .4);
    border-radius: 18px;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(216, 169, 63, .12), transparent 60%),
        var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.mtx-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

/* Square tiles at any width. */
.mtx-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    color: transparent;
    font-family: inherit;
    font-size: 26px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

/* The digit only becomes visible once its tile is revealed - before that the
   text is transparent, so nothing shows through on a long-press or selection. */
.mtx-cell.is-revealed {
    background: #6cbf3f;
    border-color: #5aa834;
    color: #10250a;
    animation: mtx-pop .32s ease;
}

/* Marks the tile the player chose, as opposed to the three the board picked. */
.mtx-cell.is-chosen {
    box-shadow: inset 0 0 0 2px #2f6b16;
}

.mtx-cell:disabled {
    cursor: default;
}

/* Dims the untaken tiles once the round is over. */
.mtx-board.is-done .mtx-cell:not(.is-revealed) {
    opacity: .45;
}

@keyframes mtx-pop {
    0%   { transform: scale(.72); }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ── Result ─────────────────────────────────────────────────────────────── */

.mtx-result {
    display: grid;
    gap: 2px;
    margin-top: 16px;
}

.mtx-result-label {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.mtx-result-value {
    color: var(--gold);
    font-size: 34px;
    font-weight: 900;
    letter-spacing: .18em;
    font-variant-numeric: tabular-nums;
}

.mtx-replay {
    width: 100%;
    margin-top: 14px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #8b5c12, #6d4710);
    cursor: pointer;
}

.mtx-replay span {
    display: block;
    padding: 13px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, #e8bd52, #c8952c);
    color: #40290a;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    transform: translateY(-3px);
    transition: transform .09s ease;
}

.mtx-replay:active span {
    transform: translateY(0);
}

.mtx-status {
    margin: 12px 0 0;
    min-height: 18px;
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 700;
}

.mtx-status.is-error {
    color: #c0392b;
}

/* ── Section shells ─────────────────────────────────────────────────────── */

.mtx-past,
.mtx-history,
.mtx-about {
    margin-top: 20px;
}

.mtx-section-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.mtx-section-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
}

.mtx-section-head span {
    color: var(--text-soft);
    font-size: 11.5px;
}

.mtx-empty {
    margin: 0;
    padding: 18px 0;
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
}

/* ── Round history ──────────────────────────────────────────────────────── */

.mtx-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}

.mtx-history-list .mtx-empty {
    grid-column: 1 / -1;
}

.mtx-history-chip {
    display: grid;
    gap: 2px;
    padding: 10px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    text-align: center;
}

.mtx-history-chip strong {
    color: var(--gold);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .1em;
    font-variant-numeric: tabular-nums;
}

.mtx-history-chip span {
    color: var(--text-soft);
    font-size: 10.5px;
}

.mtx-history-chip.is-new {
    border-color: rgba(216, 169, 63, .7);
    animation: mtx-chip-in .45s ease;
}

@keyframes mtx-chip-in {
    from { opacity: 0; transform: translateY(-6px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

/* ── Footer copy ────────────────────────────────────────────────────────── */

.mtx-about h2 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 900;
}

.mtx-about p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.6;
}

.mtx-disclaimer {
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 360px) {
    .mtx-board {
        gap: 6px;
    }

    .mtx-cell {
        font-size: 22px;
    }

    .mtx-result-value {
        font-size: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mtx-cell,
    .mtx-cell.is-revealed,
    .mtx-history-chip.is-new {
        animation: none;
        transition: none;
    }
}
