:root {
    --bg-color: #111;
    --board-bg: #1c1a17; /* Dark slate / cork base */
    /* Procedural noise texture to look like corkboard */
    --cork-texture: url('data:image/svg+xml;utf8,<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.12"/></svg>');
    --string-color: #ff3333; /* Vibrant glowing red */
    --card-shadow: 0 8px 16px rgba(0,0,0,0.6);
    --card-shadow-hover: 0 16px 32px rgba(0,0,0,0.8);
}

* {
    box-sizing: border-box;
    user-select: none; /* Prevent accidental text selection while dragging */
    -webkit-user-drag: none; /* Prevent browser default image drag */
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Roboto', sans-serif;
    /* Subtle dark theme text color globally */
    color: #e0e0e0;
}

/* --- The Layout Architecture --- */

#viewport {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none;
}

#viewport:active {
    cursor: grabbing;
}

#board {
    position: absolute;
    width: 4000px;
    height: 4000px;
    background-color: var(--board-bg);
    background-image: 
        radial-gradient(circle, transparent 20%, #0a0a0a 150%), /* Vignette */
        var(--cork-texture);
    transform-origin: 0 0;
    /* Hardware acceleration for smooth panning */
    will-change: transform;
}

#string-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Let pointer events pass through to cards/board */
    pointer-events: none;
    z-index: 1;
}

/* --- Evidence Cards Generic Styles --- */

.evidence-card {
    position: absolute;
    z-index: 2;
    cursor: grab;
    filter: drop-shadow(var(--card-shadow));
    /* Smooth scaling and shadow transitions, but exclude left/top for instant drag */
    transition: filter 0.2s ease, transform 0.2s ease;
    will-change: left, top, z-index; 
}

.evidence-card:active {
    cursor: grabbing;
    filter: drop-shadow(var(--card-shadow-hover));
}

.card-title {
    margin: 8px 0 0 0;
    pointer-events: none;
    font-size: 1.1rem;
}

/* --- The Pins --- */

.pins-container {
    position: absolute;
    top: -6px; /* slightly lifted */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px; /* Spacing between pins */
    pointer-events: none;
    z-index: 5;
}

.pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    position: relative; /* Inside flex container now */
    box-shadow: 2px 4px 5px rgba(0,0,0,0.6), inset -2px -2px 4px rgba(0,0,0,0.3);
    pointer-events: auto;
}

