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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

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

h1 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: bold;
    position: relative;
    z-index: 1;
}

header p {
    font-family: 'Georgia', 'Times New Roman', serif;
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

#game-board {
    margin-bottom: 2rem;
}

.guess-row {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.kanji-search {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.1rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 25px;
    background: #f9f9f9;
    transition: all 0.3s ease;
    outline: none;
}

.kanji-search:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.kanji-search.correct {
    background: #4CAF50 !important;
    color: white;
    border-color: #4CAF50 !important;
}

.kanji-search.incorrect {
    background: #f44336 !important;
    color: white;
    border-color: #f44336 !important;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f8f9fa;
}

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

.suggestion-kanji {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.suggestion-reading {
    color: #666;
    font-size: 0.9em;
    margin-right: 8px;
}

.suggestion-meaning {
    color: #888;
    font-size: 0.85em;
}

.kanji-input {
    width: 80px;
    height: 80px;
    font-size: 3rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    transition: all 0.3s ease;
}

.kanji-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

#hints {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

#hint-progress {
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
}

#hint-btn, #stroke-hint-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
    min-width: 150px;
}

#hint-btn:hover, #stroke-hint-btn:hover {
    background: #5a6fd8;
}

#stroke-hint-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#hint-display {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
    min-height: 50px;
    display: none;
    max-width: 400px;
}

#hint-history {
    max-width: 400px;
    text-align: left;
}

.hint-item {
    padding: 0.5rem;
    margin: 0.3rem 0;
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555;
}

/* Japanese grading system icons */
.grade-icon {
    width: 40px;
    height: 40px;
    display: inline-block;
    margin: 0 10px;
    vertical-align: middle;
}

.rating-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.grade-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.grade-item.achieved {
    background-color: #e8f5e8;
    border: 2px solid #28a745;
}

.grade-item.not-achieved {
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    opacity: 0.5;
}

.grade-item .grade-icon {
    width: 30px;
    height: 30px;
}

.grade-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 1.1em;
    font-weight: bold;
}

.grade-text {
    color: #333;
}

#feedback {
    text-align: center;
    font-size: 1.2rem;
    min-height: 30px;
}

footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#stats span {
    margin: 0 1rem;
    color: #666;
}

.correct {
    background: #4CAF50 !important;
    color: white;
    border-color: #4CAF50 !important;
}

.incorrect {
    background: #f44336 !important;
    color: white;
    border-color: #f44336 !important;
}

/* Stroke order animation styles */
.stroke-animator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 1rem 0;
}

.stroke-animator svg {
    max-width: 200px;
    max-height: 200px;
}

/* Hide stroke numbers initially - only show after first hint */
.stroke-animator svg text {
    display: none;
}

.stroke-animator.hints-started svg text {
    display: block;
}

.stroke-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    visibility: hidden; /* Hide initially until correct answer */
}

/* Hide stroke numbers initially */
.kanji-display svg text {
    display: none;
}

/* Show stroke numbers when hint is revealed */
.kanji-display.show-numbers svg text {
    display: block;
}

.stroke-controls.show {
    visibility: visible;
}

.stroke-controls button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.stroke-controls button:hover:not(:disabled) {
    background: #5a6fd8;
}

.stroke-controls button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.stroke-counter {
    font-weight: bold;
    color: #333;
    min-width: 60px;
    text-align: center;
}

/* Date Selection */
#date-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    border-radius: 12px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.date-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

#date-selection p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    line-height: 1.4;
}

#date-picker {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-width: 160px;
}

#date-picker:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

#load-date {
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#load-date:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#load-date:active {
    transform: translateY(0);
}

#load-date:hover {
    background: #1976D2;
}

/* Stroke Controls */
.stroke-controls {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.stroke-controls h3 {
    margin-top: 0;
    color: #333;
}

.stroke-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stroke-buttons button {
    padding: 8px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.stroke-buttons button:hover {
    background: #45a049;
}

.stroke-buttons button:disabled {
    background: #ccc;
    cursor: not-allowed;
}
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
        max-width: 500px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .kanji-input {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .kanji-input {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    #hint-btn, #stroke-hint-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        min-width: 120px;
    }
}
