/* CSS Variables for theming - easy to expand in the future */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #d1d5db;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: rgba(0, 0, 0, 0.1);
    --icon-invert: 0;
    --icon-opacity: 0.9;
}

:root[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --border-color: #404040;
    --success-color: #34d399;
    --error-color: #f87171;
    --shadow: rgba(0, 0, 0, 0.3);
    --icon-invert: 1;
    --icon-opacity: 0.9;
}

:root[data-theme="ocean"] {
    --bg-primary: #0a192f;
    --bg-secondary: #172a45;
    --bg-tertiary: #233554;
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --accent-color: #64ffda;
    --accent-hover: #52e4c0;
    --border-color: #233554;
    --success-color: #64ffda;
    --error-color: #ff6b9d;
    --shadow: rgba(0, 0, 0, 0.4);
    --icon-invert: 1;
    --icon-opacity: 0.9;
}

:root[data-theme="forest"] {
    --bg-primary: #1a2f1a;
    --bg-secondary: #2d4a2d;
    --bg-tertiary: #3d5a3d;
    --text-primary: #e8f5e9;
    --text-secondary: #a5d6a7;
    --accent-color: #66bb6a;
    --accent-hover: #81c784;
    --border-color: #3d5a3d;
    --success-color: #81c784;
    --error-color: #ef5350;
    --shadow: rgba(0, 0, 0, 0.4);
    --icon-invert: 1;
    --icon-opacity: 0.9;
}

:root[data-theme="sunset"] {
    --bg-primary: #2d1b2e;
    --bg-secondary: #4a2f4b;
    --bg-tertiary: #5f3d61;
    --text-primary: #fce4ec;
    --text-secondary: #f8bbd0;
    --accent-color: #ff6090;
    --accent-hover: #ff80ab;
    --border-color: #5f3d61;
    --success-color: #ffab91;
    --error-color: #ef5350;
    --shadow: rgba(0, 0, 0, 0.4);
    --icon-invert: 1;
    --icon-opacity: 0.9;
}

:root[data-theme="midnight"] {
    --bg-primary: #0d0d1a;
    --bg-secondary: #1a1a33;
    --bg-tertiary: #26264d;
    --text-primary: #e6e6ff;
    --text-secondary: #9999cc;
    --accent-color: #9d84ff;
    --accent-hover: #b399ff;
    --border-color: #26264d;
    --success-color: #84d9ff;
    --error-color: #ff84a9;
    --shadow: rgba(0, 0, 0, 0.5);
    --icon-invert: 1;
    --icon-opacity: 0.9;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

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

/* Header Styles */
header {
    background: var(--bg-secondary);
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow);
}

@media (max-width: 768px) {
    header {
        padding: 8px 0;
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 15px;
        gap: 10px;
        justify-content: center;
    }
}

h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    white-space: nowrap;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1rem;
    }
}

.site-title {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: opacity 0.3s;
}

@media (max-width: 768px) {
    .site-title {
        gap: 10px;
        width: 100%;
        justify-content: center;
    }
}

.site-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(var(--icon-invert, 0));
    opacity: var(--icon-opacity, 1);
}

@media (max-width: 768px) {
    .site-icon {
        width: 40px;
        height: 40px;
    }
}

.site-title:hover {
    opacity: 0.8;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .user-info {
        gap: 8px;
        width: 100%;
        justify-content: center;
    }
}

/* Theme Dropdown Styles */
.theme-dropdown-container {
    position: relative;
}

.theme-dropdown {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    min-width: 140px;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23888" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.theme-dropdown:hover {
    background: var(--border-color);
    border-color: var(--accent-color);
}

.theme-dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.theme-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

@media (max-width: 768px) {
    .theme-dropdown {
        min-width: 120px;
        font-size: 0.85rem;
        padding: 6px 10px;
        padding-right: 28px;
    }
}

@media (max-width: 480px) {
    .theme-dropdown {
        min-width: 110px;
        font-size: 0.8rem;
        padding: 5px 8px;
        padding-right: 26px;
    }
}

.user-info #userDisplay {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .user-info #userDisplay {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .user-info #userDisplay {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 5px;
    }
}

/* Button Styles */
.btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s, transform 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    padding: 20px 60px;
    font-size: 1.5rem;
    border-radius: 12px;
}

/* Card Styles */
.card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Message Styles */
.message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: var(--success-color);
    color: white;
    display: block;
}

.message.error {
    background: var(--error-color);
    color: white;
    display: block;
}

/* Main Menu Styles */
.main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    text-align: center;
}

.game-icon-container {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease-in;
}

.game-icon {
    width: 300px;
    height: 300px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(var(--icon-invert, 0));
    opacity: var(--icon-opacity, 1);
    transition: transform 0.3s ease;
}

.game-icon:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .game-icon {
        width: 200px;
        height: 200px;
    }
}

.game-title {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    .game-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Footer Styles */
footer {
    background: var(--bg-secondary);
    padding: 30px 0;
    margin-top: 50px;
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -2px 4px var(--shadow);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.footer-contact {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