/* Suspect Pin: Red */
.card-suspect .pin {
    background: radial-gradient(circle at 30% 30%, #ff5555, #a00000);
}

/* Clue Pin: Blue */
.card-clue .pin {
    background: radial-gradient(circle at 30% 30%, #5555ff, #0000a0);
}

/* Location Pin: Green */
.card-location .pin {
    background: radial-gradient(circle at 30% 30%, #55ff55, #008800);
}

.pin.popping-out {
    animation: pinPopOut 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pinPopOut {
    0% { 
        transform: scale(1); 
        opacity: 1; 
        width: 14px; 
        margin: 0; 
    }
    30% { 
        transform: scale(1.5) translateY(-10px); 
        opacity: 1; 
        width: 14px; 
        margin: 0; 
    }
    100% { 
        transform: scale(0) translateY(15px); 
        opacity: 0; 
        width: 0px; 
        margin: 0 -4px; /* Cancels out the 8px flex gap */
    }
}

/* --- Card Variations --- */

/* Victim: Polaroid with black border */
.card-victim {
    background: #111;
    padding: 10px 10px 35px 10px;
    width: 170px;
    border-radius: 2px;
    font-family: 'Permanent Marker', cursive;
    text-align: center;
    color: #fdfdfd;
    border: 3px solid #800;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(200, 0, 0, 0.2);
}

.card-victim .card-title {
    font-size: 1.4rem;
    line-height: 1.1;
    margin-top: 8px;
    margin-bottom: 0px;
}

.victim-role {
    font-size: 1.1rem;
    line-height: 1.1;
    margin-top: 2px;
    margin-bottom: 12px;
    font-family: 'Special Elite', monospace;
    color: #ccc;
}

.victim-stamp {
    position: absolute;
    top: 50px;
    left: 10px;
    color: #d00;
    font-family: 'Permanent Marker', cursive;
    font-size: 2rem;
    transform: rotate(-15deg);
    border: 3px solid #d00;
    padding: 2px 10px;
    opacity: 0.8;
    pointer-events: none;
    z-index: 5;
}

.card-victim img {
    width: 100%;
    height: 150px;
    background: #000;
    object-fit: cover;
    margin-bottom: 5px;
    border: 1px solid #333;
    pointer-events: none;
}

/* Suspect: Polaroid Photo */
.card-suspect {
    background: #fdfdfd;
    padding: 10px 10px 35px 10px;
    width: 170px;
    border-radius: 2px;
    font-family: 'Permanent Marker', cursive;
    text-align: center;
    color: #1a1a1a;
}

.card-suspect .card-title {
    font-size: 1.4rem;
    line-height: 1.1;
    margin-top: 8px;
    margin-bottom: 0px;
}

.suspect-role {
    font-size: 1.1rem;
    line-height: 1.1;
    margin-top: 2px;
    margin-bottom: 12px;
    font-family: 'Caveat', cursive;
    color: #333;
    font-weight: bold;
}

.card-suspect img {
    width: 100%;
    height: 150px;
    background: #333;
    object-fit: cover;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    pointer-events: none; /* Prevent image drag interfering with card drag */
}

/* Clue: Torn Notepad Paper */
.card-clue {
    background: #fdfbbd;
    padding: 20px 15px 15px 15px;
    width: 190px;
    color: #1a1a1a;
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    line-height: 1.2;
    border-radius: 2px 2px 4px 10px;
    box-shadow: inset 0px 0px 10px rgba(0,0,0,0.1);
}

.clue-header {
    font-family: 'Permanent Marker', cursive;
    color: #cc0000;
    font-size: 1rem;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Location: Map Snippet */
.card-location {
    background: #e3dcc8;
    padding: 8px;
    width: 220px;
    border: 1px solid #c4b59d;
    font-family: 'Special Elite', monospace;
    color: #111;
}

.evidence-photo-container {
    width: 100%;
    height: 110px;
    background: #e3e3e3;
    margin-bottom: 8px;
    margin-top: 5px;
    border: 1px solid rgba(0,0,0,0.3);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    border-radius: 2px;
}

.location-photo-container {
    height: 130px;
    margin-top: 0;
    border: 2px solid #554;
}

.evidence-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    mix-blend-mode: multiply; /* Gives it that vintage print on paper look */
    pointer-events: none;
    filter: contrast(1.2) sepia(0.3); /* Moody crime scene effect */
}

.card-location p {
    margin: 5px 0 0 0;
    font-size: 0.95rem;
    pointer-events: none;
}

/* --- Connecting Strings & Glows --- */

line {
    stroke: var(--string-color);
    stroke-width: 4;
    stroke-linecap: round;
    /* The glowing effect */
    filter: drop-shadow(0 0 6px var(--string-color));
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke-width 0.2s;
}

line:hover {
    stroke-width: 6;
}

/* Visual state when actively drawing a string */
.drawing-line {
    stroke-dasharray: 6, 6;
    opacity: 0.8;
}

/* Visual state for a card that has been double-clicked to start a connection */
.card-glow {
    filter: drop-shadow(0 0 15px var(--string-color)) !important;
}

/* --- Start Screen --- */
#start-screen {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.main-title {
    font-family: 'Permanent Marker', cursive;
    font-size: 5rem;
    color: #fff;
    margin: 0 0 10px 0;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 50, 50, 0.4);
    display: inline-block;
    max-width: 90vw;
}

.subtitle {
    font-size: 1.5rem;
    color: #aaa;
    margin: 0 0 40px 0;
    letter-spacing: 6px;
    text-transform: uppercase;
    font-weight: bold;
}

.instructions-block {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px 30px;
    margin-bottom: 40px;
    max-width: 600px;
    backdrop-filter: blur(5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.instructions-block h3 {
    margin: 0 0 15px 0;
    color: #fff;
    font-family: 'Permanent Marker', cursive;
    letter-spacing: 1px;
    font-size: 1.4rem;
    text-align: center;
}

.instructions-block ul {
    margin: 0;
    padding: 0 0 0 20px;
    color: #ccc;
    font-family: 'Special Elite', monospace;
    font-size: 1.15rem;
    line-height: 1.6;
}

.instructions-block li {
    margin-bottom: 10px;
}

.instructions-block strong {
    color: #ff5555;
}

/* Specific styling for the main screen instructions */
#start-screen .instructions-block {
    background: #e3dcc8; /* Manila paper */
    border: 2px solid #c4b59d;
    border-radius: 2px;
    padding: 25px 30px 20px 30px;
    margin-bottom: 30px;
    max-width: 500px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(0,0,0,0.1);
    position: relative;
    backdrop-filter: none;
    transform: rotate(-1deg);
}
#start-screen .instructions-block::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 20px;
    background: radial-gradient(circle at 30% 30%, #ff5555, #a00);
    border-radius: 50%;
    box-shadow: 2px 5px 10px rgba(0,0,0,0.5), inset -2px -2px 5px rgba(0,0,0,0.3);
    z-index: 5;
}
#start-screen .instructions-block h3 {
    color: #111;
    font-size: 1.5rem;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    margin-bottom: 15px;
}
#start-screen .instructions-block ul {
    color: #222;
    font-size: 1.05rem;
}
#start-screen .instructions-block strong {
    color: #a00;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

#start-btn {
    background: #a00;
    color: #fff;
    border: 1px solid #ff4444;
    padding: 15px 40px;
    font-size: 1.6rem;
    font-weight: bold;
    font-family: 'Roboto', sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.4);
    letter-spacing: 1px;
}

