/* --- 1. General Setup & Dark Theme --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212;
    color: #e5e5e5;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s ease; /* For OBS mode */
}

h1 {
    color: #fff;
    background-color: #1e1e1e;
    border: 1px solid #333;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    text-align: center;
    box-sizing: border-box;
    border-radius: 8px;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* For OBS mode */
}

/* General h2 styles (outside dashboard) */
h2 {
    color: #fff;
    text-transform: uppercase;
    font-size: 1em;
    letter-spacing: 1px;
    text-align: center;
    margin-top: 30px; /* Default top margin */
    margin-bottom: 15px; /* Added default bottom margin */
    background-color: #333;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #333;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* For OBS mode */
}

button {
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-grow: 1; 
}

button:disabled {
    background-color: #444;
    color: #777;
    cursor: not-allowed;
}

/* --- 2. Main Layout & Navigation --- */
#main-navigation {
    display: flex;
    width: 100%;
    max-width: 800px;
    margin-bottom: 15px;
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 5px;
}

.main-nav-button {
    flex-grow: 1;
    padding: 15px 10px;
    background-color: transparent;
    border: none;
    color: #aaa;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.main-nav-button:hover {
    color: #fff;
    background-color: #2a2a2a;
}

.main-nav-button.active {
    color: #fff;
    background-color: #c83c23;
}

#main-navigation .main-nav-button.active[id="nav-main-survivor"] {
    background-color: var(--survivor-blue);
}

/* Chaos Mode Button Container */
.chaos-mode-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.chaos-button {
    background-color: #6a4c93; 
    color: #ddd;
    font-size: 1em;
    padding: 10px 20px;
    max-width: 300px;
    border: 1px solid #4a2c73;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.chaos-button:hover {
    background-color: #7a5ca3;
}
.chaos-button.active {
    background-color: #8a6cb3;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 0 10px #a080cc, 0 0 5px #a080cc inset;
    border-color: #a080cc;
}


.settings-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: flex-end; 
    align-items: center;
    gap: 10px; 

    margin-bottom: 0; 
    height: 40px; 
}

/* Container for top-left button */
.top-left-container {
    width: 100%;
    max-width: 800px; 
    display: flex;
    justify-content: flex-start; 
    align-items: center;
    margin-bottom: 10px; 
    height: 40px; 
    gap: 10px;
}
/* button uses same style */
#show-info-button {
    background-color: #555;
    flex-grow: 0;
    padding: 8px 16px;
    font-size: 0.9em;
}
#show-info-button:hover {
     background-color: #666;
}

#open-changelog-button {
   background-color: #555;
    flex-grow: 0;
    padding: 8px 16px;
    font-size: 0.9em; 
}

#open-changelog-button:hover {
    background-color: #666;
} 

#settings-button,
#obs-toggle-button { 
    background-color: #555;
    flex-grow: 0;
    padding: 8px 16px;
    font-size: 0.9em;
}

#settings-button:hover,
#obs-toggle-button:hover {
    background-color: #666;
}


#obs-toggle-button.active {
    background-color: var(--survivor-blue);
    color: #fff;
}

/* --- 3. Main Page Content (Killer/Survivor) --- */
.main-page-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Background Image Properties */
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    min-height: 60vh;
    position: relative;
    border-radius: 8px; 
    overflow: hidden; 
    transition: background-image 0.3s ease; 
}

#killer-main-page {
    background-image: url("https://i.imgur.com/O5sXS7o.jpeg");
}

#survivor-main-page {
    background-image: url("https://i.imgur.com/1MwbBbR.jpeg");
}

/* Background Image Overlay */
.main-page-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(18, 18, 18, 0.7);
    z-index: -1;
    /* border-radius: 8px; */ /* Removed from overlay, applied to parent */
    backdrop-filter: blur(3px);
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease; /* For OBS mode */
}

/* Ensures content stays above the overlay */
.main-page-content > * {
    z-index: 1;
}

/* --- 4. Sub-Navigation --- */
.page-content {
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    padding: 0 20px 20px 20px;
}

/* --- 5. Ironman Tracker: Display Window --- */
#main-display,
#survivor-main-display {
    background-color: rgba(30, 30, 30, 0.85); /* 30,30,30 is #1e1e1e */
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-wrap: wrap;
    gap: 10px; 
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* For OBS mode */
}

