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

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

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

.content {
    text-align: center;
    padding: 20px;
    max-width: 400px;
    width: 100%;
}

.title {
    font-size: 2.5rem;
    margin: 0 0 5px;
    color: #FFD93D;
}

.tagline {
    font-size: 1.1rem;
    color: #666;
    margin: 0 0 20px;
}

.controls-inline {
    margin-bottom: 20px;
}

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

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

/* Lives */
.lives-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.heart {
    font-size: 1.5rem;
}

.heart::before {
    content: '❤️';
}

.heart.lost::before {
    content: '🖤';
    opacity: 0.4;
}

/* Timer bar */
.timer-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin: 0 auto 20px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: #FFD93D;
    border-radius: 4px;
    width: 100%;
    transition: width linear;
}

.timer-fill.warning {
    background: #e74c3c;
}

/* Tile areas */
.scramble-area, .answer-area {
    margin: 15px auto;
}

.tiles-row, .answer-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 60px;
}

.letter-tile {
    width: 48px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, opacity 0.15s;
    color: #333;
}

.letter-tile:active {
    transform: scale(0.95);
}

.letter-tile.used {
    opacity: 0.3;
    pointer-events: none;
}

.answer-slot {
    width: 48px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #333;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.answer-slot.filled {
    border-style: solid;
    border-color: #FFD93D;
    background: rgba(255, 217, 61, 0.2);
}

.answer-slot:active {
    transform: scale(0.95);
}

/* Action buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.action-btn {
    background: #e0e0e0;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn:hover {
    background: #d0d0d0;
}

.action-btn.primary {
    background: #FFD93D;
    color: #333;
}

.action-btn.primary:hover {
    background: #ffe566;
}

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.feedback.correct {
    background: rgba(76, 175, 80, 0.95);
    opacity: 1;
}

.feedback.wrong {
    background: rgba(231, 76, 60, 0.95);
    opacity: 1;
}

/* Score */
.score-display {
    margin-top: 15px;
}

.streak-label {
    color: #666;
}

.current-streak {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFD93D;
    margin-left: 8px;
}

/* Result */
.result {
    display: none;
}

.final-score {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.best-score {
    font-size: 1.2rem;
    color: #666;
    margin: 0 0 20px;
}

.share-container {
    margin-top: 15px;
}

/* Home link */
.home-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 20px;
    z-index: 100;
}

.home-link:hover {
    color: #333;
}

/* State visibility */
.state-idle .lives-display,
.state-idle .timer-bar,
.state-idle .scramble-area,
.state-idle .answer-area,
.state-idle .action-buttons,
.state-idle .score-display,
.state-idle .result {
    display: none;
}

.state-playing .controls-inline,
.state-playing .tagline,
.state-playing .result {
    display: none;
}

.state-result .controls-inline,
.state-result .tagline,
.state-result .lives-display,
.state-result .timer-bar,
.state-result .scramble-area,
.state-result .answer-area,
.state-result .action-buttons,
.state-result .score-display {
    display: none;
}

.state-result .result {
    display: block;
}