#start-btn:hover {
    background: #e00;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 50, 50, 0.8);
}

#start-btn:disabled {
    background: #444;
    color: #888;
    border: 1px solid #333;
    cursor: not-allowed;
    box-shadow: none;
    transform: scale(1);
}

.secondary-btn {
    background: transparent;
    color: #888;
    border: 1px solid #444;
    padding: 10px 25px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 15px;
}

.secondary-btn:hover {
    background: #222;
    color: #fff;
    border-color: #666;
}

/* --- Board Header --- */
#board-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 100;
    background: linear-gradient(180deg, rgba(10, 10, 12, 0.95) 0%, rgba(10, 10, 12, 0.7) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 50px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255, 50, 50, 0.2);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-sizing: border-box;
}

#board-header.hidden-header {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

#header-center {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#case-title {
    color: #fff;
    font-size: 1.8rem;
    font-family: 'Permanent Marker', cursive;
    margin: 0;
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 0 15px rgba(255, 50, 50, 0.5);
    display: inline-block;
    letter-spacing: 1px;
}

#case-date {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

#loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    color: #bbb;
    font-size: 1.1rem;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.card-loader {
    position: relative;
    width: 60px;
    height: 80px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.l-card {
    position: absolute;
    width: 45px;
    height: 60px;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.8);
    opacity: 0;
}

.c1 { background: #fdfdfd; animation: fly1 3s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.c2 { 
    background: #fdfbbd; 
    border-radius: 2px 2px 5px 15px; 
    box-shadow: inset 0px 0px 5px rgba(0,0,0,0.1), 0 6px 15px rgba(0,0,0,0.8);
    animation: fly2 3s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.c3 { 
    background: #e3dcc8; 
    border: 1px solid #c4b59d;
    animation: fly3 3s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.c3::after {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; height: 25px;
    background: #d5ceb8;
    border: 1px solid #a8a090;
}
.c4 { 
    background: #fdfdfd; 
    border-radius: 2px;
    animation: fly4 3s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.c4::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px; right: 4px; height: 35px;
    background: #333;
}

@keyframes fly1 {
    0% { transform: translate(150px, -100px) rotate(45deg); opacity: 0; }
    5% { opacity: 1; }
    15%, 90% { transform: translate(0, 0) rotate(-10deg); opacity: 1; }
    100% { transform: translate(0, 0) rotate(-10deg); opacity: 0; }
}

@keyframes fly2 {
    0%, 15% { transform: translate(-150px, -50px) rotate(-45deg); opacity: 0; }
    20% { opacity: 1; }
    30%, 90% { transform: translate(2px, 2px) rotate(8deg); opacity: 1; }
    100% { transform: translate(2px, 2px) rotate(8deg); opacity: 0; }
}

@keyframes fly3 {
    0%, 30% { transform: translate(80px, 150px) rotate(90deg); opacity: 0; }
    35% { opacity: 1; }
    45%, 90% { transform: translate(-2px, -2px) rotate(-5deg); opacity: 1; }
    100% { transform: translate(-2px, -2px) rotate(-5deg); opacity: 0; }
}

@keyframes fly4 {
    0%, 45% { transform: translate(-100px, 120px) rotate(-90deg); opacity: 0; }
    50% { opacity: 1; }
    60%, 90% { transform: translate(0px, 4px) rotate(15deg); opacity: 1; }
    100% { transform: translate(0px, 4px) rotate(15deg); opacity: 0; }
}

/* --- Bottom HUD Dock --- */
#hud-dock {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 15px;
    width: 400px;
    z-index: 500;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

#hud-dock.hidden-hud {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
    pointer-events: none;
}

#progress-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

#progress-label {
    color: #bbb;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#progress-percentage {
    color: #fff;
    font-size: 1.5rem;
    font-family: 'Permanent Marker', cursive;
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 50, 50, 0.5);
}

#progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--string-color);
    transition: width 0.3s ease, background 0.3s ease;
}

.progress-complete {
    background: #55ff55 !important;
    box-shadow: 0 0 10px #55ff55;
}

.hidden {
    display: none !important;
}

/* --- Verdict Modal --- */
#verdict-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.verdict-content {
    background: #1c1a17;
    border: 2px solid #555;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    color: #eee;
    font-family: 'Roboto', sans-serif;
}

#verdict-title {
    font-family: 'Permanent Marker', cursive;
    font-size: 3rem;
    margin: 0 0 10px 0;
    color: #fff;
    letter-spacing: 2px;
}

#verdict-result {
    font-size: 2rem;
    margin: 0 0 20px 0;
    font-weight: bold;
}

.result-correct {
    color: #55ff55;
    text-shadow: 0 0 10px rgba(85,255,85,0.5);
}

.result-wrong {
    color: #ff5555;
    text-shadow: 0 0 10px rgba(255,85,85,0.5);
}

#verdict-explanation {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #ccc;
}

#play-again-btn {
    background: #444;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 1.2rem;
    font-family: 'Roboto', sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: bold;
}

#play-again-btn:hover {
    background: #666;
}

/* --- Accuse Button --- */
.accuse-btn {
    background: #a00;
    color: white;
    border: 1px solid #500;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    margin-top: 10px;
    width: 100%;
    transition: all 0.2s;
}

.accuse-btn:disabled {
    background: #444;
    color: #888;
    border: 1px solid #333;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.accuse-btn:not(:disabled) {
    background: #e00;
    animation: pulse-accuse 1.5s infinite;
}

.accuse-btn:not(:disabled):hover {
    background: #ff2222;
}

@keyframes pulse-accuse {
    0% { box-shadow: 0 0 0 0 rgba(255, 50, 50, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 50, 50, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 50, 50, 0); }
}

/* --- Error Feedback --- */
.shake-error {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.8)) !important;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0) rotate(-1deg); }
    20%, 80% { transform: translate3d(4px, 0, 0) rotate(1deg); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0) rotate(-2deg); }
    40%, 60% { transform: translate3d(6px, 0, 0) rotate(2deg); }
}

/* --- Success Feedback --- */
.spark-success {
    animation: sparkWhite 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes sparkWhite {
    0% { filter: drop-shadow(0 0 0px rgba(255, 255, 200, 0)) brightness(1); transform: scale(1); }
    20% { filter: drop-shadow(0 0 30px rgba(255, 255, 200, 1)) brightness(1.3); transform: scale(1.08); }
    100% { filter: drop-shadow(0 0 5px rgba(255, 255, 200, 0)) brightness(1); transform: scale(1); }
}

/* --- Intro Modal (Case Brief) --- */
#intro-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.intro-content {
    background: #1c1a17; /* Dark theme instead of manila */
    border: 2px solid #555;
    padding: 50px;
    max-width: 650px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 50px rgba(0,0,0,0.1);
    color: #ccc;
    font-family: 'Special Elite', monospace;
    position: relative;
    border-radius: 4px;
}