/* Dashboard H2 styles */
#main-display > h2,
#survivor-main-display > h2 {
    flex-basis: 100%;
    margin: 0; 
    text-align: center;
    max-width: 100%;
    position: relative;
    background-color: rgba(42, 42, 42, 0.85); 
    border: 1px solid #444;
    border-radius: 6px;
    padding: 8px 15px; 
    margin-top: 5px; 
    font-size: 0.9em; 
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* OBS mode */
}
/* Remove top margin for the very first h2 */
#main-display > h2:first-of-type,
#survivor-main-display > h2:first-of-type {
    margin-top: 0;
}


#killer-pool-container,
#survivor-pool-container {
    min-height: 250px; 
    flex-basis: calc(60% - 10px);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

/* --- 6. Ironman Tracker: Character Cards --- */
.killer-card {
    background-color: rgba(42, 42, 42, 0.85); /* 42,42,42 is #2a2a2a */
    border: 1px solid #444;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    width: 100%;
    height: 100%;
    max-width: 300px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease; /* For OBS mode */
}

.killer-card h3 {
    margin: 10px 0 15px 0;
    font-size: 1.5em;
    color: #fff;
    word-wrap: break-word; /* Prevent long names overflowing */
}

.character-icon {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 15px auto; 
    background-size: 140%;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid #555;
    background-color: #222;
    flex-shrink: 0; /* Prevent icon shrinking */
}

/* --- 7. Ironman Tracker: Timers --- */
.timers {
    display: flex;
    flex-direction: column; 
    gap: 15px; 
    flex-grow: 1;
    justify-content: center; 
    min-width: 0; 
}

.timer-box {
    background-color: rgba(42, 42, 42, 0.85); 
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #333;
    flex-grow: 0; 
    transition: background-color 0.2s ease, border-color 0.3s ease; 
}

/* Make progress box clickable */
.timer-box-clickable {
    cursor: pointer;
}
.timer-box-clickable:hover {
    background-color: #3a3a3a;
}


.timer-box h3 {
    margin: 0 0 10px 0;
    padding: 0;
    border: none;
    font-size: 1em;
    color: #aaa;
    text-transform: uppercase;
}

.timer-box span {
    font-size: 2.2em;
    font-weight: bold;
    color: #fff;
    font-family: "Courier New", Courier, monospace;
}

/* NEW: Rules for Hiding Timers */
.timers-disabled .timer-current,
.timers-disabled .timer-total {
    display: none;
}

/* 2. Hide the "Start Match" button (it's not needed) */
.timers-disabled .start-match-btn {
    display: none;
}

/* 3. Make the "Complete" button take up the full width */
.timers-disabled .complete-btn {
    width: 100%; 
    margin: 5px 0; 
}

/* 4. Ensure the Progress box is still centered in its column */
.timers-disabled .timers {
     justify-content: center; 
}

/* --- 8. Ironman Tracker: Controls & Card Buttons --- */

/* Control Panel Container */
.control-panel-container {
    flex-basis: 100%; 
    display: flex;
    flex-direction: column; 
    gap: 15px; 
}

/* Rows within the Control Panel */
.controls-row {
    display: flex;
    gap: 15px; 
}

/* Force even 50/50 split for buttons in a row */
.controls-row > button {
    flex-basis: 0;
}

#roll-button,
#survivor-roll-button { 
    background-color: #c83c23;
}
#roll-button:not(:disabled):hover,
#survivor-roll-button:not(:disabled):hover {
    background-color: #a7321e;
}

#survivor-main-page #survivor-roll-button { 
    background-color: var(--survivor-blue);
}
#survivor-main-page #survivor-roll-button:not(:disabled):hover { 
    background-color: var(--survivor-blue-hover);
}


#reset-button {
    background-color: #666;
}
#reset-button:not(:disabled):hover {
    background-color: #444;
}
/* Specific override for survivor reset button */
#survivor-main-page #survivor-reset-button { /* Corrected ID */
     background-color: #5a7a9c;
}
#survivor-main-page #survivor-reset-button:not(:disabled):hover { /* Corrected ID */
    background-color: #4a6a8c;
}


