:root {
    --primary: #6C5CE7;
    --primary-dark: #5F3DC4;
    --secondary: #00B894;
    --danger: #FF6B6B;
    --warning: #FFA502;
    --success: #26DE81;
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --border-radius: 16px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape on iOS */
}

/* ============== DARK MODE ============== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1E1E1E;
        --bg-secondary: #2D2D2D;
        --text-primary: #E8E8E8;
        --text-secondary: #B0B0B0;
        --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7);
    }
    
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    }
    
    .bubble {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .form-group input {
        background: var(--bg-primary);
        color: var(--text-primary);
        border-color: #404040;
    }
    
    .form-group input::placeholder {
        color: var(--text-secondary);
    }
    
    .hangman-part.gallows {
        stroke: #CD853F !important; /* Lighter brown for dark mode */
    }

    .hangman-part.person,
    .hangman-part.person-detail {
        stroke: #FF6B6B !important; /* Same red as light mode */
    }
    
    .key {
        background: #3a3a3a;
        color: var(--text-primary);
    }
    
    .key:hover:not(:disabled) {
        background: #4a4a4a;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation; /* Improve touch responsiveness */
}

/* ============== BACKGROUND ANIMATION ============== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: rise 15s infinite ease-in;
}

.bubble:nth-child(1) {
    width: 80px;
    height: 80px;
    left: 10%;
    animation-duration: 12s;
}

.bubble:nth-child(2) {
    width: 120px;
    height: 120px;
    left: 30%;
    animation-duration: 15s;
    animation-delay: 2s;
}

.bubble:nth-child(3) {
    width: 60px;
    height: 60px;
    left: 50%;
    animation-duration: 10s;
    animation-delay: 4s;
}

.bubble:nth-child(4) {
    width: 100px;
    height: 100px;
    left: 70%;
    animation-duration: 13s;
    animation-delay: 1s;
}

.bubble:nth-child(5) {
    width: 90px;
    height: 90px;
    left: 90%;
    animation-duration: 14s;
    animation-delay: 3s;
}

@keyframes rise {
    0% {
        bottom: -100px;
        transform: translateX(0);
    }
    50% {
        transform: translateX(100px);
    }
    100% {
        bottom: 110vh;
        transform: translateX(-100px);
    }
}

/* ============== NAVIGATION ============== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger-menu span {
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.nav-link:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.logout-btn {
    color: var(--danger);
}

.theme-toggle-nav {
    font-size: 1.2rem;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle-nav:hover {
    transform: scale(1.1) rotate(20deg);
    background: var(--bg-primary);
}

/* ============== PAGE MANAGEMENT ============== */
.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

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

/* ============== AUTH PAGE ============== */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--bg-primary);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ============== ACCESSIBILITY ============== */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

button:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

input:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to main content for screen readers */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 9999;
}

.skip-to-main:focus {
    top: 0;
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    position: relative;
    min-height: 48px; /* Minimum touch target size */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* ============== LOADING STATES ============== */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

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

.btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spinner 0.8s linear infinite;
}

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

