html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #090a14;
    color: #ebede9;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    /* Prevent scrollbars */
}

/* Ensure all interactive elements use the game font */
button, input, select, textarea {
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
}

h1 {
    color: #73bed3;
}

/* Base Button Style */
.game-btn {
    background: #151d28;
    border: 2px solid #577277;
    color: #a8b5b2;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.8em;
    border-radius: 4px;
    transition: all 0.2s;
    text-align: center;
}

.game-btn:hover {
    background: #202e37;
    border-color: #73bed3;
    color: #ebede9;
    box-shadow: 0 0 10px rgba(136, 225, 242, 0.3);
}

.game-btn:active {
    transform: scale(0.95);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #202e37;
    color: #577277;
}

/* Main Layout */
#main-layout {
    display: flex;
    flex-direction: row;
    /* Explicit row */
    align-items: center;
    /* Center vertically */
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    gap: 20px;
}

#game-viewport {
    flex: 1 1 auto;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Ensure it fills the space correctly */
    max-width: calc(100% - 320px);
    max-height: 95vh;
    /* Move Border Here so Minimap is "inside" the frame */
    border: 2px solid #73bed3;
    box-shadow: 0 0 15px #73bed3;
    border-radius: 4px;
}

#gameCanvas {
    background-color: #090a14;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    /* Remove border from canvas */
    border: none;
    box-shadow: none;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Side Panel */
#side-panel {
    flex: 0 0 300px;
    /* Fixed width 300px, don't grow, don't shrink */
    max-width: 300px;
    height: 100%;
    /* Fill available height */
    overflow-y: auto;
    /* Scroll if content is long */

    background-color: #10141f;
    border: 2px solid #394a50;
    border-radius: 8px;
    padding: 20px;
    color: #ebede9;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

#side-panel h1 {
    font-size: 1.5em;
    color: #73bed3;
    margin: 0 0 10px 0;
    text-align: center;
    border-bottom: 1px solid #394a50;
    padding-bottom: 10px;
}

#party-portraits {
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    margin-bottom: 10px;
}

.portrait-slot {
    width: 66px;
    height: 66px;
    background-color: #151d28;
    border: 2px solid #577277;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 5px #090a14;
}

.panel-section h2 {
    font-size: 1.1em;
    color: #a8b5b2;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#time-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #ebede9;
    background: #151d28;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #577277;
}

#status-display p {
    margin: 5px 0;
    color: #c7cfcc;
}

#controls-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#controls-list li {
    background: #151d28;
    margin-bottom: 5px;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #819796;
}

#btn-open-inventory {
    margin-top: 10px;
    width: 100%;
}

/* Selection Screen */
#selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 5, 5, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ebede9;
}

.creation-step h1, .creation-step h2 {
    font-size: 2.5em;
    margin-bottom: 40px;
    text-shadow: 0 0 10px #73bed3;
    color: #73bed3;
}

.creation-step h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

#hero-options {
    display: flex;
    gap: 40px;
}

.hero-option {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid #577277;
    border-radius: 8px;
    padding: 10px;
    background: #10141f;
}

.hero-option:hover {
    transform: scale(1.1);
    border-color: #73bed3;
    box-shadow: 0 0 20px rgba(136, 225, 242, 0.3);
}

.hero-option p {
    text-align: center;
    margin: 10px 0 0 0;
    font-weight: bold;
    color: #a8b5b2;
}

.hero-option:hover p {
    color: #ebede9;
}

/* Encounter Modal */
#encounter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Darker background */
    z-index: 2000;
    /* Above selection screen just in case */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    /* Increased blur */
}

.encounter-content {
    background: #090a14;
    /* Darker bg */
    border: 2px solid #73bed3;
    /* Neon Cyan Border */
    border-radius: 8px;
    padding: 30px;
    width: 450px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(136, 225, 242, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.8);
    /* Cyan glow + inner shadow */
    animation: popIn 0.3s ease-out;
    color: #ebede9;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#encounter-title {
    color: #73bed3;
    /* Cyan Title */
    margin-top: 0;
    font-size: 1.5em;
    /* Adjusted for font */
    border-bottom: 2px solid #202e37;
    padding-bottom: 15px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(136, 225, 242, 0.5);
}