/* Perk Roll Buttons */
#perk-roll-button {
    background-color: #c83c23;
}
#perk-roll-button:not(:disabled):hover {
    background-color: #a7321e;
}
#survivor-perk-roll-button {
    background-color: var(--survivor-blue);
}
#survivor-perk-roll-button:not(:disabled):hover {
     background-color: var(--survivor-blue-hover);
}



.killer-card .start-match-btn,
.killer-card .complete-btn {
    width: 48%;
    margin: 5px 1%;
}

.start-match-btn {
    background-color: #28a745;
}
.start-match-btn:not(:disabled):hover {
    background-color: #218838;
}

.complete-btn {
    background-color: #007bff;
}
.complete-btn:not(:disabled):hover {
    background-color: #0069d9;
}


/* --- 9. Ironman Tracker: Completed List --- */
.hidden-section-header,
.hidden-section-content {
    display: none !important; /* Use !important to ensure override if needed */
}

/* --- 10. Perk Randomizer --- */
.perk-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    justify-items: center;
    background-color: rgba(30, 30, 30, 0.85); /* 30,30,30 is #1e1e1e */
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-top: 5px;
    min-height: 140px;
    width: 100%;
    flex-basis: 100%;
    box-sizing: border-box; 
    transition: background-color 0.3s ease, border-color 0.3s ease; /* For OBS mode */
    align-content: center;
}

.perk-list:empty::before {
    content: "Generate perks to see your loadout...";
    color: #555;
    font-style: italic;
    font-size: 1.25em;
    grid-column: 1 / -1; 
    text-align: center;
}

#perk-roll-button, 
#survivor-perk-roll-button {
    width: 100%;
}

.perk-item {
    width: 100px;
    height: 100px;
    scale: 105%;
    position: relative;    
    
    background-color: rgba(18, 18, 18, 0.85); 
    border: 2px solid #555;
    border-radius: 15%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer; 
    transition: transform 0.2s ease, border-color 0.2s ease;
    -webkit-user-select: none; 
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.perk-item:hover {
    transform: scale(1.1);
    border-color: #fff;
}

.perk-item.active-hold {
    transform: scale(1.0) !important; /* Sink in slightly */
    border-color: var(--survivor-blue) !important; /* Glow */
    box-shadow: 0 0 10px var(--survivor-blue);
    transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.perk-disclaimer {
    color: #aaa; 
    font-size: 0.8em; 
    font-style: italic; 
    text-align: center; 
    margin: 5px 0 0 0; 
    flex-basis: 100%; 
    padding: 0; 
}


/* --- 11. Color Accents & Themes --- */
:root {
    --survivor-blue: #4a90e2;
    --survivor-blue-hover: #357abd;
}

/* Killer Colors */
#killer-main-page h1 {
    border-bottom: 3px solid #c83c23;
}

/* MODIFIED: Target new modal title */
#perk-tooltip-modal .perk-tooltip-modal-content.killer-theme h4 {
    color: #c83c23;
}

/* Survivor Colors */
#survivor-main-page h1 {
    border-bottom: 3px solid var(--survivor-blue);
}

/* MODIFIED: Target new modal title */
#perk-tooltip-modal .perk-tooltip-modal-content.survivor-theme h4 {
    color: var(--survivor-blue);
}


/* --- 12. STATUS EFFECT COLORS (FINAL STRATEGY) --- */

/* Base style for all status effect keywords (Color-coded) */
.status-effect {
    font-weight: bold;
    font-style: italic;
    white-space: nowrap;
}

/* New style for all game objects (Bolded) */
.game-object {
    font-weight: bold;
    color: #ffffff; 
    white-space: nowrap;
}

/* Category 1: Positive Effects */
.status-effect.positive {
    color: #E8D746; /* Bright Yellow */
}

/* Category 2: Negative Effects */
.status-effect.negative {
    color: #A83A3A; /* Pinkish-Red */
}

/* Category 3: Aura Reading */
.status-effect.aura {
    color: #F472B6; /* Bright Pink */
}

