* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    height: 100%;

    overflow: hidden;
}

body {
    background: #0c0c0c;
    color: white;

    font-family: Arial, Helvetica, sans-serif;
}


/* =========================================================
   SCREENS
   ========================================================= */

.screen {
    display: none;

    width: 100vw;
    height: 100vh;
}

.screen.active {
    display: flex;
}


/* =========================================================
   MENUS
   ========================================================= */

#main-menu,
#mode-menu,
#custom-menu,
#settings-menu,
#about-menu {
    align-items: center;
    justify-content: center;

    background:
        radial-gradient(
            circle at center,
            #181818 0%,
            #0c0c0c 65%,
            #070707 100%
        );
}


.menu-box,
.custom-box {
    width: 420px;

    padding: 40px;

    background: #151515;

    border: 1px solid #444;

    display: flex;
    flex-direction: column;

    gap: 18px;
}


.custom-box {
    width: 500px;
}


.menu-box h1,
.custom-box h1 {
    margin-top: 0;
    margin-bottom: 25px;

    text-align: center;

    letter-spacing: 2px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

button {
    font-family: inherit;
    color: white;

    cursor: pointer;
}


.menu-button {
    width: 100%;

    padding: 16px;

    background: #252525;

    border: 2px solid #777;

    font-size: 18px;
    font-weight: bold;
}


.menu-button:hover {
    background: #333;

    border-color: white;
}


.menu-link {
    display: block;

    text-align: center;
    text-decoration: none;

    color: white;
}


.menu-link:visited {
    color: white;
}


.secondary-button {
    padding: 12px;

    background: transparent;

    border: 1px solid #555;

    font-size: 16px;
}


.secondary-button:hover {
    border-color: white;
}


/* =========================================================
   SETTINGS
   ========================================================= */

.settings-box {
    width: 460px;
}


.keybind-setting {
    padding: 20px;

    background: #101010;

    border: 1px solid #333;

    text-align: center;
}


.keybind-title {
    display: block;

    margin-bottom: 18px;

    font-size: 18px;
    font-weight: bold;

    letter-spacing: 1px;
}


.keybind-button {
    min-width: 150px;

    padding: 14px 25px;

    background: #1d1d1d;

    border: 2px solid #aaa;

    border-radius: 4px;

    font-size: 18px;
    font-weight: bold;

    letter-spacing: 1px;
}


.keybind-button:hover {
    background: #292929;

    border-color: white;
}


.keybind-button.listening {
    border-color: white;

    background: #303030;
}


#keybind-hint {
    margin: 18px 0 0;

    color: #999;

    font-size: 14px;

    line-height: 1.5;
}


/* =========================================================
   ABOUT
   ========================================================= */

.about-box {
    width: 560px;
    max-width: calc(100vw - 40px);
}


.about-content {
    max-height: 430px;

    padding: 20px;

    overflow-y: auto;

    background: #101010;

    border: 1px solid #333;

    color: #d0d0d0;

    font-size: 15px;
    line-height: 1.6;
}


.about-content p {
    margin-top: 0;
    margin-bottom: 18px;
}


.about-content p:last-child {
    margin-bottom: 0;
}




/* =========================================================
   STANDALONE LEGAL / PRIVACY PAGE
   ========================================================= */

.standalone-page {
    width: 100vw;
    height: 100vh;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        radial-gradient(
            circle at center,
            #181818 0%,
            #0c0c0c 65%,
            #070707 100%
        );
}


.privacy-box {
    width: 680px;
    max-width: calc(100vw - 40px);
}


.privacy-content {
    max-height: 62vh;

    padding: 22px;

    overflow-y: auto;

    background: #101010;

    border: 1px solid #333;

    color: #d0d0d0;

    font-size: 14px;
    line-height: 1.65;
}


.privacy-content h2 {
    margin-top: 24px;
    margin-bottom: 8px;

    color: white;

    font-size: 17px;
    letter-spacing: 0.5px;
}


