/**
 * Game Fonts
 */
@font-face {
    font-family: "Whimsy TT";
    font-style: normal;
    font-weight: normal;
    src: local("Whimsy TT"), url("../fonts/whimsytt.ttf") format("truetype");
}



/**
 * Main Styles
 */
html, body {
    margin: 0;
    padding: 0;
    border: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #090013 url("../assets/arcade-beauty-bg.png") center center / cover fixed no-repeat;
    backface-visibility: hidden;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(6, 0, 18, 0.2), rgba(8, 0, 25, 0.52) 50%, rgba(8, 0, 25, 0.12));
}
html, body, input {
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Whimsy TT", sans-serif;
    font-size: 18px;
    line-height: 1.5em;
    color: white;
}

h1 {
    font-size: 6em;
    font-weight: normal;
    text-align: center;
}
h2 {
    font-size: 4.5em;
    text-align: center;
}

a {
    color: rgb(204, 204, 204);
    text-decoration: none;
    font-size: 2em;
    line-height: 1.5em;
    transition: all 0.2s;
    outline: none;
}
    a:hover {
        color: white;
        font-size: 2.5em;
    }


#container {
    --ui-scale: 1;
    position: absolute;
    top: 50%;
    bottom: 50%;
    left: 50%;
    right: 50%;
    margin-top: -18.5em;
    margin-left: -16em;
    width: 30em;
    height: 35em;
    background: rgba(0, 0, 0, 0.92);
    box-shadow: 0 1.2em 4em rgba(0, 0, 0, 0.72), 0 0 3em rgba(137, 63, 255, 0.32);
    border: 0.65em solid rgba(156, 94, 255, 0.44);
    border-radius: 0.8em;
    backdrop-filter: blur(8px);
    overflow: hidden;
    transform: scale(var(--ui-scale));
    transform-origin: center center;
    transition: transform 0.22s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body.day-mode {
    background-image: linear-gradient(rgba(255,255,255,0.16), rgba(255,255,255,0.16)), url("../assets/arcade-beauty-bg.png");
}
body.day-mode::before {
    background: linear-gradient(90deg, rgba(255, 238, 195, 0.18), rgba(73, 25, 113, 0.14) 50%, rgba(255, 222, 153, 0.1));
}
body.day-mode #container {
    border-color: rgba(255, 219, 111, 0.78);
    box-shadow: 0 1.2em 4em rgba(0, 0, 0, 0.55), 0 0 3em rgba(255, 211, 92, 0.38);
}



/**
 * Game Design
 */
.board,
.screen,
.game {
    position: absolute;
    top: 1em;
    left: 1em;
}



/**
 * Show / Hide
 */
.mainScreen .main,
.gameOver   .input,
.highScores .high,
.help       .controls {
    display: block;
}

.display {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}



/**
 * MainScreen Design
 */
.main ul {
    text-align: center;
    padding: 0;
    margin-top: 21em;
}
.main li {
    list-style: none;
}

