/* =========================================
   TRIVIA MASTER - MAIN APP STYLES
   ========================================= */

/* Interaction Effects */
.answer-btn:active { 
    transform: scale(0.95); 
}

/* Custom Scrollbar */
.scroller::-webkit-scrollbar { 
    width: 6px; 
}
.scroller::-webkit-scrollbar-thumb { 
    background-color: #4b5563; 
    border-radius: 4px; 
}

/* Admin Fullscreen Overrides */
.admin-fullscreen .admin-text-lg { 
    font-size: 3rem; 
    line-height: 1; 
}
.admin-fullscreen .admin-text-xl { 
    font-size: 6rem; 
    line-height: 1; 
}

/* Leaderboard Animations */
.leaderboard-item { 
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

@keyframes slideUp { 
    from { transform: translateY(100%); } 
    to { transform: translateY(0); } 
}

.animate-slide-up { 
    animation: slideUp 0.3s ease-out forwards; 
}

/* =========================================
   TRIVIA MASTER - OBS OVERLAY STYLES
   ========================================= */

/* Scoped specifically for Overlay View to avoid conflicts with Main App */
html.obs-overlay, body.obs-overlay {
    height: 100vh;
    width: 100vw;
    margin: 0; padding: 0;
    overflow: hidden;
    background: transparent;
    display: flex;
    flex-direction: column;
}

#root-container {
    width: 100%;
    height: 100%;
    padding: 0.2em; /* Small default padding in EM relative to root font */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.obs-card {
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: 0.5em;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0.5em; /* Padding inside the card */
    color: var(--text-color);
    box-shadow: 0 0.1em 0.5em rgba(0,0,0,0.8);
}

/* Header Styles (Titles & Questions) */
.obs-header {
    text-align: center;
    font-weight: 900;
    flex-shrink: 0;
}
.obs-header.title {
    color: #facc15;
    font-size: 1.2em;
    border-bottom: 0.05em solid #444;
    margin-bottom: 0.2em;
}
.horizontal-layout .obs-header.title {
    border-bottom: none;
}
.obs-header.question {
    line-height: 1.1;
    margin-bottom: 0.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    word-break: break-word;
}
.horizontal-layout .obs-header.question {
    margin-bottom: 0;
    flex-shrink: 1; /* Allow it to shrink and wrap instead of pushing answers */
    flex-basis: 45%; /* Take up 45% of the horizontal space */
    max-width: 50%; /* Never take more than half the screen */
    padding-right: 1em; /* Give breathing room between question and answers */
}
.obs-header.flex-grow {
    flex-grow: 1;
}

/* Leaderboard Text Styles */
.lb-rank { font-weight: bold; color: #aaa; margin-right: 0.5em; }
.lb-name { flex-grow: 1; font-weight: bold; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb-score { font-family: monospace; color: #fde047; font-weight: bold; margin-left: 0.5em; }

/* Response Feed Styles */
.response-item {
    flex-shrink: 0; /* Prevents overlapping when too large, forcing scrollHeight overflow */
    display: flex;
    align-items: center;
}
.resp-name { color: #4ade80; font-weight: bold; margin-right: 0.3em; font-size: 0.8em; flex-shrink: 0; }
.resp-answer { font-weight: bold; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Horizontal Mode Styles */
.horizontal-layout {
    flex-direction: row !important;
    align-items: center;
    gap: 1em;
}

.horizontal-layout .lb-container {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1em;
    overflow: hidden;
}

.horizontal-layout .lb-item, .horizontal-layout .response-item {
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,0.2);
    padding-right: 0.5em;
    flex-grow: 0;
    white-space: nowrap;
}

.horizontal-layout .response-feed {
    flex-direction: row !important;
    gap: 1em;
    flex-wrap: nowrap;
    overflow: hidden;
    align-items: center;
}

/* Leaderboard specific: distribute vertical space */
.lb-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
    gap: 0.2em;
}
.lb-item {
    flex-grow: 1; /* Expand to fill height */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding: 0 0.5em;
}

/* Answer Grid Logic - Classes applied via JS */
.ans-grid {
    display: grid;
    gap: 0.4em;
    flex-grow: 1;
    width: 100%;
    height: 100%;
}
.ans-grid-2x2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.ans-grid-1x4 { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); } /* Tall */
.ans-grid-4x1 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; } /* Wide strip */

.ans-item {
    background: rgba(55, 65, 81, 0.7);
    border-radius: 0.4em;
    display: flex;
    align-items: center;
    padding: 0 0.5em;
    width: 100%;
    height: 100%;
}
.ans-item.correct {
    background: #15803d;
    border: 0.1em solid #4ade80;
    color: white;
    font-weight: 900;
}
.ans-letter { margin-right: 0.4em; opacity: 0.8; font-weight: bold; color: var(--text-color); }

/* Response Feed */
.response-feed {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.2em;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.response-item {
    flex: 1 1 45%; 
    background: rgba(17, 24, 39, 0.9);
    border: 0.1em solid #22c55e;
    border-radius: 999px;
    padding: 0.1em 0.5em;
    display: flex;
    align-items: center;
}

/* MAP STYLES */
#mapCanvas {
    width: 100%;
    height: 100%;
    border-radius: 0.5em;
    border: var(--border-width) solid var(--border-color);
}
.map-avatar-container {
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    border: 3px solid white; 
    box-shadow: 0 3px 6px rgba(0,0,0,0.4); 
    overflow: hidden; 
    background: white;
}
.map-avatar-img { width: 100%; height: 100%; object-fit: cover; }

.leaflet-popup-content-wrapper {
    background: rgba(17, 24, 39, 0.9);
    color: white;
    font-weight: bold;
}
.leaflet-popup-tip {
    background: rgba(17, 24, 39, 0.9);
}

/* QR Canvas */
.qr-container { background: white; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }