/**
 * COINRETRO MAIN STYLESHEET
 *
 * TABLE OF CONTENTS
 * ---------------------------
 * 1. GLOBAL STYLES & VARIABLES
 * 2. LAYOUT & REUSABLE COMPONENTS
 * - .container
 * - .btn (Buttons)
 * - .game-card (and grids)
 * - table (Leaderboard)
 * - .form-container (Login/Register Forms)
 * - .session-message (Feedback alerts)
 * 3. SITE STRUCTURE
 * - header
 * - footer
 * 4. PAGE-SPECIFIC STYLES
 * - #hero, #how-it-works (Homepage)
 * - #profile-page
 * 5. GAME MODAL STYLES
 * 6. RESPONSIVE DESIGN (@media query)
 */


/* ==========================================================================
   1. GLOBAL STYLES & VARIABLES
   ========================================================================== */

:root {
    --dark-bg: #10101a;
    --primary-purple: #8A2BE2;
    --bright-cyan: #00FFFF;
    --hot-pink: #FF00FF;
    --light-grey: #3a3a5a;
    --text-color: #E0E0E0;
    --retro-font: 'Press Start 2P', cursive;
}

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

body {
    font-family: sans-serif; /* A fallback font */
    background-color: var(--dark-bg);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: var(--retro-font);
    color: white;
}

a {
    color: var(--bright-cyan);
    text-decoration: none;
}

ul {
    list-style: none;
}


/* ==========================================================================
   2. LAYOUT & REUSABLE COMPONENTS
   ========================================================================== */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 60px 0;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-family: var(--retro-font);
    font-size: 0.7rem;
    text-transform: uppercase;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
}
.btn-primary:hover {
    background-color: transparent;
    color: var(--primary-purple);
}
.btn-secondary {
    background-color: transparent;
    border-color: var(--light-grey);
    color: white;
}
.btn-secondary:hover {
    background-color: var(--light-grey);
}
.btn-large {
    padding: 15px 30px;
    font-size: 0.9rem;
}

/* --- Grids (for Games, Shop, Profile) --- */
.games-grid, .shop-grid, .miners-grid, .stats-grid, .wallet-grid {
    display: grid;
    gap: 20px;
}
.games-grid, .shop-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.miners-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stats-grid, .wallet-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* --- Cards (for Games, Miners, Stats) --- */
.game-card, .miner-card, .stat-card, .wallet-card {
    background: var(--dark-bg);
    border: 2px solid var(--light-grey);
    text-align: center;
    padding: 20px;
}
.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 255, 255, 0.2);
    border-color: var(--bright-cyan);
}
.game-card img {
    max-width: 100%;
    margin-bottom: 15px;
}
.game-card h3 {
    margin-bottom: 10px;
    color: var(--bright-cyan);
}
.game-card .btn {
    margin-top: 15px;
}
.miner-card h4 {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}
.stat-card h4, .wallet-card h4 {
    font-size: 0.9rem;
    color: var(--bright-cyan);
    margin-bottom: 10px;
}
.stat-card p, .wallet-card p {
    font-size: 1.2rem;
    color: white;
    font-family: var(--retro-font);
}


/* --- Tables (for Leaderboard) --- */
table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--retro-font);
    font-size: 0.8rem;
}
th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--light-grey);
}
th {
    color: var(--bright-cyan);
}
tbody tr:hover {
    background-color: var(--light-grey);
}
td img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 10px;
    image-rendering: pixelated;
}

/* --- Forms (for Login, Register) --- */
.form-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    background: #141420;
    border: 2px solid var(--light-grey);
}
.form-container h2 {
    margin-bottom: 30px;
    font-size: 1.5rem;
}
.form-group {
    margin-bottom: 20px;
    text-align: left;
}
.form-group label {
    display: block;
    font-family: var(--retro-font);
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text-color);
}
.form-group input {
    width: 100%;
    padding: 12px;
    background: var(--dark-bg);
    border: 2px solid var(--light-grey);
    color: white;
    font-family: sans-serif;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-purple);
}
.form-container .btn {
    width: 100%;
}
.form-switch {
    margin-top: 20px;
    font-size: 0.9rem;
}

/* --- Session Messages (Feedback Alerts) --- */
.session-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid;
    font-family: sans-serif;
    font-size: 0.9rem;
    text-align: center;
}
.session-message.success {
    background-color: #1a3a1a;
    border-color: #2a8a2a;
    color: #a0e0a0;
}
.session-message.error {
    background-color: #3a1a1a;
    border-color: #8a2a2a;
    color: #e0a0a0;
}


