/* --- Base & Typography --- */
:root {
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Lato', sans-serif;
    --color-text: #4d443a;
    /* Dark, earthy brown */
    --color-heading: #3a3228;
    /* Even darker brown for headings */
    --color-background: #fdf6e3;
    /* Parchment paper */
    --color-accent: #8b4513;
    /* Saddle brown, for links/accents */
    --color-border: #d2b48c;
    /* Tan, for borders */

    --color-brute: #c0392b;
    --color-focus: #2980b9;
    --color-flow: #27ae60;
    --color-control: #f39c12;
}

/* --- General Setup --- */
body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    min-height: 100vh;
}

h1,
h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-heading);
}

.breadcrumb a {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: inline-block;
    border-bottom: 1px dotted var(--color-accent);
}

.breadcrumb a:hover {
    border-bottom-style: solid;
}

/* --- Layout --- */
.game-container {
    display: grid;
    grid-template-rows: auto auto 1fr;
    /* Header row, Game board row */
    gap: 2rem;
    width: 100%;
    max-width: 1600px;
}


.mechanic-entry {
    margin-bottom: 0.75rem;
}

.mechanic-entry ul {
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 0;
}


/* --- New Styles for Mechanics Guide Container --- */
#mechanics-guide-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 900;
}

#mechanics-panel {
    width: 320px;
    max-height: calc(100vh - 100px);
    background-color: rgba(253, 246, 227, 0.9);
    /* Parchment */
    backdrop-filter: blur(4px);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: max-height 0.3s ease-in-out;
}

#mechanics-panel .panel-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background-color: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#mechanics-panel h3,
#mechanics-panel h4 {
    margin: 0;
    color: var(--color-heading);
}

#mechanics-panel h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dotted var(--color-border);
    padding-bottom: 0.25rem;
}

#mechanics-panel .panel-content {
    padding: 0 1rem 1rem 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* When the panel is NOT active, hide its content and collapse it */
#mechanics-panel:not(.active) .panel-content {
    display: none;
}

#mechanics-panel:not(.active) {
    max-height: 50px;
    /* Adjust to fit just the header */
}

.game-header {
    /* No longer need to span columns */
    color: var(--color-heading);
}

#game-board {
    position: relative;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    aspect-ratio: 2.38;
    /* Matches the image aspect ratio */
    width: 100%;
    overflow: hidden;
    /* Ensures the ::before pseudo-element respects the border-radius */
}

#game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('./src/primevalcontinent.png');
    background-size: cover;
    background-position: center;
    /* The filter creates a pencil-sketch on old parchment effect. */
    /* filter: grayscale(1) sepia(0.7) contrast(1.5) brightness(0.9); */
    z-index: 0;
    /* Places the background behind the game elements */
}

/* --- Connections Layer --- */
#connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#connections-layer line {
    stroke: rgb(0, 153, 255);
    /* Dark brown, semi-transparent */
}

/* --- Grid & Coordinates --- */
#grid-overlay,
#coordinate-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* So it doesn't interfere with clicks. Set to 0 to be behind connections */
    z-index: 0;
    /* Below spaces and token */
}

.grid-line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.1);
}

.grid-line.vertical {
    width: 1px;
    height: 100%;
}

.grid-line.horizontal {
    width: 100%;
    height: 1px;
}

.coord-label {
    position: absolute;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
    transform: translate(-50%, -50%);
}

.coord-label.top {
    top: -20px;
}

.coord-label.left {
    left: -20px;
}

/* --- Game Board Elements --- */
.space {
    position: absolute;
    width: 3%;
    /* Using padding-top to maintain aspect ratio for a hexagon */
    padding-top: 3.46%;
    /* width * sqrt(3) / 2 * 2 -> width * 0.866 */
    height: 0;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 2;
    /* Above grid */
    background-color: rgba(255, 255, 255, 0.7);
    /* This will be the border color */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.space::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background-color: rgba(0, 0, 0, 0.5);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: -1;
}

.space:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.space:hover::before {
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
}

.space.current {
    border-color: #ffc107;
    box-shadow: 0 0 15px #ffc107;
}

.space.selectable {
    /* Use the existing rainbow animation for a flashy effect */
    animation: rainbow-pulse 2s infinite;
}

/* Space Types Styling */
.space.start {
    background-color: #393b39;
}

.space.wilderness {
    background-color: #393b39;
}

