@import 'shared.css';


* {
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100dvh;
    /* Using dvh for mobile UI consistency */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 30%);
    z-index: -2;
    pointer-events: none;
}

body.dark-mode::before {
    background: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.1), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.1), transparent 25%);
}

/* Fix for mobile keyboard covering content */
.native-keyboard-mode {
    align-items: flex-start !important;
}

.native-keyboard-mode .game-container {
    height: 100dvh !important;
    overflow-y: auto;
    justify-content: flex-start;
}

.native-keyboard-mode .typing-keyboard,
.native-keyboard-mode #keyboard-container {
    display: none !important;
}

/* Glassmorphism Container Utility */
.glass-panel {
    background: var(--surface-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: var(--surface-shadow);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.game-card {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-radius: 18px;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.game-card:active {
    transform: translateY(1px);
}

.game-icon {
    font-size: 32px;
    margin-right: 18px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.1) rotate(5deg);
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.game-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.game-desc {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Themes */
.faces-theme::after {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.85), rgba(218, 112, 214, 0.85));
}

.faces-theme {
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.wordle-theme::after {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.85), rgba(245, 158, 11, 0.85));
}

.wordle-theme {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.typing-theme::after {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.85), rgba(249, 115, 22, 0.85));
}

.typing-theme {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.space-theme::after {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.85), rgba(68, 136, 255, 0.85));
}

.space-theme {
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
}

.bee-theme::after {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.85), rgba(251, 191, 36, 0.85));
}

.bee-theme {
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Update wrapper width for cards */
.menu-wrapper {
    width: 90%;
    max-width: 450px;
    padding: 30px 25px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 5px;
    letter-spacing: 0.5px;
}

.menu-description {
    font-size: 16px;
    margin: 0 0 25px;
    opacity: 0.7;
    font-weight: 500;
}

/* Dark Mode Toggle */
/* Dark Mode Toggle & Controls */
#dark-mode-toggle,
#keyboard-toggle {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--surface-bg);
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--surface-shadow);
    border: 1px solid var(--surface-border);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.absolute-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

#dark-mode-toggle:hover,
#keyboard-toggle:hover {
    transform: scale(1.1);
}

#dark-mode-toggle:active,
#keyboard-toggle:active {
    transform: scale(0.95);
}


.native-keyboard-mode #keyboard-container {
    display: none !important;
}

/* Global Game Header */
.game-header {
    width: 100%;
    min-height: var(--header-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: env(safe-area-inset-top, 15px) 15px 10px;
}

.game-header > :first-child {
    justify-self: start;
}

.game-header > :last-child {
    justify-self: end;
}

.game-header h1 {
    justify-self: center;
    text-align: center;
    margin: 0;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-bg);
    color: var(--text-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 18px;
    box-shadow: var(--surface-shadow);
    border: 1px solid var(--surface-border);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.back-button:hover {
    background: var(--key-hover);
}

/* Shared Keyboard Styles */
#keyboard-container {
    width: 100%;
    max-width: 500px;
    padding: 5px 8px 10px;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 auto;
}

.keyboard-row {
    display: flex;
    width: 100%;
    gap: 4px;
    touch-action: manipulation;
}

.keyboard-row button {
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--key-bg);
    color: var(--key-text);
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    font-size: clamp(14px, 4vw, 18px);
    height: clamp(45px, 8vh, 58px);
    transition: background-color 0.1s ease, transform 0.05s ease, box-shadow 0.05s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
    -webkit-tap-highlight-color: transparent;
    outline: none;
    transform: translateY(0);
}

.keyboard-row button:active,
.keyboard-row button.key-pressed {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
    background-color: var(--key-hover);
}

.keyboard-row button.wide-button {
    flex: 1.5;
    font-size: clamp(12px, 3.5vw, 15px);
}

/* Shared utility classes for state (used by both games) */
.key-correct {
    background-color: var(--color-correct) !important;
    color: white !important;
}

.key-present {
    background-color: var(--color-present) !important;
    color: white !important;
}

.key-absent {
    background-color: var(--color-absent) !important;
    color: white !important;
}

/* Message Toast */
.game-message {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: var(--bg-color);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.game-message.show {
    opacity: 1;
}

@media (max-width: 480px) {
    .menu-wrapper {
        width: 85%;
        padding: 30px 20px;
    }

    h1 {
        font-size: 28px;
    }
}

.level-select {
    background: var(--surface-bg);
    color: var(--text-color);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    padding: 5px 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    backdrop-filter: blur(8px);
    outline: none;
    cursor: pointer;
    margin-right: 5px;
}

/* Start Overlay */
.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface-bg);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: 12px;
    transition: opacity 0.3s ease;
}

.start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-btn {
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 12px;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
    margin-top: 15px;
}

.start-btn:hover {
    transform: scale(1.05);
    background: var(--button-hover);
}
