/* YULE: Ninja 3 Strikes — Premium UI Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Inter:wght@300;400;600;700&display=swap');

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cyan: #00f0ff;
    --green: #00ff88;
    --red: #ff2244;
    --gold: #ffcc00;
    --purple: #bd00ff;
    --dark: #06080c;
    --panel: rgba(6, 8, 14, 0.88);
    --border: rgba(0, 240, 255, 0.18);
    --font-hud: 'Orbitron', 'Inter', sans-serif;
    --font-ui: 'Inter', sans-serif;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: var(--font-ui);
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
}

/* ============================================================
   GAME CANVAS
   ============================================================ */
#game-canvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
}

/* ============================================================
   MENU SCREEN
   ============================================================ */
#menu-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    overflow-y: auto;
    padding: 60px 16px;
    background: radial-gradient(ellipse at 50% 30%, rgba(0, 40, 10, 0.95) 0%, rgba(6, 8, 14, 0.98) 100%);
    backdrop-filter: blur(2px);
}

/* Row wrapper that holds rules card + sign-in card side by side */
.menu-cards-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    width: 100%;
    max-width: 1080px;
    flex-wrap: wrap;
}

/* ---- Rules of the Game card ---- */
.rules-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px 40px;
    width: min(480px, 90vw);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 255, 136, 0.03);
    align-self: stretch;
}

.rules-card-title {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 3px;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.35);
    text-transform: uppercase;
    margin-bottom: 28px;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(0, 240, 255, 0.07);
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s;
}

.rules-list li:hover {
    background: rgba(0, 255, 136, 0.04);
    border-color: rgba(0, 255, 136, 0.15);
}

.rule-num {
    font-family: var(--font-hud);
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--cyan);
    opacity: 0.7;
    padding-top: 2px;
    flex-shrink: 0;
    min-width: 24px;
}

.rule-text {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.65;
}

.rule-text strong {
    color: #fff;
    font-weight: 600;
}

#menu-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0, 255, 136, 0.025) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0, 255, 136, 0.025) 40px);
    pointer-events: none;
}

.menu-logo {
    text-align: center;
    margin-bottom: 10px;
}

.menu-cat-icon {
    font-size: 6rem;
    line-height: 1;
    animation: float-bob 3s ease-in-out infinite;
}

.menu-cat-icon img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 18px;
    filter: drop-shadow(0 0 24px rgba(0, 255, 136, 0.55));
    animation: float-bob 3s ease-in-out infinite;
}

@keyframes float-bob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.menu-title {
    font-family: var(--font-hud);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.6), 0 0 50px rgba(0, 255, 136, 0.2);
    margin-top: 12px;
    animation: title-glow 2s ease-in-out infinite alternate;
}

@keyframes title-glow {
    from {
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.5), 0 0 40px rgba(0, 255, 136, 0.2);
    }

    to {
        text-shadow: 0 0 30px rgba(0, 255, 136, 0.9), 0 0 70px rgba(0, 255, 136, 0.4);
    }
}

.menu-subtitle {
    font-family: var(--font-hud);
    font-size: 0.85rem;
    letter-spacing: 6px;
    color: var(--gold);
    margin-top: 6px;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
}

.game-description-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 48px;
    width: min(520px, 90vw);
    margin-top: 40px;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 255, 136, 0.03);
}

.menu-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 48px;
    width: min(520px, 90vw);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 255, 136, 0.03);
}

.menu-field-label {
    font-family: var(--font-hud);
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--cyan);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.menu-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 8px;
    padding: 14px 18px;
    font-family: var(--font-hud);
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 2px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 28px;
}

.menu-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12);
}

.menu-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.menu-input.error {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(255, 34, 68, 0.2);
    animation: input-shake 0.4s ease;
}

@keyframes input-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

.name-error {
    display: none;
    font-family: var(--font-hud);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--red);
    text-shadow: 0 0 8px rgba(255, 34, 68, 0.5);
    margin-top: -18px;
    margin-bottom: 18px;
    padding: 6px 10px;
    background: rgba(255, 34, 68, 0.08);
    border-left: 3px solid var(--red);
    border-radius: 4px;
    animation: fade-in 0.2s ease;
}