/* Category 4: Special & Unique Mechanics */
.status-effect.undetectable { color: #90A4AE; } /* Grey-Blue */
.status-effect.hex { color: #FF8800; } /* Bright Orange */
.status-effect.boon { color: #31CFF5; } /* Bright Blue */
.status-effect.invocation { color: #7A42A8; } /* Dark Purple */

/* --- 13. Color Key Legend --- */
.color-legend {
    display: none; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px 20px; 
    margin: 0; 
    padding: 15px;
    background-color: rgba(30, 30, 30, 0.85); /* 30,30,30 is #1e1e1e */
    border-radius: 8px;
    border: 1px solid #333;
    width: 100%;
    box-sizing: border-box;
    flex-basis: 100%;
}

/* Legend Toggle Button Style */
.legend-toggle-button {
    font-size: 0.7em;
    color: var(--survivor-blue);
    cursor: pointer;
    margin-left: 10px;
    text-decoration: none;
    vertical-align: middle;
    display: inline-block; 
    text-transform: none; 
    font-weight: normal; 
    border: none; 
    background: none; 
    padding: 2px 5px; 
    border-radius: 3px; 
    transition: color 0.2s ease, background-color 0.2s ease; 
}
.legend-toggle-button:hover {
    color: white;
    text-decoration: underline;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle hover background */
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #aaa;
}

.legend-item .legend-text {
    color: #fff;
    font-weight: bold;
    margin-right: 5px;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.2);
}

/* Use the same colors defined in section 12 */
.legend-swatch.positive { background-color: #E8D746; }
.legend-swatch.negative { background-color: #A83A3A; }
.legend-swatch.aura { background-color: #F472B6; }
.legend-swatch.hex { background-color: #FF8800; }
.legend-swatch.boon { background-color: #31CFF5; }
.legend-swatch.invocation { background-color: #7A42A8; }
.legend-swatch.undetectable { background-color: #90A4AE; }
.legend-swatch.game-object { background-color: #fff; border: 1px solid #555; }

/* --- 14. Modals (General Styles) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 50px;
    box-sizing: border-box;
}

.modal-content {
    background-color: #1e1e1e;
    padding: 50px;
    border-radius: 8px;
    border: 1px solid #444;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    text-align: left;
    width: 50%;
    position: relative; 
    /* Add max-height/overflow for general modals too */
    max-height: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #fff;
    font-size: 2em;
    text-transform: none; 
    flex-shrink: 0; 
}

.modal-content h3 {
    background-color: #444;
    padding: 10px;
    border-radius: 10px;
}

.modal-content p {
    margin-top: 0;
    margin-bottom: 30px;
    color: #aaa;
    font-size: 1.1em;
    line-height: 1.6;
    flex-shrink: 0; 
}

.info-modal-content {
    max-width: 950px; 
}

.info-modal-content h3 {
    font-size: 1.5em;
}

.info-modal-content p {
    margin-bottom: -5px;
    color: #fff;
}

.info-modal-content li {
    color: #aaa;
}
.info-modal-content em, strong {
    color: #fff;
}

.changelog-content {
    max-width: 100%;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-shrink: 0; 
    margin-top: auto; /* Push buttons to bottom if content is short */
    padding-top: 20px; 
}
.modal-buttons #got-it-welcome-button {
    background-color: #5858e6;
}

.modal-buttons #download-share-image-button {
    background-color: #5858e6;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 2.5em;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-grow: 0; 
    z-index: 1002; 
}
.close-button:hover {
    color: #fff;
}

/* --- 15. Confirmation Modal (Reset) --- */
#confirmation-modal .modal-content {
    max-width: 400px; 
    max-height: none; 
}

#confirm-yes {
    background-color: #c83c23;
}
#confirm-yes:hover {
    background-color: #a7321e;
}

#confirm-no {
    background-color: #666;
}
#confirm-no:hover {
    background-color: #555;
}

/* --- 16. Settings Modal --- */
.settings-modal-content {
    max-width: 800px;
    text-align: left;
}

.roster-lists-container {
    display: flex;
    gap: 20px;
    margin-top: -5px;
    margin-bottom: 5px;
    overflow-y: auto; 
    flex-grow: 1; 
    min-height: 0; 
}

.roster-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Prevent flex items from overflowing */
}

.roster-list {
    flex: 1;
    background-color: #121212;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    min-height: 0; 
}

.roster-list h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.character-list {
    overflow-y: auto; /* Make individual lists scrollable */
    padding-right: 10px; /* Space for scrollbar */
    flex-grow: 1; /* Allow list to fill its container */
    min-height: 0; /* Ensure list itself can shrink */
}

.character-list-item {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.character-list-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.character-list-item input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    flex-shrink: 0; 
}


#reset-settings-button {
    background-color: #666;
    min-width: 50%; 
    flex-grow: 0; 
}
#reset-settings-button:hover {
    background-color: #555;
}

