:root {
    --bg-dark: #0f0f13;
    --bg-panel: rgba(30, 30, 40, 0.85);
    --primary-blue: #00d2ff;
    --guilty-red: #ff0055;
    --innocent-green: #00ff9d;
    --accent-gold: #ffd700;
    --text-main: #ffffff;
    --font-header: 'Russo One', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --font-fun: 'Bangers', cursive;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000000 100%);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Layout --- */
#game-container {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto; /* Header, Main Content, Voting/Controls */
    grid-template-areas: 
        "header"
        "scene"
        "voting";
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
    transform: none;
}

/* --- Header --- */
header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    z-index: 10;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative; /* For absolute positioning of status */
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-credit {
    margin: -5px 0 0 0;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

#status-box {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

h1 {
    font-family: var(--font-header);
    font-size: 3.5rem;
    margin: 0;
    color: var(--text-main);
    text-shadow: 0 0 20px var(--primary-blue);
    letter-spacing: 5px;
    background: linear-gradient(45deg, #fff, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#status {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#timer {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

#stats-container {
    padding: 10px 20px;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--guilty-red);
    border-radius: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.2);
}

#stat-incorrect {
    font-family: var(--font-header);
    color: var(--guilty-red);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Scene (Main Content) --- */
#scene {
    grid-area: scene;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    perspective: 1000px;
}

#case-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    height: 100%; /* Allow filling height if needed */
}

/* --- Cards (Glassmorphism) --- */
.card {
    background: var(--bg-panel);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#case-file {
    width: 60%;
    flex: 2;
    /* Reset max-width from general card if needed, or keep it large */
    max-width: 1000px; 
}

#case-title {
    font-family: var(--font-header);
    font-size: 3rem;
    margin-bottom: 2rem;
    color: var(--primary-blue);
    text-shadow: 0 4px 0 rgba(0,0,0,0.3);
    border-bottom: 2px solid rgba(0, 210, 255, 0.3);
    padding-bottom: 10px;
    width: 100%;
}

#case-description {
    font-size: 1.6rem;
    line-height: 1.8;
    color: #e0e0e0;
    background: rgba(0,0,0,0.3);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    width: 100%;
    box-sizing: border-box;
}

/* Evidence Panel Overhaul */
#evidence-panel {
    border-left: none;
    border-top: 4px solid var(--accent-gold);
    width: 25%; /* Much smaller width */
    flex: 1;
    padding: 1.5rem; /* Reduced padding */
    min-width: 300px; /* Prevent it from getting too squished */
}

#evidence-panel h3 {
    font-family: var(--font-header);
    font-size: 1.5rem; /* Reduced size */
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.evidence-content {
    display: flex;
    flex-direction: column; /* Stack vertically in sidebar */
    gap: 1.5rem;
    width: 100%;
}

.evidence-side {
    background: rgba(0, 0, 0, 0.6);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    text-align: left; /* Better reading for sidebar */
}

.evidence-side h4 {
    color: var(--primary-blue);
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem; /* Smaller header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.evidence-side p {
    margin: 0;
    font-size: 0.95rem; /* Smaller text */
    color: #ccc;
    line-height: 1.4;
}

/* --- Voting Area --- */
#voting-area {
    grid-area: voting;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0;
    height: 140px; /* Fixed height for bottom bars */
    width: 100%;
    background: #0a0a0e;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.vote-box {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    padding: 0 3rem;
    transition: background 0.3s;
}

.vote-box.innocent {
    background: linear-gradient(90deg, rgba(0, 255, 157, 0.05) 0%, transparent 100%);
    border-right: 1px solid rgba(255,255,255,0.05);
}

.vote-box.guilty {
    background: linear-gradient(-90deg, rgba(255, 0, 85, 0.05) 0%, transparent 100%);
    border-left: 1px solid rgba(255,255,255,0.05);
}

.vote-header {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 15px;
    z-index: 1;
}

.vote-title-group {
    display: flex;
    flex-direction: column;
}

