/* ============================================================================
 * Minigames page
 *
 * Palette and typography follow the rest of the site:
 *   card            rgb(45, 45, 65)   hover rgb(55, 55, 80)
 *   heading yellow  rgb(255, 250, 175)
 *   primary blue    #4db5da           hover #359abe
 *   positive green  #37bc9b
 *   muted           #223 / #446
 *   font            'Anybody', cursive
 * ========================================================================== */

.page_section {
    padding: 0px;
}

.page_section h2 {
    text-align: center;
    font-family: 'Anybody', cursive;
    margin: 0px;
    margin-bottom: 4px;
    font-size: 24px;
    letter-spacing: 1px;
    color: rgb(255, 250, 175);
    transition: 0.2s;
}

.minigames_container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 30px;
}

/* ---------------------------------------------------------------- minigame */

.minigame {
    width: 100%;
    max-width: 1100px;
    margin-bottom: 20px;
    border-radius: 6px;
    background-color: rgb(45, 45, 65);
    box-shadow: rgba(5, 5, 5, 0.3) 0px 1px 2px 0px, rgba(5, 5, 5, 0.15) 0px 1px 3px 1px;
    text-shadow: 1px 1px 1px #121212;
    font-family: 'Anybody', cursive;
    color: #fff;
    overflow: hidden;
    transition: 0.3s;
}

.minigame:hover {
    background-color: rgb(50, 50, 72);
}

.minigame_header {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.minigame_image {
    position: relative;
    width: 280px;
    min-width: 280px;
    min-height: 190px;
    overflow: hidden;
    background: linear-gradient(135deg, rgb(38, 38, 58) 0%, rgb(28, 28, 44) 100%);
}

.minigame_image img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Sits under the <img>. Visible only when there is no image, or when the
   image fails to load and the <img> removes itself. A soft glow behind the
   mark keeps the panel from reading as a dead grey slab. */
.minigame_image_fallback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 45%,
                rgba(77, 181, 218, 0.20) 0%,
                rgba(77, 181, 218, 0.06) 45%,
                rgba(77, 181, 218, 0) 70%);
    color: rgba(255, 250, 175, 0.38);
    font-size: 76px;
    text-shadow: 0px 4px 14px rgba(0, 0, 0, 0.5);
}

