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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

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

.nav-brand .logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-brand .logo a {
    color: inherit;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

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

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: 70vh;
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    margin-bottom: 1.5rem;
}

.title-main {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.title-subtitle {
    display: block;
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* Hero Visual */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.visual-element {
    position: relative;
    width: 300px;
    height: 300px;
}

.floating-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    transform: rotate(-5deg);
    animation: float 6s ease-in-out infinite;
}

.card-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-line {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
}

.card-line.short {
    width: 60%;
}

.card-line.medium {
    width: 80%;
}

@keyframes float {
    0%, 100% {
        transform: rotate(-5deg) translateY(0px);
    }
    50% {
        transform: rotate(-5deg) translateY(-20px);
    }
}

/* Game-specific Hero Styles */
.game-hero {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.game-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.puzzle-preview {
    position: relative;
    max-width: 400px;
    transition: var(--transition);
}

.puzzle-preview-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.puzzle-preview-link:hover .puzzle-preview {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.puzzle-preview-link:active .puzzle-preview {
    transform: translateY(-2px);
}

.demo-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(37, 99, 235, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.puzzle-preview-link:hover .demo-hint {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.puzzle-preview-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: var(--border-radius);
}

.puzzle-preview-link:focus .puzzle-preview {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .demo-hint {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        bottom: 0.75rem;
    }
    
    .puzzle-preview-link:hover .puzzle-preview {
        transform: translateY(-2px);
    }
}

.puzzle-frame {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
}

.puzzle-frame:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.puzzle-image {
    width: 100%;
    height: auto;
    display: block;
}

.puzzle-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: var(--transition);
}

.puzzle-frame:hover .puzzle-overlay {
    transform: translateY(0);
}

.puzzle-hint p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.image-prompt-clues {
    font-family: 'Playfair Display', serif !important;
    font-size: 1rem !important;
    line-height: 1.4 !important;
    text-align: center;
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9) !important;
    letter-spacing: 0.5px;
    margin: 0 !important;
}

.image-prompt-clues em {
    font-style: italic;
    font-weight: 400;
}

.puzzle-status {
    margin-top: 1rem;
    text-align: center;
}

.difficulty-badge {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Game Demo Section */
.game-demo {
    background-color: var(--bg-tertiary);
    padding: 3rem 2rem;
    border-top: 1px solid var(--border-color);
}

.demo-container {
    max-width: 1000px;
    margin: 0 auto;
}

.demo-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
}

.puzzle-interface {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.puzzle-display {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.demo-puzzle-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.guess-interface {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.guess-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guess-input-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.guess-input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.guess-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.guess-feedback {
    padding: 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-align: center;
    transition: var(--transition);
}

.guess-feedback.correct {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.guess-feedback.incorrect {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.puzzle-hints {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.puzzle-hints h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.puzzle-hints ul {
    margin: 0;
    padding-left: 1.5rem;
}

.puzzle-hints li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Demo Game Enhancements */
.demo-left-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.demo-word-interface {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.demo-instructions {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.demo-instructions h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.demo-instructions p {
    margin: 0;
    color: var(--text-secondary);
}

.demo-tips {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.demo-tips h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.demo-tips ul {
    margin: 0;
    padding-left: 1.5rem;
}

.demo-tips li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.demo-tips strong {
    color: var(--text-primary);
}

.puzzle-hint {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    text-align: center;
}

.demo-puzzle-hint {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 0;
}

.demo-image-prompt {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
}

/* Demo word styling */
.demo-word-row {
    transition: all 0.3s ease;
}

.demo-word-row:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.demo-letter-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 5px rgba(0,123,255,0.3) !important;
}

/* Mobile responsive for demo */
@media (max-width: 768px) {
    .puzzle-interface {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .demo-instructions,
    .demo-tips {
        padding: 1rem;
    }
    
    .demo-letter-container {
        justify-content: center !important;
        gap: 0.25rem !important;
    }
    
    .demo-letter-input {
        width: 35px !important;
        height: 35px !important;
        font-size: 16px !important;
    }
}

/* How to Play Section */
.how-to-play {
    background-color: var(--bg-secondary);
    padding: 3rem 2rem;
}

.rules-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.rules-container h2 {
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.rule-step {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.step-number {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.rule-step h3 {
    margin: 1rem 0;
    color: var(--text-primary);
}

.rule-step p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.gameplay-tips {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.gameplay-tips h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.gameplay-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gameplay-tips li {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    position: relative;
    line-height: 1.5;
}

.gameplay-tips li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.gameplay-tips strong {
    color: var(--primary-color);
}

.scoring-breakdown {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.scoring-breakdown h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.scoring-item {
    background-color: var(--bg-primary);
    padding: 0.75rem 1rem;
    border-radius: calc(var(--border-radius) / 2);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
}

.scoring-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.scoring-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

@media (max-width: 768px) {
    .scoring-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .scoring-breakdown {
        padding: 1rem;
        margin-top: 1.5rem;
    }
}

/* Game Features Section */
.game-features {
    background-color: var(--bg-secondary);
    padding: 4rem 2rem;
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover {
    background-color: #d97706;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-google {
    background-color: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    font-weight: 500;
}

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

.btn-anonymous {
    background-color: #8b5cf6;
    color: white;
    font-weight: 500;
}

.btn-anonymous:hover {
    background-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.google-icon {
    margin-right: 0.5rem;
}

.anonymous-icon {
    font-size: 1.2rem;
}

/* Footer */
.footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.footer-link:hover {
    color: var(--primary-color);
}

.separator {
    color: var(--text-light);
}

/* Error Pages */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.error-content {
    max-width: 500px;
}

.error-code {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.error-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.error-details {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    text-align: left;
}

.error-details h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.error-details pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Authentication Styles */
.auth-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.auth-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.auth-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.auth-modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.auth-modal-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 24px;
    font-weight: 600;
}

.auth-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.auth-modal-close:hover {
    color: #374151;
    background: #f3f4f6;
}

.auth-modal-body {
    padding: 0 24px 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.auth-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.auth-tab:hover {
    color: #1f2937;
}

.auth-form {
    display: none;
}

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

.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

.autogenerate-link {
    color: #3b82f6;
    cursor: pointer;
    font-weight: 400;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s ease;
    margin-left: 4px;
}

.autogenerate-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: all 0.2s ease;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.auth-submit-btn:hover {
    background: #2563eb;
}

.auth-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-loading {
    display: none;
}

.auth-submit-btn.loading .btn-text {
    display: none;
}

.auth-submit-btn.loading .btn-loading {
    display: inline;
}

.auth-error {
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 14px;
    margin-top: 12px;
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    background: white;
    padding: 0 16px;
    color: #6b7280;
    font-size: 14px;
    position: relative;
}

.auth-social {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-anonymous-info {
    text-align: center;
    margin-top: 12px;
}

.auth-anonymous-info small {
    color: #6b7280;
    font-size: 12px;
}

/* Daily Puzzle Info Styles */
.daily-puzzle-info {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.daily-puzzle-info h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.daily-puzzle-info h4 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-puzzle-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* Daily Challenge Header Styles */
.daily-challenge-header {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.daily-challenge-title {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.daily-challenge-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.4;
}

.daily-progress-container {
    margin-bottom: 1.25rem;
}

.progress-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

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

.progress-percentage {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

/* Inline points display for space-efficient layout */
.todays-points-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.todays-points-inline .points-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0;
}

.todays-points-inline .points-earned {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #3b82f6);
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.daily-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.next-puzzle-countdown,
.todays-points {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 120px;
}

.countdown-label,
.points-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.countdown-time {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}

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

/* Mobile responsive adjustments for daily challenge header */
/* Celebration animation styles */
.celebration-easy {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

.celebration-medium {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
}

.celebration-hard {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

.celebration-legendary {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    animation: celebrationPulse 2s ease-in-out;
}

.celebration-mastery {
    background: linear-gradient(135deg, #f59e0b, #ef4444, #8b5cf6) !important;
    animation: masteryGlow 3s ease-in-out;
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }
    50% { transform: scale(1.02); box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5); }
}

@keyframes masteryGlow {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4); 
    }
    33% { 
        transform: scale(1.02); 
        box-shadow: 0 8px 30px rgba(245, 158, 11, 0.5); 
    }
    66% { 
        transform: scale(1.01); 
        box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4); 
    }
}

/* Progress bar celebration enhancement */
.progress-fill {
    position: relative;
    overflow: hidden;
}

.progress-fill.celebrating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 1s ease-in-out;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced countdown animations and states */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
}

@keyframes countdownGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(76, 175, 80, 0.5); }
}

/* ✅ CSS-based countdown state management (replaces inline styling) */
.countdown-completed,
.next-puzzle-countdown.countdown-completed {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0) !important;
    border: 2px solid #4CAF50 !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem !important;
    margin-bottom: 0.5rem;
    animation: countdownGlow 3s ease-in-out infinite;
}

.countdown-progressing,
.next-puzzle-countdown.countdown-progressing {
    background: linear-gradient(135deg, #fef3c7, #fef7e0) !important;
    border: 1px solid #f59e0b !important;
    border-radius: 0.25rem !important;
    padding: 0.5rem !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.countdown-available,
.next-puzzle-countdown.countdown-available {
    background: linear-gradient(135deg, #e0f2fe, #e8f4fd) !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem !important;
    animation: pulse 2s infinite;
}

.countdown-normal,
.next-puzzle-countdown.countdown-normal {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

/* Countdown time element states */
.countdown-time.countdown-completed,
#next-puzzle-countdown.countdown-completed {
    color: #4CAF50 !important;
    font-weight: bold !important;
    font-size: 1.1em !important;
}

.countdown-time.countdown-progressing,
#next-puzzle-countdown.countdown-progressing {
    color: #f59e0b !important;
    font-weight: 600 !important;
}

.countdown-time.countdown-available,
#next-puzzle-countdown.countdown-available {
    color: var(--primary-color) !important;
    font-weight: bold !important;
}

.countdown-time.countdown-normal,
#next-puzzle-countdown.countdown-normal {
    color: #666;
    font-weight: normal;
    font-size: 1em;
}

/* Enhanced daily challenge header states */
.daily-challenge-header.mastery-complete {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border: 2px solid #4CAF50;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.2);
    transform: scale(1.02);
}

.daily-challenge-header.close-to-mastery {
    background: linear-gradient(135deg, #fef3c7, #fef7e0);
    border: 1px solid #f59e0b;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.15);
}

/* Countdown time styling */
.countdown-time.completed {
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.1em;
}

.countdown-time.progressing {
    color: #f59e0b;
    font-weight: 600;
}

/* ✅ Enhanced countdown labels (CSS class-based) */
.countdown-label.countdown-label-special,
.countdown-label.special {
    font-weight: 600;
    color: #4CAF50;
}

.countdown-label.countdown-label-motivational,
.countdown-label.motivational {
    font-weight: 600;
    color: #f59e0b;
}

@media (max-width: 768px) {
    .daily-challenge-header {
        margin-bottom: 1.5rem;
        padding: 1.25rem;
    }
    
    .daily-challenge-title {
        font-size: 1.3rem;
    }
    
    .daily-challenge-subtitle {
        font-size: 0.9rem;
    }
    
    .daily-info-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .next-puzzle-countdown,
    .todays-points {
        min-width: auto;
        width: 100%;
    }
}

.puzzle-schedule ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.puzzle-schedule li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.puzzle-schedule li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.signup-encouragement,
.user-encouragement {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--border-radius);
    color: white;
}

.signup-encouragement h4,
.user-encouragement h4 {
    color: white;
    margin-bottom: 0.75rem;
}

.signup-encouragement p,
.user-encouragement p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.signup-encouragement .btn {
    background-color: white;
    color: var(--primary-color);
    border: none;
    font-weight: 600;
}

.signup-encouragement .btn:hover {
    background-color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Next Puzzles Section */
.next-puzzles-section {
    margin-top: 2rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--border-radius);
    color: white;
    position: relative;
    overflow: hidden;
}

.next-puzzles-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>') repeat;
    pointer-events: none;
}

.next-puzzles-section h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.next-puzzle-info {
    position: relative;
    z-index: 1;
}

.next-puzzle-details {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.puzzle-count-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.puzzle-count-badge .count {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.puzzle-count-badge .label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.next-date {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.125rem;
}

.countdown-container {
    text-align: center;
    margin: 2rem 0;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.countdown-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    min-width: 80px;
    transition: var(--transition);
}

.countdown-segment:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.countdown-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.countdown-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countdown-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    margin: 0;
    line-height: 1.5;
}

.upcoming-total {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
}

.upcoming-total p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

/* Countdown Timer States */
.countdown-timer.soon {
    animation: pulse 2s ease-in-out infinite;
}

.countdown-timer.urgent {
    animation: urgentPulse 1s ease-in-out infinite;
}

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

@keyframes urgentPulse {
    0%, 100% { 
        transform: scale(1); 
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.05); 
        filter: brightness(1.1);
    }
}

.countdown-timer.urgent .countdown-segment {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Responsive Design for Next Puzzles */
@media (max-width: 768px) {
    .next-puzzles-section {
        padding: 2rem 1.5rem;
    }
    
    .next-puzzle-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .puzzle-count-badge {
        padding: 0.75rem 1.25rem;
    }
    
    .puzzle-count-badge .count {
        font-size: 1.5rem;
    }
    
    .countdown-timer {
        gap: 1rem;
    }
    
    .countdown-segment {
        padding: 1rem 0.75rem;
        min-width: 70px;
    }
    
    .countdown-number {
        font-size: 2rem;
    }
    
    .countdown-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .countdown-timer {
        gap: 0.75rem;
    }
    
    .countdown-segment {
        padding: 0.75rem 0.5rem;
        min-width: 60px;
    }
    
    .countdown-number {
        font-size: 1.75rem;
    }
    
    .countdown-description {
        font-size: 1rem;
    }
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-trigger:hover {
    background-color: var(--bg-secondary);
}

.user-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-initials {
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-stats {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.user-menu-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.user-menu.open .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    z-index: 1000;
}

.user-menu-section {
    padding: 1rem;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
}

.menu-user-initials {
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
}

.user-menu-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.user-type {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.user-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0;
}

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

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

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.user-menu-item:hover {
    background-color: var(--bg-secondary);
}

.user-menu-item.logout-item {
    color: #dc2626;
}

.user-menu-item.logout-item:hover {
    background-color: #fef2f2;
}

.menu-item-icon {
    font-size: 1rem;
}

.menu-item-text {
    font-weight: 500;
}

/* Enhanced Profile Metrics in User Menu */
.difficulty-progression {
    padding: 0.75rem 0;
}

.difficulty-progression .section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-progression .section-title::before {
    content: "🎯";
    font-size: 1rem;
}

.highest-level {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 6px;
    border-left: 3px solid #6366f1;
}

.progress-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.progress-value {
    font-size: 0.9rem;
    color: #1f2937;
    font-weight: 600;
}

.level-completion-rates {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.level-rate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: #f9fafb;
    border-radius: 4px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.level-rate-item:hover {
    background: #f3f4f6;
}

.level-rate-item.attempted {
    border-left-color: #10b981;
}

.level-rate-item.not-attempted {
    opacity: 0.6;
    border-left-color: #d1d5db;
}

.level-rate-item.mastered {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left-color: #059669;
}

.level-name {
    font-size: 0.8rem;
    color: #374151;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.level-icon {
    font-size: 0.7rem;
}

.level-percentage {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

.level-percentage.high {
    color: #059669;
}

.level-percentage.medium {
    color: #d97706;
}

.level-percentage.low {
    color: #dc2626;
}

.level-percentage.none {
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        padding: 1rem;
    }
    
    .nav-brand .logo {
        font-size: 1.5rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .title-main {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .puzzle-preview {
        max-width: 300px;
        order: -1;
    }
    
    .puzzle-interface {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .rules-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .game-features {
        padding: 2rem 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .demo-container,
    .rules-container {
        padding: 0 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .error-code {
        font-size: 6rem;
    }
    
    .error-title {
        font-size: 1.5rem;
    }
}

/* ===== PUZZLE PAGE STYLES ===== */

/* Custom Puzzle Game Header */
.puzzle-game-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 0.75rem 0;
}

/* Compact Puzzle Header */
.puzzle-game-header.compact {
    padding: 0.5rem 0; /* Reduced from 0.75rem to 0.5rem */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.puzzle-nav-brand .puzzle-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.puzzle-nav-brand .puzzle-logo a {
    color: inherit;
    text-decoration: none;
}

/* Compact Logo */
.puzzle-nav-brand .puzzle-logo.compact {
    font-size: 1.25rem; /* Reduced from 1.5rem */
}

/* Compact User Section with Points */
.compact-user-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compact-points {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Compact User Badge with Tooltip */
.compact-user-badge {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar.compact.filled {
    width: 28px; /* Slightly larger for better visibility */
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #2563eb; /* Default blue - will be overridden by JavaScript */
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar.compact.filled:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

.user-initials.compact {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    user-select: none;
}

/* Tooltip Styles */
.user-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.user-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.9);
    transform: rotate(45deg);
}

.compact-user-badge:hover .user-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.tooltip-level {
    font-size: 0.75rem;
    color: #a0a0a0;
}

.tooltip-points {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 500;
}

/* Compact Auth Links */
.auth-links.compact {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.auth-links.compact .auth-link {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.auth-links.compact .auth-link:first-child {
    color: var(--accent-color);
    background: transparent;
}

.auth-links.compact .auth-link:last-child {
    color: white;
    background: var(--accent-color);
}

.auth-links.compact .auth-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-level-badge {
    background: var(--accent-color);
    color: white;
    padding: 0.29rem 0.58rem;
    border-radius: 11px;
    font-size: 0.52rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.29px;
    box-shadow: 0 1px 4px rgba(var(--accent-rgb), 0.3);
    margin-right: 0.5rem;
}

/* Combined Level and Points Display */
.level-points-display {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.level-points-display strong {
    color: var(--accent-color);
    font-weight: 600;
}

.puzzle-nav-controls {
    display: flex;
    align-items: center;
}

/* Mobile responsive puzzle header */
@media (max-width: 768px) {
    .puzzle-game-header.compact {
        padding: 0.375rem 0; /* Even more compact on mobile */
    }
    
    .puzzle-nav {
        padding: 0 0.75rem;
    }
    
    .puzzle-nav-brand .puzzle-logo.compact {
        font-size: 1.1rem; /* Further reduced for mobile */
    }
    
    /* Mobile compact user section */
    .compact-user-section {
        gap: 0.375rem;
    }
    
    .compact-points {
        font-size: 0.75rem;
        padding: 0.15rem 0.4rem;
    }
    
    .user-avatar.compact.filled {
        width: 26px; /* Slightly smaller on mobile */
        height: 26px;
    }
    
    .user-initials.compact {
        font-size: 0.65rem;
    }
    
    /* Adjust tooltip position for mobile */
    .user-tooltip {
        right: -8px; /* Slightly adjust position */
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    /* Compact auth links on mobile */
    .auth-links.compact .auth-link {
        padding: 0.2rem 0.6rem;
        font-size: 0.75rem;
    }
}

.puzzle-container {
    min-height: calc(100vh - 60px);
    background: var(--gradient-primary);
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Ensure page loads with image visible */
    scroll-behavior: smooth;
}

.puzzle-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.puzzle-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.guesses-remaining,
.difficulty-level {
    font-weight: 600;
    color: var(--text-primary);
}

.guesses-remaining span,
.difficulty-level span {
    color: var(--accent-color);
    font-weight: 700;
}

.puzzle-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

/* Left Column - Puzzle Image */
.puzzle-image-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.puzzle-image-container {
    position: relative;
    width: 100%; /* Ensure full width usage */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-large);
    background: white;
}

.puzzle-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.puzzle-image-container:hover .image-overlay {
    opacity: 1;
}

.puzzle-image-container {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.puzzle-image-container:hover {
    transform: scale(1.02);
}

.expand-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Right Column - Interaction Area */
.puzzle-interaction-section {
    display: flex;
    flex-direction: column;
    padding: 0 1rem 1rem 1rem;
    height: 100%;
}

/* Themes Section */
.themes-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.themes-section h2 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.4;
    font-weight: normal;
}

.themes-section h2 #current-hint {
    font-style: italic;
    font-weight: bold;
    color: var(--text-primary);
    font-size: 1rem;
}

.themes-section h2 #remaining-count {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: normal;
}

.points-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.points-value {
    color: var(--text-primary);
    font-size: 1rem;
}

.points-value strong {
    color: var(--accent-color);
    font-size: 1.1rem;
}

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

.theme-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.theme-box {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.theme-box.filled {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.theme-box.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.semantic-descriptor {
    margin-left: 1rem;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-row.revealed .semantic-descriptor {
    opacity: 1;
}

/* Hints Section */
.hints-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
    margin-bottom: 2rem;
}

.hints-section h2 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.hint-content {
    background: var(--background-light);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent-color);
}

.hint-content p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Puzzle Page Responsive */
@media (max-width: 1024px) {
    .puzzle-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .puzzle-image-container {
        max-height: 400px;
    }
}

/* Reduce image size by 20% on devices with height < 900px (Galaxy S23, S6, etc.) */
@media (max-height: 899px) {
    .puzzle-image-container {
        max-height: 320px !important; /* 400px * 0.8 = 320px */
    }
    
    .puzzle-image {
        max-height: 320px !important;
        object-fit: contain;
    }
    
    /* For mobile devices with height constraints */
    @media (max-width: 768px) {
        .puzzle-image-container {
            max-height: 38.4vh !important; /* 48vh * 0.8 = 38.4vh */
            min-height: 192px !important; /* 240px * 0.8 = 192px */
        }
        
        .puzzle-image {
            max-height: 38.4vh !important;
            min-height: 192px !important;
        }
    }
    
    /* For very small height devices */
    @media (max-width: 480px) {
        .puzzle-image-container {
            max-height: 320px !important;
        }
        
        .puzzle-image {
            max-height: 320px !important;
        }
    }
    
    /* For extra small devices like Galaxy S6 */
    @media (max-width: 360px) {
        .puzzle-image-container {
            max-height: 280px !important; /* Further reduced for very small screens */
        }
        
        .puzzle-image {
            max-height: 280px !important;
        }
    }
}

@media (max-width: 768px) {
    .puzzle-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Simplified mobile layout - no fixed positioning needed for sequential mode */
    .puzzle-container {
        padding-top: 60px; /* Account for header */
        min-height: auto; /* Remove forced min-height */
    }
    
    .puzzle-content {
        padding: 0.5rem;
        gap: 0.5rem;
        display: flex;
        flex-direction: column; /* Stack vertically */
        margin-top: 0;
    }
    
    /* Mobile image section - simple positioning */
    .puzzle-image-section {
        position: relative; /* Change from fixed to relative */
        order: 1; /* Image first */
        background: white;
        border-radius: 12px;
        margin-bottom: 1rem; /* Space between image and controls */
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Mobile interaction section - no complex margins needed */
    .puzzle-interaction-section {
        order: 2; /* Controls second */
        margin-top: 0; /* Remove complex calculation */
        background: white;
        position: relative;
        z-index: 1;
    }
    
    .puzzle-image-container {
        width: 100%;
        margin: 0;
    }
    
    .puzzle-image {
        width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 12px;
    }
    
    /* Interaction section - appears directly after image */
    .puzzle-interaction-section {
        order: 2;
        padding: 0.25rem;
    }
    
    /* Compact daily challenge header on mobile */
    .daily-challenge-header {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }
    
    .daily-challenge-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .daily-challenge-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    /* Level selector mobile optimization */
    .puzzle-level-selector {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .puzzle-level-selector h2 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
/* Themes section - word triads appear right after image */
.themes-section {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}
    
    .themes-section h2 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Rating section stays close to image */
    .puzzle-rating-container {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    /* Hints section mobile optimization */
    .hints-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .hints-section h2 {
        font-size: 1rem;
    }
}

/* Extra small mobile styles for puzzle page */
@media (max-width: 480px) {
    .puzzle-container {
        padding-top: 55px; /* Smaller header height */
    }
    
    .puzzle-content {
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    /* Even tighter layout for very small screens */
    .puzzle-content {
        padding: 0.25rem;
        gap: 0.25rem;
    }
    
    .puzzle-image-container {
        max-height: 500px; /* Maintain large size even on very small screens */
        margin-bottom: 0.5rem;
    }
    
    .puzzle-image {
        max-height: 500px; /* Maintain large size even on very small screens */
    }
    
    /* Compact sections on very small screens */
    .daily-challenge-header,
    .themes-section {
        padding: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    .puzzle-level-selector.compact {
        gap: 0.5rem;
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .difficulty-label {
        font-size: 0.85rem;
    }
    
    .daily-challenge-title,
    .themes-section h2 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    .daily-challenge-subtitle {
        font-size: 0.85rem;
    }
    
    /* Touch-optimized word input for small screens */
    .word-input-row {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }
    
    .letter-input {
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1rem !important;
    }
}

/* Puzzle Game - Letter Input System */

/* Word Input Rows */
.word-input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

/* Mobile optimization for word input rows */
@media (max-width: 768px) {
    .word-input-row {
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    /* Make letter inputs more touch-friendly */
    .letter-input {
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 1.1rem !important;
        border-radius: 6px;
    }
}

.word-input-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.word-input-row.correct {
    background: rgba(var(--success-rgb), 0.1);
    border-color: var(--success-color);
}

.word-input-row.incorrect {
    background: rgba(var(--error-rgb), 0.1);
    border-color: var(--error-color);
    animation: shake 0.5s ease-in-out;
}

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

/* Letter Input Container */
.letter-input-container {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

/* Individual Letter Inputs */
.letter-input {
    width: 3rem;
    height: 3rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s ease;
    outline: none;
}

.letter-input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3);
    transform: scale(1.05);
}

.letter-input:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
}

.letter-input.correct {
    border-color: var(--success-color);
    background: rgba(var(--success-rgb), 0.2);
    color: var(--success-color);
}

.letter-input:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Semantic Descriptors */
.semantic-descriptor {
    flex: 2;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.semantic-descriptor.revealed {
    opacity: 1;
    color: var(--text-primary);
    font-weight: 500;
}

/* Word Status Indicators */
.word-status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.status-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* Themes Section Styling */
.themes-section {
    margin-bottom: 2rem;
}

.themes-section h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

#remaining-count {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Glyph Title Styling - Match Themes Header */
.glyph-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
    font-family: 'Playfair Display', serif;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

#themes-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

/* Custom scrollbar for themes container */
#themes-container::-webkit-scrollbar {
    width: 6px;
}

#themes-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#themes-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

/* Loading overlay styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Responsive Design for Letter Inputs */
@media (max-width: 768px) {
    .word-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .letter-input-container {
        display: flex;
        justify-content: center;
        gap: 0.25rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .letter-input {
        width: calc((100vw - 4rem) / 8 - 0.25rem);
        max-width: 2.2rem;
        min-width: 1.8rem;
        height: 2.2rem;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .semantic-descriptor {
        text-align: center;
        font-size: 0.8rem;
        padding: 0 0.25rem;
        line-height: 1.3;
    }
    
    .word-status {
        align-self: center;
    }
    
    /* Ensure themes container doesn't cause horizontal scroll */
    #themes-container {
        max-width: 100%;
        overflow-x: hidden;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .puzzle-container {
        padding: 0.25rem;
    }
    
    .puzzle-content {
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    .puzzle-image-container {
        max-height: 400px; /* Reduced from 500px by 20% */
    }
    
    .puzzle-image {
        max-height: 400px; /* Reduced from 500px by 20% */
    }
    
    .themes-section,
    .hints-section {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .word-input-row {
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .letter-input {
        width: calc((100vw - 2rem) / 8 - 0.2rem);
        max-width: 1.8rem;
        min-width: 1.5rem;
        height: 1.8rem;
        font-size: 0.9rem;
    }
    
    .letter-input-container {
        gap: 0.15rem;
        justify-content: center;
    }
    
    .semantic-descriptor {
        font-size: 0.75rem;
        line-height: 1.2;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .puzzle-container {
        padding: 0.125rem;
    }
    
    .puzzle-content {
        padding: 0.125rem;
        gap: 0.25rem;
    }
    
    .puzzle-image-container {
        max-height: 450px; /* Significantly increased from 150px */
    }
    
    .puzzle-image {
        max-height: 450px; /* Significantly increased from 150px */
    }
    
    .letter-input {
        width: calc((100vw - 1rem) / 8 - 0.1rem);
        max-width: 1.5rem;
        min-width: 1.2rem;
        height: 1.5rem;
        font-size: 0.8rem;
    }
    
    .letter-input-container {
        gap: 0.1rem;
    }
    
    .word-input-row {
        padding: 0.125rem;
        margin-bottom: 0.25rem;
    }
    
    .themes-section,
    .hints-section {
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .semantic-descriptor {
        font-size: 0.7rem;
    }
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2001;
}

.image-modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-hint {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    max-width: 600px;
    text-align: center;
}

.modal-hint em {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .image-modal-overlay {
        padding: 1rem;
    }
    
    .image-modal-close {
        top: -40px;
        right: 0;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .modal-image {
        max-height: 75vh;
    }
    
    .modal-hint {
        margin-top: 0.75rem;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Admin Preview Mode Styles */
.admin-preview-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.admin-preview-section h2 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.level-selector {
    margin-bottom: 1rem;
}

.level-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.level-dropdown {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.level-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.preview-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.preview-info h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.current-answers {
    margin-bottom: 1rem;
}

#answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.answer-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid rgba(255, 255, 255, 0.4);
}

.answer-word {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

.answer-descriptor {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.solution-text {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
}

#solution-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 6px;
    font-style: italic;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
}

/* Responsive adjustments for preview mode */
@media (max-width: 768px) {
    .admin-preview-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .admin-preview-section h2 {
        font-size: 1.1rem;
    }
    
    .answer-item {
        padding: 0.5rem;
    }
    
    .answer-word {
        font-size: 1rem;
    }
    
    .answer-descriptor {
        font-size: 0.85rem;
    }
}

/* Next Puzzle Section Styles */
.next-puzzle-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.themes-section .next-puzzle-section {
    margin-top: 1.5rem;
    border-top: 2px solid #e8f5e8;
}

.next-puzzle-btn {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.875rem 2rem;
    border-radius: var(--border-radius);
    min-width: 180px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.next-puzzle-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.next-puzzle-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.next-puzzle-btn:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Responsive adjustments for next puzzle button */
@media (max-width: 768px) {
    .next-puzzle-section {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
    
    .next-puzzle-btn {
        font-size: 0.95rem;
        padding: 0.75rem 1.5rem;
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .next-puzzle-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Daily completion modal styles */
.daily-completed-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.daily-completed-modal.active {
    display: flex;
}

.daily-completed-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.daily-completed-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.daily-completed-close:hover {
    background: #fff;
    color: #333;
    border-color: #ccc;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* New header styles for congratulations and player name */
.daily-completed-header {
    position: relative;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-right: 3rem; /* Space for close button */
}

#daily-completed-congratulations {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#daily-completed-player-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.daily-completed-message {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 2rem;
    text-align: center;
}

.daily-completed-stats h5 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.daily-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.daily-stat-item {
    text-align: center;
    padding: 1rem;
}

.daily-stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.daily-stat-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.countdown-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
}

.countdown-timer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.countdown-part {
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.countdown-number {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.countdown-label {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countdown-description {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 500;
    text-align: center;
}

.daily-completed-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.daily-completed-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
}

.daily-completed-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

/* Mobile responsive countdown */
@media (max-width: 768px) {
    .daily-completed-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 28px;
        height: 28px;
        font-size: 1.3rem;
    }
    
    .daily-completed-header {
        padding-right: 2.5rem; /* Adjust for smaller close button */
    }
    
    #daily-completed-congratulations {
        font-size: 1.8rem;
        gap: 0.3rem;
    }
    
    #daily-completed-player-name {
        font-size: 1.2rem;
    }
    
    .daily-completed-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .countdown-timer {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .countdown-part {
        padding: 0.5rem;
    }
    
    .countdown-number {
        font-size: 1.5rem;
    }
    
    .countdown-label {
        font-size: 0.7rem;
    }
    
    .daily-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .daily-completed-message {
        font-size: 1rem;
    }
}

/* Completed puzzle state styles */
.puzzle-completed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid #4CAF50;
    border-radius: 8px;
    pointer-events: none;
    z-index: 1;
}

.puzzle-completed-banner {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    animation: completedPulse 2s ease-in-out;
}

@keyframes completedPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.puzzle-completed-banner .completion-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Previously completed word styling */
.word-input-row.previously-completed {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(76, 175, 80, 0.1));
    border: 2px solid rgba(76, 175, 80, 0.3);
    position: relative;
}

.word-input-row.previously-completed::before {
    content: '✅';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Previously completed letter inputs */
.letter-input.previously-completed {
    background: #e8f5e8 !important;
    color: #2e7d32 !important;
    border-color: #4CAF50 !important;
    cursor: not-allowed;
    opacity: 0.9;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Points display for previously completed puzzles */
.points-display.previously-completed {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #6c757d;
    color: #6c757d;
}

.points-display.previously-completed .points-label {
    color: #6c757d;
}

/* Hover effects disabled for completed puzzles */
.word-input-row.previously-completed .letter-input:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Compact Level Selector - Completely Transparent */
.puzzle-level-selector.compact {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0;
    margin: 0.75rem 0 0.25rem 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.difficulty-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    margin: 0;
}

.level-dropdown.compact {
    flex: 1;
    min-width: 0; /* Allow dropdown to shrink */
}

/* Mobile optimizations for compact level selector */
@media (max-width: 768px) {
    .puzzle-level-selector.compact {
        gap: 0.75rem;
        padding: 0;
        margin: 0.75rem 0 0.1rem 0;
    }
    
    .difficulty-label {
        font-size: 0.9rem;
    }
    
    .puzzle-rating-container.compact-spacing {
        margin-bottom: 0.1rem;
    }
}

@media (max-width: 480px) {
    .puzzle-level-selector.compact {
        gap: 0.5rem;
        padding: 0;
        margin: 0.75rem 0 0.1rem 0;
    }
    
    .difficulty-label {
        font-size: 0.85rem;
    }
    
    .puzzle-rating-container.compact-spacing {
        margin-bottom: 0.1rem;
    }
}

/* Puzzle Level Selector Styles */
.puzzle-level-selector {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
}

.puzzle-level-selector h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Enhanced Level dropdown styling */
.enhanced-level-dropdown {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    min-height: 50px;
}

.enhanced-level-dropdown:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.enhanced-level-dropdown:hover {
    border-color: var(--primary-color);
}

/* Styling for dropdown options with completion status */
.enhanced-level-dropdown option.completed {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.enhanced-level-dropdown option.in-progress {
    background: #fff3cd;
    color: #856404;
    font-weight: 500;
}

.enhanced-level-dropdown option.available {
    background: #cce5ff;
    color: #004085;
}

.enhanced-level-dropdown option.bounty-available {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    font-weight: 600;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .puzzle-level-selector {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .puzzle-level-selector h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .enhanced-level-dropdown {
        font-size: 0.9rem;
        padding: 0.6rem;
        min-height: 45px;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .puzzle-completed-banner {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .word-input-row.previously-completed::before {
        top: 0.25rem;
        right: 0.25rem;
        font-size: 1rem;
    }
}

/* Demo Page Styles */
.demo-badge {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.demo-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.demo-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.demo-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.demo-tips-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.demo-tips-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-tips-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.demo-tips-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.demo-tips-section li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.demo-instructions-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: var(--border-radius);
    border: 1px solid #93c5fd;
}

.demo-instructions-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-instructions-section p {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.demo-privacy-notice {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
    text-align: center;
}

.demo-privacy-notice small {
    color: #2e7d32;
    font-size: 0.875rem;
    line-height: 1.4;
}

.demo-level-selector {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.demo-level-selector label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.demo-level-selector .level-dropdown {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-level-selector .level-dropdown:hover {
    border-color: var(--primary-color);
}

.demo-level-selector .level-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.demo-level-selector small {
    display: block;
    margin-top: 0.5rem;
    color: #6c757d;
    font-style: italic;
}

.demo-completion-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: var(--border-radius);
    border: 2px solid #4ade80;
    text-align: center;
}

.completion-message h3 {
    font-size: 1.5rem;
    color: #16a34a;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.completion-message p {
    color: #166534;
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.demo-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    .demo-header {
        padding: 1.5rem 1rem 0.75rem;
    }
    
    .demo-header h2 {
        font-size: 2rem;
    }
    
    .demo-description {
        font-size: 1rem;
    }
    
    .demo-tips-section,
    .demo-instructions-section {
        margin: 1rem;
        padding: 1rem;
    }
    
    .demo-completion-section {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .demo-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .demo-actions .btn {
        width: 100%;
        max-width: 280px;
    }
}

/* ========================================
   DEMO GAME - TRIES COUNTER AND FAILED STATES
   ========================================*/

/* Demo Game - Tries Counter and Failed States */
.word-input-row {
    position: relative;
}

.tries-counter {
    transition: all 0.3s ease;
    z-index: 10;
}

.tries-counter.warning {
    animation: pulse-warning 1.5s ease-in-out infinite;
}

.tries-counter.danger {
    animation: pulse-danger 1s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulse-danger {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 10px rgba(255, 152, 0, 0.5); }
}

/* Unsolved word styling */
.word-input-row.failed {
    background-color: #f5f5f5 !important;
    border-color: #ccc !important;
}

.word-input-row.failed .letter-input {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    border-color: #ccc !important;
    cursor: not-allowed !important;
}

.word-input-row.failed .letter-input.failed {
    opacity: 0.8;
}

/* Incorrect word feedback */
.word-input-row.incorrect {
    border-color: #f44336;
    animation: demo-shake 0.5s ease-in-out;
}

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

/* Success states */
.word-input-row.correct {
    border-color: #4CAF50;
    background-color: rgba(232, 245, 233, 0.3) !important;
}

.word-input-row.correct .letter-input.correct {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-color: #28a745 !important;
}

/* ========================================
   LEVEL PROGRESS STYLES (NEW NUMERIC SYSTEM)
   ========================================*/

.level-progress-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.header-level-progress {
    flex-shrink: 0;
}

.level-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.level-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.level-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Update user stats to accommodate level display */
.user-stats {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* Header mini progress chart */
.header-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-mini-progress {
    flex-shrink: 0;
}

/* Responsive adjustments for level progress */
@media (max-width: 768px) {
    .level-progress-section {
        gap: 0.75rem;
        padding: 0.5rem 0;
    }

    .level-title {
        font-size: 0.8rem;
    }

    .level-subtitle {
        font-size: 0.75rem;
    }

    .user-stats {
        font-size: 0.75rem;
        max-width: 150px;
    }

    .header-user-info {
        gap: 0.25rem;
    }
}

/* Registration CTA Section for Anonymous Users */
.register-now-section {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    border-radius: var(--border-radius);
    margin: 0 !important;
    padding: 1.5rem !important;
}

.register-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.register-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.register-content {
    flex: 1;
}

.register-title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.register-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

.btn-register {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-register:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

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

.btn-register:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Hide Profile/Settings for anonymous users */
.user-menu.anonymous #profileButton,
.user-menu.anonymous #settingsButton {
    display: none;
}

/* Modern Auth Links Styling */
.auth-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.auth-link {
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px; /* Touch-friendly height */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login - Secondary action (subtle) */
.auth-login {
    color: var(--text-secondary);
    background: transparent;
    position: relative;
}

.auth-login::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.2s ease;
    transform: translateX(-50%);
}

.auth-login:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.auth-login:hover::after {
    width: 70%;
}

/* Sign Up - Primary action (more prominent) */
.auth-signup {
    color: white;
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    border: 1px solid transparent;
}

.auth-signup:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e3a8a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.auth-signup:active {
    transform: translateY(0);
}

/* Mobile responsive auth links */
@media (max-width: 768px) {
    .auth-links {
        gap: 1rem;
    }
    
    .auth-link {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        min-height: 44px;
    }
    
    /* Adjust for smaller screens but keep touch-friendly */
    .auth-login {
        padding: 0.5rem 0.75rem;
    }
    
    .auth-signup {
        padding: 0.6rem 1.25rem;
        font-weight: 600;
    }
}

@media (max-width: 480px) {
    .auth-links {
        gap: 0.75rem;
    }
    
    .auth-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.9rem;
    }
    
    .auth-login {
        padding: 0.4rem 0.6rem;
    }
    
    .auth-signup {
        padding: 0.5rem 1rem;
    }
}

/* Streamlined Today's Points Display */
.todays-points-display {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.points-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.points-icon {
    font-size: 1rem;
}

.points-text strong {
    color: var(--accent-color);
    font-weight: 600;
}

/* Compact Countdown */
.compact-countdown {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.countdown-compact {
    font-weight: 500;
}

/* Mobile optimizations for new streamlined layout */
@media (max-width: 768px) {
    .todays-points-display {
        margin: 0.5rem 0;
        padding: 0.4rem 0.6rem;
        border-radius: 6px;
    }
    
    .points-info {
        font-size: 0.85rem;
        gap: 0.4rem;
    }
    
    .points-icon {
        font-size: 0.9rem;
    }
    
    .compact-countdown {
        padding: 0.4rem;
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .todays-points-display {
        margin: 0.4rem 0;
        padding: 0.35rem 0.5rem;
    }
    
    .points-info {
        font-size: 0.8rem;
        gap: 0.35rem;
    }
    
    .compact-countdown {
        padding: 0.35rem;
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* Compact spacing for rating container */
.puzzle-rating-container.compact-spacing {
    margin-bottom: 0.25rem;
}

/* Reduce spacing between themes container and hint section */
#themes-container + #themes-header {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Ensure themes-header has minimal top spacing when following themes-container */
.themes-section #themes-header {
    margin-top: 0.5rem;
}

/* Reduce default h2 margins for themes-header specifically */
#themes-header {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Debug borders removed - positioning complete */

/* Puzzle Navigation Arrows */
.puzzle-nav-arrows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to image */
}

.puzzle-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    pointer-events: auto; /* Re-enable clicks for buttons */
}

.puzzle-nav-left {
    left: 10px;
}

.puzzle-nav-right {
    right: 10px;
}

.nav-arrow-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.nav-arrow-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.nav-arrow-btn:active {
    transform: scale(0.95);
}

/* Mobile optimizations for navigation arrows */
@media (max-width: 768px) {
    .puzzle-nav-left {
        left: 8px;
    }
    
    .puzzle-nav-right {
        right: 8px;
    }
    
    .nav-arrow-btn {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .puzzle-nav-left {
        left: 6px;
    }
    
    .puzzle-nav-right {
        right: 6px;
    }
    
    .nav-arrow-btn {
        width: 40px;
        height: 40px;
    }
    
    .nav-arrow-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Fix themes-container spacing on mobile */
@media (max-width: 768px) {
    #themes-container {
        gap: 0.25rem !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        min-height: auto !important;
    }
    
    /* Sequential mode specific - even tighter */
    body[data-sequential-mode="true"] #themes-container {
        gap: 0.1rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Style the hint wrapper when moved inside themes-container */
    .hint-wrapper {
        margin-top: 0.25rem !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }
    
    /* Ensure hint header has no extra margins when inside container */
    .hint-wrapper #themes-header {
        margin: 0 !important;
        padding: 0.5rem 0 !important;
    }
}

/* Mobile footer improvements */
@media (max-width: 768px) {
    .footer {
        padding: 1rem 0.5rem;
        margin-top: 2rem;
    }
    
    .footer-content {
        text-align: center;
    }
    
    .footer-content p {
        font-size: 0.8rem;
        color: #666;
        margin: 0;
        line-height: 1.4;
    }
}

/* Mobile responsive for inline points layout */
@media (max-width: 480px) {
    .progress-indicator {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .todays-points-inline {
        order: 2;
        align-self: flex-end;
        font-size: 0.8rem;
    }
    
    .progress-percentage {
        order: 3;
        align-self: flex-end;
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .register-now-section {
        padding: 1rem !important;
    }
    
    .register-cta {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .register-icon {
        font-size: 1.5rem;
    }
    
    .register-title {
        font-size: 0.9rem;
    }
    
    .register-subtitle {
        font-size: 0.8rem;
    }
    
    .btn-register {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}