.vote-sub {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: -5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.innocent .vote-title-group { align-items: flex-start; }
.guilty .vote-title-group { align-items: flex-end; }

.innocent .vote-header { justify-content: flex-start; }
.guilty .vote-header { justify-content: flex-end; }

.vote-instruction {
    font-family: var(--font-header);
    font-size: 1.2rem;
    opacity: 0.8;
    color: rgba(255,255,255,0.7);
    pointer-events: none;
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.bar-container {
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
}

.bar {
    height: 100%;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 0 20px currentColor;
}

#bar-innocent { background: var(--innocent-green); color: var(--innocent-green); }
#bar-guilty { background: var(--guilty-red); color: var(--guilty-red); }

.vote-box h3 {
    font-family: var(--font-header);
    font-size: 2rem;
    margin: 0;
    text-transform: uppercase;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.innocent h3, #count-innocent { color: var(--innocent-green); text-align: left; }
.guilty h3, #count-guilty { color: var(--guilty-red); text-align: right; }

#count-innocent, #count-guilty {
    font-family: var(--font-fun);
    font-size: 3rem;
    position: absolute;
    top: -50px;
}
#count-innocent { left: 2rem; }
#count-guilty { right: 2rem; }

/* --- Verdict Overlay --- */
#verdict-display {
    background: rgba(15, 15, 19, 0.98);
    border: 4px solid var(--accent-gold);
    box-shadow: 0 0 100px rgba(255, 215, 0, 0.3);
    width: 95%; /* Use nearly full width of scene */
    max-width: 1400px;
    height: 95%; /* Use nearly full height of scene */
    position: absolute; /* Position relative to #scene parent */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center perfectly in scene */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Start from top */
    align-items: center;
    z-index: 50; /* High enough to be on top of case, but not header/footer */
    padding: 4vh 2vw 2vh 2vw; /* More padding on top */
    box-sizing: border-box;
    overflow: hidden; /* Prevent ANY scrolling */
}

#final-verdict {
    font-family: var(--font-fun);
    font-size: clamp(3rem, 15vh, 8rem); /* Responsive font size */
    margin: 0 0 1vh 0; /* Small margin bottom */
    transform: rotate(-5deg);
    text-shadow: 10px 10px 0px rgba(0,0,0,0.5);
    animation: stamp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

#result-details {
    font-size: clamp(1rem, 3vh, 2rem); /* Responsive font size */
    color: #e0e0e0;
    text-align: center;
    max-width: 95%;
    line-height: 1.3;
    margin: 0 0 2vh 0; /* Fixed margin bottom instead of auto */
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-weight: bold;
    flex: 0 1 auto; /* Don't force grow, allow shrink */
    display: flex;
    align-items: flex-start; /* Align text to top */
    justify-content: center;
    overflow: hidden; /* Hide overflow if it happens */
}

@keyframes stamp {
    from { transform: scale(3) rotate(15deg); opacity: 0; }
    to { transform: scale(1) rotate(-5deg); opacity: 1; }
}

#winners-section {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    padding: 1vh 1vw; /* Smaller responsive padding */
    border: 1px solid rgba(255,215,0,0.2);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0; /* Don't shrink winners section */
}

#winners-section h3 {
    text-align: center;
    color: var(--accent-gold);
    font-family: var(--font-header);
    text-transform: uppercase;
    margin: 0 0 1vh 0; /* Minimal margin */
    font-size: clamp(1rem, 2.5vh, 1.5rem); /* Responsive font size */
}

#winners-list {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.5vw; /* Responsive gap */
    width: 100%;
    margin: 0;
}

.winner-item {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    font-family: var(--font-body);
}

/* --- Controls --- */
#controls {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    gap: 20px;
}

button {
    font-family: var(--font-header);
    font-size: 1.2rem;
    text-transform: uppercase;
    padding: 1rem 2rem;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
    color: white;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
    letter-spacing: 1px;
}

button:hover {
    background: var(--text-main);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

/* --- Login Overlay --- */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 15, 19, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.credit-text {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: floatIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 0.2s; /* Slight delay */
    opacity: 0; /* Start hidden for animation */
}

.login-box {
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 25, 0.95));
    border: 1px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 0 60px rgba(0, 210, 255, 0.15), inset 0 0 20px rgba(0, 210, 255, 0.05);
    padding: 3rem 4rem;
    border-radius: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 500px;
    width: 90%;
    transform: translateY(-20px);
    animation: floatIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.login-logo {
    font-size: 3rem !important;
    margin-bottom: 0rem !important;
    text-shadow: 0 0 30px rgba(0, 210, 255, 0.5);
}

.login-sub {
    color: rgba(255, 255, 255, 0.6);
    margin: -0.5rem 0 1rem 0;
    font-size: 1rem;
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box h2 {
    font-family: var(--font-header);
    color: var(--text-main);
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px var(--primary-blue);
    background: linear-gradient(45deg, #fff, var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#channel-input {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 12px;
    outline: none;
    font-family: var(--font-body);
    transition: all 0.3s ease;
    text-align: center;
}

#channel-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
}

#channel-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#btn-connect {
    background: linear-gradient(90deg, var(--primary-blue), #00a8cc);
    color: #000;
    font-weight: bold;
    border: none;
    font-size: 1.3rem;
    padding: 1rem;
    margin-top: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.3);
    border-radius: 12px;
}

#btn-connect:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 210, 255, 0.5);
    color: #000;
}

#btn-connect:active {
    transform: translateY(1px);
}

.hidden {
    display: none !important;
}