.space.crossroads {
    background-color: #007bff;
}

.space.academic-milestone {
    background-color: #dc3545;
    animation: pulse-red 2s infinite;
}


/* Biome Inner Colors */
.space.biome-tundra::before {
    background-color: rgba(168, 213, 229, 0.7);
    /* Icy Blue */
}

.space.biome-coastal::before {
    background-color: rgba(244, 232, 161, 0.7);
    /* Sandy Yellow */
}

.space.biome-plains::before {
    background-color: rgba(152, 201, 80, 0.7);
    /* Grassy Green */
}

.space.biome-desert::before {
    background-color: rgba(232, 180, 96, 0.7);
    /* Sandy Orange */
}

.space.biome-forest::before {
    background-color: rgba(74, 131, 65, 0.7);
    /* Deep Green */
}

.space.biome-mountain::before {
    background-color: rgba(138, 138, 138, 0.7);
    /* Rocky Gray */
}

.space.biome-volcanic::before {
    background-color: rgba(92, 44, 44, 0.7);
    /* Dark Red/Brown */
}

.space .space-id-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 9px;
    font-weight: bold;
    pointer-events: none;
    z-index: 3;
    /* Above the space's before element */
    text-shadow: 1px 1px 2px black;
}

/* New rule to hide space IDs for debugging */
.hide-space-ids .space-id-label {
    display: none;
}


/* Player Token */
#player-token {
    position: absolute;
    width: 50px;
    height: 50px;
    background-image: url('src/character.png');
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: top 0.4s ease-in-out, left 0.4s ease-in-out, transform 0.4s ease-in-out;
    /* Faster movement */
    z-index: 10;
    /* On top of everything */
    box-shadow: 0 0 10px white, 0 0 5px rgba(0, 0, 0, 0.5);
    animation: token-breathe 3s ease-in-out infinite;
}

#player-token.landing {
    animation: token-land-bounce 0.5s ease-out;
}

/* --- UI Panel --- */
.game-info,
.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#dice-result {
    font-size: 1.5rem;
    font-weight: bold;
}

#dice-result.rolling {
    animation: quick-roll 0.1s infinite;
}

/* --- Animations --- */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 5px #dc3545;
    }

    50% {
        box-shadow: 0 0 20px #dc3545;
    }

    100% {
        box-shadow: 0 0 5px #dc3545;
    }
}

@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 5px #ffc107;
    }

    50% {
        box-shadow: 0 0 20px #ffc107;
    }

    100% {
        box-shadow: 0 0 5px #ffc107;
    }
}

@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 8px #ffd700;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        box-shadow: 0 0 25px #ffec8b, 0 0 10px white;
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        box-shadow: 0 0 8px #ffd700;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes rainbow-pulse {

    0%,
    100% {
        background-color: #a73d00;
        /* Yellow */
        box-shadow: 0 0 15px #ffc107;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        background-color: #ff5e00;
        /* Lighter Yellow */
        box-shadow: 0 0 25px #ffdb70, 0 0 10px white;
        transform: translate(-50%, -50%) scale(1.3);
    }
}

@keyframes quick-roll {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes token-breathe {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes token-land-bounce {
    0% {
        transform: translate(-50%, -50%) scale(1.05);
    }

    30% {
        transform: translate(-50%, -80%) scale(1.25);
        /* Move up and enlarge */
    }

    60% {
        transform: translate(-50%, -50%) scale(0.95);
        /* Land and squash */
    }

    80% {
        transform: translate(-50%, -55%) scale(1.1);
        /* Small bounce back */
    }

    100% {
        transform: translate(-50%, -50%) scale(1.05);
        /* Settle */
    }
}

/* --- Tooltip --- */
#game-tooltip {
    position: fixed;
    /* Use fixed to position relative to viewport */
    background-color: rgba(26, 26, 26, 0.9);
    color: #f0f0f0;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    border: 1px solid #444;
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    pointer-events: none;
    white-space: pre-wrap;
    /* Respects newlines in the text */
    /* Prevent tooltip from interfering with mouse events */
    z-index: 100;
    /* Ensure it's on top of other elements */
    transition: opacity 0.2s ease;
}

/* --- UI Panel Theming --- */
#ui-panel {
    background-color: rgba(253, 246, 227, 0.85);
    /* Semi-transparent parchment */
    backdrop-filter: blur(4px);
    padding: 1.5rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    /* gap: 1.5rem; */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 0;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}