/* ============== THEME TOGGLE ============== */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide floating button when navbar is visible */
.navbar:not([style*="display: none"]) ~ .theme-toggle {
    display: none;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 15px 40px rgba(108, 92, 231, 0.4);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Dark mode class for manual toggle */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

body.dark-mode .bubble {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .form-group input {
    background: #1E1E1E;
    color: #E8E8E8;
    border-color: #404040;
}

body.dark-mode .hangman-part.gallows {
    stroke: #CD853F !important; /* Lighter brown for dark mode */
}

body.dark-mode .hangman-part.person,
body.dark-mode .hangman-part.person-detail {
    stroke: #FF6B6B !important; /* Same red as light mode */
}

body.dark-mode .key {
    background: linear-gradient(135deg, #5F3DC4, #4a31a0);
}

body.dark-mode .stat-card,
body.dark-mode .letter-box,
body.dark-mode .user-info,
body.dark-mode .auth-card {
    background: #2D2D2D;
    color: #E8E8E8;
}

/* ============== TOAST NOTIFICATIONS ============== */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

body.dark-mode .toast {
    background: #2D2D2D;
    color: #E8E8E8;
}

body.dark-mode .toast-message {
    color: #E8E8E8;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ============== GAME PAGE ============== */
.game-container {
    max-width: 900px;
    margin: 1rem auto;
    padding: 1rem;
}

.user-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.user-avatar {
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    flex: 1;
}

.username {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-stats-mini {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.hint-container {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 184, 148, 0.2));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hint-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.hint-text {
    flex: 1;
    font-size: 0.95rem;
    color: #FFFFFF;
    font-weight: 500;
    line-height: 1.5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ============== HANGMAN SVG ============== */
.hangman-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
}

.hangman-svg {
    width: 160px;
    height: 200px;
}

.hangman-part {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hangman-part.gallows {
    stroke: #8B4513;
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 1;
}

.hangman-part.person {
    stroke: var(--danger);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
}

.hangman-part.person-detail {
    stroke: var(--danger);
    stroke-width: 1.5;
    fill: none;
}

.hangman-part.show {
    opacity: 1;
    animation: drawPart 0.5s ease;
}

@keyframes drawPart {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============== WORD DISPLAY ============== */
.word-display {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    min-height: 50px;
}

.letter-box {
    width: 40px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    box-shadow: var(--shadow);
    animation: letterPop 0.3s ease;
}

@keyframes letterPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.letter-space {
    width: 20px;
}

/* ============== KEYBOARD ============== */
.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 0.5rem;
}

.key {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
}

.key:active:not(:disabled) {
    transform: translateY(0) scale(0.95); /* Visual feedback on tap */
    box-shadow: 0 5px 10px rgba(108, 92, 231, 0.2);
}

.key:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.key.correct {
    background: linear-gradient(135deg, var(--success), #20B976);
    animation: correctPulse 0.5s ease;
}

.key.wrong {
    background: linear-gradient(135deg, var(--danger), #E84855);
    animation: wrongShake 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}


/* ============== GAME MESSAGE ============== */
.game-message {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: messageSlide 0.5s ease;
}

.game-message.hidden {
    display: none;
}

.game-message.win {
    background: linear-gradient(135deg, rgba(38, 222, 129, 0.9), rgba(32, 191, 107, 0.9));
    color: white;
}

.game-message.lose {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(238, 90, 111, 0.9));
    color: white;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-new-game {
    background: linear-gradient(135deg, var(--secondary), #00a881);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 3rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.btn-new-game:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 184, 148, 0.3);
}

/* ============== HISTORY & STATS PAGES ============== */
.content-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 2rem;
}

.content-container h1 {
    color: white;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    text-align: center;
}

.history-list, .stats-grid {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.history-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-word {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
}

.history-result {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.history-result.won {
    background: var(--success);
    color: white;
}

.history-result.lost {
    background: var(--danger);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-box {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 184, 148, 0.1));
    border-radius: 12px;
}

.stat-box-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-box-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ============== RESPONSIVE ============== */

/* Tablet */
@media (max-width: 992px) {
    .game-container, .content-container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hangman-svg {
        width: 200px;
        height: 250px;
    }
}

/* Mobile - Landscape & Small Tablets */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 4rem 1rem 1rem;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        width: 100%;
        text-align: left;
        padding: 1rem;
        border-radius: 8px;
    }
    
    body.dark-mode .nav-menu {
        background: rgba(45, 45, 45, 0.98);
    }
    
    .navbar {
        padding: 0.5rem 0;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .game-container, .content-container {
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .auth-container {
        padding: 0.5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.75rem;
    }

    .user-info {
        padding: 0.75rem;
    }

    .user-avatar {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }

    .username {
        font-size: 1rem;
    }

    .game-stats {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .hint-container {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .hint-icon {
        font-size: 1.25rem;
    }

    .hint-text {
        font-size: 0.85rem;
    }

    .hangman-wrapper {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .hangman-svg {
        width: 130px;
        height: 165px;
    }
    
    .hangman-part.gallows {
        stroke-width: 2.5;
    }

    .hangman-part.person {
        stroke-width: 2;
    }

    .hangman-part.person-detail {
        stroke-width: 1.5;
    }

    .word-display {
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }

    .letter-box {
        width: 35px;
        height: 45px;
        font-size: 1.3rem;
    }

    .keyboard {
        grid-template-columns: repeat(7, 1fr);
        gap: 0.5rem;
        padding: 0 0.5rem;
        margin-bottom: 1rem;
    }

    .key {
        padding: 0.7rem 0.3rem;
        font-size: 0.95rem;
        min-height: 46px;
        min-width: 44px;
        border-radius: 8px;
        font-weight: 600;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-box {
        padding: 1.5rem;
    }

    .stat-box-value {
        font-size: 2.5rem;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .history-word {
        font-size: 1.1rem;
    }

    .toast {
        min-width: auto;
        max-width: 90vw;
    }
}

/* Mobile - Portrait */
@media (max-width: 480px) {
    .game-container {
        padding: 0.4rem;
        margin: 0.3rem auto;
    }
    
    .auth-card {
        padding: 1.25rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.85rem;
    }

    .user-info {
        padding: 0.6rem;
        gap: 0.6rem;
        margin-bottom: 0.6rem;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.75rem;
    }

    .username {
        font-size: 0.95rem;
    }

    .user-stats-mini {
        font-size: 0.8rem;
    }

    .game-stats {
        gap: 0.5rem;
        margin-bottom: 0.6rem;
    }

    .stat-card {
        padding: 0.6rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .hint-container {
        padding: 0.6rem;
        gap: 0.6rem;
        margin-bottom: 0.6rem;
    }

    .hint-icon {
        font-size: 1.1rem;
    }

    .hint-text {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .hangman-wrapper {
        padding: 0.75rem;
        margin-bottom: 0.6rem;
    }

    .hangman-svg {
        width: 110px;
        height: 140px;
    }
    
    .hangman-part.gallows {
        stroke-width: 2;
    }

    .hangman-part.person {
        stroke-width: 1.8;
    }

    .hangman-part.person-detail {
        stroke-width: 1.2;
    }
    
    .word-display {
        gap: 0.35rem;
        margin-bottom: 0.6rem;
        min-height: 42px;
    }

    .letter-box {
        width: 30px;
        height: 40px;
        font-size: 1.2rem;
        border-bottom: 2px solid var(--primary);
    }

    .keyboard {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.4rem;
        padding: 0 0.3rem;
        margin-bottom: 0.75rem;
    }

    .key {
        padding: 0.65rem 0.25rem;
        font-size: 0.9rem;
        min-height: 44px;
        min-width: 42px;
        border-radius: 7px;
    }

    .btn-new-game {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .game-message {
        font-size: 1rem;
        padding: 0.85rem;
    }

    .stat-box-value {
        font-size: 1.75rem;
    }

    .stat-box-label {
        font-size: 0.85rem;
    }

    .theme-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        bottom: 1rem;
        right: 1rem;
    }

    .toast {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
        min-width: 250px;
    }

    .nav-brand {
        font-size: 1.2rem;
    }
}

/* Very Small Mobile Devices */
@media (max-width: 360px) {
    .auth-title {
        font-size: 1.5rem;
    }

    .game-container {
        padding: 0.5rem;
    }

    .letter-box {
        width: 30px;
        height: 40px;
        font-size: 1.1rem;
    }

    .keyboard {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.35rem;
        padding: 0 0.25rem;
    }

    .key {
        padding: 0.7rem 0.2rem;
        font-size: 0.95rem;
        min-height: 46px;
        min-width: 42px;
        border-radius: 8px;
    }

    .hangman-svg {
        width: 90px;
        height: 115px;
    }
    
    .hangman-part.gallows {
        stroke-width: 1.8;
    }

    .hangman-part.person {
        stroke-width: 1.5;
    }

    .hangman-part.person-detail {
        stroke-width: 1;
    }
}

/* Landscape Mode Optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .game-container {
        margin: 0.3rem auto;
        padding: 0.3rem;
    }

    .user-info {
        padding: 0.5rem;
        margin-bottom: 0.4rem;
    }

    .game-stats {
        margin-bottom: 0.4rem;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }

    .hint-container {
        padding: 0.5rem;
        margin-bottom: 0.4rem;
    }
    
    .hint-text {
        font-size: 0.8rem;
    }

    .hangman-wrapper {
        padding: 0.5rem;
        margin-bottom: 0.4rem;
    }

    .hangman-svg {
        width: 85px;
        height: 110px;
    }
    
    .hangman-part.gallows {
        stroke-width: 1.5;
    }

    .hangman-part.person {
        stroke-width: 1.5;
    }

    .hangman-part.person-detail {
        stroke-width: 1;
    }

    .word-display {
        margin-bottom: 0.4rem;
        gap: 0.3rem;
        min-height: 35px;
    }

    .letter-box {
        width: 28px;
        height: 36px;
        font-size: 1.1rem;
    }

    .keyboard {
        grid-template-columns: repeat(9, 1fr);
        gap: 0.3rem;
        margin-bottom: 0.4rem;
    }

    .key {
        padding: 0.4rem 0.2rem;
        font-size: 0.8rem;
        min-height: 40px;
        border-radius: 6px;
    }
    
    .btn-new-game {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .auth-container {
        padding: 0.75rem;
    }

    .auth-card {
        padding: 1.25rem;
    }
}

/* ============== FOOTER ============== */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer p {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
}

/* Dark mode footer */
@media (prefers-color-scheme: dark) {
    .footer {
        background: rgba(0, 0, 0, 0.2);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

body.dark-mode .footer {
    background: rgba(0, 0, 0, 0.2);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Mobile footer adjustments */
@media (max-width: 768px) {
    .footer {
        padding: 1rem;
    }

    .footer p {
        font-size: 0.85rem;
    }
}
