/* Word Chain Game Styles */

:root {
    /* Game state colors */
    --color-idle: #FFD93D;
    --color-playing: #45B7D1;
    --color-result: #FFD93D;

    /* Text colors */
    --color-text: #333;
    --color-text-light: rgba(0, 0, 0, 0.6);

    /* Feedback colors */
    --color-success: #4CAF50;
    --color-error: #FF6B6B;

    /* Typography */
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--color-idle);
    color: var(--color-text);
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.content {
    text-align: center;
    padding: 2rem;
    max-width: 90%;
    width: 100%;
    max-width: 500px;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.controls-inline {
    margin-bottom: 1rem;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.current-letter {
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
}

.current-letter span {
    display: inline-block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-transform: uppercase;
}

.chain-display {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    min-height: 1.5em;
    word-wrap: break-word;
}

.input-container {
    margin: 1rem 0;
}

.word-input {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    outline: none;
    background: white;
    font-family: inherit;
    text-transform: lowercase;
    transition: border-color 0.2s ease;
}

.word-input:focus {
    border-color: rgba(0, 0, 0, 0.4);
}

.word-input.correct {
    border-color: var(--color-success);
    animation: pulse-success 0.3s ease;
}

.word-input.incorrect {
    border-color: var(--color-error);
    animation: shake 0.3s ease;
}

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

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

.feedback {
    font-size: 1rem;
    min-height: 1.5rem;
    margin: 0.5rem 0;
}

.feedback.success {
    color: var(--color-success);
}

.feedback.error {
    color: var(--color-error);
}

.score {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
}

.best-score {
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.hint {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-top: 1rem;
}

.home-link {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    transition: background 0.2s;
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* State: Idle */
.state-idle .timer,
.state-idle .current-letter,
.state-idle .chain-display,
.state-idle .feedback,
.state-idle .score,
.state-idle .share-container {
    display: none;
}

.state-idle .word-input {
    display: block;
}

/* State: Playing */
.state-playing {
    background-color: var(--color-playing);
}

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

.state-playing .title,
.state-playing .timer {
    color: white;
}

.state-playing .title {
    font-size: 1.5rem;
}

/* State: Result */
.state-result {
    background-color: var(--color-result);
}

.state-result .controls-inline,
.state-result .current-letter,
.state-result .chain-display,
.state-result .input-container,
.state-result .timer {
    display: none;
}

.state-result.new-best .title {
    color: #E6A700;
    animation: celebrate 0.6s ease-out;
}

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

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

    .current-letter {
        font-size: 2.5rem;
    }

    .current-letter span {
        width: 60px;
        height: 60px;
        line-height: 60px;
    }

    .word-input {
        font-size: 1.25rem;
        padding: 0.75rem;
    }
}
