/* ZCOOL KuaiLe is the CRUNCH logo font only; everything else is Dosis. Both are bundled so they load offline. */
@font-face {
    font-family: ZCOOL KuaiLe;
    src: url("../fonts/ZCOOLKuaiLe-Regular.ttf");
}
@font-face {
    font-family: Dosis;
    src: url("../fonts/Dosis.ttf") format("truetype");
    font-weight: 200 800;
    font-display: block;
}

/* No grey flash on tap (Android's WebView highlights anything tappable) */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Black behind everything, so a sub-pixel gap at the screen edge (the page is sized in whole pixels) never shows white */
html {
    background: #000;
}

body {
    background: #000;
    margin: 0;
    width: 100%;
    min-height: 100vh;
    height: 100%;
    overflow: hidden;
    font-family: 'Dosis', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/*PRELOADER*/
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preloader-status {
    position: absolute;
    background-repeat: no-repeat;
    background-position: center;
    color: #fff;
}

/*GAME*/
#game-canvas {
    background: #000;
}
canvas {
    position: fixed;
    background: transparent;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
#joystick {
    position: absolute;
    left: 0;
    bottom: 0;
    top: 0;
    right: 0;
}

/*CLOSE BUTTONS*/
/* The X on the How to Play, customisation and leaderboard pages: all the same size and in the same place
   (top right, level with the shirt and pause buttons). game.js sets the size and offsets from the scale. */
#customisation-close, #close-how-to, #leaderboard-close, #mode-picker-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 33px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    letter-spacing: 0;
    line-height: 1;
    color: #fff;
}
#customisation-close::before, #close-how-to::before, #leaderboard-close::before, #mode-picker-close::before {
    line-height: 1;
}

/*CLICKABLE THINGS*/
#play-button, #how-to-button, #fastest-time, #menu-customise, #privacy-link, #privacy-policy-link,
#menu .menu-money, #pause-button, #pause-menu-resume, #pause-menu-quit, #play-again-button,
#game-over-menu, .continue-btn, #close-how-to, .how-to-next, #customisation-close, #customisation-cta,
.customisation-option, #leaderboard-close, #mode-picker-close, #mode-button, .mode-card, #leaderboard-you, #customisation .menu-money {
    cursor: pointer;
}

/*PAUSE*/
#pause-button {
    position: absolute;
    top: 0;
    right: 0;
    color: #ffffff6e;
    /*font-size: 1.5em;*/
    padding: 0.2em;
}
#pause-menu {
    align-items: center;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    color: white;
    background: rgba(0, 0, 0, 0.50);
    font-family: 'Dosis', sans-serif;
    font-size: 18px;
}
#pause-menu > div {
    text-align: center;
}
#pause-menu-buttons {
    margin: 20px;
}
#pause-menu-buttons div {
    margin: 20px 22px;
    display: inline-block;
    font-weight: 600;
    font-size: 22px;
}

/*GAME OVER*/
#game-over {
    align-items: center;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    color: white;
    background: rgba(0, 0, 0, 0.50);
    font-family: 'Dosis', sans-serif;
    font-size: 18px;
}
#game-over > div {
    text-align: center;
}
#continue-options {
    margin: 0;
}
#continue-label {
    font-size: 18px;
    letter-spacing: 3px;
    opacity: 0.8;
    margin-bottom: 6px;
}
#continue-row {
    display: flex;
    justify-content: center;
    gap: 14px;
}
/* The hole sits in the middle of the screen. With a continue offer, the heading, the options and the
   buttons are placed relative to that centre so the hole has clear space above and below it. */
#game-over.with-continue > div {
    position: relative;
    width: 100vw;
    height: 0;
}
#game-over.with-continue #game-over-heading {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 62px;
    margin: 0;
    font-size: 34px;
}
/* Endless fills this in with the depth reached and the best depth; it sits between the heading and the options */
#game-over.with-continue #game-over-stats {
    position: absolute;
    left: 0;
    right: 0;
    top: -50px;
}
#game-over.with-continue #game-over-score-text {
    font-size: 15px;
    letter-spacing: 3px;
}
#game-over.with-continue #game-over-score {
    font-size: 34px;
    margin-top: 0;
    line-height: 1.1;
}
#game-over.with-continue #game-over-best {
    font-size: 15px;
    min-height: 0;
}
#game-over.with-continue #continue-options {
    position: absolute;
    left: 0;
    right: 0;
    top: 50px;
}
#game-over.with-continue #game-over-buttons {
    position: absolute;
    left: 0;
    right: 0;
    top: 132px;
    margin: 0;
}
#game-over.with-continue #game-over-buttons div {
    margin: 0 22px;
    font-size: 22px;
}
#continue-or {
    align-self: center;
    font-size: 16px;
    letter-spacing: 3px;
    opacity: 0.6;
}
.continue-btn {
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    padding: 0.2em 0.7em;
    font-size: 20px;
    font-weight: 600;
}
.continue-btn.disabled {
    opacity: 0.35;
}
#game-over-buttons {
    margin: 20px;
}
#game-over-buttons div {
    margin: 20px 22px;
    display: inline-block;
    font-weight: 600;
    font-size: 22px;
}
#game-over-score {
    font-size: 46px;
    margin-top: 10px;
    /*    font-family: "Arial";*/
}
/* Under the winning time: NEW BEST, or the best time to beat */
#game-over-best {
    font-size: 20px;
    letter-spacing: 3px;
    min-height: 1.2em;
    opacity: 0.75;
}
#game-over-best.new-best {
    color: #ffc34d;
    opacity: 1;
    font-weight: 600;
}