#save-settings-button {
    background-color: var(--survivor-blue);
    min-width: 50%; 
    display: flexbox; 
}
#save-settings-button:hover {
    background-color: var(--survivor-blue-hover);
}

/* NEW: Timer Toggle Checkbox Style */
.settings-option {
    padding: 10px 15px;
    background-color: #121212;
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 20px; 
    flex-shrink: 0; 
}
.settings-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.1em;
    gap: 12px; 
}
.settings-option input {
    width: 18px;
    height: 18px;
}

/* --- 17. Footer --- */
.app-footer {
    width: 100%;
    max-width: 800px;
    margin-top: 40px;
    padding: 20px 0; 
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px; 
    box-sizing: border-box; 
}
/* Ensure footer takes full width */
body > .app-footer {
     max-width: 100%;
     padding-left: 20px;
     padding-right: 20px;
}


.footer-credits {
     flex-grow: 1; /* Allow credits to take center space */
}

.footer-credits p {
    color: #777;
    font-size: 0.9em;
    line-height: 1.5;
    margin: 5px 0;
    text-align: center;
}

.footer-version {
    text-align: right;
    flex-shrink: 0; 
}

.version-number {
    color: #555;
    font-size: 0.9em;
    margin: 5px 0 0 0;
    text-align: center;
}

.link-button {
    background: none;
    border: none;
    color: var(--survivor-blue);
    font-size: 0.9em;
    padding: 5px;
    cursor: pointer;
    text-decoration: underline;
}
.link-button:hover {
    color: #fff;
}

.social-links {
    display: flex;
    gap: 10px;
    justify-content: center; 
    flex-shrink: 0;
}

.settings-button-link {
    display: inline-block;
    text-decoration: none;
    color: white;
    background-color: #555;
    padding: 8px 16px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0;
    text-align: center;
    white-space: nowrap;
}

#twitch-button {
    background-color: #9146FF;
}
#twitch-button:hover {
    background-color: #7a3add;
}

#kofi-button {
    background-color: #00b9fe;
}
#kofi-button:hover {
    background-color: #00a0db;
}

#feedback-button {
    background-color: #f16220; 
}
#feedback-button:hover {
    background-color: #d85518;
}

/* --- 18. Changelog & Completed List Modals --- */
.changelog-content {
    margin-top: 20px;
    max-height: 40vh; 
    overflow-y: auto;
    text-align: left;
    padding-right: 15px; 
    flex-grow: 1; 
}

.changelog-content h3 {
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
    margin-top: 15px; 
}
.changelog-content h3:first-of-type {
    margin-top: 0;
}

.changelog-content ul {
    padding-left: 20px;
    list-style: disc; 
}

.changelog-content li {
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 8px;
}

/* Completed List Modal Specific Styles */
.completed-modal-content {
    max-width: 450px; 
}

.completed-modal-list-area {
    margin-top: 20px;
    overflow-y: auto; /* Make the list area scrollable */
    flex-grow: 1; 
    padding-right: 15px;
    padding-left: 15px; 
    border-top: 1px solid #333; 
    padding-top: 15px;
     min-height: 0; 
}

.completed-modal-list-area .killer-card {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 5px;
    padding-left: 10px;
    max-width: 100%;
}
.completed-modal-list-area .character-icon {
    width: 40px;
    height: 40px;
    border-width: 2px;
    border-radius: 50%;
    margin: 0;
    background-size: 140%;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #555;
    background-color: #222;
    flex-shrink: 0; 
}
.completed-modal-list-area .killer-card h3 {
    font-size: 1.25em;
    text-decoration: line-through;
    color: #ff5f5f;
    margin: 0;
    flex-grow: 1;
    text-align: left;
    margin-left: 15px;
    overflow: hidden; 
    white-space: nowrap;
    text-overflow: ellipsis;
}
.completed-modal-list-area .killer-time {
    font-size: 0.75em;
    font-family: "Courier New", Courier, monospace;
    color: #28a745;
    font-weight: bold;
    margin-left: 5px;
    flex-shrink: 1; 
}

