/* =====================================================================
   The pages outside the library: home, sign in, account, apps, billing,
   legal; plus the shell's terms gate and the plan banner the library
   and the player show. Builds on theme.css.
   ===================================================================== */

/* ---- Loading and failure states -------------------------------------- */
.pg-loading {
    margin: 48px 0;
    color: var(--fg-2);
    font-family: var(--font-meta);
    font-size: var(--text-sm);
}

.pg-fail {
    max-width: 640px;
    margin: 40px auto;
    padding: 0 16px;
}

.pg-actions, .hm-cta, .br-actions, .ac-actions, .pl-actions, .sh-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

html.pg-play-fail body {
    overflow: auto;
}

/* ---- Home -------------------------------------------------------------- */
.hm-hero {
    padding: 40px 0 24px;
    max-width: 820px;
}

.hm-title {
    margin: 16px 0 0;
    font-size: clamp(38px, 6vw, 64px);
    line-height: 1.02;
}

.hm-systems {
    margin-top: 18px;
    font-family: var(--font-meta);
    font-size: var(--text-sm);
    color: var(--fg-2);
}

.hm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 40px;
}

.hm-card {
    padding: 24px 26px;
    border-radius: var(--r-lg);
}

    .hm-card h3 {
        margin: 0 0 8px;
    }

    .hm-card p {
        margin: 0;
    }

.hm-pricing {
    display: flex;
    justify-content: center;
    margin-top: 64px;
}

.hm-price {
    width: 100%;
    max-width: 460px;
    padding: 32px;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
    text-align: left;
}

.hm-amount {
    margin: 12px 0 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 44px;
    letter-spacing: -.03em;
    line-height: 1.1;
}

.hm-limit {
    margin: 6px 0 18px;
    color: var(--fg-0);
}

.hm-list {
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

    .hm-list li {
        position: relative;
        padding-left: 26px;
        margin: 8px 0;
    }

        .hm-list li::before {
            content: "";
            position: absolute;
            left: 2px;
            top: .55em;
            width: 12px;
            height: 7px;
            border-left: 2px solid var(--teal);
            border-bottom: 2px solid var(--teal);
            transform: rotate(-45deg);
        }

.hm-fine, .ac-fine, .si-fine {
    font-family: var(--font-meta);
    font-size: var(--text-xs);
    color: var(--fg-2);
    line-height: 1.6;
}

.hm-fine {
    margin: 14px 0 0;
}

.hm-faq {
    max-width: 760px;
    margin: 72px auto 0;
}

    .hm-faq details {
        border-bottom: 1px solid var(--line);
        padding: 14px 0;
    }

    .hm-faq summary {
        cursor: pointer;
        color: var(--fg-0);
        font-weight: 600;
        font-size: 17px;
        list-style: none;
    }

        .hm-faq summary::-webkit-details-marker {
            display: none;
        }

        .hm-faq summary::after {
            content: "+";
            float: right;
            color: var(--teal);
            font-weight: 400;
        }

    .hm-faq details[open] summary::after {
        content: "–";
    }

    .hm-faq details p {
        margin: 10px 0 4px;
    }

/* ---- Sign in ----------------------------------------------------------- */
.si-card {
    max-width: 440px;
    margin: 24px auto;
    padding: 36px 32px 28px;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.si-mark .sh-mark {
    width: 52px;
    height: 52px;
}

.si-title {
    margin: 14px 0 6px;
    font-size: 30px;
}

.si-lead {
    margin: 0 0 22px;
}

.si-providers {
    display: grid;
    gap: 10px;
}

.si-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 18px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-2);
    background: rgba(255,255,255,.04);
    color: var(--fg-0);
    font: inherit;
    font-weight: 600;
    font-size: var(--text-body);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}

    .si-provider:hover:not(:disabled) {
        background: rgba(255,255,255,.08);
        border-color: rgba(16,202,188,.4);
    }

    .si-provider:disabled {
        opacity: .6;
        cursor: wait;
    }

    .si-provider svg {
        width: 20px;
        height: 20px;
        flex: none;
    }

    .si-provider.is-busy {
        border-color: var(--teal);
    }

    /* Google's and Microsoft's own buttons (page-signin.js): the picture is the button, at its own size; the
       hover, focus and busy marks go around it, never over it */
    .si-provider--brand,
    .si-provider--brand:hover:not(:disabled) {
        width: auto;
        justify-self: center;
        padding: 0;
        border: 0;
        border-radius: 4px;
        background: none;
    }

        .si-provider--brand img {
            display: block;
        }

        .si-provider--brand:hover:not(:disabled),
        .si-provider--brand:focus-visible,
        .si-provider--brand.is-busy {
            outline: 2px solid var(--teal);
            outline-offset: 3px;
        }

.si-wait {
    color: var(--fg-2);
    font-size: var(--text-sm);
}

.si-error, .ac-err, .pl-err, .sh-modal-err {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    background: rgba(255,107,107,.1);
    border: 1px solid rgba(255,107,107,.35);
    color: #ffc2c2;
    font-size: var(--text-sm);
    text-align: left;
}

.si-error {
    margin: 0 0 16px;
}

.si-fine {
    margin: 22px 0 0;
}

/* ---- The plan banner (library, player) --------------------------------- */
.pl-slot {
    margin-bottom: 24px;
}

.pl-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    padding: 18px 22px;
    border-radius: var(--r-lg);
    border: 1px solid rgba(16,202,188,.35);
    background: linear-gradient(120deg, rgba(16,202,188,.14), rgba(16,202,188,.04));
}

    .pl-banner[data-tone="warn"] {
        border-color: rgba(240,180,60,.4);
        background: linear-gradient(120deg, rgba(240,180,60,.14), rgba(240,180,60,.04));
    }