.name-error.visible {
    display: block;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #00cc66, #00ff88);
    border: none;
    border-radius: 8px;
    font-family: var(--font-hud);
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #000;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 136, 0.6);
}

.start-btn:active {
    transform: translateY(0);
}

.menu-rules {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 8px 10px;
}

.rule-item .ri {
    font-size: 1rem;
}

/* ============================================================
   GAME HUD OVERLAY
   ============================================================ */
#game-ui {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}

#game-ui.hidden {
    display: none;
}

/* --- Score (top-right) --- */
#score-panel {
    position: absolute;
    top: 20px;
    right: 24px;
    text-align: right;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    min-width: 160px;
    backdrop-filter: blur(8px);
}

.hud-label {
    font-family: var(--font-hud);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: var(--cyan);
    opacity: 0.7;
}

#score-value {
    font-family: var(--font-hud);
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 204, 0, 0.6);
    line-height: 1.1;
    transition: transform 0.15s;
}

#score-value.pop {
    animation: score-pop 0.3s ease;
}

@keyframes score-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
        color: #fff;
    }

    100% {
        transform: scale(1);
    }
}

/* --- Timer + Strikes (top-left) --- */
#info-panel {
    position: absolute;
    top: 20px;
    left: 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#yule-icon-hat {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.18);
    background: var(--panel);
}

#timer-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    backdrop-filter: blur(8px);
}

#timer-value {
    font-family: var(--font-hud);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    transition: color 0.3s;
}

#timer-value.crit {
    color: var(--red);
    text-shadow: 0 0 15px rgba(255, 34, 68, 0.7);
    animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes timer-pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.6;
    }
}

#strikes-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    backdrop-filter: blur(8px);
}

#strikes-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.strike-icon {
    font-size: 1.4rem;
    transition: all 0.3s;
    filter: drop-shadow(0 0 6px rgba(255, 34, 68, 0.5));
}

.strike-icon.used {
    filter: grayscale(1) brightness(0.3);
    transform: scale(0.85);
}

/* --- Ninja counter (mid-left) --- */
#ninja-panel {
    position: absolute;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    backdrop-filter: blur(8px);
    text-align: center;
    min-width: 70px;
}

#ninja-count {
    font-family: var(--font-hud);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--red);
    text-shadow: 0 0 10px rgba(255, 34, 68, 0.5);
}

/* --- Player name (bottom-left) --- */
#player-panel {
    position: absolute;
    bottom: 24px;
    left: 24px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    backdrop-filter: blur(8px);
}

#player-name-display {
    font-family: var(--font-hud);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 1px;
}

/* --- Bottom-right ammo indicator --- */
#ammo-panel {
    position: absolute;
    bottom: 24px;
    right: 24px;
    text-align: right;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    backdrop-filter: blur(8px);
}

.ammo-label {
    font-family: var(--font-hud);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.4);
}

.ammo-value {
    font-family: var(--font-hud);
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

/* --- Crosshair (center) --- */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 2px;
}

/* vertical bar */
#crosshair::before {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

/* horizontal bar */
#crosshair::after {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

/* center dot — gap in bars */
#crosshair-gap {
    position: absolute;
    width: 6px;
    height: 6px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 60, 60, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 60, 60, 0.8);
}

/* --- Kill popup --- */
.kill-popup {
    position: absolute;
    font-family: var(--font-hud);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
    pointer-events: none;
    animation: kill-float 0.9s ease-out forwards;
    white-space: nowrap;
}

@keyframes kill-float {
    0% {
        transform: translateY(0) scale(0.7);
        opacity: 1;
    }

    60% {
        transform: translateY(-50px) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translateY(-90px) scale(0.9);
        opacity: 0;
    }
}