/* --- Floating UI Panel --- */
#floating-ui-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

#ui-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-background);
    background-color: var(--color-heading);
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease-in-out;
}

#ui-toggle-btn .move-icon {
    stroke: var(--color-background);
}

#ui-toggle-btn.grabbing {
    cursor: grabbing;
}

#ui-toggle-btn:hover {
    background-color: var(--color-accent);
    transform: translateY(-2px);
}

/* Style the panel when it's part of the floating container */
#floating-ui-container #ui-panel {

    /* Positioning and Sizing */
    position: absolute;
    bottom: 100%;
    /* Position it directly above the button */
    margin-bottom: 10px;
    width: 300px;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;

    /* Re-apply original panel styling */
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* When the container is NOT active, hide the panel */
#floating-ui-container:not(.active) #ui-panel {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
}

/* Reset button styles inside the panel that might be affected */
#floating-ui-container #roll-dice-btn {
    background-color: var(--color-accent);
    color: var(--color-background);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: bold;
    transition: background-color 0.2s;
}

#floating-ui-container #roll-dice-btn:hover {
    background-color: #6a350f;
    /* Darker saddle brown */
}

#floating-ui-container #roll-dice-btn:disabled {
    background-color: #a08c7d;
    /* Muted brown */
    cursor: not-allowed;
}

/* --- Expedition Camp Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--color-background);
    padding: 2rem 3rem;
    border-radius: 10px;
    border: 2px solid var(--color-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    color: var(--color-text);
    font-family: var(--font-body);
    max-width: 500px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin-top: 0;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-actions button {
    /* Reuse styles from roll-dice-btn */
    background-color: var(--color-accent);
    color: var(--color-background);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: bold;
    transition: background-color 0.2s, transform 0.2s;
}

.modal-actions button:hover {
    background-color: #6a350f;
    /* Darker saddle brown */
    transform: translateY(-2px);
}

.modal-actions button:disabled {
    background-color: #9e8a77;
    border-color: #9e8a77;
    cursor: not-allowed;
    transform: none;
}

/* --- New Styles for Title Match Modal --- */
#title-match-aspirants {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.aspirant-card {
    background-color: #e0d6c3;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 120px;
}

.aspirant-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    border-color: var(--color-accent);
}

.aspirant-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-heading);
    margin-bottom: 0.5rem;
}

.aspirant-card .aspirant-name {
    font-weight: bold;
    color: var(--color-heading);
}

/* --- New Styles for Crossroads Modal --- */
#crossroads-rival-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
    background-color: #e0d6c3;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

#crossroads-rival-display img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-heading);
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#crossroads-rival-display .rival-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-heading);
}

/* --- New Styles for Game Actions Bar --- */
.game-actions-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-actions-bar {
    display: flex;
    align-items: center;
    width: max-content;
    justify-content: center;
    gap: 1.5rem;
    padding: 10px;
    background-color: rgba(253, 246, 227, 0.8);
    /* Slightly transparent paper color */
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.game-actions-bar .game-info {
    display: flex;
    gap: 1rem;
    font-weight: bold;
    color: var(--color-heading);
}

/* --- Notification System --- */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    align-items: center;
}

.notification {
    padding: 12px 20px;
    border-radius: 6px;
    color: White;
    background-color: var(--color-accent);
    color: white;
    font-family: var(--font-body);
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.2);
    min-width: 250px;
    text-align: center;
    animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-in 3.5s forwards;
}

/* Notification Types */
.notification.info {
    background-color: var(--color-focus);
}

.notification.reward {
    background-color: var(--color-accent);
}

.notification.error {
    background-color: var(--color-brute);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

#roll-dice-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--color-accent);
    background-color: var(--color-accent);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
}

#roll-dice-btn:hover {
    background-color: #a55d2a;
    transform: translateY(-2px);
}

#roll-dice-btn:active,
.debug-btn:active {
    transform: translateY(0px) scale(0.95);
}

#roll-dice-btn:disabled {
    background-color: #9e8a77;
    border-color: #9e8a77;
    cursor: not-allowed;
}

.debug-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
    background-color: transparent;
    color: var(--color-accent);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.debug-btn:hover {
    background-color: rgba(139, 69, 19, 0.1);
    /* Faint saddle brown */
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.dice-display {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-heading);
}

