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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #FFD93D;
    text-align: center;
}

.subtitle {
    font-size: 1.2rem;
    color: #aaa;
    text-align: center;
}

.description {
    font-size: 0.95rem;
    color: #888;
    text-align: center;
    max-width: 300px;
    line-height: 1.4;
}

.controls-inline {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #ccc;
}

.control-pill .touch::before {
    content: "👆";
}

.stats {
    display: flex;
    gap: 20px;
    font-size: 1.1rem;
    min-height: 30px;
}

.level {
    color: #FFD93D;
    font-weight: 600;
}

.strikes {
    font-size: 1.2rem;
}

.grid {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1;
    margin: 10px 0;
}

.cell {
    background: #2a2a4a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
    aspect-ratio: 1;
}

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

.cell.has-number {
    background: #FFD93D;
}

.cell.hidden-number {
    background: #FFD93D;
}

.cell.hidden-number .number {
    visibility: hidden;
}

.cell.correct {
    background: #4ade80;
    animation: pulse-correct 0.3s ease-out;
}

.cell.wrong {
    background: #ef4444;
    animation: shake 0.3s ease-out;
}

.cell.revealed {
    background: #FFD93D;
    opacity: 0.6;
}

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

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

.result-text {
    font-size: 1.8rem;
    font-weight: 700;
    min-height: 40px;
    text-align: center;
}

.result-text.success {
    color: #4ade80;
}

.best-score {
    font-size: 1rem;
    color: #888;
    min-height: 24px;
}

.share-container {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #fff;
    color: #1a1a2e;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 217, 61, 0.3);
}

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

.share-btn.copied {
    background: #4ade80;
    color: #fff;
}

.share-icon {
    width: 18px;
    height: 18px;
}

.hint {
    font-size: 0.9rem;
    color: #666;
    min-height: 24px;
    text-align: center;
}

.home-link {
    position: absolute;
    bottom: 20px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 20px;
    transition: color 0.2s, background 0.2s;
}

.home-link:hover {
    color: #FFD93D;
    background: rgba(255, 217, 61, 0.1);
}

/* State-based visibility */
.state-idle .stats,
.state-idle .grid,
.state-idle .result-text,
.state-idle .share-container,
.state-idle .hint {
    display: none;
}

.state-playing .subtitle,
.state-playing .description,
.state-playing .controls-inline,
.state-playing .result-text,
.state-playing .best-score,
.state-playing .share-container,
.state-playing .hint {
    display: none;
}

.state-result .subtitle,
.state-result .description,
.state-result .controls-inline,
.state-result .stats,
.state-result .grid {
    display: none;
}

.new-best .result-text {
    animation: celebrate 0.5s ease-out;
}

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

/* Responsive adjustments */
@media (max-width: 400px) {
    .title {
        font-size: 2rem;
    }

    .grid {
        gap: 6px;
    }

    .cell {
        font-size: 1.2rem;
        border-radius: 6px;
    }
}

@media (min-height: 800px) {
    .game-container {
        min-height: auto;
        padding: 40px 20px;
    }
}
