
.ttt-game-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 255, 0.95) 100%);
    border-radius: 20px;
    padding: 20px;
    margin: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slideInUp 0.4s ease;
    max-width: 400px;
    margin: 15px auto;
}

.ttt-header-button {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: none;     align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: auto !important;
}

body.chat-open .ttt-header-button {
    display: flex;
}

.ttt-header-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c8ff0 0%, #8a5fb8 100%);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.45);
}

.ttt-header-button:active {
    transform: translateY(-50%) scale(0.95);
}

.ttt-header-button:disabled,
.ttt-header-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.ttt-header-button.active {
    animation: pulse 0.3s ease;
}

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

.chat-header .ttt-header-button i {
    font-size: 16px;
    line-height: 1;
}

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

.ttt-header {
    margin-bottom: 20px;
    text-align: center;
}

.ttt-players {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ttt-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.ttt-player.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ttt-symbol {
    font-size: 20px;
    font-weight: bold;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttt-x {
    color: #ff6b6b;
    text-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.ttt-o {
    color: #4ecdc4;
    text-shadow: 0 2px 4px rgba(78, 205, 196, 0.3);
}

.ttt-player.active .ttt-x,
.ttt-player.active .ttt-o {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ttt-name {
    font-size: 14px;
    font-weight: 600;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ttt-vs {
    font-size: 12px;
    color: #666;
    font-weight: bold;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.ttt-status {
    margin-top: 10px;
}

.ttt-turn-text {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.ttt-game-container.my-turn .ttt-turn-text {
    color: #667eea;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

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

.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
}

.ttt-cell {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ttt-cell:hover:not(.ttt-cell-filled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.ttt-cell-filled {
    cursor: not-allowed;
    background: white;
}

.ttt-cell-symbol {
    font-size: 36px;
    font-weight: bold;
    line-height: 1;
}

.ttt-pop-in {
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.ttt-winning-cell {
    animation: winPulse 0.5s ease infinite alternate;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

@keyframes winPulse {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.1);
    }
}

.ttt-winning-cell .ttt-cell-symbol {
    color: white !important;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.ttt-win-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, #ff6b6b, transparent);
    height: 5px;
    border-radius: 3px;
    z-index: 10;
    animation: drawLine 0.5s ease forwards;
}

@keyframes drawLine {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

.ttt-win-line.row-1 {
    top: 16.67%;
    left: 5%;
    width: 90%;
}

.ttt-win-line.row-2 {
    top: 50%;
    left: 5%;
    width: 90%;
}

.ttt-win-line.row-3 {
    top: 83.33%;
    left: 5%;
    width: 90%;
}

.ttt-win-line.col-1 {
    left: 16.67%;
    top: 5%;
    width: 5px;
    height: 90%;
    background: linear-gradient(180deg, transparent, #ff6b6b, transparent);
}

.ttt-win-line.col-2 {
    left: 50%;
    top: 5%;
    width: 5px;
    height: 90%;
    background: linear-gradient(180deg, transparent, #ff6b6b, transparent);
}

.ttt-win-line.col-3 {
    left: 83.33%;
    top: 5%;
    width: 5px;
    height: 90%;
    background: linear-gradient(180deg, transparent, #ff6b6b, transparent);
}

.ttt-win-line.diag-1 {
    top: 50%;
    left: 50%;
    width: 120%;
    transform: translate(-50%, -50%) rotate(45deg);
    transform-origin: center;
}

.ttt-win-line.diag-2 {
    top: 50%;
    left: 50%;
    width: 120%;
    transform: translate(-50%, -50%) rotate(-45deg);
    transform-origin: center;
}

.ttt-result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ttt-result-content {
    text-align: center;
    color: white;
}

.ttt-result-icon {
    font-size: 60px;
    margin-bottom: 10px;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.ttt-result-text {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ttt-result-overlay.win {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
}

.ttt-result-overlay.lose {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(255, 154, 0, 0.9));
}

.ttt-result-overlay.draw {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.9), rgba(85, 239, 196, 0.9));
}

.ttt-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.ttt-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

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

.ttt-btn.ttt-quit {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
}

.ttt-btn.ttt-quit:hover {
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.ttt-btn.ttt-rematch {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.ttt-btn.ttt-rematch:hover {
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.ttt-notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 200;
    animation: slideDown 0.3s ease;
}

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

.ttt-notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.ttt-invitation-sent {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    animation: slideInUp 0.3s ease;
}

.ttt-invitation-sent .ttt-invitation-text {
    font-size: 16px;
    color: #667eea;
    margin-bottom: 10px;
}

.loading-dots {
    display: inline-flex;
    gap: 2px;
}

.loading-dots span {
    animation: bounce 1.4s infinite ease-in-out both;
    font-size: 20px;
    color: #667eea;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 40% { 
        transform: scale(1);
    }
}

.ttt-invitation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.ttt-invitation-modal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.5s ease;
    position: relative;
}

.ttt-invitation-header {
    margin-bottom: 20px;
}

.ttt-invitation-header i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
    animation: pulse 2s infinite;
}

.ttt-invitation-header h2 {
    font-size: 28px;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ttt-invitation-content p {
    font-size: 18px;
    margin: 10px 0;
}

.ttt-invitation-content h3 {
    font-size: 24px;
    margin: 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ttt-invitation-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 25px 0;
}

.ttt-accept-large {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    font-size: 16px;
    padding: 12px 24px;
}

.ttt-decline-large {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    font-size: 16px;
    padding: 12px 24px;
}

.ttt-invitation-timer {
    margin-top: 20px;
}

.timer-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
}

.timer-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ecdc4, #ff6b6b);
    transform-origin: left;
}

@keyframes countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.ttt-invitation-timer span {
    font-size: 14px;
    opacity: 0.8;
}

.ttt-invitation {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
}

.ttt-invitation-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.ttt-invitation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ttt-accept {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.ttt-decline {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
}

@media (max-width: 480px) {
    .ttt-game-container {
        margin: 10px;
        padding: 15px;
    }
    
    .ttt-board {
        max-width: 250px;
        gap: 8px;
        padding: 10px;
    }
    
    .ttt-cell-symbol {
        font-size: 28px;
    }
    
    .ttt-result-icon {
        font-size: 48px;
    }
    
    .ttt-result-text {
        font-size: 20px;
    }
}

@media (prefers-color-scheme: dark) {
    .ttt-game-container {
        background: linear-gradient(135deg, rgba(36, 37, 38, 0.95) 0%, rgba(48, 49, 60, 0.95) 100%);
    }
    
    .ttt-player {
        background: rgba(58, 59, 60, 0.7);
        color: #e4e6eb;
    }
    
    .ttt-player.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .ttt-board {
        background: rgba(36, 37, 38, 0.9);
    }
    
    .ttt-cell {
        background: linear-gradient(135deg, #3a3b3c 0%, #2c2d2e 100%);
    }
    
    .ttt-cell-filled {
        background: #58595a;
    }
    
    .ttt-vs {
        background: rgba(255, 255, 255, 0.1);
        color: #b0b3b8;
    }
    
    .ttt-turn-text {
        color: #b0b3b8;
    }
    
    .ttt-invitation {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    }
    
    .ttt-invitation-text {
        color: #e4e6eb;
    }
}