.pl-text {
    flex: 1 1 320px;
}

.pl-title {
    color: var(--fg-0);
    font-size: 18px;
}

.pl-body, .pl-note {
    margin: 4px 0 0;
    font-size: var(--text-sm);
}

.pl-actions {
    margin-top: 0;
}

.pl-err {
    flex-basis: 100%;
}

.rm-play .pg-fail .pl-banner {
    margin-top: 24px;
}

/* ---- Account ----------------------------------------------------------- */
.ac-sec {
    margin-top: 22px;
    padding: 24px 26px;
    border-radius: var(--r-lg);
}

.ac-h {
    margin: 0 0 6px;
    font-size: 22px;
}

.ac-lead {
    margin: 0 0 14px;
    font-size: var(--text-sm);
}

.ac-muted {
    color: var(--fg-2);
    font-size: var(--text-sm);
}

.ac-plan {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 10px;
}

.ac-plan-words p {
    margin: 4px 0 0;
}

.ac-badge {
    flex: none;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    font-family: var(--font-meta);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--fg-on-teal);
    background: var(--grad-teal);
}

    .ac-badge[data-tone="warn"] {
        color: #2a1d00;
        background: linear-gradient(135deg, #ffd27a, var(--warn));
    }

.ac-meter {
    margin: 14px 0;
}

.ac-meter-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--fg-0);
    font-size: var(--text-sm);
    margin-bottom: 8px;
}

.ac-meter-bar {
    height: 10px;
    border-radius: var(--r-pill);
    background: rgba(255,255,255,.07);
    overflow: hidden;
}

.ac-meter-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--grad-teal);
    min-width: 2px;
}

    .ac-meter-fill[data-tone="warn"] {
        background: linear-gradient(90deg, #ffd27a, var(--warn));
    }

.ac-list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.ac-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

    .ac-row:first-child {
        border-top: 0;
    }

.ac-row-words {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

    .ac-row-words strong {
        color: var(--fg-0);
    }

.ac-export {
    margin-top: 14px;
}

.ac-export-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ac-export-game {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

    .ac-export-game strong {
        color: var(--fg-0);
    }

.ac-export-files {
    margin: 6px 0 0;
    padding-left: 18px;
}

    .ac-export-files li {
        font-size: var(--text-sm);
        margin: 2px 0;
        word-break: break-all;
    }

.ac-danger {
    border-color: rgba(255,107,107,.3);
}

.ac-confirm {
    display: block;
    margin: 6px 0 14px;
    color: var(--fg-1);
    font-size: var(--text-sm);
}

    .ac-confirm .ds-input {
        margin-top: 8px;
        max-width: 260px;
        display: block;
    }

/* ---- Apps -------------------------------------------------------------- */
.dl-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 36px;
}

.dl-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 24px;
    border-radius: var(--r-lg);
}

    .dl-card h3 {
        margin: 0 0 6px;
    }

    .dl-card p {
        margin: 0 0 18px;
        font-size: var(--text-sm);
        flex: 1;
    }

/* ---- Billing return ---------------------------------------------------- */
.br-card {
    margin: 24px auto;
    padding: 32px;
    border-radius: var(--r-xl);
}

/* ---- Legal documents --------------------------------------------------- */
.legal-doc {
    max-width: 760px;
    margin: 0 auto;
}

    .legal-doc h1 {
        margin: 14px 0 6px;
    }

    .legal-doc h2 {
        margin: 40px 0 10px;
        font-size: 24px;
    }

    .legal-doc h3 {
        margin: 26px 0 8px;
        font-size: 19px;
    }

    .legal-doc p, .legal-doc li {
        line-height: 1.75;
    }

    .legal-doc table {
        width: 100%;
        border-collapse: collapse;
        margin: 14px 0;
        font-size: var(--text-sm);
    }

    .legal-doc th, .legal-doc td {
        text-align: left;
        vertical-align: top;
        padding: 8px 10px;
        border-bottom: 1px solid var(--line);
        color: var(--fg-1);
    }

    .legal-doc th {
        color: var(--fg-0);
        font-weight: 600;
    }

    .legal-doc address {
        font-style: normal;
        color: var(--fg-1);
        line-height: 1.7;
    }

.legal-meta {
    font-family: var(--font-meta);
    font-size: var(--text-xs);
    color: var(--fg-2);
}

/* ---- The terms gate (shell.js) ------------------------------------------ */
html.sh-modal-open, html.sh-modal-open body {
    overflow: hidden;
}

.sh-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
    background: rgba(4,6,6,.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
}

.sh-modal-card {
    width: 100%;
    max-width: 520px;
    padding: 28px;
    border-radius: var(--r-xl);
    background: var(--ink-1);
    box-shadow: var(--shadow-pop);
}

    .sh-modal-card h2 {
        margin: 10px 0 12px;
    }

.sh-terms-list {
    margin: 0 0 18px;
    padding-left: 20px;
}

    .sh-terms-list li {
        margin: 8px 0;
        font-size: var(--text-sm);
    }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
    .dl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hm-grid, .dl-grid {
        grid-template-columns: 1fr;
    }

    .hm-price, .si-card, .br-card, .sh-modal-card {
        padding: 24px 20px;
    }

    .ac-sec {
        padding: 20px 18px;
    }

    .ac-row {
        flex-wrap: wrap;
    }
}
