.deck {
    display: grid;
    gap: clamp(0.7rem, 1.4vw, 1.1rem);
}

.deck-grid {
    display: grid;
    gap: clamp(0.7rem, 1.4vw, 1.1rem);
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 2fr) minmax(0, 1.15fr);
    grid-template-areas:
        "stats featured featured"
        "library featured featured"
        "library board intel"
        "library board intel";
    align-items: stretch;
}

.deck-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1rem 1.1rem 0.9rem;
    border: 1px solid var(--line-1);
    border-radius: var(--r-3);
    background: linear-gradient(180deg, var(--ink-2) 0%, var(--ink-1) 100%);
    box-shadow: var(--shadow-2, 0 18px 40px -28px #000);
}

.deck-panel--stats {
    grid-area: stats;
}

.deck-panel--featured {
    grid-area: featured;
}

.deck-panel--library {
    grid-area: library;
}

.deck-panel--board {
    grid-area: board;
}

.deck-panel--intel {
    grid-area: intel;
}

/* ---------- shared panel furniture ---------- */

.deck-kicker {
    margin: 0 0 0.8rem;
    color: var(--fg-3);
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.deck-kicker span {
    color: var(--accent);
}

.deck-head {
    margin-bottom: 0.85rem;
}

.deck-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--fg-1);
}

.deck-head p {
    margin: 0.25rem 0 0;
    color: var(--fg-3);
    font-size: 0.76rem;
    line-height: 1.5;
}

.deck-head--tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.deck-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0.2rem;
    border: 1px solid var(--line-1);
    border-radius: 999px;
    background: var(--ink-0);
}

.deck-tab {
    padding: 0.28rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--fg-3);
    font: 600 0.68rem/1 var(--font-ui);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.deck-tab:hover {
    color: var(--fg-1);
}

.deck-tab.is-active {
    background: var(--accent);
    color: #06211d;
}

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

.deck-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line-1);
}

.deck-link {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

.deck-link:hover {
    color: var(--accent-hi);
}

.deck-link--button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.deck-dots {
    display: flex;
    gap: 5px;
}

.deck-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--line-3);
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.deck-dot.is-active {
    background: var(--accent);
    transform: scale(1.25);
}

/* ---------- counters ---------- */

.deck-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 0;
}

.deck-stat {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line-1);
    border-radius: var(--r-2);
    background: var(--ink-0);
}

.deck-stat dt {
    margin: 0;
    color: var(--fg-3);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.deck-stat dd {
    margin: 0.3rem 0 0;
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
    color: var(--fg-1);
    font-variant-numeric: tabular-nums;
}

.deck-note {
    margin: 0.85rem 0 0;
    color: var(--fg-3);
    font-size: 0.74rem;
    line-height: 1.55;
}

.deck-panel--stats .deck-link {
    margin-top: auto;
    padding-top: 0.9rem;
}

/* ---------- featured ---------- */

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.featured-grid > .game-card[hidden] {
    display: none;
}

/* The rotating panels must not change height as they roll, so the cards get a
   fixed body and the text is clamped rather than allowed to wrap freely. */
.deck-panel--featured .game-card {
    min-height: 15.5rem;
}

.deck-panel--featured .game-card p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- library rows ---------- */

.deck-rows {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
    align-content: start;
}

.deck-row {
    border: 1px solid var(--line-1);
    border-radius: var(--r-2);
    background: var(--ink-0);
    overflow: hidden;
}

.deck-row[hidden] {
    display: none;
}

.deck-row-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.65rem;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease;
}

.deck-row:not(.is-locked):hover .deck-row-link,
.deck-row-link:focus-visible {
    background: var(--ink-3);
}

.deck-row-title {
    color: var(--fg-1);
    font-family: var(--font-display);
    font-size: 0.92rem;
    letter-spacing: 0.03em;
}

.deck-row-meta {
    color: var(--fg-3);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.deck-row.is-locked .deck-row-title {
    color: var(--fg-4);
}

.deck-row.is-locked .deck-row-meta {
    color: var(--fg-4);
}

/* ---------- leaderboard ---------- */

.deck-tabpanel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* A flex display beats the UA rule for [hidden], which would leave both
   leaderboard scopes on screen at once. */
.deck-tabpanel[hidden] {
    display: none;
}

.board-list {
    display: grid;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

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

.board-row {
    display: grid;
    grid-template-columns: 1.3rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.55rem;
    border: 1px solid var(--line-1);
    border-radius: var(--r-2);
    background: var(--ink-0);
}

.board-rank {
    color: var(--fg-4);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.board-row:nth-child(1) .board-rank {
    color: var(--accent);
}

.board-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fg-1);
    font-size: 0.78rem;
}

.board-value {
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    white-space: nowrap;
}

.board-scope {
    margin: 0 0 0.5rem;
    color: var(--fg-3);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.board-empty {
    margin: 0.2rem 0 0;
    padding: 0.7rem 0.75rem;
    border: 1px dashed var(--line-2);
    border-radius: var(--r-2);
    color: var(--fg-3);
    font-size: 0.74rem;
    line-height: 1.55;
}

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

/* ---------- intel panel ---------- */

.deck-panel--intel .home-intel-list {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.deck-panel--intel .intel-list-item[hidden] {
    display: none;
}

.deck-panel--intel .intel-list-item {
    border: 1px solid var(--line-1);
    border-radius: var(--r-2);
    background: var(--ink-0);
}

.deck-panel--intel .intel-list-link {
    padding: 0.55rem 0.7rem;
}

.deck-panel--intel .intel-list-title {
    font-size: 0.86rem;
    line-height: 1.3;
}

.deck-panel--intel .intel-list-excerpt {
    display: none; /* three lines each, or the panel outgrows its row */
}

/* ---------- home copy + categories ---------- */

.home-copy {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
    gap: clamp(1rem, 2.4vw, 2rem);
    margin-top: clamp(1.6rem, 3vw, 2.6rem);
    align-items: start;
}

.home-copy-main h2 {
    margin: 0 0 0.6rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    color: var(--fg-1);
}

.home-copy-main h2 + p {
    margin-top: 0;
}

.home-copy-main p {
    max-width: 72ch;
    margin: 0 0 0.9rem;
    color: var(--fg-2);
    font-size: 0.9rem;
    line-height: 1.75;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.55rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.category-item {
    display: flex;
}

.category-link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line-1);
    border-radius: var(--r-2);
    background: var(--ink-2);
    text-decoration: none;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.category-link:hover,
.category-link:focus-visible {
    border-color: var(--accent);
    background: var(--ink-3);
    transform: translateY(-1px);
}

.category-label {
    color: var(--fg-1);
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.category-count {
    color: var(--accent);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.category-blurb {
    color: var(--fg-3);
    font-size: 0.74rem;
    line-height: 1.5;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
    .deck-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "stats library"
            "featured featured"
            "board intel";
    }
}

@media (max-width: 820px) {
    .deck-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "stats"
            "featured"
            "library"
            "board"
            "intel";
    }

    .featured-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-copy {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .deck-row-link,
    .deck-tab,
    .deck-dot,
    .category-link {
        transition: none;
    }

    .category-link:hover {
        transform: none;
    }
}
