/* CSS Stylesheet for Tomás Müller: Desafío Karting */
:root {
    --bg-dark: #090d16;
    --card-dark: #1f2937;
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --accent: #ffd200;
    --accent-dark: #eab308;
    --text-white: #f9fafb;
    --text-gray: #94a3b8;
    --border: #374151;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Quicksand', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 440px;
    height: 100vh;
    max-height: 850px;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header HUD */
.hud-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.back-link {
    color: var(--text-gray);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-light);
}

.hud-item-score {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
}

.hud-item-lives {
    display: flex;
    gap: 4px;
}

.hud-item-lives i {
    color: #4b5563; /* Dead heart */
    font-size: 1.05rem;
    transition: color 0.3s ease;
}

.hud-item-lives i.active {
    color: #ef4444; /* Alive heart */
}

.hud-btn {
    background: var(--card-dark);
    border: 1px solid var(--border);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.hud-btn:hover {
    background: var(--border);
}

/* Canvas Wrapper */
.canvas-wrapper {
    flex-grow: 1;
    position: relative;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #1f2937;
}

/* Overlay Screen (Start / Game Over) */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-screen.active {
    display: flex;
    opacity: 1;
}

.screen-content {
    text-align: center;
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-subtitle {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--primary-light);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    font-weight: 900;
    line-height: 1.15;
    color: var(--text-white);
    margin-bottom: 15px;
}

.game-title span {
    color: var(--accent);
}

.game-description {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.5;
    margin-bottom: 25px;
}

.how-to-play {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    width: 100%;
    margin-bottom: 30px;
}

.how-to-play h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: 0.05em;
}

.controls-guide {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-gray);
}

.controls-guide strong {
    color: var(--text-white);
}

.btn-play-game {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #0f172a;
    border: none;
    border-radius: 12px;
    padding: 14px 28px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, box-shadow 0.1s;
    width: 100%;
    justify-content: center;
}

.btn-play-game:hover {
    filter: brightness(1.06);
}

.btn-play-game:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* Game Over Styles */
.screen-title-over {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    color: #ef4444;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.score-report {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.final-score {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 25px;
}

.sponsor-promo {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-bottom: 25px;
    text-align: left;
}

.promo-img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
    border: 1.5px solid var(--border);
}

.promo-text {
    font-size: 0.75rem;
    color: var(--text-gray);
    line-height: 1.4;
}

.screen-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-secondary-game {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-white) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.btn-secondary-game:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Footer promo */
.game-footer {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border);
    padding: 15px;
    z-index: 10;
    text-align: center;
}

.footer-promo-wrapper p {
    font-size: 0.78rem;
    color: var(--text-gray);
    line-height: 1.4;
    margin-top: 5px;
}

.footer-promo-wrapper strong {
    color: var(--text-white);
}

.footer-badge {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-light);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* Mobile Touch controls overlay */
#touch-controls {
    position: absolute;
    bottom: 90px;
    left: 0;
    width: 100%;
    display: none;
    justify-content: space-between;
    padding: 0 25px;
    pointer-events: none;
    z-index: 8;
}

.touch-btn {
    width: 76px;
    height: 76px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.touch-btn:active {
    background: var(--primary);
    border-color: var(--primary-light);
    transform: scale(0.95);
}

/* Show mobile controls only on touch screens / small width */
@media (max-width: 768px) {
    #touch-controls {
        display: flex;
    }
}
@media (max-height: 600px) {
    .promo-img {
        display: none;
    }
}
