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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.95;
}

.server-status-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.language-selector label {
    color: white;
    font-size: 0.9em;
    font-weight: 500;
}

.language-selector select {
    background: white;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 500;
}

.language-selector select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

.game-wrapper {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .game-wrapper {
        grid-template-columns: 1fr;
    }
}

.game-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 1.1em;
    margin-right: 5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
}

.grid-container {
    width: 100%;
    height: 500px;
    border: 3px solid #667eea;
    border-radius: 10px;
    background: linear-gradient(45deg, #f5f7fa 25%, transparent 25%, transparent 75%, #f5f7fa 75%, #f5f7fa),
                linear-gradient(45deg, #f5f7fa 25%, transparent 25%, transparent 75%, #f5f7fa 75%, #f5f7fa);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    position: relative;
    overflow: hidden; /* panning handled by transform */
    margin-bottom: 20px;
}

/* Panning cursor */
.grid-container { cursor: grab; }
.grid-container.panning { cursor: grabbing; user-select: none; }

.grid-inner {
    position: absolute;
    left: 0;
    top: 0;
}

.word-on-grid {
    position: absolute;
    display: flex;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 2px;
    transition: transform 0.2s;
}

.word-on-grid:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Seed (generated start) visual */
.word-on-grid.seed-word {
    border: 2px dashed #f0ad4e;
}

.seed-letter {
    opacity: 0.95;
}

/* Full coverage bonus visual */
.word-on-grid.full-word {
    border: 2px solid #22c55e;
    box-shadow: 0 0 18px rgba(34,197,94,0.25);
}

/* New word animation */
.word-on-grid.new-word {
    animation: pop-in 0.5s ease;
}

.letter-cell.new-letter {
    animation: pop-letter 0.6s cubic-bezier(.2,.9,.2,1);
}

@keyframes pop-in {
    0% { transform: scale(0.6); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes pop-letter {
    0% { transform: translateY(-8px) scale(0.8); opacity: 0; }
    70% { transform: translateY(0) scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

.letter-cell {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    margin: 1px;
    text-transform: uppercase;
}

.letter-cell.connection-point {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s infinite;
}

/* Placement placeholder (visual blank squares for hint placements) */
.placement-placeholder {
    position: absolute;
    border-radius: 4px;
    border: 2px dashed rgba(10, 132, 255, 0.9);
    background: rgba(10,132,255,0.12);
    box-shadow: 0 2px 6px rgba(3, 80, 255, 0.08);
    pointer-events: none;
    z-index: 5; /* above words but below popovers */
}

/* Small badge for placement counts next to hint words */
.placement-count {
    display: inline-block;
    background: rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 8px;
    font-size: 0.8em;
    color: #333;
    vertical-align: middle;
}

/* Small local estimate text next to possible moves */
#possible-moves-local {
    display: block;
    font-size: 0.7em;
    color: rgba(255,255,255,0.9);
    margin-top: 4px;
}

/* Bonus cell styles */
.letter-cell.double-letter {
    background: linear-gradient(135deg, #ffeaa7 0%, #d63031 100%);
    box-shadow: inset 0 0 5px rgba(214, 48, 49, 0.3);
}

.letter-cell.triple-letter {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    box-shadow: inset 0 0 5px rgba(225, 112, 85, 0.3);
}

.letter-cell.double-word {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    box-shadow: inset 0 0 5px rgba(108, 92, 231, 0.3);
}

.letter-cell.triple-word {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    box-shadow: inset 0 0 5px rgba(232, 67, 147, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.controls {
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group input {
    flex: 1;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.select-small {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* Confetti checkbox styles */
#confetti-checkbox {
    width: 16px;
    height: 16px;
}

/* Visual hints checkbox styles */
#visual-hints-checkbox {
    width: 16px;
    height: 16px;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.input-group input:disabled {
    background: #f0f0f0;
    color: #888;
    cursor: not-allowed;
    border-color: #ccc;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    flex: 1;
    min-width: 150px;
}

.btn-small {
    padding: 8px 10px;
    font-size: 0.95em;
    min-width: 40px;
    flex: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled,
.btn-primary.btn-disabled {
    background: linear-gradient(135deg, #aaa 0%, #888 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.hints {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.hints h3 {
    margin-bottom: 10px;
    color: #667eea;
}

#hints-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hint-word {
    padding: 8px 15px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.hint-word:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.leaderboard-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
}

.leaderboard {
    max-height: 600px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.leaderboard-entry:nth-child(1) {
    border-left-color: #ffd700;
    background: linear-gradient(90deg, #fff9e6 0%, #f8f9fa 100%);
}

.leaderboard-entry:nth-child(2) {
    border-left-color: #c0c0c0;
    background: linear-gradient(90deg, #f5f5f5 0%, #f8f9fa 100%);
}

.leaderboard-entry:nth-child(3) {
    border-left-color: #cd7f32;
    background: linear-gradient(90deg, #fff4e6 0%, #f8f9fa 100%);
}

.leaderboard-rank {
    font-weight: bold;
    font-size: 1.2em;
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
    margin: 0 10px;
}

.leaderboard-stats {
    display: flex;
    gap: 10px;
    font-size: 0.9em;
    color: #666;
}

.no-records {
    text-align: center;
    color: #999;
    padding: 20px;
}

.rules {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.rules summary {
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    color: #667eea;
    padding: 10px;
}

.rules summary:hover {
    color: #764ba2;
}

.rules-content {
    margin-top: 15px;
    padding: 15px;
    line-height: 1.8;
}

.rules-content ol {
    padding-left: 25px;
}

.rules-content li {
    margin-bottom: 10px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
}

.final-stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.final-stats p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.final-stats strong {
    color: #667eea;
    font-size: 1.3em;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons .btn {
    flex: 1;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.server-status-wrapper {
    margin-top: 8px;
}

.server-status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    color: #fff;
    background: #6c757d;
    font-size: 0.9em;
}

.server-status.online {
    background: #28a745;
}

.server-status.offline {
    background: #dc3545;
}

.server-status.synced {
    animation: pulse 1s ease-out;
}

/* Provide support for JS-added class 'server-synced' */
.server-status.server-synced {
    animation: server-flash 1s ease-out;
}

@keyframes server-flash {
    0% { transform: scale(0.98); box-shadow: none; }
    30% { transform: scale(1.06); box-shadow: 0 8px 24px rgba(40,167,69,0.25); }
    100% { transform: scale(1); box-shadow: none; }
}

.confetti-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Turn timer */
.turn-timer {
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-block;
}

.turn-progress {
  width: 220px;
  height: 10px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

.turn-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #33cc33, #ffd11a, #ff3b30);
  background-size: 300% 100%;
  transition: width 300ms linear, background-position 1.5s linear;
  border-radius: 999px;
}

.turn-progress-bar.low {
  background-position: 100% 0;
}

/* Hide hint area when hints are disabled */
.hints.disabled { display: none !important; }
/* Word stats styles - similar to leaderboard */
.word-stats-section h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.word-stats {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word-stats-entry {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.word-stats-entry:hover {
    background-color: rgba(138, 43, 226, 0.05);
}

.word-stats-entry:last-child {
    border-bottom: none;
}

.word-stats-entry:nth-child(1) {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.word-stats-entry:nth-child(2) {
    background: linear-gradient(135deg, #c0c0c0, #e0e0e0);
    color: #333;
}

.word-stats-entry:nth-child(3) {
    background: linear-gradient(135deg, #cd7f32, #d4af37);
    color: #333;
}

.word-stats-rank {
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

.word-stats-word {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.word-stats-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    color: #666;
}

.word-stats-stats span {
    margin-bottom: 2px;
}

.word-stats-stats span:last-child {
    margin-bottom: 0;
    color: #999;
}

.bonus-indicator {
    margin-left: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 13px;
    display: inline-block;
}
.bonus-indicator.bonus-enabled {
    background: #e6ffed;
    color: #006400;
    border: 1px solid #b3f1c3;
}
.bonus-indicator.bonus-disabled {
    background: #fff4f4;
    color: #990000;
    border: 1px solid #f0b3b3;
}

/* ==================== WORD EXPLANATION PANEL (LLM) ==================== */
.word-explanation-panel {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ebff 100%);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.word-explanation-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.word-explanation-panel .explanation-hint {
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.word-explanation-panel .explanation-content {
    background: white;
    border-radius: 8px;
    padding: 12px;
    min-height: 60px;
    max-height: 250px;
    overflow-y: auto;
    line-height: 1.5;
    font-size: 14px;
}

.word-explanation-panel .explanation-word {
    font-weight: 700;
    color: #8a2be2;
    font-size: 18px;
    margin-bottom: 8px;
    display: block;
}

.word-explanation-panel .explanation-loading {
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-explanation-panel .explanation-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #8a2be2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.word-explanation-panel .explanation-error {
    color: #dc3545;
    padding: 8px;
    background: #fff0f0;
    border-radius: 4px;
}

/* Tooltip for word explanation on hover */
.word-tooltip {
    position: fixed;
    background: white;
    border: 2px solid #8a2be2;
    border-radius: 12px;
    padding: 15px;
    max-width: 350px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.word-tooltip .tooltip-word {
    font-weight: 700;
    color: #8a2be2;
    font-size: 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-tooltip .tooltip-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.word-tooltip .tooltip-loading {
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-tooltip .tooltip-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid #8a2be2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.word-tooltip .tooltip-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.word-tooltip .tooltip-close:hover {
    color: #333;
}

/* Ctrl key pressed state - show help cursor on words */
body.ctrl-pressed .word-on-grid {
    cursor: help;
}

body.ctrl-pressed .word-on-grid:hover {
    outline: 2px solid #8a2be2;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==================== MULTIPLAYER STYLES ==================== */

.btn-online {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.3s ease;
}
.btn-online:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}
.btn-online.active {
    background: linear-gradient(135deg, #e17055, #d63031);
}

.multiplayer-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.mp-header h2 {
    color: #333;
    margin: 0;
}

.mp-status {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
}
.mp-status.connected {
    background: #d4edda;
    color: #155724;
}
.mp-status.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.mp-lobby {
    padding: 10px 0;
}

.mp-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mp-rooms-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
}

.mp-no-rooms {
    text-align: center;
    color: #888;
    padding: 30px;
}

.mp-room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.mp-room-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.mp-room-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mp-room-item-name {
    font-weight: 600;
    color: #333;
}

.mp-room-item-players {
    font-size: 13px;
    color: #666;
}

.mp-room-item-mode {
    font-size: 12px;
    color: #888;
}

.mp-join-quick {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}
.mp-join-quick:hover {
    background: #5a6fd6;
}

/* Room View */
.mp-room-view {
    padding: 10px 0;
}

.mp-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.mp-room-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-room-label, .mp-room-code-label {
    font-size: 13px;
    opacity: 0.9;
}

.mp-room-name {
    font-weight: 700;
    font-size: 18px;
}

.mp-room-code {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 2px;
}

.mp-game-status {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 14px;
}

.mp-turn-indicator {
    text-align: center;
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
}
.mp-turn-indicator.my-turn {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    animation: pulse-green 1.5s infinite;
}
.mp-turn-indicator .your-turn {
    color: #155724;
    font-size: 22px;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
}

.mp-room-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 800px) {
    .mp-room-content {
        grid-template-columns: 1fr;
    }
}

.mp-players-section, .mp-chat-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.mp-players-section h4, .mp-chat-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.mp-players-list {
    max-height: 200px;
    overflow-y: auto;
}

.mp-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.mp-player.current-turn {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    box-shadow: 0 0 0 2px #ffc107;
}
.mp-player.is-me {
    border-left: 4px solid #667eea;
}

.mp-player-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mp-player-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.mp-player-score {
    font-weight: 700;
    color: #667eea;
}

.mp-room-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Chat */
.mp-chat-messages {
    height: 180px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.mp-chat-msg {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}
.mp-chat-msg.system {
    color: #888;
    font-style: italic;
    text-align: center;
}

.mp-chat-player {
    font-weight: 600;
    margin-right: 5px;
}

.mp-chat-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}
.mp-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Dialogs */
.mp-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.mp-dialog-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    min-width: 350px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mp-dialog-content h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.mp-form-group {
    margin-bottom: 15px;
}

.mp-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.mp-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}
.mp-form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.mp-dialog-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.mp-dialog-buttons .btn {
    flex: 1;
}

/* Results Modal */
.mp-results-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.mp-results-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    min-width: 400px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mp-results-content h2 {
    margin-bottom: 25px;
    color: #333;
}

.mp-standings {
    margin-bottom: 25px;
}

.mp-standing-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}
.mp-standing-row.is-me {
    background: linear-gradient(135deg, #e8f4f8, #d4edda);
    border: 2px solid #667eea;
}
.mp-standing-row:first-child {
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
}

.mp-rank {
    font-size: 18px;
    min-width: 40px;
}

.mp-name {
    flex: 1;
    font-weight: 600;
    text-align: left;
}

.mp-final-score {
    font-weight: 700;
    color: #667eea;
    font-size: 18px;
}

#mp-results-close {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
#mp-results-close:hover {
    background: #5a6fd6;
    transform: scale(1.05);
}

/* Word with player color */
.word-on-grid[style*="--player-color"] .letter-cell {
    border-color: var(--player-color);
}

