/* ===== ANSON PARAKKUU - GAME STYLES (9:16 LOCKED) ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&display=swap');

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

html, body {
    width: 100%;
    background: #0a0a0f;
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
}

/* ===== OUTER WRAPPER (black sidebars on desktop) ===== */
#game-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
}

/* ===== GAME CONTAINER — strict 9:16 ===== */
#game-container {
    position: relative;
    overflow: hidden;
    background: #1a1a2e;
    /* Dimensions set by JS to maintain exact 9:16 */
}

/* ===== CANVAS ===== */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: auto;
}

/* ===== SCREEN OVERLAYS ===== */
.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.4s ease;
}

.screen-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== START SCREEN ===== */
#start-screen {
    background: radial-gradient(circle at top, rgba(20, 20, 35, 0.4) 0%, rgba(10, 10, 15, 0.8) 100%);
    backdrop-filter: blur(5px);
    justify-content: flex-start;
    padding: 8% 0;
}

.title-image {
    width: 95%; /* Almost full width */
    max-height: 40%; /* Increase cap significantly */
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 10px rgba(255, 183, 77, 0.3));
    animation: titleBounce 3s ease-in-out infinite;
    transform: rotate(-3deg);
    margin-top: 5%;
    margin-bottom: auto; /* Push character down */
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0) rotate(-3deg) scale(1); }
    50% { transform: translateY(-12px) rotate(-1deg) scale(1.03); }
}

.start-character {
    height: 35%; /* Make it huge */
    width: 60%;
    margin-top: -10%; /* Reduce layout impact */
    margin-bottom: auto; /* Push play button to bottom */
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
    animation: charIdle 2.5s ease-in-out infinite;
}

@keyframes charIdle {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.subtitle {
    font-size: clamp(14px, 4vmin, 18px);
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    animation: subtitlePulse 2s ease-in-out infinite;
    margin-bottom: 2%; /* Keep it tight to the play button */
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ===== BUTTONS ===== */
.btn-play {
    position: relative;
    padding: 16px 64px;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(22px, 5vmin, 32px);
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #ff4757, #ff6b81, #ff4757);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 6px 0 #cc3945,
        0 12px 24px rgba(255, 71, 87, 0.4),
        inset 0 3px 0 rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.15s ease;
    animation: playPulse 2s infinite;
    overflow: hidden;
    margin-bottom: 2%;
}

@keyframes playPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 0 #cc3945, 0 12px 24px rgba(255, 71, 87, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 6px 0 #cc3945, 0 16px 32px rgba(255, 71, 87, 0.6); }
}

.btn-play::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-play:hover::before {
    left: 100%;
}

.btn-play:hover {
    transform: translateY(-2px) scale(1.05);
}

.btn-play:active {
    transform: translateY(4px) scale(0.95);
    box-shadow:
        0 2px 0 #cc3945,
        0 4px 12px rgba(255, 71, 87, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    animation: none;
}

.high-score-display {
    font-size: clamp(13px, 3vmin, 17px);
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1%;
    margin-bottom: 8%; /* Some space at the bottom */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.high-score-display span {
    color: #ffb347;
    font-weight: 700;
}

.creator-credits {
    position: absolute;
    bottom: 3%;
    font-size: clamp(12px, 3vmin, 15px);
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

.creator-credits a {
    color: #ffb347;
    text-decoration: underline;
    font-weight: 700;
    transition: all 0.2s;
}

.creator-credits a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 179, 71, 0.8);
}

/* ===== GAMEPLAY UI ===== */
#score-display {
    position: absolute;
    top: 4%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    font-size: clamp(40px, 7vmin, 68px);
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 4px 0 rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(255, 255, 255, 0.2);
    pointer-events: none;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
}

#score-display.visible {
    opacity: 1;
}

#score-display.pop {
    animation: scorePop 0.2s ease;
}

@keyframes scorePop {
    0% { transform: translateX(-50%) scale(1); }
    40% { transform: translateX(-50%) scale(1.4); }
    100% { transform: translateX(-50%) scale(1); }
}

/* ===== GAME OVER SCREEN ===== */
#gameover-screen {
    background: radial-gradient(circle at center, rgba(30, 20, 25, 0.8) 0%, rgba(10, 10, 15, 0.95) 100%);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    gap: 4%;
    padding: 0;
}

#gameover-screen:not(.hidden) {
    animation: screenPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes screenPopIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.gameover-title {
    font-size: clamp(28px, 7vmin, 42px);
    font-weight: 900;
    color: #ff4757;
    text-transform: uppercase;
    text-align: center;
    width: 90%;
    line-height: 1.3;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transform: rotate(-3deg);
    animation: titleDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0;
}

