@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Press Start 2P', 'Segoe UI', sans-serif;
    color: #f8fbff;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

body.theme-night {
    background-color: #05060c;
    color: #f8fbff;
}

body.theme-day {
    background-color: #fef7d2;
    color: #0f172a;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
	padding: 0;
    box-sizing: border-box;
}

#gameCanvas {
    display: block;
	width: 100vw; /* Full width on mobile */
    height: 100vh;
    max-width: 600px; /* Larger width for bigger characters */
    background: transparent;
    /* Ensure canvas takes full viewport height on mobile */
    min-height: 100vh;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: pointer;
	margin: 0 auto;
}

/* On screens above 500px, center with white space */
@media (min-width: 500px) {
	#gameCanvas {
		width: 500px;
		height: 700px;
		margin: 0 auto;
	}
}

.screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: left;
    z-index: 10;
    background: rgba(8, 10, 18, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(2px);
    border-radius: 12px;
	min-width: 300px;
    max-width: 90%;
}

.screen.hidden {
    display: none;
}

.screen h1 {
    font-size: 1.8rem;
    color: #7dd3fc;
    text-shadow: 0 0 12px rgba(125, 211, 252, 0.35);
    margin-bottom: 1rem;
}

.screen h2 {
    font-size: 1.5rem;
    color: #7dd3fc;
    text-shadow: 0 0 12px rgba(125, 211, 252, 0.35);
    margin-bottom: 1rem;
}

.screen p {
    color: #e2e8f0;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

button {
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
    color: white;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 12px;
    cursor: pointer;
    margin: 0;
    transition: all 0.2s;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    font-family: 'Press Start 2P', monospace;
}

button:hover {
    background: linear-gradient(180deg, #0ea5e9, #0284c7);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.18);
    color: #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button.secondary.tiny {
    padding: 0.25rem 0.4rem;
    font-size: 0.55rem;
    border-radius: 4px;
}

/* Red "danger" button style (works for buttons and links) */
button.danger, a.danger {
	background: #ef4444;
	box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
	color: #fff;
}
button.danger:hover, a.danger:hover {
	background: #dc2626;
	box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

button.secondary.small {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 18px;
}

button.secondary:hover {
    background: rgba(2, 6, 23, 0.8);
    border-color: rgba(56, 189, 248, 0.4);
}

#game-ui {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#game-ui.hidden {
    display: none;
}

.floating-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    pointer-events: auto;
}

#play-again-btn:hover {
    background: #22c55e !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74,222,128,0.4) !important;
}

#play-again-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74,222,128,0.3) !important;
}

#game-over-screen {
    z-index: 15;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(5, 6, 12, 0.95) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    min-width: auto !important;
    max-width: none !important;
    overflow-y: auto;
}

#game-over-screen.hidden {
    display: none !important;
}

#game-over-screen .panel {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 12px;
    padding: 0.6rem 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.5);
}

#evolution-status {
    background: #E8F4F8;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-size: 0.95rem;
    color: #2C3E50;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    #game-container {
        padding: 0;
        padding-top: 50px;
    }
    
    #top-bar {
        padding: 0.4rem 0.5rem;
        gap: 0.5rem;
    }
    
    #score-display, #fun-points {
        font-size: 0.8rem;
    }
    
    #evolution-text {
        font-size: 0.65rem;
    }
    
    #skins-btn-game {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .screen {
        padding: 1.5rem;
    }
    
    .screen h1 {
        font-size: 2rem;
    }
    
    .screen h2 {
        font-size: 1.5rem;
    }
    
    button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #evolution-progress {
        bottom: 0.3rem;
        padding: 0.5rem 0.7rem;
    }
    
    .progress-label {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    
    #evolution-text {
        font-size: 0.7rem;
    }
    
    #score-display, #fun-points {
        font-size: 0.9rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #game-container {
        padding: 0.25rem;
    }
    
    #game-ui {
        top: 0.25rem;
        left: 0.25rem;
        width: calc(100% - 0.5rem);
    }
    
    #evolution-progress {
        width: calc(98% - 0.5rem);
        padding: 0.5rem;
    }
}

/* Skins Screen */
#skins-screen {
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-sizing: border-box;
	text-align: center;
}

@media (max-width: 480px) {
    #skins-screen {
        padding: 1.5rem;
        max-height: 85vh;
    }
}

@media (max-width: 360px) {
    #skins-screen {
        padding: 1rem;
        max-height: 80vh;
    }
}

#total-blubs-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4A90E2;
    margin-bottom: 1rem;
}

#skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
	margin: 1rem 0 2rem;
}

