/* Temple Run - Game Styles */

@font-face {
    font-family: 'temple-run-small-caps';
    src: url("../fonts/temple-run-small-caps.woff2") format('woff2');
    font-weight: normal;
    font-style: normal;
}

/* === Reset & Base === */
html, body {
    overflow: hidden;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: none;
    touch-action: pan-x pan-y;
    background: #1a0a00;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -o-user-select: none;
}

body {
    font-family: temple-run-small-caps, Arial, Helvetica, sans-serif;
    color: #333;
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    outline: none;
}

/* === Golden Gradient Text === */
.label {
    display: block;
    text-transform: uppercase;
    background: linear-gradient(to bottom, #fcfa61 0%, #fcfa61 19%, #faf55f 23%, #f0dd54 36%, #d39a35 66%, #cb872c 78%, #ca842b 80%, #ca842b 100%);
    background-clip: border-box;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    font-weight: 100;
    -webkit-text-stroke-width: 1.0px;
    -webkit-text-stroke-color: black;
}

.label.medium {
    font-size: 14px;
}

.label.small {
    font-size: 10px;
}

.label.title-text {
    font-size: 48px;
    letter-spacing: 4px;
}

.label.subtitle-text {
    font-size: 18px;
}

.subheader {
    font-size: 12px;
    color: #4F291C;
}

/* === Screens === */
.screen {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 10, 0, 0.95);
}

.screen.overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* === Loading Screen === */
.loading-content {
    text-align: center;
}

.loading-bar-container {
    width: 250px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 20px auto;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #d39a35, #fcfa61);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* === Main Menu === */
.menu-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.menu-stats {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* === Buttons === */
.game-button {
    background: linear-gradient(to bottom, #4a3520, #3a2510);
    border: 2px solid #8B6914;
    border-radius: 12px;
    padding: 12px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
    text-align: center;
}

.game-button:hover {
    background: linear-gradient(to bottom, #5a4530, #4a3520);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.game-button:active {
    transform: scale(0.98);
}

.play-button {
    min-width: 200px;
    padding: 16px 48px;
    border-color: #d4a020;
    box-shadow: 0 0 15px rgba(212, 160, 32, 0.3);
}

/* === Settings === */
.settings-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-width: 280px;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #555;
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: #d4a020;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.sensitivity-range {
    width: 120px;
    accent-color: #d4a020;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    color: #a08050;
    margin-top: 6px;
}

/* === HUD === */
.hud {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.hud-score {
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.hud-coins {
    display: flex;
    align-items: center;
    gap: 4px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.coin-icon {
    font-size: 14px;
}

.hud-distance {
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.pause-button {
    pointer-events: all;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.pause-button:hover {
    background: rgba(0, 0, 0, 0.6);
}

.hud-powerups {
    position: absolute;
    bottom: 80px;
    left: 16px;
    display: flex;
    gap: 8px;
}

.powerup-indicator {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
}

.powerup-timer {
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    transform-origin: left;
}

/* === Pause === */
.pause-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === Game Over === */
.gameover-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.gameover-stats {
    display: flex;
    gap: 30px;
    margin: 10px 0;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === Landscape prompt for mobile === */
#landscapePrompt {
    position: fixed;
    inset: 0;
    background: #0a0a0f;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ff9500;
    text-align: center;
    flex-direction: column;
    gap: 20px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .label.title-text {
        font-size: 36px;
        letter-spacing: 2px;
    }

    .label {
        font-size: 18px;
    }

    .game-button {
        padding: 10px 30px;
        min-width: 140px;
    }

    .play-button {
        min-width: 180px;
        padding: 14px 40px;
    }

    .hud-top {
        padding: 8px 10px;
    }

    .gameover-stats {
        gap: 16px;
    }

    .menu-stats {
        gap: 24px;
    }
}

@media (max-width: 480px) {
    .label.title-text {
        font-size: 28px;
    }

    .label {
        font-size: 14px;
    }

    .game-button {
        padding: 8px 24px;
        min-width: 120px;
    }

    .gameover-stats {
        flex-wrap: wrap;
    }
}