.status-item #discipline-display {
    display: flex;
    justify-content: center;
}

.status-item #discipline-name {
    padding: 5px 15px;
    font-size: 1rem;
    text-transform: capitalize;
    width: fit-content;
}

/* --- New Styles for Debug Tools --- */
.debug-tool {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

/* --- Renamed Floating UI Container --- */
#status-menu-container {
    position: fixed;
    bottom: 20px;
    /* Default position */
    left: 20px;
    /* Default position */
    z-index: 1000;
    /* background-color: var(--color-panel-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px); */
    transition: transform 0.3s ease-in-out;
}

/* New class to apply during drag to prevent visual artifacts */
#status-menu-container.dragging {
    background-color: transparent;
    backdrop-filter: none;
    /* box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); */
    /* Enhance shadow while dragging */
    transition: none;
    /* Disable transition during drag for smoother movement */
}

/* --- New Styles for Status Menu Panel --- */
#status-menu-container #ui-panel {
    padding: 15px;
    min-width: 280px;
    /* Add transition for smooth toggle */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    position: absolute;
    bottom: calc(100% + 10px);
}

.character-header {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
}

.character-portrait {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    object-fit: cover;
}

#status-menu-container h3 {
    margin: 0;
    font-size: 1.2rem;
}

/* When the container is NOT active, hide the panel */
#status-menu-container:not(.active) #ui-panel {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
}

.status-item {
    margin-bottom: 15px;
}

.status-item label {
    display: block;
    font-weight: bold;
    color: var(--color-heading);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.pmagic-bar-container {
    position: relative;
    width: 100%;
    height: 24px;
    background-color: #e0d6c3;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

#pmagic-bar {
    height: 100%;
    background: linear-gradient(to right, #28a745, #aaffc3);
    /* Green gradient for health */
    border-radius: 3px;
    transition: width 0.5s ease-in-out;
}

#pmagic-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-heading);
    font-weight: bold;
    font-size: 0.85rem;
    text-shadow: 0 0 3px white;
}

.affinity-bar-container {
    position: relative;
    width: 100%;
    height: 24px;
    background-color: #e0d6c3;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

#affinity-bar {
    height: 100%;
    background: linear-gradient(to right, #e91e63, #ff98b9);
    /* Pink gradient for affinity */
    border-radius: 3px;
    transition: width 0.5s ease-in-out;
}

#affinity-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-heading);
    font-weight: bold;
    font-size: 0.85rem;
    text-shadow: 0 0 3px white;
}

.bar-increments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    /* So they don't interfere with anything */
    padding: 0 10%;
    /* Don't draw lines at the very start or end */
    box-sizing: border-box;
}

.increment-line {
    width: 1px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    /* A subtle dark line */
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.1);
    /* A subtle highlight for depth */
}


#technique-counts {
    display: flex;
    gap: 8px;
    justify-content: space-around;
}

.tech-count {
    padding: 5px 10px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.tech-count.brute {
    background-color: var(--color-brute);
}

.tech-count.focus {
    background-color: var(--color-focus);
}

.tech-count.flow {
    background-color: var(--color-flow);
}

.tech-count.control {
    background-color: var(--color-control);
}

/* New styles for technique text colors */
.text-brute {
    color: var(--color-brute);
    font-weight: bold;
    text-transform: capitalize;
}

.text-focus {
    color: var(--color-focus);
    font-weight: bold;
    text-transform: capitalize;
}

.text-flow {
    color: var(--color-flow);
    font-weight: bold;
    text-transform: capitalize;
}

.text-control {
    color: var(--color-control);
    font-weight: bold;
    text-transform: capitalize;
}


/* --- New Styles for Inventory --- */
#inventory-display {
    display: flex;
    gap: 1rem;
    padding: 8px 12px;
    background-color: #e0d6c3;
    /* A neutral color from the palette */
    border-radius: 5px;
    border: 1px solid var(--color-border);
    justify-content: center;
}

#inventory-display span {
    font-weight: bold;
    color: var(--color-heading);
}

/* --- New Animation for UI Updates --- */
.highlight-update {
    animation: highlight-update-animation 0.8s ease-out;
}

@keyframes highlight-update-animation {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    30% {
        transform: scale(1.15);
        filter: brightness(1.5);
        box-shadow: 0 0 15px gold;
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}