@keyframes titleDrop {
    0% { transform: translateY(-50px) rotate(-10deg) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) rotate(-3deg) scale(1); opacity: 1; }
}

.gameover-roast {
    font-size: clamp(14px, 3.5vmin, 18px);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    width: 85%;
    font-style: italic;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    animation: fadeIn 1s ease 0.3s both;
    margin: 0;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.gameover-character {
    height: 15%; /* Keep layout footprint small */
    width: auto;
    margin: 0; /* Let flex gap handle spacing */
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(255, 0, 0, 0.4));
    animation: crashSpin 1.5s ease-out forwards;
}

@keyframes crashSpin {
    0% { transform: scale(1) rotate(-180deg) translateY(-100px); opacity: 0; }
    50% { transform: scale(4.5) rotate(20deg) translateY(10px); opacity: 1; }
    100% { transform: scale(3.5) rotate(0deg) translateY(0); }
}

.score-container {
    width: 75%;
    margin: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 6% 8%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    animation: scoreContainerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}

@keyframes scoreContainerPop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

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

.score-row:first-child {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
}

.score-label {
    font-size: clamp(13px, 2.5vmin, 16px);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: clamp(24px, 5vmin, 36px);
    font-weight: 900;
    color: #fff;
}

.score-value.best {
    color: #ffb347;
}

.new-best {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b35, #ffb347);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    margin-left: 6px;
    animation: newBestPulse 1s ease-in-out infinite;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes newBestPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.btn-retry, .btn-home {
    width: 70%;
    padding: 16px 20px;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(16px, 4vmin, 22px);
    font-weight: 800;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.15s ease;
    margin: 0; /* Remove bottom margin to let gap handle it */
}

.btn-retry {
    color: #fff;
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    box-shadow:
        0 5px 0 #c0392b,
        0 10px 24px rgba(255, 107, 107, 0.6),
        0 0 15px rgba(255, 107, 107, 0.4);
    animation: retryBounce 2s infinite;
}

@keyframes retryBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn-retry:active {
    transform: translateY(4px) scale(0.95);
    box-shadow:
        0 1px 0 #c0392b,
        0 3px 12px rgba(255, 107, 107, 0.3);
    animation: none;
}

.btn-home {
    width: 50%;
    padding: 12px 16px;
    font-size: clamp(14px, 3vmin, 18px);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.btn-home:active {
    transform: translateY(2px) scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

/* ===== GET READY OVERLAY ===== */
#get-ready-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#get-ready-overlay.visible {
    opacity: 1;
}

.get-ready-text {
    font-size: clamp(28px, 6vmin, 44px);
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 3px 0 rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: readyPulse 1.2s ease-in-out infinite;
}

@keyframes readyPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.08); opacity: 1; }
}

.tap-hint {
    font-size: clamp(13px, 3vmin, 17px);
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3%;
    animation: subtitlePulse 2s ease-in-out infinite;
}

/* ===== SCREEN SHAKE ===== */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-8px, 4px); }
    20% { transform: translate(8px, -4px); }
    30% { transform: translate(-5px, 6px); }
    40% { transform: translate(5px, -3px); }
    50% { transform: translate(-3px, 4px); }
    60% { transform: translate(3px, -3px); }
    70% { transform: translate(-2px, 2px); }
    80% { transform: translate(2px, -1px); }
    90% { transform: translate(-1px, 1px); }
}

#game-container.shake {
    animation: screenShake 0.2s ease-out;
}

/* ===== FLASH EFFECT ===== */
#flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.08s ease;
}

#flash-overlay.flash {
    opacity: 0.5;
    transition: opacity 0.01s;
}

/* ===== SEO CONTENT SECTION ===== */
.seo-section {
    background: #111;
    color: #ddd;
    padding: 60px 20px;
    line-height: 1.6;
}

.seo-container {
    max-width: 800px;
    margin: 0 auto;
}

.seo-section h1 {
    font-size: 2.5rem;
    color: #ffb347;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.seo-section h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.seo-section p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.seo-section ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.seo-section li {
    margin-bottom: 10px;
}

.play-now-btn {
    display: inline-block;
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    color: #fff;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    margin-top: 20px;
    transition: transform 0.2s;
}

.play-now-btn:hover {
    transform: scale(1.05);
}

.play-now-container {
    text-align: center;
    margin-bottom: 40px;
}