/* --- 19. NEW: Perk Tooltip Modal --- */
.perk-tooltip-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Dimming overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500; 
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none; 
}

.perk-tooltip-modal-content {
    background-color: #121212;
    color: #e5e5e5;
    border: 1px solid #444;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 380px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    pointer-events: auto; 
    text-align: left;
}
.perk-tooltip-modal-content h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
}
.perk-tooltip-modal-content p {
    margin: 0;
    line-height: 1.6;
    font-size: 1em;
    color: #e5e5e5;
}


/* --- 20. NEW: OBS Mode Styles (MODIFIED) --- */
/* This class will be toggled on the <body> */
body.obs-mode {
    /* Use magenta background for color keying */
    background-color: #FF00FF !important;
}
body.obs-mode.browser-source {
    background-color: transparent !important; /* Overrides the Magenta */
}

/* Make main page container (with BG image) transparent */
body.obs-mode .main-page-content {
    background-image: none !important;
}
body.obs-mode .main-page-content::before {
    background-color: transparent !important;
    backdrop-filter: none !important;
}

/* Make page title (h1) and other non-dashboard h2s transparent */
body.obs-mode h1,
body.obs-mode h2 {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* --- MODIFICATION START --- */
body.obs-mode #main-display, body.obs-mode #survivor-main-display {
    background-color: rgba(30, 30, 30, 0);
}
body.obs-mode #survivor-main-display,
body.obs-mode .timer-box,
body.obs-mode .killer-card,
body.obs-mode .perk-list,
body.obs-mode #main-display > h2,
body.obs-mode #survivor-main-display > h2, 
body.obs-mode .perk-item,
body.obs-mode .color-legend {
    /* DO NOT touch the background-color, it keep its rgba() */
    border-color: transparent !important; /* ONLY remove the border */
    box-shadow: none !important; /* ONLY remove the shadow */
}

/* Select perk/character icons */
body.obs-mode .character-icon,
body.obs-mode .perk-item {
     /* We DO NOT touch the background-color, letting it keep its #222 or rgba() fallback */
    border-color: rgba(255, 255, 255, 0.6) !important; /* Keep a faint border for definition */
}
/* --- MODIFICATION END --- */


/* Add text shadow for readability on transparent background */
body.obs-mode h1,
body.obs-mode h2,
body.obs-mode h3,
body.obs-mode span,
body.obs-mode p,
body.obs-mode .legend-item,
body.obs-mode .perk-disclaimer {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 1px 1px rgba(0,0,0,1);
}
/* Special handling for some elements */
body.obs-mode .timer-box h3 {
    color: #ccc !important; /* Keep secondary text slightly dimmer */
}
body.obs-mode .legend-toggle-button {
    color: var(--survivor-blue) !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 1px 1px rgba(0,0,0,1);
}
body.obs-mode .legend-toggle-button:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
}


/* --- 21. NEW: "New Update" Notification Glow --- */
@keyframes newFeatureGlow {
    0% {
        box-shadow: 0 0 5px var(--survivor-blue), 0 0 10px var(--survivor-blue);
    }
    50% {
        box-shadow: 0 0 15px var(--survivor-blue), 0 0 25px var(--survivor-blue);
    }
    100% {
        box-shadow: 0 0 5px var(--survivor-blue), 0 0 10px var(--survivor-blue);
    }
}
.new-feature-highlight {
    animation: newFeatureGlow 1.5s infinite ease-in-out;
    border-color: var(--survivor-blue) !important; 
}

.link-button.new-feature-highlight {
    color: #fff;
    text-shadow: 0 0 5px var(--survivor-blue), 0 0 10px var(--survivor-blue);
    animation: none; 
}