.privacy-content h2:first-child {
    margin-top: 0;
}


.privacy-content p {
    margin-top: 0;
    margin-bottom: 14px;
}


.privacy-content ul {
    margin-top: 0;
    margin-bottom: 16px;

    padding-left: 22px;
}


.privacy-content li {
    margin-bottom: 8px;
}


.privacy-content a {
    color: #d9d9d9;
}


.privacy-content a:hover {
    color: white;
}


.privacy-note {
    color: #9d9d9d;

    font-size: 13px;
}


.privacy-back-link {
    display: block;

    width: 100%;

    text-align: center;
    text-decoration: none;

    color: white;
}


/* =========================================================
   CUSTOM SETTINGS
   ========================================================= */

.setting {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 10px 0;

    border-bottom: 1px solid #333;

    font-size: 17px;
}


.setting-column {
    display: flex;
    flex-direction: column;

    gap: 12px;

    padding: 10px 0;

    border-bottom: 1px solid #333;
}


.setting-label {
    display: flex;

    justify-content: space-between;
}


input[type="checkbox"] {
    width: 22px;
    height: 22px;
}


input[type="range"] {
    width: 100%;
}


select {
    padding: 7px 10px;

    background: #222;

    color: white;

    border: 1px solid #555;
}


/* =========================================================
   GAME
   ========================================================= */

#game-screen {
    position: relative;

    flex-direction: column;
    align-items: center;

    background:
        radial-gradient(
            circle at 50% 45%,
            #171717 0%,
            #0c0c0c 65%,
            #070707 100%
        );
}


/* =========================================================
   TOP BAR
   ========================================================= */

#game-top-bar {
    position: relative;

    flex: 0 0 70px;

    width: 100%;
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-bottom: 1px solid #222;
}


#quit-button {
    position: absolute;

    left: 25px;
    top: 50%;

    transform: translateY(-50%);

    padding: 10px 18px;

    background: #1d1d1d;

    border: 1px solid #555;
}


#quit-button:hover {
    border-color: #aaa;

    background: #292929;
}


#mode-name {
    font-size: 19px;

    font-weight: bold;

    letter-spacing: 3px;
}


/* =========================================================
   STATS
   ========================================================= */

#stats-panel {
    position: absolute;

    right: 35px;
    top: 105px;

    width: 180px;

    padding: 20px;

    background: #141414;

    border: 1px solid #444;

    z-index: 10;
}


#stats-panel h2 {
    margin-top: 0;

    text-align: center;

    font-size: 18px;

    letter-spacing: 2px;
}


.stat-row {
    display: flex;

    justify-content: space-between;

    margin: 14px 0;

    color: #ccc;
}


.stat-row span:last-child {
    color: white;

    font-weight: bold;
}


/* =========================================================
   SKILL CHECK AREA
   ========================================================= */

#skill-check-area {
    position: relative;

    flex: 1 1 auto;

    width: 100%;

    min-height: 0;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;
}


/* =========================================================
   SKILL CHECK
   ========================================================= */

#skill-check {
    position: relative;

    width: 230px;
    height: 230px;

    flex: 0 0 230px;

    opacity: 0;

    transition: opacity 0.06s;
}


#skill-check.visible {
    opacity: 1;
}


#skill-check-svg {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;
}


#circle-background {
    fill: none;

    stroke: #d7d7d7;

    stroke-width: 2.2;

    opacity: 0.84;

    filter:
        drop-shadow(
            0 0 1px
            rgba(255, 255, 255, 0.2)
        );
}


#normal-zone {
    fill: none;

    stroke: #6f6f6f;

    stroke-width: 10;

    stroke-linecap: butt;

    opacity: 0.95;
}


#great-zone {
    fill: none;

    stroke: #f5f5f5;

    stroke-width: 14;

    stroke-linecap: butt;

    filter:
        drop-shadow(
            0 0 1px
            rgba(255, 255, 255, 0.6)
        );
}