/* Thin accent edge so the panel reads as deliberate art, not a gap. */
.minigame_image:after {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    right: 0;
    width: 3px;
    background: linear-gradient(180deg, #4db5da 0%, #37bc9b 100%);
    opacity: 0.55;
}

.minigame_headline {
    flex: 1;
    min-width: 0;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.minigame_name {
    font-size: 26px;
    letter-spacing: 2px;
    color: rgb(255, 250, 175);
    margin-bottom: 4px;
}

.minigame_tagline {
    font-size: 14px;
    letter-spacing: 1px;
    color: #4db5da;
    margin-bottom: 10px;
}

.minigame_description {
    font-size: 14px;
    font-weight: 100;
    line-height: 1.55;
    color: #b9b9cc;
    max-width: 780px;
}

/* The prize pool on offer. Reward colours match the achievement tiles, the
   chat and the account table, so a figure is recognisable before it is read. */
.minigame_totals {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
}

.minigame_totals_label {
    font-family: 'Anybody', cursive;
    font-size: 11px;
    font-weight: 100;
    letter-spacing: 2px;
    color: #7f7f99;
    margin-right: 10px;
}

.minigame_total {
    font-family: 'Anybody', cursive;
    font-size: 14px;
    letter-spacing: 1px;
    padding: 4px 10px;
    margin-right: 6px;
    margin-bottom: 4px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.22);
    white-space: nowrap;
    cursor: default;
}

.minigame_total i {
    margin-right: 4px;
    font-size: 12px;
}

.minigame_total_coins   { color: rgb(255, 204, 0); }
.minigame_total_tickets { color: #50C878; }
.minigame_total_cases   { color: #A99BFF; }

/* ------------------------------------------------------------------- pills */

.minigame_summary {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 14px;
}

.minigame_pill {
    font-size: 12px;
    letter-spacing: 1px;
    padding: 5px 10px;
    border-radius: 12px;
    margin-right: 8px;
    margin-bottom: 6px;
    background-color: #223;
    white-space: nowrap;
}

/* All pills sit muted. The claim pill earns its colour only when the count is
   above zero -- "0 TO CLAIM" in green reads as an invitation that is not
   actually there. .minigame_pill_active is toggled by PHP on first paint and
   by UpdateCounts() after every sync. */
.minigame_pill_unclaimed { background-color: #2e2e44; color: #8f8fa8; }
.minigame_pill_progress  { background-color: #2e2e44; color: #9a9ab2; }
.minigame_pill_locked    { background-color: #2e2e44; color: #8f8fa8; }
.minigame_pill_done      { background-color: #2e2e44; color: #8f8fa8; }

.minigame_pill_unclaimed.minigame_pill_active {
    background-color: #37bc9b;
    color: #fff;
    box-shadow: 0 0 10px rgba(55, 188, 155, 0.35);
}

/* ----------------------------------------------------------------- actions */

.minigame_actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 16px;
}

.minigame_button {
    display: inline-block;
    outline: none;
    border: none;
    border-radius: 4px;
    font-family: 'Anybody', cursive;
    font-size: 14px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 1px #12121238;
    box-shadow: rgba(5, 5, 5, 0.3) 0px 1px 2px 0px, rgba(5, 5, 5, 0.15) 0px 1px 3px 1px;
    padding: 9px 16px;
    margin-right: 8px;
    margin-bottom: 8px;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
}

.minigame_join_button {
    background-color: #37bc9b;
    font-weight: bold;
    padding: 11px 20px;
}

.minigame_join_button:hover {
    background-color: #2f9e83;
}

.minigame_join_button:disabled {
    background-color: #446;
    cursor: default;
}

.minigame_play_button {
    background-color: #4db5da;
    font-weight: bold;
    padding: 11px 24px;
}

.minigame_play_button:hover {
    background-color: #359abe;
}

/* Status, not a control. Progress refreshes itself on load and every 30s,
   so this only has to tell the user how current the numbers are. */
.minigame_last_refreshed {
    display: inline-flex;
    align-items: center;
    padding: 6px 4px;
    margin-bottom: 8px;
    font-family: 'Anybody', cursive;
    font-size: 12px;
    font-weight: 100;
    letter-spacing: 1px;
    color: #7f7f99;
    cursor: default;
}

.minigame_last_refreshed i {
    margin-right: 6px;
    font-size: 11px;
    opacity: 0.7;
}

.minigame_sync_note {
    display: none;
    padding: 0px 24px 14px 24px;
    font-family: 'Anybody', cursive;
    font-size: 12px;
    letter-spacing: 1px;
}

.minigame_sync_warning {
    color: #f0c419;
}

/* ------------------------------------------------------------ achievements */

.minigame_achievements {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 20px 20px 20px;
    background-color: rgba(0, 0, 0, 0.12);
}

.achievements_heading {
    font-family: 'Anybody', cursive;
    font-size: 14px;
    letter-spacing: 2px;
    color: rgb(255, 250, 175);
    margin: 0px 0px 12px 0px;
}

.achievements_heading_claim {
    color: #37bc9b;
}

.achievements_heading_claim i {
    margin-right: 6px;
}

.achievements_section {
    margin-bottom: 22px;
}

.achievements_section:last-child {
    margin-bottom: 0;
}

/* --- show / hide controls ------------------------------------------------ */

/* Sits on the card edge, full width, so it reads as a lid on the block below
   rather than another action competing with PLAY. */
.achievements_toggle {
    display: block;
    width: 100%;
    background: rgba(0, 0, 0, 0.18);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    outline: none;
    padding: 10px;
    font-family: 'Anybody', cursive;
    font-size: 12px;
    letter-spacing: 2px;
    color: #9a9ab2;
    cursor: pointer;
    transition: 0.25s;
}

.achievements_toggle:hover {
    background: rgba(0, 0, 0, 0.30);
    color: #fff;
}

.achievements_toggle_icon {
    margin-right: 8px;
    font-size: 11px;
}

/* Completed is a sub-toggle, so it is quieter than the block toggle. */
.completed_toggle {
    background: none;
    border: none;
    outline: none;
    padding: 0px 0px 12px 0px;
    font-family: 'Anybody', cursive;
    font-size: 14px;
    letter-spacing: 2px;
    color: rgb(255, 250, 175);
    cursor: pointer;
    transition: 0.25s;
}

.completed_toggle:hover {
    color: #fff;
}

.completed_toggle_icon {
    margin-right: 8px;
    font-size: 11px;
}

/* CSS grid rather than wrapped flex: auto-fill with a uniform gap gives the
   same gutter between every tile AND the same margin on the left and right
   edges, at any width. Wrapped flex could not -- the last row's leftover space
   always piled up on one side. */
.achievements_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.achievements_empty {
    font-family: 'Anybody', cursive;
    font-weight: 100;
    font-size: 13px;
    color: #99a;
    padding: 4px 0px 6px 0px;
}

/* ------------------------------------------------------- achievement tiles */

/* Width and gutters come from the grid; the tile only styles itself. */
.achievement {
    position: relative;
    padding: 14px 16px;
    border-radius: 6px;
    background-color: rgb(52, 52, 74);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid #446;
    box-shadow: rgba(5, 5, 5, 0.25) 0px 2px 6px 0px;
    display: flex;
    flex-direction: column;
    transition: 0.25s;
}

.achievement:hover {
    background-color: rgb(60, 60, 84);
    border-color: rgba(255, 255, 255, 0.10);
    transform: translateY(-1px);
    box-shadow: rgba(5, 5, 5, 0.35) 0px 4px 10px 0px;
}

.achievement_unclaimed { border-left-color: #37bc9b; }
.achievement_locked    { border-left-color: #446; }
.achievement_done      { border-left-color: #223; opacity: 0.75; }

/* Title + reward, ruled off from the progress area below it. */
.achievement_top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.achievement_name {
    font-size: 14px;
    letter-spacing: 1px;
    color: #fff;
    padding-right: 10px;
    line-height: 1.3;
}

/* Reward colours follow the rest of the site so a reward is recognisable at a
   glance, without reading the label:
     coins   rgb(255, 204, 0)  the coin gold used in the header balance  8.0:1
     tickets #50C878           the emerald used for the ticket balance   5.7:1
     cases   #A99BFF           the free-case purple, lifted for dark     5.1:1

   The admin panel's free-case purple is #7B68EE, which only manages 2.9:1 on
   this card background -- fine on the lighter admin tables, too dim here. Same
   hue, raised until it sits alongside the other two.

   Defined once; the PHP and JS renderers both just set the class. */
.achievement_reward {
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
    color: rgb(255, 204, 0);
}

.achievement_reward_coins {
    color: rgb(255, 204, 0);
}

.achievement_reward_tickets {
    color: #50C878;
}

.achievement_reward_case {
    color: #A99BFF;
}

.achievement_reward_none {
    color: #8a8aa5;
}

.achievement_description {
    font-size: 12px;
    font-weight: 100;
    line-height: 1.5;
    color: #a0a0b8;
    margin-bottom: 12px;
    flex: 1;
}

/* ---------------------------------------------------------------- progress */

.achievement_progress_list {
    margin-bottom: 10px;
}

.achievement_progress {
    margin-bottom: 7px;
}

.achievement_progress_label {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 100;
    letter-spacing: 1px;
    color: #aab;
    margin-bottom: 3px;
}

.achievement_progress_value {
    color: #ccd;
    white-space: nowrap;
    padding-left: 8px;
}

.achievement_progress_bar {
    width: 100%;
    height: 7px;
    border-radius: 4px;
    background-color: rgb(32, 32, 48);
    overflow: hidden;
}

.achievement_progress_fill {
    height: 100%;
    border-radius: 4px;
    background-color: #4db5da;
    transition: width 0.4s;
}

.achievement_unclaimed .achievement_progress_fill,
.achievement_done .achievement_progress_fill {
    background-color: #37bc9b;
}

/* ------------------------------------------------------- claim button/state */

.achievement_claim_button {
    outline: none;
    border: none;
    border-radius: 4px;
    width: 100%;
    padding: 8px;
    font-family: 'Anybody', cursive;
    font-size: 13px;
    letter-spacing: 1px;
    color: #fff;
    background-color: #37bc9b;
    text-shadow: 1px 1px 1px #12121238;
    box-shadow: rgba(5, 5, 5, 0.3) 0px 1px 2px 0px;
    cursor: pointer;
    transition: 0.3s;
}

.achievement_claim_button:hover {
    background-color: #2f9e83;
}

.achievement_claim_button:disabled {
    background-color: #446;
    cursor: default;
}

.achievement_status {
    border-radius: 4px;
    width: 100%;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    letter-spacing: 1px;
    box-sizing: border-box;
}

.achievement_status_claimed {
    background-color: #223;
    color: #37bc9b;
}

.achievement_status_preexisting {
    background-color: #223;
    color: #8a8aa5;
}

.achievement_status_locked {
    background-color: #223;
    color: #778;
}

/* ------------------------------------------------------------- empty state */

.no-items {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 0px;
}

.no-items-content {
    text-align: center;
    font-family: 'Anybody', cursive;
    color: #778;
}

.no-items-content i {
    font-size: 48px;
    margin-bottom: 10px;
}

.no-items-content p {
    font-size: 16px;
    letter-spacing: 1px;
    margin: 0;
}

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

@media (max-width: 900px) {
    .minigame_header {
        flex-direction: column;
    }

    /* height, not max-height: the fallback is absolutely positioned, so it
       gives the container no intrinsic height to cap. */
    .minigame_image {
        width: 100%;
        min-width: 0;
        height: 140px;
        min-height: 0;
    }

    .minigame_image_fallback {
        font-size: 48px;
    }

    /* Accent edge runs along the bottom once the card stacks. */
    .minigame_image:after {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: 3px;
        background: linear-gradient(90deg, #4db5da 0%, #37bc9b 100%);
    }

    .achievement {
        width: 100%;
        margin-right: 0px;
    }

    .minigame_button {
        width: 100%;
        margin-right: 0px;
        text-align: center;
    }

    .minigame_last_refreshed {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 460px) {
    .minigame_totals_label {
        width: 100%;
        margin-bottom: 6px;
    }

    .minigame_name {
        font-size: 20px;
    }

    .minigame_headline {
        padding: 14px;
    }

    .minigame_achievements {
        padding: 6px 14px 16px 14px;
    }

    .achievement_top {
        flex-direction: column;
    }

    .achievement_reward {
        margin-top: 4px;
    }
}
