/* ==========================
   GLOBAL & BACKGROUND
   ========================= */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('../assets/bollywood-stage-bg.png');
    background-size: cover;
    background-position: center 60px;
    background-color: #b5a8d9;
    background-repeat: no-repeat;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* ==========================
   INPUTS & BUTTONS BASE
   ========================= */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
}

button {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

button:active { transform: scale(0.95); }

/* ==========================
   LOGIN SCREEN
   ========================= */
.login-container {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    width: 70%;
    max-width: 280px;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.login-container h1 {
    font-size: 20px;
    margin: 0 0 15px 0;
    font-family: 'Bebas Neue', sans-serif;
    color: #412d5f;
    letter-spacing: 3px;
}

#joinBtn {
    background: #28a745;
    color: white;
    width: 80%;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 15px;
}

#joinBtn:hover { background: #218838; }

/* ==========================
   GAME LAYOUT
   ========================= */
.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100vh;
}

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    box-sizing: border-box;
    z-index: 20;
    background: rgba(65, 45, 95, 0.95);
}

.round-indicator {
    background: #ffc107;
    color: #333;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    margin-right: 8px;
    white-space: nowrap;
}

.word-display {
    padding: 8px 12px;
    font-size: 15px;
    font-weight: bold;
    flex-grow: 1;
    margin-right: 8px;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer {
    background: #ffc107;
    color: #333;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

.timer.danger {
    background: #dc3545;
    color: white;
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

.start-btn {
    background: #28a745;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 18px;
    position: absolute;
    top: 350px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

canvas {
    display: none;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    z-index: 15;
    position: absolute;
    top: 19%;
    left: 10%;
    width: 80%;
    height: 60%;
}

/* ==========================
   DRAWING TOOLS
   ========================= */
.controls-area {
    position: fixed;
    bottom: 165px;
    display: flex;
    justify-content: space-between;
    width: 90%;
    max-width: 350px;
    z-index: 20;
}

.control-btn {
    flex: 1;
    margin: 0 5px;
    background: #3d8bcd;
    color: white;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 50px;
}

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

/* ==========================
   PLAYER ROSTER
   ========================= */
.players-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 360px;
    z-index: 20;
}

#playerButtons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.player-btn {
    background: #412d5f;
    color: white !important;
    padding: 12px;
    border-radius: 50px;
    font-weight: bold;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 17px;
    cursor: pointer;
}

.active-drawer {
    background: #ffc107 !important;
    color: #412d5f !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

/* ==========================
   MOVIE SELECTION MODAL
   ========================= */
.movie-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    transition: transform 0.2s;
    box-sizing: border-box;
}

.movie-btn:hover { transform: scale(1.02); }

.movie-easy   { background: #28a745; }
.movie-medium { background: #fd7e14; }
.movie-hard   { background: #dc3545; }

.movie-info {
    font-size: 14px;
    background: rgba(0,0,0,0.2);
    padding: 4px 8px;
    border-radius: 4px;
}

/* ==========================
   ELEGANT VICTORY CARD
   ========================= */
.victory-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

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

.victory-card {
    background: white;
    border-radius: 24px;
    padding: 36px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 300px;
    width: 80%;
}

@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.victory-emoji {
    font-size: 52px;
    margin-bottom: 8px;
}

.victory-card h2 {
    color: #28a745;
    font-size: 28px;
    margin: 0 0 10px 0;
}

.victory-card p {
    color: #412d5f;
    font-size: 26px;
    margin: 0;
    line-height: 1.5;
    font-weight: bold;
}

/* ==========================
   RECAP SCREEN
   ========================= */
#recapScreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, #1a0533 0%, #0a0015 100%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.recap-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: #ffc107;
    letter-spacing: 4px;
    margin-bottom: 30px;
    text-shadow:
        1px 1px 0px #b8860b,
        2px 2px 0px #8b6914;
    animation: fadeIn 0.8s ease;
}

.recap-strip-wrapper {
    width: 100%;
    overflow: hidden;
}

.recap-strip {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding: 0 40px;
    animation: scrollStrip linear forwards;
    will-change: transform;
}

@keyframes scrollStrip {
    from { transform: translateX(100vw); }
    to   { transform: translateX(-100%); }
}

.recap-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 12px;
    width: 200px;
    box-shadow:
        0 0 20px rgba(255, 215, 0, 0.15),
        inset 0 0 20px rgba(255, 215, 0, 0.05);
}

.recap-card img {
    width: 176px;
    height: 176px;
    object-fit: contain;
    border-radius: 10px;
    background: white;
}

.recap-movie-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: #FFD700;
    text-align: center;
    margin-top: 10px;
    letter-spacing: 2px;
    text-shadow:
        1px 1px 0px #B8860B,
        2px 2px 0px #8B6914,
        3px 3px 0px #5a4010;
    line-height: 1.2;
}

/* ==========================
   MODALS
   ========================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    color: #412d5f;
    padding: 25px;
    border-radius: 20px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 85vh;
    overflow-y: auto;
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.scoreboard-item {
    background: rgba(65, 45, 95, 0.1);
    padding: 12px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
}

.scoreboard-item:nth-child(1) { background: #ffc107; color: #333; }
.scoreboard-item:nth-child(2) { background: #e2e2e2; color: #333; }
.scoreboard-item:nth-child(3) { background: #cd7f32; color: #fff; }

.play-again-btn {
    background: #28a745;
    color: white;
    width: 100%;
    border-radius: 50px;
    padding: 15px;
    font-size: 18px;
    flex-shrink: 0;
}

.play-again-btn:hover { background: #218838; }

.victory-confirm { border: 3px solid #ffc107; }

.modal-btns {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
}

.confirm-btn {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.confirm-btn.yes { background: #28a745; }
.confirm-btn.no  { background: #dc3545; }

/* ==========================
   TOAST NOTIFICATIONS
   ========================= */
#toastNotification {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(65, 45, 95, 0.95);
    color: white;
    padding: 14px 28px;
    border-radius: 16px;
    z-index: 500;
    transition: top 0.4s ease;
    pointer-events: none;
    white-space: normal;
    text-align: center;
    width: 75%;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    line-height: 1.5;
}

#toastNotification.show {
    top: 80px;
}
