@font-face {
  font-family: 'SpaceAge';
  src: url('./fonts/SpaceAge.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Geologica';
  src: url('./fonts/Geologica.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}



* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Geologica';
    overflow: hidden;
    background: #000;
    color: #fff;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}
/* Главное меню */
#mainMenu {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    max-width: 369px;
    width: 100%;
}

#mainMenu h1 {
    font-size: 60px;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 5px;
    background: linear-gradient(45deg, #0ff, #f0f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    }

    50% {
        text-shadow: 0 0 40px rgba(255, 0, 255, 0.8);
    }
}

.menuButton {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 369px;
    width: 100%;
    height: 85px;
    font-size: 48px;
    letter-spacing: 2px;
    background: url('./img/button.png') center center no-repeat;
    background-size: 100%;
    color: #71758e;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    border: none;
    margin-bottom: 13px;
    margin-left: auto;
    margin-right: auto;
}

.menuButton:hover {
    transform: scale(1.1);
    background: url('./img/button-hover.png') center center no-repeat;
    background-size: 100%;
    color: white;
}


/* Экран статистики */
#statsScreen {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 916px;
    width: 100%;
    max-height: 70vh;
    background: url('./img/stats-bg.png') center center no-repeat;
    background-size: 100% 100%;
    padding:0 40px;
    border-radius: 20px;
    display: none;
    z-index: 100;
    height: 919px;
    padding-top: 35px;
}
#statsScreen.active {
    display: block;
}
#statsScreen .logo {
        width: 100%;
        max-width: 579px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 20px;
    }
#statsScreen .logo img {
    width: 100%;
}
#statsScreen h2 {
    font-size: 22px;
    margin-bottom: 30px;
    text-align: center;
    color: #0ff;
    text-transform: uppercase;
}

.statLabel {
    margin-bottom: 20px;
    color: #767a95;
    font-size: 30px;
}
.shapeCount img,.tunnelCount img {
    width: 50px;
}

.statsTable {
    width: 100%;
    margin-bottom: 30px;
}
.statsTable tr {
    height: 40px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.statsTable td {
    padding: 10px;
    font-size: 18px;
}

.statsTable .rank {
    color: #f0f;
    font-weight: bold;
    width: 50px;
}

.statsTable .score {
    color: #0ff;
    font-weight: bold;
}

.statsTable .date {
    color: #888;
    text-align: right;
}
.statValue {
    color: #628cae;
    font-size: 35px;
   
}
.statValue span {
    color: #628cae;
}
.statRow {
    display: flex;
    padding-left: 40px;
}
/* HUD */
#gameHUD {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: none;
    z-index: 50;
}

.hudElement {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #0ff;
    display: inline-block;
    margin: 5px;
    font-size: 20px;
    font-weight: bold;
}

#score {
    color: #0ff;
    font-size: 28px;
}

#phase {
    color: #f0f;
    position: absolute;
    top: 20px;
    right: 20px;
}

/* Экран конца игры */
#gameOverScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    width: 90%;
    border-radius: 20px;
    border: 3px solid #f00;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.5);
    display: none;
    z-index: 100;
}

#gameOverScreen h2 {
    font-size: 48px;
    color: #f00;
    margin-bottom: 30px;
    text-transform: uppercase;
    animation: shake 0.5s infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

#finalScore {
    font-size: 36px;
    color: #0ff;
    margin: 20px 0;
}

/* Мобильные контролы */
#mobileControls {
  display: flex !important;
  position: fixed !important;
  bottom: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 9999 !important;
  pointer-events: auto !important;
  user-select: none !important;
  touch-action: manipulation !important;
}

.mobileControls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    z-index: 50;
}

.controlBtn {
    width: 80px;
    height: 80px;
    margin: 0 20px;
    background: rgba(0, 255, 255, 0.2);
    border: 3px solid #0ff;
    border-radius: 50%;
    color: #0ff;
    font-size: 30px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    line-height: 74px;
    text-align: center;
    user-select: none;
}

.controlBtn:active {
    background: rgba(0, 255, 255, 0.5);
    transform: scale(0.95);
}

/* Индикатор туннеля */
#tunnelWarning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: #f00;
    text-transform: uppercase;
    font-weight: bold;
    display: none;
    z-index: 60;
    animation: blink 0.5s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Загрузочный экран */
#loadingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.loader {
    width: 100px;
    height: 100px;
    border: 5px solid #0ff;
    border-top: 5px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
@media (max-width: 600px) {
    .logo {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    .logo img {
        width: 100%;
    }
    .menuButton {
        max-width: 90%;
        font-size: 22px;
    }
    .mobileControls.active {
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }
    .statRow {
        padding-left: 0;
    }
    .statValue {
        font-size: 22px;
    }
    .statLabel {
        font-size: 22px;
    }
    .shapeCount img, .tunnelCount img {
        width: 30px;
    }
    #score,#phase {
        font-size: 13px;
    }
}