#encounter-desc {
    color: #c7cfcc;
    font-size: 0.9em;
    /* Adjusted for font */
    line-height: 1.8;
    margin-bottom: 30px;
}

#encounter-options button {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    background: transparent;
    /* Transparent like main menu */
    border: 2px solid #577277;
    color: #819796;
    cursor: pointer;
    font-size: 1em;
    /* Adjusted for font */
    border-radius: 4px;
    /* Slightly closer to main menu style */
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#encounter-options button:hover {
    border-color: #73bed3;
    color: #73bed3;
    background: rgba(136, 225, 242, 0.1);
    box-shadow: 0 0 15px rgba(136, 225, 242, 0.3);
    transform: scale(1.02);
}

#encounter-image {
    margin-bottom: 15px;
}

#encounter-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    border: 1px solid #394a50;
}

/* Start Screen */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #090a14;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ebede9;
}

.game-title {
    font-size: 5em;
    margin: 0;
    color: #73bed3;
    text-shadow: 0 0 20px #73bed3, 0 0 40px #4f8fba;
    letter-spacing: 10px;
}

.subtitle {
    font-size: 1.5em;
    color: #819796;
    margin-bottom: 50px;
    letter-spacing: 5px;
}

.main-btn {
    padding: 15px 40px;
    font-size: 1.5em;
    background: transparent;
    border: 3px solid #73bed3;
    color: #73bed3;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.main-btn:hover, .main-btn.selected {
    background: #73bed3;
    color: #090a14;
    box-shadow: 0 0 30px #73bed3;
    transform: scale(1.05);
}

/* Lore Screen */
#lore-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #090a14;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lore-content {
    max-width: 600px;
    text-align: center;
    color: #ddd;
    font-size: 1.2em;
    line-height: 1.8;
}

.lore-content h2 {
    color: #e7d5b3;
    margin-bottom: 30px;
    font-size: 2em;
}

.secondary-btn {
    padding: 10px 30px;
    background: #202e37;
    border: 2px solid #577277;
    color: #ebede9;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: #73bed3;
    background: #394a50;
    color: #73bed3;
}

/* Inventory Grid Items */
.inv-grid-item {
    background: #202e37;
    border: 1px solid #577277;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    cursor: pointer;
    position: relative;
    text-align: center;
    padding: 2px;
}

.inv-grid-item:hover {
    border-color: #ebede9;
    background: #394a50;
}

.inv-item-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #ebede9;
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 0.8em;
}

/* Equipment Slots */
.equip-slot {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px dashed #394a50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: #577277;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.equip-slot:hover {
    border-color: #819796;
    background: rgba(255, 255, 255, 0.05);
}

.equip-slot.filled {
    border: 2px solid #a8b5b2;
    color: #ebede9;
    background: #202e37;
}

.equip-slot.filled:hover {
    border-color: #cf573c;
    /* Red to indicate unequip? */
}

/* Character Sheet Styles */
.equip-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    padding: 2px;
    box-sizing: border-box;
}

.char-sheet-header {
    background: #151d28;
    border: 3px solid #394a50;
    border-bottom: none;
    padding: 15px 30px;
    width: 90%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.char-sheet-header h2 {
    margin: 0;
    font-size: 1.8em;
    color: #73bed3;
    text-shadow: 0 0 10px rgba(136, 225, 242, 0.5);
}

#char-sheet-subtitle {
    color: #819796;
    font-size: 0.8em;
    margin-top: 5px;
}

.close-x {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #577277;
    font-size: 2em;
    cursor: pointer;
}