/* Player page background canvas to match gameplay vibe */
#player-bg-canvas {
	position: fixed;
	inset: 0;
	z-index: 0;
	width: 100vw;
	height: 100vh;
	display: block;
	image-rendering: pixelated;
	pointer-events: none;
}

/* Scroll area for player page to keep preview visible on all devices */
#player-scroll {
	max-height: min(60vh, 600px);
	overflow-y: auto;
	padding-right: 0.25rem;
}

@media (max-width: 480px) {
	#player-scroll {
		max-height: 55vh;
	}
}

/* Dark, game-like dashboard styling for Player screen */
#player-screen.screen {
	background: rgba(8, 10, 18, 0.88);
	border: 1px solid rgba(56, 189, 248, 0.25);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(2, 6, 23, 0.8);
	backdrop-filter: blur(2px);
}

#player-screen h2 {
	color: #7dd3fc;
	text-shadow: 0 0 12px rgba(125, 211, 252, 0.35);
}

#player-stats {
	color: #e2e8f0;
}

#player-stats span {
	color: #facc15;
}

#back-to-game {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
}

/* Player compact dashboard layout */
#player-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	align-items: start;
	margin: 0.5rem 0 0.75rem;
}

.player-col.left, .player-col.right {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.panel {
	background: rgba(2, 6, 23, 0.6);
	border: 1px solid rgba(56, 189, 248, 0.18);
	border-radius: 12px;
	padding: 0.6rem 0.75rem;
	box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.5);
}

.panel-title {
	font-size: 0.8rem;
	color: #7dd3fc;
	margin-bottom: 0.4rem;
	text-align: left;
}

.stats-table {
	width: 100%;
	border-collapse: collapse;
}

.stats-table td {
	padding: 0.25rem 0.25rem;
	font-size: 0.8rem;
	color: #e2e8f0;
}

.stats-table td.value {
	text-align: right;
	color: #facc15;
	font-weight: bold;
}

@media (max-width: 640px) {
	#player-layout {
		grid-template-columns: 1fr;
	}
	
	#player-screen {
		padding: 1rem !important;
	}
	
	#player-screen h2 {
		font-size: 1.2rem !important;
	}
	
	#player-preview {
		width: 100px !important;
		height: 100px !important;
	}
	
	#player-scroll {
		max-height: 300px !important;
	}
}

/* Home screen themed like player screen */
#home-screen.screen {
	background: rgba(8, 10, 18, 0.88);
	border: 1px solid rgba(56, 189, 248, 0.25);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(2, 6, 23, 0.8);
	backdrop-filter: blur(2px);
}

#home-screen h1 {
	color: #7dd3fc;
	text-shadow: 0 0 12px rgba(125, 211, 252, 0.35);
	margin-bottom: 0.5rem;
}

.panel {
	background: rgba(2, 6, 23, 0.6);
	border: 1px solid rgba(56, 189, 248, 0.18);
	border-radius: 12px;
	padding: 0.6rem 0.75rem;
	box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.5);
}

.panel-title {
	font-size: 0.8rem;
	color: #7dd3fc;
	margin-bottom: 0.4rem;
	text-align: left;
}

.howto-list {
	margin-left: 1rem;
}
.howto-list li {
	margin: 0.25rem 0;
	color: #e2e8f0;
	font-size: 0.9rem;
	text-align: left;
}

/* Tap-to-start overlay */
#tap-to-start {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	z-index: 20;
	font-size: 1.2rem;
	font-weight: 700;
	color: #4ade80;
	text-shadow: 0 0 20px rgba(74, 222, 128, 0.6), 0 0 40px rgba(74, 222, 128, 0.3);
	animation: pulse 1.5s infinite;
	font-family: 'Press Start 2P', monospace;
}
#tap-to-start.hidden { display: none; }
@keyframes pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.4; transform: scale(0.95); }
}


/* Game over screen already uses .screen class which has the dark theme */

.skin-card {
    background: rgba(12, 16, 32, 0.95);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.skin-card.selected {
    border-color: #38ef7d;
    box-shadow: 0 0 20px rgba(56, 239, 125, 0.45);
}

.skin-card.locked {
    opacity: 0.65;
}

.skin-preview {
    display: block;
    margin: 0 auto 0.75rem;
    image-rendering: pixelated;
    border: 3px solid rgba(255, 255, 255, 0.08);
    background: #06070f;
}

.skin-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.skin-cost {
    font-size: 0.65rem;
    color: #facc15;
    margin-bottom: 0.4rem;
}

.skin-action button {
    background: #38bdf8;
    color: #020617;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.skin-card.selected button {
    background: #38ef7d;
    color: #020617;
}

.skin-share-btn {
    background: #f43f5e !important;
    color: #fff !important;
}

.skin-action button:disabled {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #skins-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