/* --- Spawn warning --- */
#spawn-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-hud);
    font-size: 0.9rem;
    letter-spacing: 4px;
    color: var(--red);
    text-shadow: 0 0 15px var(--red);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#spawn-warning.active {
    opacity: 1;
    animation: warning-blink 0.6s ease-in-out;
}

@keyframes warning-blink {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* --- Hit Flash Overlay --- */
#hit-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(255, 0, 0, 0);
    transition: none;
}

#hit-flash.active {
    animation: hit-flash-anim 0.4s ease-out forwards;
}

@keyframes hit-flash-anim {
    0% {
        background: rgba(255, 0, 0, 0.55);
    }

    30% {
        background: rgba(255, 0, 0, 0.3);
    }

    100% {
        background: rgba(255, 0, 0, 0);
    }
}

/* blood splatter corners */
#hit-flash.active::before,
#hit-flash.active::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(180, 0, 0, 0.6) 0%, transparent 70%);
    animation: hit-flash-anim 0.4s ease-out forwards;
}

#hit-flash.active::before {
    width: 300px;
    height: 300px;
    top: -50px;
    left: -50px;
}

#hit-flash.active::after {
    width: 300px;
    height: 300px;
    bottom: -50px;
    right: -50px;
}

/* --- Muzzle flash overlay --- */
#muzzle-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

#muzzle-flash.pop {
    animation: muzzle-pop 0.08s ease-out forwards;
}

@keyframes muzzle-pop {
    0% {
        opacity: 0.18;
        background: radial-gradient(ellipse at 60% 85%, rgba(255, 200, 80, 0.6) 0%, transparent 60%);
    }

    100% {
        opacity: 0;
    }
}

/* --- Click-to-play overlay --- */
#click-to-play {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
    pointer-events: all;
}

#click-to-play .ctp-title {
    font-family: var(--font-hud);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--green);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    animation: title-glow 1.5s ease-in-out infinite alternate;
}

#click-to-play .ctp-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

#click-to-play.hidden {
    display: none;
}

/* ============================================================
   GAME OVER SCREEN
   ============================================================ */
#game-over-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
}

#game-over-screen.hidden {
    display: none;
}

.go-card {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 48px;
    width: min(580px, 94vw);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: card-rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes card-rise {
    from {
        transform: translateY(40px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

#go-title {
    font-family: var(--font-hud);
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

#go-title-icon {
    height: 3.5rem;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    mix-blend-mode: screen;
}

#go-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1px;
    margin-bottom: 30px;
}

#go-player-name {
    font-family: var(--font-hud);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.go-score-wrapper {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 204, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.go-score-label {
    font-family: var(--font-hud);
    font-size: 0.65rem;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}

#go-score {
    font-family: var(--font-hud);
    font-size: 4rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.5);
    line-height: 1;
}

.go-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
}

.go-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px;
}

.go-stat-label {
    font-family: var(--font-hud);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}

.go-stat-value {
    font-family: var(--font-hud);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.go-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.go-btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-family: var(--font-hud);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.go-btn:hover {
    transform: translateY(-2px);
}

.go-btn-x {
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.go-btn-x:hover {
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

.x-logo {
    font-size: 1rem;
    font-weight: 900;
}

.go-btn-screenshot {
    background: rgba(0, 240, 255, 0.08);
    color: var(--cyan);
    border: 1px solid rgba(0, 240, 255, 0.25);
}

.go-btn-screenshot:hover {
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.15);
}

.go-btn-again {
    background: linear-gradient(135deg, #00cc66, #00ff88);
    color: #000;
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.3);
}

.go-btn-again:hover {
    box-shadow: 0 8px 28px rgba(0, 255, 136, 0.5);
}

.go-share-note {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 10px;
    line-height: 1.5;
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden {
    display: none !important;
}

/* Vignette overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}

.back-home-link {
    font-family: var(--font-hud);
    font-size: 0.8rem;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    text-decoration: none;
    letter-spacing: 2px;
    transition: color 0.2s, text-shadow 0.2s;
    font-weight: 600;
}

.back-home-link:hover {
    color: var(--green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
    text-decoration: underline;
}