.close-x:hover { color: #cf573c; }

.char-sheet-container {
    display: flex;
    width: 90%;
    max-width: 1100px;
    height: 75vh;
    min-height: 600px;
    background: #10141f;
    border: 3px solid #394a50;
    box-sizing: border-box;
    padding: 10px;
    gap: 15px;
}

.char-sheet-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stats-col { width: 25%; }
.portrait-col { width: 40%; }
.inventory-col { width: 35%; }

.sheet-panel, .trade-sheet, .loot-sheet {
    background: #151d28;
    border: 2px solid #202e37;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 10px #090a14;
}

.trade-sheet { width: 1000px; border-color: #e8c170; }
.loot-sheet { width: 800px; border-color: #ad7757; }

.sheet-panel h3 {
    margin: -15px -15px 15px -15px;
    background: #151d28;
    padding: 8px;
    font-size: 0.7em;
    color: #a8b5b2;
    border-bottom: 1px solid #202e37;
    text-align: center;
}

.stats-list {
    font-size: 0.8em;
    line-height: 2.2;
}

.paperdoll-frame {
    flex-grow: 1;
    background: #151d28;
    border: 3px solid #202e37;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#paper-doll-model, #examine-paper-doll-model {
    width: 100%;
    height: 100%;
}

.party-tabs-panel {
    height: 60px;
    padding: 5px !important;
}

.party-mini-tabs {
    display: flex;
    gap: 5px;
    height: 100%;
}

.party-mini-tabs button {
    flex: 1;
    font-size: 0.6em;
    background: #151d28;
    border: 1px solid #394a50;
    color: #577277;
}

.party-mini-tabs button.active {
    background: #73bed3;
    color: #090a14;
    border-color: #ebede9;
}

.journal-tab {
    background: #151d28;
    border: 2px solid #394a50;
    color: #819796;
    padding: 15px;
    cursor: pointer;
    font-size: 0.7em;
    text-align: left;
    transition: all 0.2s;
}

.journal-tab:hover {
    border-color: #73bed3;
    color: #ebede9;
}

.journal-tab.active {
    background: #e8c170;
    border-color: #e8c170;
    color: #090a14;
    box-shadow: 0 0 15px rgba(232, 193, 112, 0.4);
    font-weight: bold;
}

.capacity-container {
    font-size: 0.6em;
    margin-bottom: 10px;
    color: #819796;
}

.capacity-bar-bg {
    width: 100%;
    height: 4px;
    background: #090a14;
    margin-top: 4px;
}

#inventory-bar {
    height: 100%;
    width: 0%;
    background: #75a743;
}

.inventory-grid-compact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 55px;
    gap: 5px;
    overflow-y: auto;
    flex-grow: 1;
}

.info-panel {
    height: 150px;
    font-size: 0.7em;
}

.placeholder-text {
    text-align: center;
    color: #394a50;
    margin-top: 40px;
}

#paper-doll-slots, #examine-paper-doll-slots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#paper-doll-slots .equip-slot, #examine-paper-doll-slots .equip-slot {
    pointer-events: auto;
}

/* Redefine equip slot sizes for the sheet */
.equip-slot {
    width: 75px;
    height: 75px;
    font-size: 0.7em;
}
.creation-container {
    width: 80%;
    max-width: 700px; /* Adjusted for a single-column layout */
    height: 80%;
    max-height: 700px;
    background: #151d28;
    border: 2px solid #577277;
    border-radius: 8px;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.creation-main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden; /* Prevent parent from growing */
}

#creation-steps {
    flex-grow: 1;
    overflow-y: auto;
    text-align: center;
    padding-right: 15px; /* For scrollbar */
}

.creation-step {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    animation: popIn 0.3s ease-out;
}

.creation-step.active-step {
    display: flex; /* Visible when active */
}

.creation-side-panel {
    margin-top: 20px;
    padding: 15px;
    background: #10141f;
    border: 1px solid #202e37;
    border-radius: 4px;
    text-align: center;
}

#side-panel-title {
    color: #73bed3;
    border-bottom: 1px solid #394a50;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

#side-panel-desc {
    color: #a8b5b2;
    line-height: 1.6;
    font-size: 0.9em;
}

