/* Mobile-only reflow of existing DataTables; desktop tables keep their markup and sizing. */
.pool-history-mobile .pool-history-mobile-title {
    display: none;
}

@media (max-width: 767px) {
    .pool-history-mobile {
        --history-card-bg: #ffffff;
        --history-card-alt: #f9fafc;
        --history-card-border: #e3e8f0;
        --history-card-divider: #edf1f4;
        --history-ink: #304861;
        --history-muted: #7b8696;
    }

    body.dark .pool-history-mobile {
        --history-card-bg: #252525;
        --history-card-alt: #292929;
        --history-card-border: #414141;
        --history-card-divider: #414141;
        --history-ink: #dadde3;
        --history-muted: #a1a8b2;
    }

    .pool-history-mobile .pool-history-mobile-title {
        display: block;
        margin: 0 0 14px;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) {
        display: block;
        width: 100% !important;
        max-width: 100%;
        margin: 0 !important;
        border: 0;
        font-family: "Fira Sans", Roboto, Arial, Helvetica, sans-serif;
        font-size: 14px;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > thead,
    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > colgroup {
        display: none !important;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody {
        display: block;
        width: 100%;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr {
        display: grid;
        width: 100%;
        box-sizing: border-box;
        gap: 10px 12px;
        padding: 13px;
        margin-bottom: 9px;
        background: var(--history-card-bg) !important;
        border: 1px solid var(--history-card-border);
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(47, 68, 101, .04);
        min-width: 0;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr:nth-child(even) {
        background: var(--history-card-alt) !important;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td {
        display: block;
        min-width: 0;
        width: auto !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        line-height: 1.35;
        overflow-wrap: anywhere;
        text-align: left;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td.dataTables_empty {
        grid-column: 1 / -1;
    }

    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td a {
        overflow-wrap: anywhere;
    }

    .pool-history-mobile #payoutsDT > tbody > tr {
        grid-template-columns: minmax(0, 1fr) minmax(100px, 38%);
        grid-template-areas: "amount time" "address tx";
        align-items: start;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(1) {
        grid-area: time;
        font-size: 13px;
        color: var(--history-muted);
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(2) {
        grid-area: amount;
        font-size: 16px;
        font-weight: 600;
        color: var(--history-ink);
        font-variant-numeric: tabular-nums;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(2)::after {
        content: " " var(--history-payout-unit, attr(data-mobile-unit));
        font-size: 12px;
        font-weight: 600;
        color: var(--history-muted);
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(3) {
        grid-area: address;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
        color: var(--history-ink);
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(3) a {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(4) {
        grid-area: tx;
        font-size: 14px;
        font-weight: 600;
        text-align: right;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(4) a {
        white-space: nowrap;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(3)::before,
    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(4)::before {
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        font-weight: 400;
        color: var(--history-muted);
    }
    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(3)::before {
        content: var(--history-payout-address, attr(data-mobile-label));
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(4)::before {
        content: var(--history-payout-tx, attr(data-mobile-label));
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "height luck" "divider divider" "time difficulty" "reward found";
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr::before {
        content: "";
        display: block;
        grid-area: divider;
        height: 1px;
        background: var(--history-card-divider);
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(1) {
        grid-area: height;
        align-self: center;
        color: var(--history-ink);
        font-size: 16px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(2) {
        grid-area: time;
        font-size: 14px;
        color: var(--history-ink);
        font-variant-numeric: tabular-nums;
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(3) {
        grid-area: luck;
        text-align: right;
        align-self: center;
        font-size: 14px;
        font-weight: 600;
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(3)::after {
        content: " " var(--history-block-luck, attr(data-mobile-label));
        font-size: 12px;
        font-weight: 400;
        color: var(--history-muted);
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(2)::before,
    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(4)::before,
    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(5)::before {
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        font-weight: 400;
        color: var(--history-muted);
    }
    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(2)::before {
        content: var(--history-block-time, attr(data-mobile-label));
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(5)::before {
        content: var(--history-block-diff, attr(data-mobile-label));
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(4)::before {
        content: var(--history-block-reward, attr(data-mobile-label));
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(5) {
        grid-area: difficulty;
        text-align: right;
        font-size: 14px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        color: var(--history-ink);
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(4) {
        grid-area: reward;
        font-size: 14px;
        color: var(--history-ink);
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(6) {
        grid-area: found;
        font-size: 14px;
        color: var(--history-ink);
    }

    /* Pro view: "Found By" sits in the right-hand column next to the reward, label above the value like the
       other cells (the light view keeps it as a full-width row, see below) */
    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(6)::before {
        content: var(--history-block-found, attr(data-mobile-label));
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        font-weight: 400;
        color: var(--history-muted);
    }
}

/* Light view (html[data-k-view="light"]): luck and net/share difficulty are hidden, so the reward takes the
   right-hand slot next to the time instead of a row of its own */
@media (max-width: 767px) {
    html[data-k-view="light"] .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr {
        grid-template-areas: "height height" "divider divider" "time reward" "found found";
    }

    html[data-k-view="light"] .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(6)::before {
        content: var(--history-block-found, attr(data-mobile-label)) " ";
        display: inline;
        margin: 0 6px 0 0;
    }

    html[data-k-view="light"] .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(4) {
        text-align: right !important;   /* the base cell rule wins on specificity: its :is() lists #payoutsDT */
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }
}

@media (max-width: 359px) {
    .pool-history-mobile table:is(#payoutsDT, .newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr {
        padding: 10px;
        gap: 9px;
    }

    .pool-history-mobile #payoutsDT > tbody > tr > td:nth-child(2) {
        font-size: 16px;
    }

    .pool-history-mobile table:is(.newBlocksDT, .immatureBlocksDT, .maturedBlocksDT, .immatureTokenBlocksDT, .maturedTokenBlocksDT) > tbody > tr > td:nth-child(1) {
        font-size: 15px;
    }
}
