@font-face {
    font-family: 'B Yekan';
    src: url('https://kadad.ir/wp-content/uploads/fonts/B-YEKAN.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    font-family: 'B Yekan', Tahoma, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: url('BG.png') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    position: relative;
    color: white;
}

/* body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.1);
    z-index: 0;
} */

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(0,0,0,0.75);
    border-radius: 25px;
    padding: 20px;
    backdrop-filter: blur(3px);
}

h1, h2, h3, h4 {
    color: #f9ca24;
    text-align: center;
    margin: 15px 0;
}

button, .btn-like {
    background: #0984e3;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 12px;
    font-family: 'B Yekan', Tahoma;
    font-size: 1em;
    cursor: pointer;
    transition: 0.2s;
}

button:hover, .btn-like:hover {
    background: #74b9ff;
    transform: scale(1.02);
}

button.primary {
    background: #00b894;
}

button.danger {
    background: #d63031;
}

button.warning {
    background: #fdcb6e;
    color: #2d3436;
}

input, select, textarea {
    background: #2d3436;
    color: white;
    border: 1px solid #636e72;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 10px;
    font-family: 'B Yekan', Tahoma;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #f9ca24;
}

.flex-center {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.player-card {
    background: #2d3436;
    border-radius: 18px;
    padding: 15px 10px;
    text-align: center;
    position: relative;
    border: 2px solid #636e72;
    transition: 0.3s;
}

.player-card.dead {
    opacity: 0.4;
    background: #1e272e;
    border-color: #d63031;
}

.player-card.current-speaker-card {
    border-color: #f9ca24;
    box-shadow: 0 0 15px #f9ca24;
    transform: scale(1.02);
}

.player-card.mafia-card {
    border-color: #e84118;
    box-shadow: 0 0 10px #e84118;
}

.player-name {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}

.player-role {
    font-size: 0.8em;
    padding: 5px 10px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 8px;
}

.role-mafia { background: #e84118; color: white; }
.role-doctor { background: #00b894; color: white; }
.role-detective { background: #fdcb6e; color: #2d3436; }
.role-civilian { background: #636e72; color: white; }
.role-janitor { background: #8e44ad; color: white; }
.role-joker { background: #f39c12; color: #2d3436; }
.role-escort { background: #3498db; color: white; }
.role-werewolf { background: #27ae60; color: white; }
.role-vampire { background: #c0392b; color: white; }

.vote-badge {
    position: absolute;
    top: -12px;
    right: -8px;
    background: #f9ca24;
    color: #2d3436;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

.status-panel {
    background: #2d3436;
    padding: 15px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.status-panel h3 {
    margin: 0;
    color: #f9ca24;
}

.detective-result-box {
    background: #fdcb6e;
    color: #2d3436;
    padding: 12px;
    border-radius: 15px;
    margin: 10px auto;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    display: none;
    max-width: 400px;
    animation: fadeInOut 8s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: scale(0.8); }
    10% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; display: none; }
}

.timer {
    font-size: 2.5em;
    font-weight: bold;
    direction: ltr;
    background: #00000088;
    display: inline-block;
    padding: 5px 20px;
    border-radius: 50px;
    margin: 10px 0;
    color: #f9ca24;
}

.speaker-box {
    background: #00b894;
    color: white;
    padding: 15px;
    border-radius: 20px;
    text-align: center;
    font-size: 1.2em;
    cursor: pointer;
    margin: 15px 0;
}

.speaker-box:hover {
    transform: scale(1.02);
    background: #019874;
}

.vote-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.vote-btn {
    background: #636e72;
    padding: 10px 18px;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.2s;
    color: white;
}

.vote-btn.selected {
    background: #00b894;
    transform: scale(1.05);
}

.vote-option {
    display: inline-block;
    background: #636e72;
    padding: 8px 15px;
    border-radius: 25px;
    margin: 5px;
    cursor: pointer;
    color: white;
}

.vote-option input {
    margin-left: 5px;
}

.chat-section, .speak-messages {
    margin-top: 30px;
    background: #2d3436;
    border-radius: 20px;
    padding: 15px;
}

.chat-section h3, .speak-messages h3 {
    margin-bottom: 15px;
    color: #f9ca24;
}

.chat-messages, .messages-container {
    height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    background: #1e272e;
    border-radius: 15px;
}

.chat-message, .speak-message {
    padding: 8px 12px;
    margin: 5px 0;
    background: #2d3436;
    border-radius: 10px;
    color: white;
}

.speak-message {
    background: #fdcb6e;
    color: #2d3436;
    border-right: 4px solid #00b894;
}

.speak-message .speaker-name {
    font-weight: bold;
}

.speak-message .message-time {
    font-size: 0.7em;
    color: #636e72;
    margin-right: 10px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border-radius: 25px;
    border: none;
    background: #1e272e;
    color: white;
}

.chat-input button {
    background: #0984e3;
    padding: 10px 20px;
    border-radius: 25px;
}

.night-actions, .voting-panel, .host-control, .ready-players, .mafia-info {
    background: #1e272e;
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
    text-align: center;
}

.host-control {
    background: #fdcb6e;
    color: #2d3436;
}

.host-control button {
    background: #2d3436;
    color: white;
}

.ready-players {
    background: #1e272e;
    color: white;
}

.ready-badge {
    display: inline-block;
    background: #00b894;
    padding: 3px 10px;
    border-radius: 15px;
    margin: 2px;
    color: white;
}

.not-ready-badge {
    display: inline-block;
    background: #636e72;
    padding: 3px 10px;
    border-radius: 15px;
    margin: 2px;
    color: white;
}

.mafia-info {
    background: #e84118;
    color: white;
    font-weight: bold;
}

.waiting-text {
    text-align: center;
    padding: 30px;
    color: #fdcb6e;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #2d3436;
    padding: 30px;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
}

.modal-content h3 {
    color: #f9ca24;
    margin-bottom: 20px;
}

.modal-content input, .modal-content select, .modal-content textarea {
    width: 100%;
    margin: 10px 0;
}

.modal-content textarea {
    height: 150px;
    resize: vertical;
}

.modal-content .cancel-btn {
    background: #e84118;
}

.close {
    float: left;
    cursor: pointer;
    font-size: 1.5em;
    color: #b2bec3;
}

.close:hover {
    color: white;
}

.role-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
    background: #1e272e;
    border-radius: 10px;
    color: white;
}

.role-row input {
    width: 60px;
    margin: 0;
}

.role-item {
    background: #1e272e;
    padding: 12px;
    margin: 10px 0;
    border-radius: 12px;
    text-align: right;
    color: white;
}

.role-item h4 {
    color: #f9ca24;
    margin-bottom: 8px;
    text-align: right;
}

.role-item p {
    color: #dfe6e9;
    font-size: 0.85em;
    line-height: 1.5;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    margin-right: 8px;
}

.badge-mafia { background: #e84118; color: white; }
.badge-doctor { background: #00b894; color: white; }
.badge-detective { background: #fdcb6e; color: #2d3436; }
.badge-janitor { background: #8e44ad; color: white; }
.badge-joker { background: #f39c12; color: #2d3436; }
.badge-escort { background: #3498db; color: white; }
.badge-werewolf { background: #27ae60; color: white; }
.badge-vampire { background: #c0392b; color: white; }
.badge-civilian { background: #636e72; color: white; }

.room-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #636e72;
}

.room-name-badge {
    background: #f9ca24;
    color: #2d3436;
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: bold;
}

.room-code, .player-name {
    background: #2d3436;
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
}

.copy-btn {
    background: #0984e3;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    color: white;
}

.moon-icon {
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 40px;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    padding: 10px;
    display: none;
}

.moon-icon.full-moon {
    display: block;
    color: #f9ca24;
    text-shadow: 0 0 10px #f9ca24;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.role-hidden {
    filter: blur(5px);
    cursor: pointer;
    transition: 0.3s;
}

.role-hidden:hover {
    filter: blur(0);
    background: #00b894;
}

.timer-large, .timer-box {
    font-size: 2em;
    font-weight: bold;
    color: #f9ca24;
    margin: 10px 0;
}

.auto-next-info {
    background: #0984e3;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-top: 10px;
    color: white;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.mode-btn {
    padding: 12px 30px;
    font-size: 1.2em;
    border-radius: 50px;
    cursor: pointer;
    background: #2d3436;
    transition: 0.3s;
    color: white;
}

.mode-btn.active {
    background: #00b894;
    transform: scale(1.05);
}

.role-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.role-card {
    background: #2d3436;
    padding: 10px 15px;
    border-radius: 15px;
    text-align: center;
    min-width: 100px;
    color: white;
}

.role-card input {
    width: 60px;
    text-align: center;
    margin-top: 8px;
}

.voting-player {
    background: #2d3436;
    padding: 12px;
    margin: 8px 0;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.voting-player-name {
    font-weight: bold;
    min-width: 100px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    justify-content: flex-start;
}

.checkbox-group label {
    background: #636e72;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
    color: white;
}

.checkbox-group input {
    margin-left: 5px;
    transform: scale(1.2);
    vertical-align: middle;
}

.checkbox-group label:has(input:checked) {
    background: #00b894;
}

.create-room {
    background: linear-gradient(135deg, #00b894, #019874);
    padding: 15px 25px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 30px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}

.create-room:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(0,184,148,0.3);
}

.rooms-list {
    background: rgba(0,0,0,0.6);
    border-radius: 25px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.room-card {
    background: #2d3436;
    border-radius: 18px;
    padding: 15px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    transition: 0.3s;
    color: white;
}

.room-card:hover {
    background: #3d4346;
}

.room-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #f9ca24;
}

.room-details {
    font-size: 0.85em;
    color: #b2bec3;
    margin-top: 5px;
}

.room-players {
    background: #0984e3;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: white;
}

.room-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
}

.status-waiting {
    background: #fdcb6e;
    color: #2d3436;
}

.status-playing {
    background: #00b894;
    color: white;
}

.status-full {
    background: #e84118;
    color: white;
}

.join-btn {
    background: #00b894;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.join-btn:hover {
    transform: scale(1.05);
}

.join-btn.disabled {
    background: #636e72;
    cursor: not-allowed;
}

.empty-rooms {
    text-align: center;
    padding: 40px;
    color: #b2bec3;
}

@media (max-width: 700px) {
    .container { padding: 15px; }
    .map { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .room-card { flex-direction: column; text-align: center; }
    .voting-player { flex-direction: column; align-items: flex-start; gap: 8px; }
    .mode-selector { flex-direction: column; align-items: center; }
    .role-selector { flex-direction: column; align-items: center; }
}