#creation-nav {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#creation-nav .main-btn, #creation-nav .secondary-btn {
    font-size: 1em;
    padding: 10px 20px;
}

.creation-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.creation-section label {
    font-size: 1.2em;
    color: #73bed3;
    margin-bottom: 10px;
    text-shadow: 0 0 5px rgba(136, 225, 242, 0.5);
}

#char-name-input {
    background: #10141f;
    border: 2px solid #577277;
    color: #ebede9;
    padding: 10px 15px;
    font-size: 1.2em;
    text-align: center;
    width: 300px;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
}

#char-name-input:focus {
    border-color: #73bed3;
    box-shadow: 0 0 10px rgba(136, 225, 242, 0.3);
}

.selection-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.select-btn {
    background: #151d28;
    border: 2px solid #577277;
    color: #819796;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.8em;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 100px;
    text-align: center;
}

.select-btn:hover {
    background: #202e37;
    border-color: #a8b5b2;
    color: #ebede9;
}

.select-btn.active {
    background: #da863e; /* Orange highlight */
    border-color: #da863e;
    color: #ebede9;
    box-shadow: 0 0 10px rgba(255, 133, 27, 0.5);
    font-weight: bold;
}

.portrait-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    background: #10141f;
    border: 1px solid #202e37;
    border-radius: 4px;
    justify-items: center;
}

.portrait-option {
    width: 80px;
    height: 80px;
    border: 2px solid #577277;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    background: #090a14;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.portrait-option:hover {
    border-color: #ebede9;
    transform: scale(1.1);
}

.portrait-option.active {
    border-color: #73bed3;
    box-shadow: 0 0 15px #73bed3;
    transform: scale(1.1);
    z-index: 10;
}

#btn-start-adventure:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #577277;
    color: #577277;
    background: transparent;
    box-shadow: none;
}

.summary-container {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.summary-portrait {
    width: 120px;
    height: 120px;
    border: 3px solid #73bed3;
    border-radius: 4px;
    background: #090a14;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.summary-portrait img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.summary-details h3 {
    font-size: 1.5em;
    color: #ebede9;
    margin: 0 0 10px 0;
}

.summary-details p {
    font-size: 1em;
    color: #c7cfcc;
    margin: 5px 0;
}

#randomize-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#randomize-container label {
    font-size: 0.9em;
    color: #a8b5b2;
    cursor: pointer;
}

#randomize-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Backstory Scrollbar */
#backstory-text::-webkit-scrollbar {
    width: 8px;
}
#backstory-text::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
#backstory-text::-webkit-scrollbar-thumb {
    background: #73bed3;
    border-radius: 4px;
}

/* City Screen Specific Styles */
#city-screen h1 {
    margin-bottom: 30px;
    text-shadow: 0 0 15px rgba(136, 225, 242, 0.5);
}

.city-panel {
    text-align: center;
    padding: 20px;
    background: #151d28;
    border: 2px solid #394a50;
    border-radius: 8px;
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.city-panel h2 {
    font-size: 1em;
    margin: 0;
    color: #ebede9;
}

.city-panel p {
    font-size: 0.7em;
    color: #819796;
    margin: 0 0 10px 0;
}

.city-panel .game-btn {
    width: 100%;
}

/* Trade / Loot Modal */
#trade-modal, #loot-modal {
    backdrop-filter: blur(5px);
}

#loot-items div:last-child {
    border-bottom: none;
}

#loot-items div {
    font-size: 0.8em;
    color: #ebede9;
    margin-bottom: 5px;
}

#loot-items::-webkit-scrollbar {
    width: 10px;
}

#loot-items::-webkit-scrollbar-track {
    background: #10141f;
}

/* Combat Animations */
.unit-lunge-player {
    animation: lungePlayer 0.3s ease-in-out;
}

.unit-lunge-enemy {
    animation: lungeEnemy 0.3s ease-in-out;
}

/* Combat JRPG Side-View Layout */
.combat-unit-el {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
}

.combat-unit-el canvas {
    width: 120px;
    height: 140px;
    image-rendering: pixelated;
    transition: transform 0.2s ease-out;
}