.intro-content::before {
    content: 'CONFIDENTIAL';
    position: absolute;
    top: 15px; left: 15px;
    font-family: 'Permanent Marker', cursive;
    color: #a00;
    font-size: 1.5rem;
    transform: rotate(-10deg);
    opacity: 0.8;
}

#intro-title {
    font-family: 'Permanent Marker', cursive;
    font-size: 2.8rem;
    margin: 30px 0 20px 0;
    color: #fff;
    line-height: 1.1;
}

#intro-description {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 0;
    color: #aaa;
}

.scrollable-content {
    overflow-y: auto;
    max-height: 50vh;
    margin-bottom: 30px;
    padding-right: 10px;
}

#investigate-btn {
    background: #111;
    color: #fff;
    border: 2px solid #111;
    padding: 12px 40px;
    font-size: 1.2rem;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

#investigate-btn:hover {
    background: #a00;
    border-color: #a00;
    transform: scale(1.05);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    /* Start Screen */
    #start-screen {
        padding: 20px;
        justify-content: flex-start;
        overflow-y: auto;
    }

    .main-title {
        font-size: 3rem;
        margin-top: 20px;
    }
    
    .subtitle {
        font-size: 1rem;
        letter-spacing: 1px;
        text-align: center;
        padding: 0 10px;
    }
    
    #start-screen .instructions-block {
        padding: 15px 15px 10px 15px;
        max-width: 100%;
        margin-bottom: 15px;
    }
    
    #start-screen .instructions-block h3 {
        font-size: 1.1rem;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }
    
    #start-screen .instructions-block ul {
        font-size: 0.85rem;
    }
    
    .instructions-block li {
        margin-bottom: 5px;
    }
    
    #start-btn {
        padding: 12px 20px;
        font-size: 1.2rem;
    }
    
    .secondary-btn {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
    
    /* Intro Modal */
    .intro-content {
        padding: 30px 20px;
        max-width: 90vw;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
    
    .scrollable-content {
        overflow-y: auto;
        margin-bottom: 15px;
        padding-right: 5px;
        flex-shrink: 1;
        min-height: 0;
    }
    
    #intro-title {
        font-size: 1.8rem;
    }
    
    #intro-description {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    /* Board Header */
    #board-header {
        padding: 10px 15px;
        flex-direction: row;
        gap: 5px;
    }
    
    #case-title {
        font-size: 1.2rem;
    }
    
    #case-date {
        font-size: 0.7rem;
    }
    
    /* HUD Dock */
    #hud-dock {
        width: 90vw;
        padding: 10px 15px;
        bottom: 15px;
    }
    
    #progress-label {
        font-size: 0.75rem;
    }
    
    #progress-percentage {
        font-size: 1.2rem;
    }
    
    /* Verdict Modal */
    .verdict-content {
        padding: 25px 15px;
        max-width: 90vw;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #verdict-title {
        font-size: 2rem;
    }
    
    #verdict-result {
        font-size: 1.5rem;
    }
    
    #verdict-explanation {
        font-size: 1rem;
    }
}

.header-icon-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

#quit-modal, #help-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 10, 10, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}


.danger-btn {
    background: #e00;
    color: white;
    border: 1px solid #500;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: #ff2222;
}


.intro-content::before {
    z-index: 10;
}

#close-help-btn {
    background: transparent;
    color: #ff5555;
    border: 2px solid #ff5555;
    padding: 10px 25px;
    font-size: 1.1rem;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(255, 85, 85, 0.2), inset 0 0 5px rgba(255, 85, 85, 0.2);
}

#close-help-btn:hover {
    background: rgba(255, 85, 85, 0.15);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.4), inset 0 0 10px rgba(255, 85, 85, 0.4);
    transform: scale(1.05);
}


#analyze-btn {
    background: #ff5555;
    color: white;
    border: 1px solid #a00;
    padding: 8px 10px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 4px;
    width: 100%;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(255, 85, 85, 0.4);
}

#analyze-btn:hover {
    background: #ff2222;
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.6);
}


