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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.game-area {
    background: transparent;
    border-radius: 20px;
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.puzzle-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.date {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
}

.progress {
    font-size: 1rem;
    color: #666;
}

.chain-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
    flex: 1;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: fit-content;
    margin: 0 auto;
    position: relative;
}

.word-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.letter-slot {
    width: 60px;
    height: 60px;
    background: #1e3a8a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.letter-slot.revealed {
    background: #1e3a8a;
    color: white;
}

.letter-slot.empty {
    background: #1e3a8a;
    color: #1e3a8a;
}

.letter-slot.current-row {
    background: #fbbf24;
    color: #1e3a8a;
    animation: pulse 2s infinite;
}

.word-row.selectable {
    animation: selectable-pulse 1.5s infinite;
}

.word-row.selectable .letter-slot {
    background: #dc2626;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Only apply hover effects on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .word-row.selectable:hover .letter-slot {
        background: #b91c1c;
        transform: scale(1.05);
    }

    .word-row.selectable:hover {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
    }
}

.word-row.active .letter-slot {
    background: #16a34a;
    color: white;
    cursor: default;
    transition: all 0.3s ease;
}

.word-row.active .letter-slot:hover {
    background: #16a34a;
    transform: none;
}

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

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

@keyframes letterReveal {
    0% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% { 
        transform: scale(1.1);
        opacity: 1;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

.input-area {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.money-display {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.money-label {
    color: #666;
    font-size: 1rem;
}

.money-amount {
    color: #16a34a;
    font-size: 1.3rem;
    font-weight: 700;
}

.stats-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    padding: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: white;
}

.stats-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.help-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    padding: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: white;
}

.help-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Game completion overlay styles */

.step-display {
    margin-bottom: 20px;
}

.step-info {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
    display: inline-block;
}

.input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

#answer-input {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    width: 300px;
    outline: none;
    transition: border-color 0.3s;
}

#answer-input:focus {
    border-color: #667eea;
}

#submit-btn {
    padding: 15px 25px;
    font-size: 1.1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

#submit-btn:hover {
    background: #5a6fd8;
}

#submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.feedback {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback.neutral {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.stats {
    display: flex;
    justify-content: space-around;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

@media (max-width: 600px) {
    .container {
        padding: 2vw;
        width: 96vw;
        margin: 0 auto;
    }
    
    header h1 {
        font-size: 8vw;
    }
    
    .subtitle {
        font-size: 4vw;
    }
    
    .chain-display {
        gap: 2vw;
        padding: 3vw;
    }
    
    .letter-slot {
        width: 12vw;
        height: 12vw;
        font-size: 5vw;
    }
    
    .word-row {
        gap: 2vw;
    }
    
}

/* Game Completion Styles */
.game-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.completion-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
}

.completion-modal h2 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.completion-message {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.completion-chain {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.chain-item {
    background: #667eea;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}

.chain-arrow {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2rem;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.completion-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: #667eea;
    color: white;
}

.action-btn.primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.action-btn.secondary {
    background: #e9ecef;
    color: #333;
}

.action-btn.secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Styles - Enhanced */
@media (max-width: 768px) {
    .container {
        padding: 2vw;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    header h1 {
        font-size: 6vw;
    }
    
    .subtitle {
        font-size: 3vw;
    }
    
    .chain-display {
        padding: 3vw;
        gap: 1.5vw;
        margin: 0 auto;
        width: fit-content;
        max-width: calc(100vw - 4vw);
    }
    
    .letter-slot {
        width: 11vw;
        height: 11vw;
        font-size: 3.8vw;
        min-width: 15px;
        min-height: 15px;
    }
    
    .word-row {
        gap: 1.5vw;
    }
    
    .money-display {
        font-size: 2.5vw;
        padding: 1vw 2vw;
        margin-top: 2vw;
    }
    
    .money-label {
        font-size: 2.2vw;
    }
    
    .money-amount {
        font-size: 2.8vw;
    }
    
    .stats-btn {
        width: 6vw;
        height: 6vw;
        font-size: 2vw;
        padding: 1vw;
        min-width: 28px;
        min-height: 28px;
    }
    
    .help-btn {
        width: 6vw;
        height: 6vw;
        font-size: 2vw;
        padding: 1vw;
        min-width: 28px;
        min-height: 28px;
        margin-right: 1vw;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5vw;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    header h1 {
        font-size: 7vw;
    }
    
    .subtitle {
        font-size: 3.5vw;
    }
    
    .chain-display {
        padding: 2.5vw;
        gap: 1.2vw;
        margin: 0 auto;
        width: fit-content;
        max-width: calc(100vw - 3vw);
    }
    
    .letter-slot {
        width: 10vw;
        height: 10vw;
        font-size: 3.5vw;
        min-width: 12px;
        min-height: 12px;
    }
    
    .word-row {
        gap: 1.2vw;
    }
    
    .money-display {
        font-size: 2.2vw;
        padding: 0.8vw 1.5vw;
        margin-top: 1.5vw;
    }
    
    .money-label {
        font-size: 1.9vw;
    }
    
    .money-amount {
        font-size: 2.5vw;
    }
    
    .stats-btn {
        width: 5.5vw;
        height: 5.5vw;
        font-size: 1.8vw;
        padding: 0.8vw;
        min-width: 24px;
        min-height: 24px;
        margin-right: 1vw;
    }
    
    .help-btn {
        width: 5.5vw;
        height: 5.5vw;
        font-size: 1.8vw;
        padding: 0.8vw;
        min-width: 24px;
        min-height: 24px;
        margin-right: 1vw;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 1vw;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .chain-display {
        padding: 2vw;
        gap: 1vw;
        margin: 0 auto;
        width: fit-content;
        max-width: calc(100vw - 2vw);
    }
    
    .letter-slot {
        width: 9vw;
        height: 9vw;
        font-size: 3vw;
        min-width: 10px;
        min-height: 10px;
    }
    
    .word-row {
        gap: 1vw;
    }
    
    .money-display {
        font-size: 2vw;
        padding: 0.6vw 1.2vw;
        margin-top: 1vw;
    }
    
    .money-label {
        font-size: 1.7vw;
    }
    
    .money-amount {
        font-size: 2.2vw;
    }
    
    .stats-btn, .help-btn {
        width: 5vw;
        height: 5vw;
        font-size: 1.6vw;
        padding: 0.6vw;
        min-width: 20px;
        min-height: 20px;
        margin-right: 0.8vw;
    }
}

@media (max-width: 600px) {
    .completion-modal {
        padding: 20px;
        margin: 20px;
    }
    
    .completion-modal h2 {
        font-size: 2rem;
    }
    
    .completion-chain {
        flex-direction: column;
        gap: 5px;
    }
    
    .chain-item {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .completion-actions {
        flex-direction: column;
    }
}

