* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #312b6d;
    color: #ffffff;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
}

#app {
    width: 100%;
    height: 100%;
    max-width: 500px;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: max(env(safe-area-inset-top), 15px);
    padding-left: max(env(safe-area-inset-left), 15px);
    padding-right: max(env(safe-area-inset-right), 15px);
    padding-bottom: calc(max(env(safe-area-inset-bottom), 15px) + 60px);
    z-index: 1;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.pink-bg {
    background: rgb(23 40 50) !important;
    border-color: rgba(255, 192, 203, 0.3);
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.25), rgba(112, 0, 255, 0.25));
    border: 2px solid rgba(0, 242, 255, 0.4);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

.lang-btn:hover {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.35), rgba(112, 0, 255, 0.35));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.5);
}

.lang-btn:active {
    transform: scale(0.96);
}

.lang-icon {
    font-size: 16px;
}

.lang-text {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.score-container,
.level-container,
.lines-container {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 70px;
}

.label {
    font-size: 10px;
    letter-spacing: 1.5px;
    opacity: 0.9;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.6);
}

.value {
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
    color: #00ffcc;
}

.game-area {
    flex: 1;
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    min-height: 0;
}

.game-board-wrapper {
    flex: 1;
    position: relative;
    padding: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#tetris-board {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}

.right-panel {
    flex: 0 0 110px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hold-piece-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100px;
}

.hold-piece-container .label {
    margin-bottom: 4px;
    font-size: 9px;
}

#hold-piece {
    width: 100%;
    max-width: 85px;
    height: 100%;
    max-height: 70px;
    object-fit: contain;
}

.next-pieces-container {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.next-pieces-container .label {
    margin-bottom: 6px;
    font-size: 9px;
}

.next-pieces-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    flex: 1;
    overflow-y: auto;
}

.next-canvas {
    width: 100%;
    max-width: 90px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.pause-button-container {
    display: flex;
    justify-content: center;
    padding: 6px 4px;
}

.pause-game-btn {
    width: 100%;
    max-width: 96px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.25), rgba(255, 193, 7, 0.15));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.pause-game-btn:hover {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.35), rgba(255, 193, 7, 0.25));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.5);
}

.pause-game-btn:active {
    transform: scale(0.95);
}

.audio-controls {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 4px;
}

.audio-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 2px solid rgba(0, 242, 255, 0.4);
    background: linear-gradient(145deg, rgba(0, 242, 255, 0.15), rgba(0, 168, 255, 0.1));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.audio-btn:hover {
    background: linear-gradient(145deg, rgba(0, 242, 255, 0.25), rgba(0, 168, 255, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.4);
}

.audio-btn:active {
    transform: scale(0.95);
}

.audio-btn.active {
    background: linear-gradient(145deg, rgba(0, 242, 255, 0.35), rgba(0, 168, 255, 0.25));
    border-color: rgba(0, 242, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}

.audio-btn.muted {
    opacity: 0.5;
    background: linear-gradient(145deg, rgba(255, 0, 85, 0.15), rgba(255, 50, 100, 0.1));
    border-color: rgba(255, 0, 85, 0.4);
}

.controls-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 0 5px 5px 5px;
    margin-bottom: 0;
}

.control-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    color: white;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 -2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.control-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.control-btn:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

.control-btn:active {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.15));
    transform: scale(0.94);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.accent-btn {
    background: linear-gradient(145deg, rgba(0, 242, 255, 0.25), rgba(0, 168, 255, 0.15));
    border: 2px solid rgba(0, 242, 255, 0.5);
    box-shadow: 0 4px 25px rgba(0, 242, 255, 0.4);
}

.accent-btn:hover {
    box-shadow: 0 6px 30px rgba(0, 242, 255, 0.6);
}

.purple-btn {
    background: linear-gradient(145deg, rgba(112, 0, 255, 0.25), rgba(150, 50, 255, 0.15));
    border: 2px solid rgba(112, 0, 255, 0.5);
    box-shadow: 0 4px 25px rgba(112, 0, 255, 0.4);
}

.purple-btn:hover {
    box-shadow: 0 6px 30px rgba(112, 0, 255, 0.6);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 16px;
    text-align: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.title {
    font-size: 56px;
    font-weight: 900;
    background: linear-gradient(135deg, #00f2ff 0%, #ff0055 50%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(0, 242, 255, 0.5);
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

.subtitle {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.primary-btn {
    background: linear-gradient(135deg, #00f2ff 0%, #00a8ff 100%);
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    color: #0a0a0f;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.5), 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(0, 242, 255, 0.7), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.primary-btn:active {
    transform: scale(0.97);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
    letter-spacing: 2px;
}

.stats {
    margin: 15px 0;
}

.stats p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin: 8px 0;
    font-weight: 500;
}

.stats span {
    color: white;
    font-weight: 700;
}

@media (max-height: 750px) {
    #app {
        padding-top: 10px;
        padding-bottom: calc(max(env(safe-area-inset-bottom), 10px) + 5px);
    }

    .game-header {
        margin-bottom: 8px;
    }

    .game-area {
        margin-bottom: 8px;
        gap: 8px;
    }

    .controls-area {
        min-height: 65px;
        gap: 6px;
    }

    .control-btn {
        width: 65px;
        height: 65px;
    }

    .title {
        font-size: 48px;
    }

    h2 {
        font-size: 30px;
    }

    .next-canvas {
        max-width: 80px;
        height: 55px;
    }

    .hold-piece-container {
        height: 90px;
    }

    #hold-piece {
        max-width: 75px;
        max-height: 65px;
    }
}

@media (max-height: 650px) {
    #app {
        padding-top: 8px;
        padding-bottom: calc(max(env(safe-area-inset-bottom), 8px) + 5px);
    }

    .controls-area {
        min-height: 60px;
        gap: 5px;
    }

    .control-btn {
        width: 60px;
        height: 60px;
    }

    .value {
        font-size: 18px;
    }

    .title {
        font-size: 40px;
    }

    .next-canvas {
        max-width: 75px;
        height: 50px;
    }

    .hold-piece-container {
        height: 85px;
    }

    #hold-piece {
        max-width: 70px;
        max-height: 60px;
    }
}

@media (max-width: 380px) {
    .control-btn {
        width: 58px;
        height: 58px;
    }
}