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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    margin: 0;
}

.container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    margin-bottom: 1rem;
    font-size: 2.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.status {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    font-weight: bold;
    min-height: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-gap: 12px;
    margin-bottom: 2rem;
}

.cell {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.cell:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cell:active {
    transform: scale(0.95);
}

.cell.x {
    color: #ff6b6b;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
}

.cell.o {
    color: #4ecdc4;
    text-shadow: 0 0 15px rgba(78, 205, 196, 0.6);
}

button {
    background: linear-gradient(135deg, #ff9f43 0%, #ff6b6b 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.connection-panel {
    background-color: #2b3a55;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.my-id-container,
.connect-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.my-id-container p,
.connect-container p {
    font-size: 14px;
    color: #aebfd8;
    margin: 0;
}

.id-box {
    display: flex;
    align-items: center;
    background-color: #1e293b;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 16px;
    color: #fff;
    justify-content: space-between;
}

.id-box button {
    background-color: #4ade80;
    color: #1e293b;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
}

.connect-container input {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #4a5568;
    background-color: #1e293b;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.connect-container button {
    padding: 10px;
    border-radius: 5px;
    border: none;
    background-color: #60a5fa;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.connect-container button:hover {
    background-color: #3b82f6;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #4a5568;
    margin: 10px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #4a5568;
}

.divider span {
    padding: 0 10px;
    font-size: 12px;
    font-weight: bold;
}

.secondary-btn {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(236, 72, 153, 0.4);
}

.chat-panel {
    margin-top: 20px;
    background-color: #1e293b;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 200px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
    text-align: left;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

.message {
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 14px;
    max-width: 80%;
    word-break: break-word;
}

.message.self {
    background-color: #3b82f6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message.other {
    background-color: #4a5568;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: none;
    background-color: #2d3748;
    color: white;
    font-size: 14px;
    outline: none;
}

#chat-send-btn {
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    background-color: #10b981;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: none;
}

#chat-send-btn:hover {
    background-color: #059669;
    transform: none;
}

/* --- VIDEO CALL STYLES --- */
.video-panel {
    margin-top: 15px;
    background-color: #1e293b;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 4/3;
    background-color: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 80px;
    height: 60px;
    background-color: #000;
    border-radius: 5px;
    border: 2px solid white;
    object-fit: cover;
    z-index: 10;
}

.video-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.call-btn {
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.call-btn.voice {
    background-color: #3b82f6;
}

.call-btn.voice:hover {
    background-color: #2563eb;
}

.call-btn.video {
    background-color: #10b981;
}

.call-btn.video:hover {
    background-color: #059669;
}

.end-call-btn {
    background-color: #ef4444;
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.end-call-btn:hover {
    background-color: #dc2828;
}

.icon-btn {
    background-color: #3b82f6;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-btn.muted {
    background-color: #4a5568;
}