/* --- 22. RESPONSIVE & MOBILE STYLES --- */
/* This media query targets tablets and phones (768px and smaller) */
@media (max-width: 768px) {
    .top-left-container,
    .settings-container {
        margin-bottom: 5px; 
        height: auto; 
        padding-left: 10px; 
        padding-right: 10px;
    }
     #show-info-button,
    #settings-button { 
        font-size: 0.8em;
        padding: 6px 12px;
    }
    #obs-toggle-button {
        display: none;
    }

    /* NEW: Chaos button on mobile */
    .chaos-mode-container {
        margin-bottom: 5px;
    }
    .chaos-button {
        font-size: 0.9em;
        padding: 8px 16px;
    }
    
    .perk-item {
        /* Revert size */
        width: 90px;
        height: 90px;
        /* Keep rotation */
    }
     .perk-item:hover {
        /* Keep mobile hover scale consistent */
         transform: scale(1.1);
     }


    /* General Layout Adjustments */
    body {
        padding: 10px;
    }
    h1 {
        font-size: 1.5em; 
        padding: 15px;
    }
    h2 { /* General h2 on mobile */
         font-size: 0.9em; 
         max-width: 90%; 
    }
    /* Dashboard h2 on mobile */
     #main-display > h2,
    #survivor-main-display > h2 {
         font-size: 0.85em; 
         padding: 6px 10px;
    }


    .main-page-content,
    .settings-container { 
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
     .main-page-content {
        padding-left: 5px; 
        padding-right: 5px;
     }
    .page-content {
         padding: 0 5px 10px 5px; 
    }


    /* Dashboard Adjustments */
     #main-display,
    #survivor-main-display {
        gap: 10px; 
        padding: 10px; 
    }
    /* Ensure card container and timers stack on mobile */
    #killer-pool-container,
    #survivor-pool-container,
    #main-display .timers,
    #survivor-main-display .timers {
        flex-basis: 100%; 
        min-width: 0; 
    }
     #killer-pool-container,
    #survivor-pool-container {
         min-height: 160px; 
     }
    .character-icon {
         width: 100px; 
         height: 100px;
    }
    .killer-card {
         max-width: 100%;
         padding: 15px;
    }
     .killer-card h3 {
         font-size: 1.3em; 
     }
     .timer-box {
         padding: 10px; 
     }
     .timer-box span {
         font-size: 1.8em; 
     }

    .settings-container {
        margin-top: 10px; 
        margin-bottom: 10px;
         padding-left: 10px; 
         padding-right: 10px;
    }


    /* Perk Grid Adjustments */
    .perk-list {
        grid-template-columns: repeat(2, 1fr); 
        gap: 5px;
        padding: 10px; 
        width: 100%; 
    }
    .perk-item {
        width: 70px; 
        height: 70px;
        padding-bottom: 0; 
        max-width: 100%; 
        position: relative; 
    }
     .perk-item::before {
        content: none;
    }


    /* Legend Adjustments */
     .legend-toggle-button {
         display: block; /* Move toggle below H2 */
         margin-top: 5px;
         margin-left: auto; 
         margin-right: auto;
         font-size: 0.8em;
     }


    /* --- Modal Adjustments --- */

    
    .modal-content {
        max-width: 100%;
        padding: 15px; 
        max-height: 100%; 
        overflow-y: auto;
        min-height: 0; 
    }
     .modal-content h2 {
         font-size: 1.3em;
         margin-bottom: 15px; 
     }
     .modal-content p {
         font-size: 1em;
         margin-bottom: 20px;
     }

    #reset-roster-modal.modal-content {
        max-width: 100%; 
        flex: 0 1 auto; 
    }

    /* NEW RULE TO FIX THE BUTTONS */
    #reset-roster-modal.modal-content button {
        flex-grow: 0; /* Stops the buttons from growing too wide */
        scale: 90%;
        padding: 15px
    }
    /* --- Settings Modal Mobile Scrolling --- */
    .settings-modal-content {
        min-height: 0;
    }

    
    .roster-lists-container {
        display: flex;            
        flex-direction: column;  
        flex-grow: 1;             
        min-height: 0;           
        overflow-y: auto;        
        gap: 8px; 
    }
    .roster-column {
        min-height: 50; 
        margin-bottom: 15px; 
    }
    .roster-list {
        display: flex;            
        flex-direction: column;   
        flex: 0 0 auto;           
        overflow-y: visible;       
    }

    .character-list {
        flex-grow: 0;             
        overflow-y: visible;      
        padding-right: 0;         
        max-height: none;        
    }
     .character-list-item {
         font-size: 1em; 
     }


    /* --- Footer Adjustments --- */
    .app-footer {
        flex-direction: column; 
        gap: 15px; 
        text-align: center;
        margin-top: 20px;
        padding: 15px 10px 10px 10px; 
        width: 100%; 
        max-width: 100%;
        box-sizing: border-box;
    }

    .footer-credits p,
    .footer-version {
        text-align: center;
    }
     .footer-version {
         width: 100%; 
     }

    .social-links {
        margin-bottom: 0; 
        justify-content: center; 
        order: -1; 
        width: 100%; 
        flex-direction: column;
    }
     .settings-button-link {
         padding: 6px 12px;
         font-size: 0.9em;
     }
}