/* =========================================================
   MOVING INDICATOR
   ========================================================= */

#needle-container {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    will-change: transform;
}


#needle {
    position: absolute;

    left: 50%;
    top: 50%;

    width: 38px;
    height: 92px;

    transform:
        translate(-50%, -50%)
        translateY(-103px);

    transform-origin: center center;

    background-image: url("needle.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    pointer-events: none;

    filter:
        drop-shadow(
            0 0 5px
            rgba(255, 0, 0, 0.7)
        )
        drop-shadow(
            0 0 10px
            rgba(180, 0, 0, 0.45)
        );
}


/* =========================================================
   CENTER KEY BOX
   ========================================================= */

#space-box {
    position: absolute;

    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);

    min-width: 110px;
    height: 42px;

    padding: 0 17px;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        rgba(5, 5, 5, 0.8);

    border:
        2px solid
        rgba(240, 240, 240, 0.92);

    border-radius: 9px;

    color: #afafaf;

    font-size: 16px;
    font-weight: 600;

    box-shadow:
        0 0 2px
        rgba(0, 0, 0, 0.8);
}


/* =========================================================
   RESULT TEXT
   ========================================================= */

#result-text {
    flex: 0 0 40px;

    height: 40px;

    margin-top: 8px;

    font-size: 24px;
    font-weight: bold;

    letter-spacing: 2px;

    text-align: center;
}


/* =========================================================
   REPAIR HUD
   ========================================================= */

#progress-section {
    position: relative;

    flex: 0 0 105px;

    width: 620px;
    max-width: calc(100vw - 120px);

    height: 105px;

    margin: 0 auto 28px auto;

    display: block;
}


/* =========================================================
   HAND
   ========================================================= */

#repair-hand-container {
    position: absolute;

    left: 0;
    top: 10px;

    width: 58px;
    height: 58px;

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;
}


#repair-hand {
    display: block;

    width: 52px !important;
    height: 52px !important;

    max-width: 52px !important;
    max-height: 52px !important;

    object-fit: contain;

    flex: none;

    filter:
        drop-shadow(
            1px 2px 2px
            rgba(0, 0, 0, 0.85)
        );
}


/* =========================================================
   REPAIR CONTENT
   ========================================================= */

#repair-progress-content {
    position: absolute;

    left: 68px;
    right: 0;
    top: 0;

    height: 100%;
}


/* =========================================================
   REPAIR LABEL
   ========================================================= */

#repair-label {
    position: absolute;

    left: 0;
    top: 4px;

    margin: 0;

    color: #eee;

    font-size: 16px;
    font-weight: bold;

    line-height: 18px;

    letter-spacing: 1px;

    text-align: left;

    text-shadow:
        1px 1px 2px black;
}


/* =========================================================
   REPAIR BAR
   ========================================================= */

#progress-container {
    position: absolute;

    left: 0;
    top: 28px;

    width: 100%;
    height: 18px;

    margin: 0;
    padding: 2px;

    overflow: hidden;

    background:
        linear-gradient(
            to bottom,
            #080a0b 0%,
            #1c2226 45%,
            #08090a 100%
        );

    border:
        1px solid #394147;

    box-shadow:
        0 1px 0
        rgba(255, 255, 255, 0.15)
        inset,

        0 -1px 0
        rgba(0, 0, 0, 0.9)
        inset,

        0 2px 5px
        rgba(0, 0, 0, 0.85);
}


#progress-bar {
    position: relative;

    display: block;

    width: 0%;
    height: 100%;

    margin: 0;

    background:
        linear-gradient(
            to bottom,
            #8497a2 0%,
            #697d88 25%,
            #536771 48%,
            #3b4d57 70%,
            #2a3941 100%
        );

    border-top:
        1px solid
        rgba(255, 255, 255, 0.45);

    box-shadow:
        0 0 5px
        rgba(180, 215, 230, 0.28);

    transition:
        width 0.08s linear;
}


