@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    color: #00ff00;
    overflow: hidden;
    height: 100vh;
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border: 4px solid #00ff00;
    background: #000;
    box-shadow: 0 0 20px #00ff00;
}

.header {
    padding: 20px;
    background: linear-gradient(90deg, #001100, #003300);
    border-bottom: 2px solid #00ff00;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2rem;
    font-weight: 900;
    text-shadow: 0 0 10px #00ff00;
    letter-spacing: 2.4px;
}

.stats {
    display: flex;
    gap: 24px;
    font-size: 0.96rem;
    font-weight: 700;
}

.timer, .clicks {
    padding: 8px 12px;
    border: 2px solid #00ff00;
    background: rgba(0, 255, 0, 0.1);
    text-shadow: 0 0 5px #00ff00;
    width: 112px;
    text-align: center;
}

.leaderboard-btn {
    font-family: 'Orbitron', monospace;
    font-size: 0.96rem;
    font-weight: 700;
    padding: 8px 12px;
    background: linear-gradient(45deg, #003300, #006600);
    color: #00ff00;
    border: 2px solid #00ff00;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    text-shadow: 0 0 5px #00ff00;
    text-align: center;
}

.leaderboard-btn:hover {
    background: linear-gradient(45deg, #006600, #009900);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.7);
    transform: translateY(-1px);
}

.leaderboard-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 3px rgba(0, 255, 0, 0.5);
}

.main-content {
    flex: 1;
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    min-height: 0;
}

.game-area {
    flex: none;
    position: relative;
    background: radial-gradient(circle at center, #001a00, #000);
    overflow: hidden;
    border-right: 2px solid #00ff00;
    width: min(calc((100vh - 96px) * 1.5), calc(100vw - 280px));
    height: min(calc(100vh - 96px), calc((100vw - 280px) / 1.5));
    min-width: 640px;
    min-height: 480px;
    aspect-ratio: 3/2;
}

.analytics-panel {
    flex: 1;
    min-width: 240px;
    background: linear-gradient(180deg, #001100, #000);
    padding: 16px;
    overflow-y: auto;
    min-height: 480px;
}

.circle {
    position: absolute;
    width: 8vmin;
    height: 8vmin;
    background: radial-gradient(circle, #00ff00, #00cc00);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 10px rgba(255, 255, 255, 0.3);
    transition: transform 0.1s ease, top 0.08s ease-out, left 0.08s ease-out;
    display: none;
}

.circle:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 30px #00ff00,
        inset 0 0 15px rgba(255, 255, 255, 0.5);
}

.circle:active {
    transform: scale(0.9);
}

.start-screen, .end-screen, .username-prompt, .calculating-screen, .leaderboard-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border: 3px solid #00ff00;
    border-radius: 10px;
    box-shadow: 0 0 30px #00ff00;
}

.start-screen h2, .end-screen h2, .username-prompt h2, .calculating-screen h2, .leaderboard-screen h2 {
    font-size: 3rem;
    margin-bottom: 30px;
    text-shadow: 0 0 15px #00ff00;
    animation: pulse 2s infinite;
}

.start-screen p, .end-screen p {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #cccccc;
}

.start-btn, .restart-btn {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 15px 30px;
    background: linear-gradient(45deg, #003300, #006600);
    color: #00ff00;
    border: 3px solid #00ff00;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px #00ff00;
}

.start-btn:hover, .restart-btn:hover {
    background: linear-gradient(45deg, #006600, #009900);
    box-shadow: 0 0 20px #00ff00;
    transform: translateY(-2px);
}

.start-btn:active, .restart-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 5px #00ff00;
}

@keyframes pulse {
    0%, 100% { 
        text-shadow: 0 0 15px #00ff00;
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 25px #00ff00;
        transform: scale(1.05);
    }
}

/* Retro scan lines effect */
.game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.03) 2px,
        rgba(0, 255, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

#finalTime {
    color: #00ff00;
    font-weight: 900;
    text-shadow: 0 0 10px #00ff00;
}

/* Analytics Panel Styles */
.analytics-panel h3 {
    font-size: 1.2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 0 0 10px #00ff00;
    border-bottom: 2px solid #00ff00;
    padding-bottom: 8px;
}

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

.stat-box {
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid #00ff00;
    padding: 12px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #00cc00;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.44rem;
    font-weight: 900;
    color: #00ff00;
    text-shadow: 0 0 8px #00ff00;
}

.chart-section {
    margin-top: 16px;
}

.chart-section h4 {
    font-size: 0.96rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    color: #00cc00;
    text-shadow: 0 0 5px #00ff00;
}

.chart-container {
    height: 160px;
    background: rgba(0, 255, 0, 0.03);
    border: 2px solid #00ff00;
    border-radius: 5px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.1);
}

.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 1rem;
    font-weight: 700;
    color: #006600;
    text-shadow: 0 0 5px #00ff00;
}

.chart-bars {
    display: flex;
    align-items: end;
    height: 150px;
    gap: 3px;
    padding: 0 10px;
    flex: 1;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, #003300, #00ff00);
    border: 1px solid #00ff00;
    border-radius: 2px 2px 0 0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 10px;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.chart-bar:hover {
    background: linear-gradient(to top, #004400, #00ff88);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    transform: scaleY(1.05);
}

.chart-bar.latest {
    background: linear-gradient(to top, #440000, #ff4400);
    border-color: #ff4400;
    box-shadow: 0 0 10px rgba(255, 68, 0, 0.6);
}

.chart-bar.latest:hover {
    background: linear-gradient(to top, #550000, #ff6600);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.8);
}

.bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, 
        rgba(0, 255, 0, 0.8), 
        rgba(0, 255, 0, 0.3)
    );
    border-radius: 1px 1px 0 0;
}

.chart-bar.latest .bar-fill {
    background: linear-gradient(to top, 
        rgba(255, 68, 0, 0.8), 
        rgba(255, 68, 0, 0.3)
    );
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #00cc00;
    border-top: 1px solid #00ff00;
    margin-top: 5px;
}

/* Add scan line effect to analytics panel */
.analytics-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 255, 0, 0.02) 3px,
        rgba(0, 255, 0, 0.02) 6px
    );
    pointer-events: none;
}