/* --- 23. Mulligan System --- */

/* 1. The "Mulligan Tokens: X" counter */
.mulligan-container {
    display: none; /* JS will show this when perks are rolled */
    flex-basis: 100%; 
    text-align: center;
    font-size: 0.9em;
    color: #aaa;
    margin-top: 10px;  
    margin-bottom: 0;
}

/* Style the number (e.g., the "2") */
.mulligan-container span {
    font-weight: bold;
    color: #fff;
    font-size: 1.1em;
}

/* 2. The 🔄 Re-roll Button on each perk */
.perk-reroll-btn {
    position: absolute;
    top: 5px;
    right: 1px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid #555;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 5; /* Sit on top of the perk icon */
    transition: all 0.2s ease;
    scale: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; 
}

.perk-reroll-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    color: var(--survivor-blue);
    transform: scale(1.1);
}

/* This is the most important part! */
.perk-reroll-btn:disabled {
    background-color: rgba(0, 0, 0, 0.4);
    color: #666;
    border-color: #333;
    cursor: not-allowed;
    transform: none; 
}


/* --- More Mobile adjustments --- */
@media (max-width: 768px) {
    .perk-reroll-btn {
        width: 20px;
        height: 20px;
        font-size: 14px;
        line-height: 1; /* Keep reset */
    }
}

#killer-share-run-button,
#survivor-share-run-button {
    display: none;
}

/* --- 24. Share Run Card --- */
.share-card {
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.share-card h3 {
    color: #fff;
    font-size: 1.4em;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.share-card-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 25px;
}

.share-card-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.share-card-stat span {
    font-size: 0.9em;
    color: #aaa;
    text-transform: uppercase;
}

.share-card-stat strong {
    font-size: 1.8em;
    color: #fff;
    font-weight: 600;
}

.share-card-footer {
    font-size: 0.9em;
    color: var(--survivor-blue);
    font-weight: 500;
}

.share-card-date {
    font-size: 0.8em;
    color: #aaa;
    margin: 20px 0 5px 0; 
    padding: 0;
}
/* --- 25. Banner Mode Switcher (Replaces H1) --- */

.banner-mode-switcher {
    display: flex;
    width: 100%;
    max-width: 600px;
    margin: 0 auto; /* Center it */
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden; /* Keeps button corners clean */
    border: 1px solid #333;
    background-color: #1e1e1e; /* Match old H1 background */
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

/* Maintain the Red/Blue Underline identity from the old H1 */
#killer-main-page .banner-mode-switcher {
    border-bottom: 3px solid #c83c23;
}
#survivor-main-page .banner-mode-switcher {
    border-bottom: 3px solid #4a90e2;
}

.banner-mode-btn {
    flex: 1; 
    background: none;
    border: none;
    padding: 20px; 
    font-size: 1.2em;
    font-weight: bold;
    color: #555; 
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

/* Hover Effect */
.banner-mode-btn:hover {
    background-color: #2a2a2a;
    color: #ccc;
}

/* --- Active States --- */

/* Ironman Active (Gold Theme) */
.banner-mode-btn.ironman.active {
    background-color: #2e2e2e; 
    color: #d4af37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}
/* Add a glow */
.banner-mode-btn.ironman.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #d4af37;
}

/* Roulette Active (Pink Theme) */
.banner-mode-btn.roulette.active {
    background-color: #2e2e2e;
    color: #e91e63; 
    text-shadow: 0 0 10px rgba(233, 30, 99, 0.2);
}
/* Add a glow */
.banner-mode-btn.roulette.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #e91e63;
}

body.roulette-mode .timers, 
body.roulette-mode .share-card-stats {
    display: none !important;
}

body.roulette-mode #reset-button,
body.roulette-mode #survivor-reset-button {
    display: none;
}

@media (max-width: 768px) {
    .banner-mode-btn {
        padding: 15px;
        font-size: 1em;
    }
}