/*MENU*/
#menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Dosis', sans-serif;
    font-size: 18px;
    letter-spacing: 4px;
}
#menu > div {
    text-align: center;
}

#menu-logo {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 60px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    letter-spacing: 6px;
    margin-bottom: 1.5em;
    line-height: 0;
    }
#menu #play-button {
    color: rgba(255, 255, 255, 0.8);
    font-size: 46px;
    line-height: 0;
    animation: pulse 2s infinite;
}
#menu #how-to-button {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    letter-spacing: 0.13em;
    margin: 0.4em 0 0.8em;
}
#menu #mode-button {
    color: rgba(255, 255, 255, 0.55);
    font-size: 17px;
    letter-spacing: 0.13em;
    margin: 0.9em 0 0;
    cursor: pointer;
}
#menu #mode-button::before { content: "MODE: "; opacity: 0.6; }
#menu #mode-button .fal { margin-left: 2px; font-size: 1.1em; vertical-align: -1px; }
#menu #fastest-time {
    padding-top: 9px;
}
#menu #options-button {
    color: rgba(255, 255, 255, 0.8);
    font-size: 34px;
    margin: 0.5em 0;
}
#privacy-desc {
    font-size: 0.7em;
    line-height: 1.2em;
}
#privacy-policy-link {
    margin-top: 0.4em;
    text-decoration: underline;
    display: block;
}
#privacy-policy-link, #privacy-policy-link:active, #privacy-policy-link:hover, #privacy-policy-link:visited {
    color: rgba(255, 255, 255, 0.8);
}
#privacy-link {
    position: absolute;
    bottom: 6px; /* game.js sets left and bottom from the scale, to keep it clear of rounded screen corners */
    left: 9px;
    padding: 0.3em;
    letter-spacing: 0.13em;
}
/* A link to the Google Play listing, only on the version on the owner's own website (target-own); where PRIVACY sits in the app */
#play-store-link {
    display: none;
    position: absolute;
    bottom: 6px;
    left: 9px;
    padding: 0.4em 0.8em;
    letter-spacing: 0.13em;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    text-decoration: none;
    cursor: pointer;
}
.target-own #play-store-link { display: block; }
#play-store-link:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
/* The app version in the bottom right corner, faint (game.js sets right and bottom from the scale, like the privacy link) */
#version-label {
    position: absolute;
    bottom: 6px;
    right: 9px;
    padding: 0.3em;
    letter-spacing: 0.13em;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