/* ==========================================================================
   3. SITE STRUCTURE
   ========================================================================== */

header {
    background: rgba(16, 16, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--light-grey);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
header .logo {
    font-size: 1.5rem;
    color: var(--bright-cyan);
    text-shadow: 2px 2px var(--hot-pink);
}
header nav ul {
    display: flex;
    gap: 25px;
}
header nav a {
    font-family: var(--retro-font);
    font-size: 0.7rem;
    color: var(--text-color);
    transition: color 0.3s;
}
header nav a:hover {
    color: var(--bright-cyan);
}
header nav a.active {
    color: var(--hot-pink);
    text-shadow: 0 0 5px var(--hot-pink);
}
header .auth-buttons {
    display: flex;
    gap: 15px;
}

footer {
    background: #0a0a12;
    padding: 40px 0 20px;
    border-top: 2px solid var(--light-grey);
}
.footer-columns {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}
.footer-column h3 {
    margin-bottom: 15px;
    color: var(--bright-cyan);
}
.footer-column ul li {
    margin-bottom: 10px;
}
.footer-column a:hover {
    color: white;
}
.social-icons a {
    font-size: 1.5rem;
    margin-right: 15px;
}
.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-grey);
    font-size: 0.8rem;
    color: #aaa;
}


/* ==========================================================================
   4. PAGE-SPECIFIC STYLES
   ========================================================================== */

/* --- Homepage --- */
#hero {
    background: linear-gradient(rgba(16, 16, 26, 0.7), rgba(16, 16, 26, 0.9)), url('https://via.placeholder.com/1920x1080/10101a/000000?text=') center center/cover no-repeat;
    text-align: center;
    padding: 100px 0;
}
#hero h1 {
    font-size: 3rem;
    text-shadow: 3px 3px var(--hot-pink);
}
#hero h2 {
    font-size: 1.5rem;
    color: var(--bright-cyan);
    margin-bottom: 20px;
}
#hero p {
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto 30px;
}
#how-it-works .container {
    display: flex;
    justify-content: space-between;
    text-align: center;
    gap: 30px;
}
#how-it-works .step i {
    font-size: 3rem;
    color: var(--primary-purple);
    margin-bottom: 15px;
}
#how-it-works .step h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

/* --- Profile Page --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 50px;
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border: 4px solid var(--light-grey);
    image-rendering: pixelated;
}
.profile-info h2 {
    font-size: 2rem;
}
.profile-section h3 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--light-grey);
    padding-bottom: 10px;
    margin-bottom: 20px;
}


/* ==========================================================================
   5. EMBEDDED GAME STYLES
   ========================================================================== */
.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 40px auto;
  aspect-ratio: 2 / 1;
  border-radius: 20px;
  border: 4px solid #ff00cc;
  background: linear-gradient(135deg, #111122, #1a1a33);
  box-shadow:
    inset 0 0 20px rgba(255, 0, 204, 0.5),
    inset 0 0 40px rgba(0, 255, 255, 0.2),
    0 0 30px rgba(255, 0, 255, 0.4),
    0 0 60px rgba(0, 255, 255, 0.2);
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background-color: #111;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  border: 2px solid var(--bright-cyan, #23ee88);
  border-radius: 10px;
  box-shadow:
    inset 0 0 20px rgba(0, 255, 255, 0.3),
    0 0 25px rgba(255, 0, 255, 0.4);
}

#game-overlay {
  backdrop-filter: blur(6px);
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  font-family: 'Press Start 2P', cursive;
}

#start-screen button,
#game-over-screen a.btn {
  background: linear-gradient(to right, #ff00cc, #23ee88);
  color: #000;
  border: none;
  font-family: 'Press Start 2P', sans-serif;
  padding: 12px 24px;
  margin-top: 20px;
  cursor: pointer;
  border-radius: 10px;
  box-shadow:
    0 0 10px #23ee88,
    0 0 20px #ff00cc;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#start-screen button:hover,
#game-over-screen a.btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 20px #23ee88,
    0 0 40px #ff00cc;
}


/* ==========================================================================
   6. RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    #hero h1 { font-size: 2.2rem; }
    #hero h2 { font-size: 1.2rem; }
    #how-it-works .container {
        flex-direction: column;
    }
    .footer-columns {
        flex-direction: column;
        text-align: center;
    }
}