@import url('https://fonts.googleapis.com/css?family=Hammersmith+One');

/*
 *  General
 */

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: black;
    font-family: 'Hammersmith One', sans-serif;
    font-size: 18px;
}

a, a:link, a:visited, a:active, a:hover {
    letter-spacing: 2px;
    text-decoration: none;
    color: white;
}

ul {
    list-style-type: none;
    padding: 0;
}

/*
 *  Container
 */

.container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28em;
    height: 33em;
    margin-left: -15em;
    margin-top: -16.5em;
    padding: 1em;
    border-radius: 1.5em;
    background-color: #222;
}

/*
 *  Main Menu
 */

.main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 1.5em;
    background-color: #222;
    z-index: 10;
}

.main-menu h1 {
    margin: 0;
    padding: 2.3em 0 0 0;
    text-align: center;
    font-size: 4.5em;
    text-shadow: 0.05em 0.05em 0.05em #111;
    color: #e2d708;
    cursor: default;
}

.main-menu h1 span {
    font-size: 0.6em;
    color: white;
}

.main-menu h2 {
    margin: 0;
    padding: 6em 0 0 0;
    text-align: center;
    font-size: 1.6em;
    color: #999;
}

.main-menu ul {
    margin-top: 2.5em;
    text-align: center;
    font-size: 1.5em;
}

.main-menu li {
    margin: 0;
    padding: 0.5em 0;
}

.main-menu .button {
    cursor: pointer;
    color: #999;
}

.main-menu .button:hover {
    color: white;
}

.main-menu .button em {
    margin-right: 0.5em;
    font-size: 0.7em;
    font-style: normal;
    color: #e2d708;
}

/*
 *  Game
 */

.game-container {
    position: absolute;
    top: 1em;
    left: 1em;
    width: 28em;
    height: 33em;
    background-color: black;
    border-radius: 0.5em;
}

.game-container .board {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
}

.game-container .ghosts {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
}

.game-container .fruit {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 7;
}

.game-container .pacman {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 8;
}

.game-container .animations {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9;
}

.game-container .scores {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.game-container .ready {
    position: absolute;
    top: 19em;
    left: 11.2em;
    width: 5.6em;
    height: 1.6em;
    font-size: 1.5em;
    font-weight: bold;
    color: #e2d708;
    z-index: 11;
    display: none;
}

.game-container .gameover {
    position: absolute;
    top: 19em;
    left: 9em;
    width: 10em;
    height: 1.6em;
    font-size: 1.5em;
    font-weight: bold;
    color: red;
    z-index: 11;
    display: none;
}

.game-container .life {
    position: absolute;
    bottom: 0.5em;
    left: 1em;
    height: 1.5em;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    z-index: 11;
    display: none;
}

.game-container .score {
    position: absolute;
    top: 0.5em;
    left: 1em;
    height: 1.5em;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    z-index: 11;
    display: none;
}

.game-container .high-score {
    position: absolute;
    top: 0.5em;
    right: 1em;
    height: 1.5em;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    z-index: 11;
    display: none;
}

.game-container .sound {
    position: absolute;
    bottom: 0.5em;
    right: 1em;
    width: 1.5em;
    height: 1.5em;
    background-image: url('../images/sound.png');
    background-size: 100% 100%;
    cursor: pointer;
    z-index: 12;
    display: none;
}

.game-container .sound-off {
    background-image: url('../images/sound_off.png');
}

/*
 *  Pause Menu
 */

.pause-menu {
    position: absolute;
    top: 11em;
    left: 8em;
    width: 12em;
    height: 11em;
    border-radius: 1em;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: none;
}

.pause-menu h2 {
    margin: 0;
    padding: 1em 0 0 0;
    text-align: center;
    font-size: 2em;
    color: #e2d708;
}

.pause-menu ul {
    margin-top: 1.5em;
    text-align: center;
    font-size: 1.2em;
}

.pause-menu li {
    margin: 0;
    padding: 0.4em 0;
}

.pause-menu .button {
    cursor: pointer;
    color: #999;
}

.pause-menu .button:hover {
    color: white;
}

/*
 *  High Scores
 */

.high-scores {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 1.5em;
    background-color: #222;
    z-index: 10;
    display: none;
}

.high-scores h2 {
    margin: 0;
    padding: 1.5em 0 0 0;
    text-align: center;
    font-size: 2.5em;
    color: #e2d708;
}

.high-scores ul {
    margin-top: 1em;
    text-align: center;
    font-size: 1.2em;
}

.high-scores li {
    margin: 0;
    padding: 0.2em 0;
    color: white;
}

.high-scores .button {
    margin-top: 1em;
    cursor: pointer;
    color: #999;
}

.high-scores .button:hover {
    color: white;
}

/*
 *  Help
 */

.help {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 1.5em;
    background-color: #222;
    z-index: 10;
    display: none;
}

.help h2 {
    margin: 0;
    padding: 1.5em 0 0 0;
    text-align: center;
    font-size: 2.5em;
    color: #e2d708;
}

.help .content {
    margin: 1em 2em;
    text-align: center;
    font-size: 1em;
    color: white;
    line-height: 1.4em;
}

.help .controls {
    margin-top: 1em;
    font-size: 0.9em;
    color: #999;
}

.help .button {
    margin-top: 1em;
    text-align: center;
    cursor: pointer;
    color: #999;
    font-size: 1.2em;
}

.help .button:hover {
    color: white;
}

/*
 *  Animations
 */

.waves {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3em;
    overflow: hidden;
    z-index: 1;
}

.waves div {
    position: absolute;
    width: 200%;
    height: 100%;
    background-color: #111;
}

.waves div:before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    right: 0;
    background-repeat: repeat;
    height: 10px;
    background-size: 20px 20px;
    background-image:
        radial-gradient(circle at 10px -5px, transparent 12px, #222 13px);
}

.waves div:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    right: 0;
    background-repeat: repeat;
    height: 15px;
    background-size: 40px 20px;
    background-image:
        radial-gradient(circle at 10px 15px, #222 12px, transparent 13px);
}

/**
 * Mobile Responsive Fixes
 */
@media (max-width: 600px) {
    /* Scale the entire em-based layout to fit viewport */
    html, body {
        /* Base width 30em + 2em border = 32em. 100vw / 32 ~= 3.125vw */
        font-size: 3.1vw;
    }
    
    /* Ensure container fits and reset any rigid constraints if necessary */
    #container, .container {
        max-width: 100%;
    }
    
    /* Force canvas to scale visually to the container */
    canvas {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        touch-action: none !important;
    }

    .game-container {
        width: 100% !important;
        touch-action: none !important;
    }
}