/* The home controls frame the game instead of covering its play area. */
.home-ui {
    position: fixed;
    z-index: 20;
    inset: 0;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.home-screen .home-ui {
    opacity: 1;
    visibility: visible;
}
.home-ui button {
    pointer-events: auto;
    border: 1px solid rgba(186, 132, 255, 0.42);
    color: #fff1bf;
    background: linear-gradient(145deg, rgba(28, 8, 61, 0.96), rgba(64, 18, 91, 0.94));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 0.65em 1.8em rgba(8, 0, 25, 0.36);
    font: 700 0.92rem/1 "Microsoft YaHei", sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.18s ease, opacity 0.2s ease, background 0.18s ease, color 0.18s ease;
}
.home-ui button:hover,
.home-ui button:focus-visible {
    color: #291536;
    background: linear-gradient(135deg, #fff4ad, #ffc85d);
    transform: translateY(-2px);
    outline: none;
}
.top-command-bar {
    position: fixed;
    top: clamp(0.8rem, 2.4vh, 1.6rem);
    left: 50%;
    display: flex;
    gap: 0.38rem;
    padding: 0.38rem;
    transform: translateX(-50%);
    border: 1px solid rgba(151, 90, 225, 0.42);
    border-radius: 1.05rem;
    background: rgba(19, 5, 43, 0.82);
    box-shadow: 0 0.8rem 2.4rem rgba(9, 0, 30, 0.42);
    backdrop-filter: blur(14px);
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.top-command-bar button {
    min-width: 5.1rem;
    height: 2.85rem;
    padding: 0 0.8rem;
    border-radius: 0.72rem;
}
.top-command-bar button span {
    margin-right: 0.26rem;
    font-size: 1.08em;
}
.top-command-bar .recommended {
    color: #291536;
    background: linear-gradient(135deg, #fff4ad, #ffc85d);
    box-shadow: 0 0.4rem 1.3rem rgba(255, 201, 89, 0.2);
}
.floating-control {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    height: 3.25rem;
    padding: 0 1.1rem;
    border-radius: 1.7rem;
}
.restart-chip {
    top: clamp(1rem, 3vh, 2rem);
    left: clamp(1rem, 3vw, 3rem);
}
.settings-orb {
    left: clamp(1rem, 3vw, 3rem);
    bottom: clamp(1rem, 3vh, 2rem);
    width: 3.7rem;
    height: 3.7rem;
    padding: 0;
    border-radius: 50%;
}
.settings-orb .control-icon {
    font-size: 1.55rem;
}
.settings-orb .control-text {
    display: none;
}
.sound-chip {
    right: clamp(1rem, 3vw, 3rem);
    bottom: clamp(1rem, 3vh, 2rem);
}
.minimal-controls .top-command-bar,
.minimal-controls .restart-chip,
.minimal-controls .sound-chip {
    opacity: 0;
    pointer-events: none;
}
.minimal-controls .top-command-bar {
    transform: translateX(-50%) translateY(0.6rem);
}
.minimal-controls .restart-chip,
.minimal-controls .sound-chip {
    transform: translateY(0.6rem);
}
.ui-toast {
    position: fixed;
    z-index: 24;
    bottom: clamp(5.3rem, 10vh, 7rem);
    left: 50%;
    transform: translateX(-50%) translateY(-0.3em);
    padding: 0.48rem 0.9rem;
    border-radius: 1rem;
    color: #2c1741;
    background: rgba(255, 218, 100, 0.95);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.32);
    font: 700 0.8rem/1.4 "Microsoft YaHei", sans-serif;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.ui-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}



/**
 * High Scores Design
 */
.high {
    text-align: center;
}
.scores {
    text-align: center;
    font-size: 1.7em;
}
    .scores .titles,
    .scores .scores,
    .help   .titles,
    .help   .scores {
        float: left;
        clear: both;
        width: 100%;
    }
    .scores .titles {
        margin-bottom: 0.3em;
        color: rgb(255, 255, 51);
    }

    .scores .left,
    .scores .right,
    .help   .left,
    .help   .right {
        float: left;
        width: 40%;
        margin-bottom: 0.3em;
    }
    .scores .left,   .help .left   { text-align: right; }
    .scores .right,  .help .right  { text-align:  left; }
    .scores .middle, .help .middle {
        float: left;
        width: 20%;
        text-align: center;
        margin-bottom: 0.3em;
    }

.none {
    font-size: 2em;
    margin: 5em 0 0 0;
    color: rgb(255, 255, 51);
}

.restore, .back {
    position: absolute;
    bottom: 0.8em;
}
    .restore { left:  0.8em; }
    .back    { right: 0.8em; }



/**
 * Game Over Design
 */
.input {
    text-align: center;
}
.input p {
    font-size: 2em;
    color: rgb(255, 255, 51);
    margin-top: 4em;
}
.input input {
    background-color: transparent;
    border-color: rgb(0, 51, 255);
    border-radius: 0.6em;
    padding: 0.5em;
    font-size: 1.5em;
    margin-right: 0.5em;
}
.input input:focus {
    outline: none;
}
.restart {
    display: block;
    margin-top: 2em;
}



/**
 * Controls Design
 */
.controls ol {
    box-sizing: border-box;
    width: 95%;
    margin: 0 auto;
    font-size: 2em;
    line-height: 1.25em;
    color: rgb(255, 255, 51);
}
.controls ol li {
    margin-bottom: 0.7em;
}
.controls ol li span {
    color: white;
    font-size: 0.62em;
}

.controls a {
    float: right;
    margin-right: 5%;
}



/**
 * Audio Button
 */
.audio {
    position: absolute;
    bottom: 2em;
    left: 12em;
    width: 4em;
    height: 2.2em;
    cursor: pointer;
}
.audio:hover {
    transform: scale(1.2);
    transition: all 0.2s;
}

.audio .triangle {
    position: absolute;
    bottom: 0.2em;
    left: 0.2em;
    border: 1em solid transparent;
    border-right-color: rgb(204, 204, 204);
}
    .audio:hover .triangle { border-right-color: white; }

.audio .box {
    position: absolute;
    bottom: 0.9em;
    left: 1.1em;
    height: 0.6em;
    width: 0.5em;
    background-color: rgb(204, 204, 204);
}
    .audio:hover .box { background-color: white; }

.waves {
    position: absolute;
    bottom: 0;
    left: 2em;
}
    .waves div {
        position: absolute;
        left: 0;
        background-color: rgb(204, 204, 204);
        border-radius: 0 20em 20em 0;
    }
    .waves div:nth-child(1) {
        bottom: 0.3em;
        width:  1.8em;
        height: 1.8em;
    }
    .waves div:nth-child(2) {
        bottom: 0.5em;
        width:  1.4em;
        height: 1.4em;
    }
    .waves div:nth-child(3) {
        bottom: 0.7em;
        width:  1em;
        height: 1em;
    }
    .waves div:nth-child(4) {
        bottom: 0.9em;
        width:  0.6em;
        height: 0.6em;
    }

    .audio:hover .waves div {
        background-color: white;
    }
    .waves div:before {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        right: 0.1em;
        top: 0;
        background-color: black;
        border-radius: 0 20em 20em 0;
    }

@media (max-width: 720px), (max-height: 760px) {
    #container {
        font-size: min(18px, calc(100vw / 34), calc(100vh / 39));
    }
    .top-command-bar {
        top: 0.55rem;
        width: calc(100vw - 1rem);
        box-sizing: border-box;
        gap: 0.2rem;
        padding: 0.28rem;
        border-radius: 0.8rem;
    }
    .top-command-bar button {
        flex: 1 1 0;
        min-width: 0;
        height: 2.35rem;
        padding: 0 0.18rem;
        font-size: 0.68rem;
    }
    .restart-chip {
        top: 3.65rem;
        left: 0.65rem;
        height: 2.55rem;
        padding: 0 0.8rem;
        font-size: 0.72rem !important;
    }
    .settings-orb {
        left: 0.7rem;
        bottom: 0.7rem;
        width: 3rem;
        height: 3rem;
    }
    .sound-chip {
        right: 0.7rem;
        bottom: 0.7rem;
        height: 2.8rem;
        padding: 0 0.85rem;
        font-size: 0.72rem !important;
    }
}