#lives-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 4px;
    margin-bottom: 2px;
}
.life-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5555;
    box-shadow: 0 0 8px rgba(255, 85, 85, 0.8);
    transition: all 0.3s ease;
}
.life-dot.lost {
    background: #333;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
    transform: scale(0.8);
}


#string-inventory-container {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 250px;
}
#string-count-label {
    font-size: 0.75rem;
    color: #ff5555;
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}
#string-bar-bg {
    width: 100%;
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
}
#string-bar-fill {
    height: 100%;
    background: #ff5555;
    width: 100%;
    transition: width 0.3s ease, background 0.3s;
    box-shadow: 0 0 5px rgba(255, 85, 85, 0.8);
}

@media (max-width: 768px) {
    #string-inventory-container {
        width: 150px;
    }
    #string-count-label {
        font-size: 0.65rem;
    }
}


@media (max-width: 768px) {
    #hud-dock {
        padding: 8px 12px;
        bottom: 10px;
    }
    #progress-container {
        gap: 6px;
    }
    #analyze-btn {
        margin-top: 4px;
        padding: 8px 10px;
        font-size: 0.95rem;
    }
    #lives-container {
        margin-top: 4px;
        margin-bottom: 2px;
    }
    .life-dot {
        width: 10px;
        height: 10px;
    }
}


/* --- Zoom Controls --- */
#zoom-controls {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dynamically move up when the HUD dock is visible */
#hud-dock:not(.hidden-hud) ~ #zoom-controls {
    bottom: 130px;
}

#zoom-controls button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #1c1a17;
    border: 2px solid #555;
    color: #ccc;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'Roboto', sans-serif;
}

#zoom-controls button:hover {
    background: #333;
    color: #fff;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    #zoom-controls {
        right: 15px;
        bottom: 20px; /* Base position same as desktop */
    }
    
    #hud-dock:not(.hidden-hud) ~ #zoom-controls {
        bottom: 160px; /* Moves higher on mobile to clear the larger dock */
    }
    
    #zoom-controls button {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* --- Mobile Spacing Fix --- */
@media (max-width: 768px) {
    #start-screen {
        justify-content: center;
    }
    .main-title {
        margin-top: 10px;
        margin-bottom: 5px;
    }
    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 25px;
    }
    #start-screen .instructions-block {
        margin-bottom: 25px;
    }
    .button-group {
        gap: 10px;
    }
}

/* --- Smooth Space Collapsing for Loading Screen --- */
.subtitle {
    max-height: 100px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.instructions-block {
    max-height: 600px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.collapse-space {
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none;
}


/* --- Modal Animations --- */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

#intro-modal:not(.hidden),
#verdict-modal:not(.hidden),
#quit-modal:not(.hidden),
#help-modal:not(.hidden) {
    animation: modalFadeIn 0.3s ease-out forwards;
}

#intro-modal:not(.hidden) > div,
#verdict-modal:not(.hidden) > div,
#quit-modal:not(.hidden) > div,
#help-modal:not(.hidden) > div {
    animation: contentSlideUp 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}


/* Victim Pin: White/Silver */
.card-victim .pin {
    background: radial-gradient(circle at 30% 30%, #ffffff, #aaaaaa);
}


    10% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); filter: blur(0px); }
    20% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); filter: blur(0px); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); filter: blur(10px); }
}

@media (max-width: 768px) {
    }


@keyframes newEvidenceGlow {
    0% { filter: brightness(1); box-shadow: 0 0 0px rgba(255, 215, 0, 0); }
    30% { filter: brightness(1.3); box-shadow: 0 0 30px rgba(255, 215, 0, 0.9); }
    100% { filter: brightness(1); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
}

.new-evidence-highlight {
    animation: newEvidenceGlow 2.5s ease-out forwards;
}


@keyframes correctConnectionGlow {
    0% { filter: brightness(1); box-shadow: 0 0 0px rgba(85, 255, 85, 0); }
    30% { filter: brightness(1.3); box-shadow: 0 0 30px rgba(85, 255, 85, 0.9); }
    100% { filter: brightness(1); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
}

.correct-glow {
    animation: correctConnectionGlow 1.5s ease-out forwards;
}