/*LEADERBOARD*/
#menu #fastest-time {
    cursor: pointer;
}
#menu #fastest-time .fa-trophy {
    margin-left: 0.4em;
    font-size: 0.85em;
    opacity: 0.8;
}
/* The mode picker: Endless and Classic side by side */
#mode-picker {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.98);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Dosis', sans-serif;
}
#mode-picker-box {
    width: min(620px, 92vw);
    text-align: center;
}
#mode-picker-title {
    font-size: 26px;
    letter-spacing: 5px;
    margin: 0 0 14px;
}
#mode-picker-cards {
    display: flex;
    gap: 14px;
    justify-content: center;
}
.mode-card {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    padding: 14px 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.mode-card.selected {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}
.mode-card-name {
    font-size: 26px;
    letter-spacing: 4px;
    margin-bottom: 8px;
}
.mode-card-desc {
    font-size: 16px;
    line-height: 1.25;
    opacity: 0.75;
    flex: 1 1 auto;
}
.mode-card-tag {
    visibility: hidden;
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 3px;
    opacity: 0.6;
}
.mode-card.selected .mode-card-tag {
    visibility: visible;
}
#leaderboard {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Dosis', sans-serif;
}
#leaderboard-box {
    width: min(520px, 80vw);
    max-height: calc(100% - 16px);
    display: flex;
    flex-direction: column;
    text-align: center;
}
#leaderboard-box > * {
    flex: none;
}
#leaderboard-title {
    font-size: 30px;
    letter-spacing: 4px;
    margin: 0 0 2px;
}
/* Which board this is: the mode is the title, this says what the numbers are */
#leaderboard-subtitle {
    font-size: 14px;
    letter-spacing: 4px;
    opacity: 0.6;
    margin-bottom: 10px;
}
/* The list scrolls (the top 100), so it fits whatever height the screen has */
#leaderboard-list {
    flex: 1 1 auto !important;
    min-height: 90px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 18px;
    scrollbar-width: none;
}
#leaderboard-list::-webkit-scrollbar {
    display: none;
}
.leaderboard-row {
    flex-shrink: 0;
}
.leaderboard-row {
    display: flex;
    gap: 14px;
    padding: 1px 10px;
    border-radius: 4px;
    text-align: left;
}
.leaderboard-row.you {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.leaderboard-rank {
    width: 2em;
    opacity: 0.6;
}
.leaderboard-player {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.leaderboard-time {
    letter-spacing: 2px;
}
.leaderboard-message {
    padding-top: 70px;
    opacity: 0.7;
    letter-spacing: 3px;
}
#leaderboard-best {
    margin-top: 2px;
    font-size: 18px;
    letter-spacing: 2px;
    color: #fff;
}
#leaderboard-you {
    margin-top: 8px;
    font-size: 18px;
    cursor: pointer;
}
#leaderboard-you-label {
    opacity: 0.6;
}
#leaderboard-name {
    margin: 0 0.3em;
    color: #fff;
}
#leaderboard-you .fa-pen {
    font-size: 0.8em;
    opacity: 0.7;
}
.leaderboard-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    font: 600 28px 'Dosis', sans-serif;
    text-align: center;
    color: #fff;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    outline: 0;
}

/*HOW TO*/
#how-to {
    min-height: 100vh;
    background: #000;
    position: absolute;
    width: 100%;
    height: 100%;
}
.how-to-page {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
}
.how-to-page div {
    margin: 20px;
    max-width: 30%;
}
.how-to-page p {
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Dosis', sans-serif;
    font-size: 1.65em;
}
#how-to img, #how-to video {
    width: 100%;
}
#how-to-hole {
    position: static; /* the global canvas rule makes canvases fixed */
    display: block;
    width: 100%;
    height: auto;
}
.how-to-page .how-to-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 30%; /* a set width, so that four icons make two rows of two (and the two on the Classic page stay side by side) */
}
/* Pages with more text use smaller sizes so they fit a landscape phone */
.how-to-page.how-to-medium p {
    font-size: 1.45em;
}
.how-to-page.how-to-small p {
    font-size: 1.3em;
    margin: 0.5em 0;
}
#how-to .how-to-icons img {
    width: 46%; /* two per row with the gap between them (48% plus the gap was just over a full row) */
    height: auto;
    align-self: center;
}
.how-to-next {
    border: 2px solid rgb(255 255 255 / 80%);
    display: inline-block;
    padding: 10px;
    border-radius: 5px;
    float: right;
}

/*CUSTOMISATION*/
#menu-customise::before {
    font-size: 1.15em;
    line-height: 1;
}
/* A square button level with the antimatter counter; game.js sets its size, top and right from the scale */
#menu-customise {
    letter-spacing: 0; /* the menu's letter spacing would add a gap after the glyph and push it off centre */
    position: absolute;
    top: 7px;
    right: 14px;
    font-size: 24px;
    box-sizing: border-box;
    width: 1.9em;
    height: 1.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid #ffffffb8;
    box-shadow: 0 0 10px 0px #fff;
    border-radius: 5px;
}
#customisation {
    min-height: 100vh;
    position: absolute;
    width: 100%;
    height: 100%;
}
#customisation-grid {
    margin-left: 50%;
    width: 50%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
/* Each tile is a little picture of the black hole in that colour (drawn by menu.js into .tile-hole), on a dark
   backdrop with a glow in the colour, and its name underneath. --glow is set per tile by menu.js. */
