/* Phones and narrow tablets. The desktop pages are drawn for a 920-pixel
   column with everything absolutely positioned, the logo and the header band
   baked into the background image. Below 940 pixels the same elements flow in
   one column instead: logo (background) and nav, the page title image, the
   text at a readable size, the footer buttons, the social and store badges.
   Wider screens keep the desktop layout (base.css / index.css) untouched.
   Linked from every page after base.css or index.css, with a viewport meta. */
@media (max-width: 939px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        margin: 0;
        font-size: 16px;
        line-height: 1.5;
        overflow-wrap: break-word;
        /* The background image fades into the page colour under the header:
           its desktop bands (a line at 258 pixels, the image's end at 1055)
           would otherwise cross the text */
        background-image: linear-gradient(to bottom, rgba(21, 81, 158, 0) 140px, #15519e 240px), url('images/bg_inside.png');
        background-size: 100% 1100px, auto;
        background-repeat: no-repeat;
        background-position: top center;
        background-attachment: scroll;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    /* ---- Header: the logo (in the background) and the nav under it ---- */
    #logo_holder {
        position: static;
        display: block;
        width: 180px;
        height: 104px;
        margin: 0 auto;
    }

    #header {
        position: static;
        width: auto;
        margin: 0;
        padding: 4px 8px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        font-size: 17px;
        line-height: 1.2;
        border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    }

    /* claim.html has no logo link: leave the logo's room all the same */
    body:not(.index) > #header:first-child {
        margin-top: 104px;
    }

    #header a,
    #header img {
        position: static;
    }

    #header a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 10px;
    }

    /* ---- Content column ---- */
    #button_holder_center,
    #scroller {
        position: static;
        width: auto;
        margin: 0;
    }

    #scroller {
        padding: 0 16px;
    }

    #title {
        position: static;
        display: block;
        margin: 20px auto 8px;
    }

    /* The decorative tile column next to the text */
    #left_graphic {
        display: none;
    }

    #left_graphic_store {
        position: static;
        display: block;
        margin: 16px auto 0;
        max-width: 60%;
    }

    #text {
        position: static;
        width: auto;
        max-width: 40em;
        height: auto;
        overflow: visible;
        margin: 0 auto;
        padding: 8px 0 16px;
    }

    #text h2,
    h2 {
        font-size: 20px;
        line-height: 1.3;
        margin: 20px 0 8px;
    }

    #text ul,
    #text ol {
        padding-left: 22px;
    }

    #text li {
        margin-bottom: 6px;
    }

    #text a {
        padding: 2px 0;
    }

    /* Desktop nudges written into the pages (FAQ captions placed beside an
       image, the PayPal button, ...) would push text off a narrow screen */
    #text [style*="position"] {
        position: static !important;
    }

    .rect {
        margin: 16px 0;
        padding: 16px;
        padding-bottom: 16px !important;
        overflow: hidden;   /* contains its floated images */
    }

    /* FAQ pictures: the side-by-side pairs stay side by side at half width,
       the small icons float beside their text, the wide ones take the width */
    .content_image {
        float: left;
        max-width: 45%;
        margin: 4px 12px 8px 0;
    }

    .content_image[src*="FAQ_GRAPHIC"] {
        width: 48%;
        max-width: 48%;
        margin: 8px 0 8px 0;
    }

    .content_image[src*="FAQ_GRAPHIC"] + .content_image[src*="FAQ_GRAPHIC"] {
        margin-left: 4%;
    }

    .content_image[src*="COUNT"],
    .content_image[src*="START"],
    .content_image[src*="SHUFFLE"],
    .content_image[src*="GIGH_SCORE"],
    .content_image[src*="100_EXTRA"],
    .content_image[src*="SEQ_2x"],
    .content_image[src*="SCORE_4x"],
    .content_image[src*="CURRENT_GAMES"],
    .content_image[src*="RULES_GRAPHIC"],
    #text img[src*="SEQ.png"],
    #text img[src*="NUMBERS_BAG"] {
        float: none;
        display: block;
        max-width: 100%;
        margin: 12px auto;
    }

    /* The bonus-square captions are spaced with em spaces for two pictures
       side by side on desktop */
    .content_image[src*="SEQ_2x"] + .non_float {
        text-align: center;
        white-space: nowrap;
        font-size: min(13px, 3.5vw);
    }

    /* ---- Forms (store, claim) ---- */
    #text table,
    #claim table {
        width: 100%;
        border-collapse: collapse;
    }

    #text td,
    #claim td {
        padding: 4px 4px 4px 0;
        vertical-align: middle;
    }

    #text input[type="text"],
    #text select,
    #claim input[type="text"] {
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        min-height: 40px;
        font-size: 16px;   /* iOS zooms into smaller fields */
    }

    #claim {
        position: static;
        width: auto;
        height: auto;
        margin: 24px 16px;
    }

    #claim td:first-child {
        width: 45%;
    }

    #claim input[type="submit"] {
        min-height: 44px;
        min-width: 120px;
        font-size: 16px;
    }

    /* ---- Rankings: the 768-pixel table scrolls inside its own box ---- */
    #ratings_logo_top {
        position: static;
        display: block;
        max-width: 50%;
        margin: 16px auto;
    }

    #ratings_table_scroller {
        position: static;
        width: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 8px;
    }

    #table_header,
    #ratings_table_div {
        position: static;
        top: 0;
    }

    #ratings_table_div {
        height: auto;
        max-height: 60vh;
    }

    #badge_popup {
        position: fixed;
        top: 80px;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: 500px;
        margin: 0 auto;
        overflow-x: auto;
    }

    .badges_table img {
        max-width: none;
    }

    /* ---- Footer: page buttons, notice, social and store badges ---- */
    #button_holder {
        position: static;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        padding: 20px 8px 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.25);
        margin-top: 8px;
    }

    #button_holder a {
        display: block;
        line-height: 0;
    }

    .button {
        position: static;
        display: block;
        height: 40px;
        width: auto;
        max-width: none;
    }

    #cp_notice {
        position: static;
        text-align: center;
        padding: 8px 16px;
    }

    #bottom_row,
    #bottom_row_ratings {
        position: static;
        width: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px 12px;
        padding: 8px 16px 32px;
    }

    #bottom_row a,
    #bottom_row_ratings a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    #bottom_row img,
    #bottom_row_ratings img {
        position: static;
    }

    /* ---- Home page (index.css): logo in the background under the nav ---- */
    body.index {
        background-image: linear-gradient(to bottom, rgba(21, 81, 158, 0) 250px, #15519e 370px), url('images/bg_index.png');
        background-position: center 52px;
    }

    body.index #header {
        border-bottom: none;
    }

    body.index #scroller {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 150px;   /* the background's logo */
    }

    body.index #scroller > center {
        order: 1;
    }

    body.index #links_right {
        order: 2;
    }

    body.index #scroller > a {
        order: 3;
    }

    body.index #links_left {
        order: 4;
    }

    body.index #links_left,
    body.index #links_right {
        position: static;
        width: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin: 16px 0 8px;
    }

    body.index #links_right br {
        display: none;
    }

    body.index #play_appstore,
    body.index #play_facebook,
    body.index #play_browser,
    body.index #play_android,
    body.index #img_ratings {
        position: static;
        display: block;
    }

    /* Follow / Like: the button picture with its icon over the left end */
    body.index #scroller > a {
        position: relative;
        display: block;
        width: 241px;
        height: 60px;
        margin: 8px auto 0;
    }

    body.index .home_button,
    body.index #hb_twitter {
        position: absolute;
        top: 0;
        height: 60px;
        max-width: none;
    }

    body.index .home_icon,
    body.index #hi_twitter {
        position: absolute;
        top: 12px;
        height: 37px;
        max-width: none;
    }

    body.index #button_holder {
        margin-top: 16px;
    }
}
