body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 24px 12px;
}

.game-container {
    width: 100%;
    max-width: 980px;
}

.game-area {
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.mode-btn {
    color: #2c3e50;
}

.mode-btn:hover {
    color: #ffffff;
}

h1 {
    color: var(--primary-color);
    margin: 0;
}

.status {
    min-height: 1.6em;
    margin: 12px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 700;
}

.online-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 12px;
}

.opponent-name {
    color: var(--text-muted, #666);
    font-weight: 600;
}

.word-reveal {
    display: inline-block;
    margin: 0 auto 16px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #eef6ff;
    color: #1f4e79;
    font-weight: 700;
}

.word-reveal strong {
    letter-spacing: 2px;
}

.word-master-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.board-panel {
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    min-width: 260px;
}

.board-panel h2 {
    margin: 0 0 12px;
    color: #2c3e50;
    font-size: 1.05rem;
}

.word-board,
.opponent-progress-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 6px;
}

.guess-row,
.opponent-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.tile,
.opponent-tile {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}

.tile.filled {
    border-color: #6b7280;
}

.tile.correct,
.key.correct,
.opponent-tile.solved-row {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #ffffff;
}

.tile.present,
.key.present {
    background: #c9a227;
    border-color: #c9a227;
    color: #ffffff;
}

.tile.absent,
.key.absent {
    background: #5f6b76;
    border-color: #5f6b76;
    color: #ffffff;
}

.opponent-tile {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #ffffff;
}

.opponent-tile.completed-row {
    background: #cbd5e1;
    border-color: #94a3b8;
}

.opponent-tile.active-row {
    border-color: var(--primary-color, #2980b9);
}

.board-summary {
    min-height: 1.4em;
    margin-top: 10px;
    color: #4b5563;
    font-size: 0.95rem;
    font-weight: 600;
}

.guess-feedback {
    min-height: 1.6em;
    margin: 12px auto;
    color: #b45309;
    font-weight: 700;
}

.guess-feedback.success {
    color: #2e7d32;
}

.guess-feedback.error {
    color: #c0392b;
}

.keyboard {
    max-width: 620px;
    margin: 12px auto 0;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.key {
    width: auto;
    flex: 0 0 auto;
    min-width: 42px;
    min-height: 48px;
    padding: 8px 10px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #e5e7eb;
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: none;
}

.key:hover:not(:disabled) {
    background: var(--primary-color, #2980b9);
    border-color: var(--primary-color, #2980b9);
    color: #ffffff;
    transform: translateY(-1px);
}

.key.wide {
    min-width: 84px;
    font-size: 0.85rem;
}

.key:disabled {
    opacity: 0.72;
}

.game-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

@keyframes row-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.guess-row.shake {
    animation: row-shake 0.28s ease-in-out;
}

@media (max-width: 700px) {
    body {
        padding: 12px 8px;
    }

    .game-area {
        padding: 18px 10px;
    }

    .word-master-layout {
        gap: 14px;
    }

    .board-panel {
        min-width: 0;
        width: 100%;
        max-width: 350px;
        padding: 12px;
    }

    .tile {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .key {
        min-width: 31px;
        min-height: 43px;
        padding: 6px 5px;
        font-size: 0.8rem;
        border-radius: 6px;
    }

    .key.wide {
        min-width: 62px;
        font-size: 0.72rem;
    }
}

@media (max-width: 380px) {
    .tile {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }

    .guess-row,
    .opponent-row,
    .word-board,
    .opponent-progress-grid {
        gap: 4px;
    }

    .key {
        min-width: 28px;
        min-height: 40px;
        padding: 5px 3px;
    }

    .key.wide {
        min-width: 56px;
    }
}