#progress-bar::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    top: 1px;

    height: 3px;

    background:
        rgba(225, 240, 245, 0.22);
}


#progress-bar::after {
    content: "";

    position: absolute;

    inset: 0;

    background:
        repeating-linear-gradient(
            90deg,

            transparent 0px,
            transparent 64px,

            rgba(235, 245, 250, 0.22) 65px,
            rgba(235, 245, 250, 0.22) 67px,

            transparent 68px,
            transparent 75px
        );

    opacity: 0.75;
}


/* =========================================================
   PERCENTAGE
   ========================================================= */

#progress-text {
    position: absolute;

    left: 0;
    top: 54px;

    width: 100%;

    margin: 0;

    color: #eee;

    font-size: 17px;
    font-weight: bold;

    line-height: 20px;

    text-align: center;

    text-shadow:
        1px 1px 2px black;
}


/* =========================================================
   END OVERLAY
   ========================================================= */

#end-overlay {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        rgba(0, 0, 0, 0.84);

    z-index: 100;
}


#end-overlay.hidden {
    display: none;
}


#end-box {
    width: 420px;

    padding: 35px;

    background: #151515;

    border: 1px solid #666;

    text-align: center;
}


#end-box h1 {
    margin-top: 0;
}


#end-box p {
    font-size: 18px;
}


#end-box button {
    margin-top: 10px;
}


/* =========================================================
   SMALL SCREENS
   ========================================================= */

@media (max-width: 900px) {

    #stats-panel {
        right: 15px;

        width: 150px;
    }


    #skill-check {
        width: 210px;
        height: 210px;

        flex-basis: 210px;
    }


    #space-box {
        min-width: 102px;
        height: 40px;

        font-size: 15px;
    }


    #progress-section {
        width: 520px;

        max-width:
            calc(100vw - 60px);
    }


    #repair-hand-container {
        width: 52px;
        height: 52px;
    }


    #repair-hand {
        width: 46px !important;
        height: 46px !important;

        max-width: 46px !important;
        max-height: 46px !important;
    }


    #repair-progress-content {
        left: 60px;
    }
}

/* =========================================================
   ADVERTISEMENT PLACEHOLDERS

   These appear on every non-game screen. The actual game
   screen automatically hides them. Later, replace the
   placeholder contents in index.html with your ad provider's
   ad unit code.
   ========================================================= */

#site-ad-rails {
    position: fixed;

    inset: 0;

    z-index: 50;

    pointer-events: none;
}


.ad-slot {
    position: absolute;

    top: 50%;

    width: 160px;
    height: min(600px, 72vh);
    min-height: 320px;

    transform: translateY(-50%);

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 12px;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            rgba(24, 24, 24, 0.92),
            rgba(12, 12, 12, 0.94)
        );

    border: 1px solid #383838;

    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02) inset,
        0 8px 30px rgba(0, 0, 0, 0.35);

    color: #777;

    pointer-events: auto;
}


.ad-slot-left {
    left: clamp(18px, 3vw, 52px);
}


.ad-slot-right {
    right: clamp(18px, 3vw, 52px);
}


.ad-label {
    position: absolute;

    top: 12px;
    left: 0;
    right: 0;

    color: #686868;

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 1.5px;

    text-align: center;
}


.ad-placeholder-text {
    padding: 8px 12px;

    border: 1px dashed #444;

    color: #666;

    font-size: 13px;

    letter-spacing: 0.8px;

    text-transform: uppercase;
}


/*
   The ad rails completely disappear whenever the actual
   trainer/game screen is active, including the results
   overlay at the end of a run.
*/

body:has(#game-screen.active) #site-ad-rails {
    display: none;
}


/*
   Side ads are intentionally removed on narrower screens
   instead of squeezing or covering the menu.
*/

@media (max-width: 1150px) {

    #site-ad-rails {
        display: none;
    }

}