.customisation-option {
    position: relative;
    width: 3.6em;
    height: 3.6em;
    border-radius: 0.7em;
    margin: 0.6em 0.5em;
    background: radial-gradient(circle at 50% 50%, #12121f 0%, #05050a 70%, #000 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 16px -3px var(--glow, #fff);
    transition: box-shadow 0.2s, transform 0.2s;
}
.customisation-option .tile-hole {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    animation: tile-spin 24s linear infinite;
}
@keyframes tile-spin { to { transform: rotate(360deg); } }
.customisation-row {
    display: flex;
    justify-content: center;
    align-items: center;
}
/* Locked colours are dimmed and grey until bought (the price badge sits on top) */
.customisation-option.locked .tile-hole {
    filter: grayscale(0.3) brightness(0.72);
}
.customisation-option.locked {
    box-shadow: none;
}
/* The colour currently in use: a bright ring and a stronger glow */
.customisation-option.selected {
    box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff, 0 0 22px 0 var(--glow, #fff);
    transform: scale(1.06);
}
/* Price badge on locked tiles, taken from the tile's data-cost */
.customisation-option.locked:before {
    content: attr(data-cost);
    position: absolute;
    bottom: -0.3em;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 0.45em 0 1.45em;
    border-radius: 0.6em;
    background: url(../img/antimatter.png) no-repeat 0.2em 50% / 1.1em auto, #000000d0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-family: 'Dosis', sans-serif;
    font-size: 0.85em;
    line-height: 1.3em;
    z-index: 1;
}
#customisation-cta {
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Dosis', sans-serif;
    font-size: 1.7em;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    padding: 0.35em;
    margin-top: 1em;
}
#customisation-cta.disabled {
    opacity: 0.2;
}

/*MONEY*/
/* Same look and place as the in-game counter (#hud-money); game.js sets the size, top and left from the scale */
.menu-money {
    position: absolute;
    top: 7px;
    left: 14px;
    font-size: 22px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Dosis', sans-serif;
    letter-spacing: normal;
}
/* Antimatter balance while playing, on the pause menu and on game over: top left, level with the timer */
#hud-money {
    position: fixed;
    top: 7px;
    left: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    pointer-events: none; /* taps go through to the game */
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Dosis', sans-serif;
    font-size: 22px;
}
#hud-money .menu-money-icon {
    height: 1.7em;
    margin-right: 0.35em;
}
#hud-money .menu-money-balance {
    font-size: 1em;
    color: inherit;
}
.menu-money-icon {
    height: 1.7em;
    margin-right: 0.35em;
}
.am-inline {
    height: 1.1em;
    vertical-align: -0.2em;
    margin: 0 0.1em;
}
/* The dialog library sets height:auto on images inside its boxes; match its selector to win */
.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content img.am-inline,
.jconfirm .jconfirm-box .jconfirm-buttons button img.am-inline {
    height: 1.1em;
    width: auto;
    max-width: none;
}
.menu-money-balance {
    font-size: 1em;
    color: inherit;
}

/*JCONFIRM*/
.jconfirm .jconfirm-box {
    background-color: #0000006b;
    color: #fff;
    text-align: center;
    padding: 2.5em 2em 1.5em 2em;
}
.jconfirm .jconfirm-holder {
    max-width: 30em;
    margin: auto;
}
/* The rename dialog sits at the top of the screen, clear of the on-screen keyboard */
.jconfirm.jconfirm-top .jconfirm-cell {
    vertical-align: top;
}
.jconfirm.jconfirm-top .jconfirm-box {
    background-color: #000; /* solid, so the leaderboard behind does not show through the text */
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    padding: 1em 1.5em 0.9em 1.5em;
}
.jconfirm.jconfirm-top .jconfirm-holder {
    padding-top: 10px;
}
.jconfirm-buttons {
    float: none !important;
}
.jconfirm-buttons button.btn-default, .jconfirm-buttons button.btn-default:focus {
    background-color: unset !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    outline: 0 !important;
}
.jconfirm .jconfirm-box, .jconfirm-buttons button {
    font-family: 'Dosis', sans-serif;
}
.jconfirm-buttons button {
    font-size: 20px !important;
    font-weight: 600 !important;
}
.jconfirm-content {
    font-family: 'Dosis', sans-serif;
    font-size: 34px;
    text-transform: uppercase;
    line-height: 1.3em;
}
.jconfirm.jconfirm-white .jconfirm-bg, .jconfirm.jconfirm-light .jconfirm-bg {
    background-color: #000;
}




/*KEYFRAMES*/
@keyframes pulse {
    0% {
        transform: scale(0.95);
    }

    50% {
        transform: scale(1);
    }

    100% {
        transform: scale(0.95);
    }
}
/* The CrazyGames version: no privacy link or version label (the app's), no leaderboard (the trophy and the tap) */
.target-web #privacy-link, .target-web #version-label, .target-web #fastest-time .fa-trophy { display: none !important; }
.target-web #fastest-time { pointer-events: none; }
