:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --primary: #58a6ff;
    --primary-hover: #1f6feb;
    --danger: #f85149;
    --danger-hover: #da3633;
    --buzzer: #ff3b30;
    --card-bg: #1c2128;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans KR', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 50% 0%, #1f2937 0%, #0d1117 70%);
}

#app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    position: relative;
    overflow-y: auto;
}

.screen {
    display: none;
    padding: 20px;
    height: 100%;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin: auto;
    width: 100%;
}

.title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 30px;
    line-height: 1.1;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.title span {
    color: var(--primary);
    font-size: 2rem;
}

.input-group {
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: border 0.3s;
}

input:focus {
    border-color: var(--primary);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    padding: 15px 20px;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.btn.primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn.danger {
    background: var(--danger);
    color: white;
}

.btn.danger:hover {
    background: var(--danger-hover);
}

.btn.text-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 10px;
}

.btn.text-btn:hover {
    color: white;
}

.btn:disabled {
    background: #30363d;
    color: #8b949e;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.sm {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.btn.outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.btn.full-width {
    width: 100%;
}

.cta-btn {
    font-size: 1.2rem;
    padding: 20px;
    margin-top: 20px;
}

.buzzer {
    background: var(--buzzer);
    color: white;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }

    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 15px rgba(255, 59, 48, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

/* Role Card (Flip Animation) */
.role-card-container {
    perspective: 1000px;
    width: 200px;
    height: 300px;
    margin: 30px auto;
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-inner.is-flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card-front {
    background: linear-gradient(135deg, #1c2128, #0d1117);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.question-mark {
    font-size: 5rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.card-back {
    transform: rotateY(180deg);
    /* Colors handled in JS based on role */
}

/* 직업 카드 일러스트 이미지 */
#my-role-img {
    width: 60%;
    margin: 0 auto 10px;
    display: block;
    max-height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

/* Admin Dashboard */
.admin-header {
    background: #161b22;
    margin: -20px -20px 20px -20px;
    padding: 20px;
    border-bottom: 1px solid var(--primary);
}

.dashboard-panel {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.dashboard-panel h3 {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

.user-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.user-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 5px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #8b0000;
    /* Dark Red */
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid #ff3b30;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.5);
    color: white;
}

.siren-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

/* Role Back Colors */
.bg-mafia {
    background: linear-gradient(135deg, #8b0000, #400000);
    border: 2px solid #ff3b30;
}

.bg-police {
    background: linear-gradient(135deg, #003366, #001133);
    border: 2px solid #58a6ff;
}

.bg-doctor {
    background: linear-gradient(135deg, #0f5132, #051b11);
    border: 2px solid #20c997;
}

.bg-citizen {
    background: linear-gradient(135deg, #2ea043, #165624);
    border: 2px solid #3fb950;
}