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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
}

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

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-top: 5px;
}

.score-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.level-display {
    text-align: center;
    margin-bottom: 8px;
}

.level-name {
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.next-level {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.level-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.level-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.level-dot.active {
    box-shadow: 0 0 8px currentColor;
}

.score-display {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.score-label {
    color: #888;
    margin-right: 5px;
}

#current-score {
    color: #f39c12;
    font-weight: bold;
}

.score-separator {
    color: #555;
    margin: 0 5px;
}

#max-score {
    color: #888;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #e74c3c);
    width: 0%;
    transition: width 0.3s ease;
}

.celebration {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    color: #fff;
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    animation: pulse 1s infinite;
}

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

.message {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    transition: opacity 0.3s ease;
    visibility: visible;
    opacity: 1;
}

.message.hidden {
    visibility: hidden;
    opacity: 0;
}

.message.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.message.warning {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.message.success {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.hidden:not(.message) {
    display: none !important;
}

.grid-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 300px;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cell.corner {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.cell.non-corner {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.cell:hover:not(.used) {
    transform: scale(1.05);
}

.cell:active:not(.used) {
    transform: scale(0.95);
}

.cell.used {
    background: #333 !important;
    color: #666 !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

.word-display {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.current-word {
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #fff;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.btn {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #27ae60, #229954);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.words-found-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.words-found-section h3 {
    font-size: 1rem;
    color: #888;
    margin-bottom: 10px;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.word-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.scoring-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    font-size: 0.85rem;
}

.scoring-info h4 {
    color: #888;
    margin-bottom: 10px;
}

.scoring-info ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.scoring-info li {
    color: #aaa;
}

.corner-indicator {
    color: #f39c12;
    margin-right: 5px;
}

/* Responsive adjustments */
@media (max-width: 360px) {
    .grid {
        max-width: 260px;
    }

    .cell {
        font-size: 1.6rem;
    }

    .current-word {
        font-size: 1.6rem;
    }
}

@media (min-width: 500px) {
    .container {
        max-width: 450px;
    }

    .grid {
        max-width: 340px;
    }
}