.combat-unit-el:hover canvas {
    transform: scale(1.1);
}

/* Status Cards in Bottom Tray */
.combat-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #151d28;
    border: 2px solid #394a50;
    border-radius: 6px;
    width: 200px;
    transition: all 0.2s;
    position: relative;
}

.combat-status-card.active {
    border-color: #e8c170;
    box-shadow: 0 0 10px rgba(232, 193, 112, 0.3);
    background: #202e37;
}

.combat-status-card canvas {
    width: 40px;
    height: 40px;
    border: 1px solid #577277;
    background: #090a14;
    image-rendering: pixelated;
}

.combat-status-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.combat-status-name {
    font-size: 0.5em;
    color: #ebede9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.combat-status-hp-bar {
    width: 100%;
    height: 6px;
    background: #090a14;
    border-radius: 3px;
    overflow: hidden;
}

.combat-status-hp-fill {
    height: 100%;
    background: #75a743;
    transition: width 0.3s ease-out;
}

.combat-shield-indicator {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #4f8fba;
    border: 1px solid #a4dddb;
    color: #ebede9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 0 10px rgba(0, 116, 217, 0.5);
    z-index: 20;
    animation: shieldPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes shieldPop {
    from { transform: scale(0) translateX(-50%); opacity: 0; }
    to { transform: scale(1) translateX(-50%); opacity: 1; }
}

@keyframes lungePlayer {
    0% { transform: translateX(0); }
    50% { transform: translateX(-80px) scale(1.1); }
    100% { transform: translateX(0); }
}

@keyframes lungeEnemy {
    0% { transform: translateX(0); }
    50% { transform: translateX(80px) scale(1.1); }
    100% { transform: translateX(0); }
}

.card-rejection {
    animation: cardRejection 0.3s ease-in-out;
}

@keyframes cardRejection {
    0% { transform: translateX(0); filter: brightness(1); }
    20% { transform: translateX(-10px); filter: brightness(1.5) sepia(1) hue-rotate(-50deg); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
    100% { transform: translateX(0); filter: brightness(1); }
}

.unit-hit {
    animation: hitFlash 0.2s ease-in-out;
}

@keyframes hitFlash {
    0% { filter: brightness(1); }
    50% { filter: brightness(3) sepia(1) hue-rotate(-50deg); }
    100% { filter: brightness(1); }
}

.unit-shake {
    animation: unitShake 0.2s ease-in-out;
}

@keyframes unitShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification-toast {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #73bed3;
    color: #73bed3;
    padding: 15px 30px;
    font-size: 0.8em;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(136, 225, 242, 0.3);
    animation: slideInDown 0.3s ease-out, fadeOut 0.5s ease-in 2.5s forwards;
    pointer-events: auto;
}

@keyframes slideInDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

#loot-items::-webkit-scrollbar-thumb {
    background: #ad7757;
    border: 2px solid #10141f;
}

#world-map-modal .sheet-panel {
    background: #090a14;
    border: 3px solid #73bed3;
    padding: 10px;
    box-shadow: 0 0 30px rgba(115, 190, 211, 0.3);
}

#large-minimap {
    width: 100%;
    height: 100%;
    display: block;
}

/* Death Modal */
#death-modal {
    animation: deathFadeIn 3s forwards;
    pointer-events: auto;
}

@keyframes deathFadeIn {
    0% { background: rgba(0,0,0,0); opacity: 0; }
    50% { background: rgba(0,0,0,0.8); opacity: 1; }
    100% { background: #090a14; opacity: 1; }
}

#death-modal h1 {
    font-family: 'Press Start 2P', cursive;
    letter-spacing: 5px;
    margin-top: -50px;
}

/* Grim Underworld Atmosphere */
.underworld-mode::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 900; /* Below UI but above canvas */
    box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.7) 90%);
    mix-blend-mode: multiply;
}

.underworld-mode canvas {
    filter: sepia(30%) contrast(1.1) brightness(0.8);
}