/* Username Prompt Styles */
.username-prompt input {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    padding: 10px 15px;
    margin: 20px 0;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    border-radius: 5px;
    color: #00ff00;
    text-align: center;
    width: 250px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.username-prompt input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    background: rgba(0, 255, 0, 0.15);
}

.username-prompt input::placeholder {
    color: #006600;
    opacity: 0.8;
}

/* Calculating Screen Styles */
.calculating-screen {
    min-width: 400px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.loading-dots span {
    font-size: 2rem;
    color: #00ff00;
    animation: loadingDot 1.5s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes loadingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Leaderboard Screen Styles */
.leaderboard-screen {
    min-width: 500px;
    max-height: 80vh;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
}

.player-score {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.player-score h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
}

.player-score p {
    font-size: 1.2rem;
    color: #cccccc;
    margin: 0;
}

.leaderboard-list {
    flex: 1;
    max-height: 30vh;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 2px solid #00ff00;
    border-radius: 5px;
    background: rgba(0, 255, 0, 0.05);
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    transition: background 0.3s ease;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 0, 0.1);
}

.leaderboard-entry.current-player {
    background: rgba(255, 255, 0, 0.1);
    border: 1px solid #ffff00;
    font-weight: bold;
}

.leaderboard-entry .rank {
    font-weight: 900;
    font-size: 1.1rem;
    color: #00ff00;
    min-width: 40px;
    text-align: left;
}

.leaderboard-entry .username {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: #cccccc;
}

.leaderboard-entry.current-player .username {
    color: #ffff00;
    text-shadow: 0 0 5px #ffff00;
}

.leaderboard-entry .score {
    font-weight: 700;
    font-size: 1.1rem;
    color: #00ff00;
    min-width: 80px;
    text-align: right;
}

/* Tinybird Button Styles */
.tinybird-link {
    display: block;
    text-decoration: none;
    margin-top: 20px;
}

.tinybird-btn {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 12px 16px;
    background: linear-gradient(45deg, #003300, #006600);
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
    text-shadow: 0 0 3px #00ff00;
    width: 100%;
    text-align: center;
}

.tinybird-btn:hover {
    background: linear-gradient(45deg, #006600, #009900);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
    transform: translateY(-1px);
}

.tinybird-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.4);
}

/* Responsive Design for Smaller Screens */
@media screen and (max-width: 1440px) {
    h1 {
        font-size: 1.6rem;
        letter-spacing: 1.6px;
    }
    
    .stats {
        font-size: 0.8rem;
        gap: 16px;
    }
    
    .timer, .clicks {
        width: 96px;
        padding: 6px 10px;
    }
    
    .leaderboard-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .game-area {
        min-width: 480px;
        min-height: 320px;
    }
    
    .analytics-panel {
        min-width: 200px;
        padding: 12px;
    }
    
    .analytics-panel h3 {
        font-size: 0.96rem;
        margin-bottom: 12px;
    }
    
    .stat-value {
        font-size: 1.12rem;
    }
    
    .chart-section h4 {
        font-size: 0.8rem;
    }
    
    .chart-container {
        height: 120px;
    }
    
    .tinybird-btn {
        font-size: 0.64rem;
        padding: 8px 10px;
    }
}

@media screen and (max-width: 1200px) {
    h1 {
        font-size: 1.44rem;
        letter-spacing: 0.8px;
    }
    
    .stats {
        font-size: 0.72rem;
        gap: 12px;
    }
    
    .timer, .clicks {
        width: 80px;
        padding: 5px 8px;
        font-size: 0.72rem;
    }
    
    .leaderboard-btn {
        font-size: 0.72rem;
        padding: 5px 8px;
    }
    
    .game-area {
        min-width: 400px;
        min-height: 280px;
    }
    
    .analytics-panel {
        min-width: 160px;
        padding: 10px;
    }
    
    .analytics-panel h3 {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    
    .stat-label {
        font-size: 0.64rem;
    }
    
    .stat-value {
        font-size: 0.96rem;
    }
    
    .chart-section h4 {
        font-size: 0.72rem;
    }
    
    .chart-container {
        height: 96px;
    }
    
    .tinybird-btn {
        font-size: 0.56rem;
        padding: 6px 8px;
    }
}

@media screen and (max-width: 1024px) {
    .header {
        padding: 12px;
    }
    
    h1 {
        font-size: 1.2rem;
        letter-spacing: 0.8px;
    }
    
    .stats {
        font-size: 0.64rem;
        gap: 8px;
    }
    
    .timer, .clicks {
        width: 72px;
        padding: 4px 6px;
        font-size: 0.64rem;
    }
    
    .leaderboard-btn {
        font-size: 0.64rem;
        padding: 4px 6px;
    }
    
    .game-area {
        min-width: 320px;
        min-height: 240px;
    }
    
    .analytics-panel {
        min-width: 144px;
        padding: 8px;
        min-height: 400px;
    }
    
    .analytics-panel h3 {
        font-size: 0.72rem;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }
    
    .stat-box {
        padding: 8px;
    }
    
    .stat-label {
        font-size: 0.56rem;
        margin-bottom: 2px;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .chart-section {
        margin-top: 12px;
    }
    
    .chart-section h4 {
        font-size: 0.64rem;
        margin-bottom: 8px;
    }
    
    .chart-container {
        height: 80px;
        padding: 6px;
    }
    
    .no-data {
        font-size: 0.64rem;
    }
    
    .chart-labels {
        font-size: 0.48rem;
        padding: 2px 6px;
    }
    
    .tinybird-btn {
        font-size: 0.48rem;
        padding: 5px 6px;
    }
}

/* Misclick animation */
@keyframes misclickFlash {
    0% {
        background: radial-gradient(circle at center, #001a00, #000);
    }
    20% {
        background: radial-gradient(circle at center, #1a0000, #300000);
    }
    100% {
        background: radial-gradient(circle at center, #001a00, #000);
    }
}

.game-area.misclick {
    animation: misclickFlash 0.6s ease-out;
}
