/* Custom Fonts */
@font-face {
    font-family: 'AvenirNextWorld-Medium';
    src: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/fonts%2FAvenirNextWorld-Medium.otf?alt=media&token=6d0c0700-529c-45a3-bfd7-dc79b07030cd') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'AvenirNextWorld-Bold';
    src: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/fonts%2FAvenirNextWorld-Bold.otf?alt=media&token=8d06a955-d494-4533-b00f-f419be3a1781') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Additional focus state removal for all interactive elements */
*:focus,
*:active,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Specifically target buttons to remove default focus states */
button,
input,
select,
textarea,
[role="button"],
[tabindex] {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

button:focus,
button:active,
button:focus-visible,
input:focus,
input:active,
select:focus,
select:active,
textarea:focus,
textarea:active {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body {
    font-family: 'AvenirNextWorld-Bold', 'Jersey 20', Arial, sans-serif;
    font-weight: 700;
    background-color: #000011;
    color: #ffffff;
    overflow: hidden;
    touch-action: manipulation;
    position: fixed;
    width: 100%;
    height: 100%;
}

button {
    font-family: 'AvenirNextWorld-Bold', 'Jersey 20', Arial, sans-serif;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000011;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Loading Screen */
.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000011;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Above title screen */
    color: white;
    text-align: center;
}

.loading-screen h1 {
    color: #FFF;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    font-family: "AvenirNextWorld-Bold", "Jersey 20", Arial, sans-serif;
    font-size: 48px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%;
    margin-bottom: 40px;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #A1E1FC 0%, #FFB8FF 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-screen.hidden {
    display: none;
}

/* Title Screen overlay */
.title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: none; /* Hidden initially until fonts and background load */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.title-screen.loaded {
    display: flex;
    opacity: 1;
}

.title-screen h1 {
    color: #FFF;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    font-family: "AvenirNextWorld-Bold";
    font-size: 72px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%; /* 72px */
    margin-bottom: 20px;
}

.title-screen p {
    font-size: clamp(14px, 4vw, 18px);
    margin: 10px 0;
    color: #ccc;
    font-family: 'AvenirNextWorld-Medium', 'Jersey 20', Arial, sans-serif;
}

.start-button {
    margin-top: 30px;
    padding: 15px 30px;
    border-radius: 27.5px;
    border: 3px solid #FFF;
    color: #FFF;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    font-family: "AvenirNextWorld-Bold", "Jersey 20", Arial, sans-serif;
    font-size: 18px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%; /* 18px */
    min-width: 180px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.start-button:hover,
.start-button:active {
    background: #FFB8FF;
    box-shadow: 0 0 30px rgba(255, 184, 255, 0.5);
    transform: translateY(-2px);
}

.loading {
    color: #FDE7C5;
    font-size: clamp(12px, 3vw, 16px);
    margin-top: 20px;
    font-family: 'AvenirNextWorld-Bold', 'Jersey 20', Arial, sans-serif;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Back Button */
.back-button {
    position: absolute;
    top: 20px;
    left: 0;
    width: 60px;
    height: 40px;
    border-radius: 0 20px 20px 0;
    background: #3B4279;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Higher than game over screen (2500) */
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.back-button:hover,
.back-button:active {
    background: #4A5299;
    transform: scale(1.08);
}

.back-button svg {
    pointer-events: none;
}

.back-button.visible {
    display: flex;
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.game-over-screen.visible {
    display: flex;
    opacity: 1;
}

.winner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.winner-color {
    text-align: center;
    font-family: "AvenirNextWorld-Bold", "Jersey 20", Arial, sans-serif;
    font-size: 72px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%;
    margin: 0;
    transition: color 0.3s ease;
}

.winner-color.blue-win {
    color: #A1E1FC;
}

.winner-color.red-win {
    color: #FFB8FF;
}

.winner-text {
    text-align: center;
    color: #FFF;
    font-family: "AvenirNextWorld-Bold", "Jersey 20", Arial, sans-serif;
    font-size: 72px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%;
    margin: 0;
}

.play-again-button {
    margin-top: 30px;
    padding: 15px 30px;
    border-radius: 27.5px;
    border: 3px solid #FFF;
    color: #FFF;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    font-family: "AvenirNextWorld-Medium", "Jersey 20", Arial, sans-serif;
    font-size: 18px;
    font-style: normal;
    font-weight: 950;
    line-height: 100%;
    min-width: 200px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.play-again-button:hover,
.play-again-button:active {
    background: #FFB8FF;
    box-shadow: 0 0 30px rgba(255, 184, 255, 0.5);
    transform: translateY(-2px);
}
