
/* Cairo font-face */
@font-face {
    font-family: 'Cairo';
    src: url('../Cairo-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
/* page base */
body {
    background: #1a1a1a; /* deep gray */
    color: #ffffff;      /* white fonts */
    font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 16px;
}

/* center main and make things readable */
main {
    margin: 0;
    width: 100%;
    position: relative;
    z-index: 101;
}

/* layout for multiple grids side-by-side */
.grids { display:flex; gap:28px; align-items:flex-start; justify-content:flex-start; }
.digging-grid-container {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px) saturate(120%);
    position: relative;
    z-index: 101;
}
.grids #side-grids { display:flex; flex-direction:column; margin:-12px; flex: 0 0 auto; }

/* Functions grid (1x5) above main digging grid */
.functions-grid {
    border-collapse: collapse;
    display: block;
    width: fit-content;
    background-color: #333333;
    margin-bottom: 8px;
}

.functions-grid .depth-cell {
    width: 50px;
    min-width: 50px;
    border: none;
}

.functions-grid .cell {
    width: 50px;
    max-width: 50px;
    height: 50px;
    border: 1px solid rgba(0,0,0,0.5);
    background: rgba(255,255,255,0.02);
    color: #fff;
    font-size: 12px;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

/* Dwarf and marker styling for functions grid */
.functions-grid .cell.has-dwarf::before {
    content: '👷';
    font-size: 20px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0.75;
    pointer-events: none;
}

.functions-grid .cell > * {
    position: relative;
    z-index: 1;
}

.functions-grid .cell .drop-off-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    font-size: 18px;
    opacity: 0.95;
}

/* Functions container with grid + links side by side */
.functions-container {
    display: flex;
    gap: 1px;
    align-items: flex-start;
    justify-content: center;
    height: 70px;
}

/* Functions list with clickable links (7 per row grid layout) */
.functions-list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 0px;
    flex: 0 0 auto;
    border-radius: 6px;
}

.functions-list a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    aspect-ratio: 1 / 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #dbeafe;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    margin-bottom: 4px;
    position: relative; /* Allow absolute positioning of progress bars */
    overflow: hidden; /* Contain progress/temperature bars within button */
}

.functions-list a:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.functions-list a:active {
    transform: translateY(0px);
}

.functions-list a .icon {
    font-size: 16px;
    min-width: 16px;
}

/* digging grid */
#digging-grid {
    border-collapse: collapse;
    display: block;
    width: fit-content;
    background-color: #333333;
}

/* each grid cell is a bigger square now */
#digging-grid .cell {
    width: 50px;
    height: 50px;
    padding: 0;
    box-sizing: border-box;
    background: #fff;    /* brownish */
    border: 1px solid #000000; /* darker outline so cells are visible */
    color: #fff;            /* show hardness numbers in white */
    text-align: center;
    font-size: 10px;
    line-height: 50px;      /* vertically center the number */
    position: relative;     /* allow pseudo-element background markers */
}

/* marker used to show a dwarf in a cell */
/* kept for compatibility (no longer required) */
#digging-grid .dwarf-marker {
    display: inline-block;
    font-size: 26px; /* kept for legacy rendering */
    line-height: 1;
    vertical-align: middle;
    margin-left: 6px;
}

/* show a faint, larger emoji in the background when a dwarf occupies the cell */
#digging-grid .cell.has-dwarf::before {
    content: '🧎';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;        /* larger, background-style */
    opacity: 0.8;          /* visible */
    pointer-events: none;   /* doesn't interfere with interactions */
    z-index: 1;             /* behind text content but above moving markers */
}

/* hide the default dwarf marker when digging (⛏️ marker is shown instead) */
#digging-grid .cell.has-dwarf.is-digging::before {
    opacity: 0;
}

/* ensure cell content sits above the background marker */
#digging-grid .cell > * {
    position: relative;
    z-index: 3;
}

#digging-grid .cell.crit-hit::after {
    content: '❗';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 219, 36, 0.2) 0%, rgba(255, 86, 86, 0.865) 50%, transparent 70%);
    opacity: 0;
    animation: critHitFlash 0.3s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 2;
}

/* One-hit animation - stronger gold/orange effect */
#digging-grid .cell.one-hit::after {
    content: '💥';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
      background: radial-gradient(circle, rgba(255, 186, 36, 0.6) 0%, rgba(255, 86, 86, 0.8) 50%, transparent 70%);
    opacity: 0;
    animation: oneHitFlash 0.3s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 10;
}

@keyframes oneHitFlash {
    0% { opacity: 0; transform: scale(0.2); }
    20% { opacity: 0.4; transform: scale(0.4); }
    40% { opacity: 0.6; transform: scale(0.6); }
    60% { opacity: 0.8; transform: scale(0.8); }
    80% { opacity: 0.8; transform: scale(1.0); }
    99% { opacity: 0.8; transform: scale(1.2); }
    100% { opacity: 0.0; transform: scale(1.2); }
}

@keyframes critHitFlash {
    0% { opacity: 0; transform: scale(0.2); }
    20% { opacity: 0.4; transform: scale(0.4); }
    40% { opacity: 0.6; transform: scale(0.6); }
    60% { opacity: 0.8; transform: scale(0.8); }
    80% { opacity: 0.8; transform: scale(1.0); }
    99% { opacity: 0.8; transform: scale(1.2); }
    100% { opacity: 0.0; transform: scale(1.2); }
}

/* Nuclear explosion animation - green radioactive blast */
#digging-grid .cell.nuclear-explosion::after {
    content: '☢️';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 150px;
    background: radial-gradient(circle, rgba(53, 250, 0, 0.8) 0%, rgba(20, 200, 0, 0.6) 40%, transparent 80%);
    opacity: 0.6;
    animation: nuclearExplosion 0.3s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 15;
    filter: drop-shadow(0 0 10px rgba(53, 250, 0, 0.8));
}

/* Nuclear radiation effect for weakened cells */
#digging-grid .cell.nuclear-radiation-weakened::after {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgb(54, 250, 0) 0%, rgba(20, 200, 0, 0.861) 50%, transparent 70%);
    opacity: 0.6;
    animation: radiationPulse 0.3s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 2;
}

/* Nuclear radiation effect for damaged cells (outer ring) */
#digging-grid .cell.nuclear-radiation-damaged::after {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(53, 250, 0, 0.2) 0%, rgba(20, 200, 0, 0.15) 50%, transparent 70%);
    opacity: 0.6;
    animation: radiationPulse 0.3s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 2;
}

@keyframes nuclearExplosion {
    0% {
        opacity: 0;
        transform: scale(0.3);
        filter: drop-shadow(0 0 10px rgba(53, 250, 0, 0.8));
    }
    20% {
        opacity: 1;
        transform: scale(0.7);
        filter: drop-shadow(0 0 20px rgba(53, 250, 0, 1));
    }
    50% {
        opacity: 0.9;
        transform: scale(1.2);
        filter: drop-shadow(0 0 30px rgba(53, 250, 0, 0.8));
    }
    100% {
        opacity: 0;
        transform: scale(2.0);
        filter: drop-shadow(0 0 5px rgba(53, 250, 0, 0.2));
    }
}

@keyframes radiationPulse {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Randomium transmutation animation - rotating dice with magenta glow */
#digging-grid .cell.randomium-transmute::after {
    content: '🎲';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    background: radial-gradient(circle, rgba(255, 0, 255, 0.6) 0%, rgba(200, 0, 200, 0.4) 40%, transparent 80%);
    opacity: 0.9;
    animation: randomiumSpin 0.8s ease-out forwards;
    animation-iteration-count: 1;
    pointer-events: none;
    z-index: 15;
    filter: drop-shadow(0 0 15px rgba(255, 0, 255, 0.9));
}

@keyframes randomiumSpin {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
        filter: drop-shadow(0 0 5px rgba(255, 0, 255, 0.5));
    }
    20% {
        opacity: 1;
        transform: scale(0.8) rotate(180deg);
        filter: drop-shadow(0 0 20px rgba(255, 0, 255, 1));
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(-90deg);
        filter: drop-shadow(0 0 30px rgba(255, 0, 255, 0.9));
    }
    80% {
        opacity: 0.8;
        transform: scale(1.0) rotate(135deg);
        filter: drop-shadow(0 0 15px rgba(255, 0, 255, 0.6));
    }
    100% {
        opacity: 0;
        transform: scale(1.5) rotate(-45deg);
        filter: drop-shadow(0 0 5px rgba(255, 0, 255, 0.2));
    }
}

/* Gem spawn - no animation */
#digging-grid .cell.gem-spawn::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}


/* running/moving marker - intentionally lower z-index so it does not block a digging dwarf's marker */
#digging-grid .cell .moving-marker {
    position: absolute;
    left: 48%;
    top: 62%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    line-height: 1;
    z-index: 0; /* lower than the digger background (z-index:1) */
    opacity: 0.95;
    pointer-events: none;
}

/* striking marker for main digging grid */
#digging-grid .cell .striking-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    line-height: 1;
    z-index: 5;
    opacity: 0.95;
    pointer-events: none;
    animation: strikeShake 0.5s ease-in-out infinite;
}

/* gem marker for gems on grid cells */
#digging-grid .cell .gem-marker {
    content: '💎';
    position: absolute;
    width: 35px;
    height: 35px;
    background: #cd5454;
    transform: rotate(45deg); /* square turned into a diamond */
    display: block;
    z-index: 1;
}


/* digging animation styles */
#digging-grid .cell.is-digging {
    animation: digGlow 1s linear infinite;
}

#digging-grid .digging-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    z-index: 2; /* in front of digging background */
    pointer-events: none;
}


/* small shovel impact animation */
@keyframes shovelStrike {
    30% { transform: translate(-50%,-60%) rotate3d(1, 2, 3, 30deg); }
    40% { transform: translate(-50%,-40%) rotate3d(1, 2, 3, 10deg); }
    100% { transform: translate(-50%,-50%) rotate3d(1, 2, 3, 0deg); }
}

#digging-grid .digging-marker.strike { 
    animation: shovelStrike 0.9s ease-in-out infinite; 
}

/* style for the depth label (first column) */
#digging-grid .depth-cell {
    width: 50px;
    min-width: 50px;
    background: transparent;
    color: #ddd;
    text-align: center;
    font-size:12px;
    font-weight:600;
    padding: 0 2px;
    border: 1px solid #000000;
    vertical-align: middle;
}

/* ensure text (if any) is white and small */
#digging-grid .cell,
#controls,
header, footer {
    color: #ffffff;
}

/* dig button style that matches the theme */
#dig-button {
    background: #3a3a3a;
    color: #fff;
    border: 1px solid #555;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
}

/* small responsive tweak so grid isn't squeezed */
@media (max-width: 420px) {
    main { padding: 8px; }
}

/* center the controls below the grid */
#controls {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

/* top bar (site header with controls) */
.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    margin-bottom: 16px;
    width: calc(532px + 28px + 450px + 162px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px) saturate(120%);
    position: sticky;
    top: 0;
    z-index: 0;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.brand-logo {
    width: 100px;
    height: 100px;
    padding-left: 12px;
    padding-right: 12px;
}

.brand-text {
    display: flex;
    gap: 0px;
}

.topbar .brand h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.6px;
}

.topbar .brand .subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.7;
    font-weight: 400;
}

.topbar-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.topbar-controls > div {
    display: flex;
    gap: 8px;
}

.gold-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(218, 165, 32, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    color: #ffd700;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
    height: 38px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gold-display:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(218, 165, 32, 0.15));
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-1px);
}

.gold-display .gold-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.4));
}

.gold-display .gold-amount {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* stock status pills in header */
.stock-status { display:flex; align-items:center; gap:8px; margin-left: 12px; }
.stock-pill { display:flex; gap:6px; align-items:center; padding:6px 8px; border-radius:8px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.03); font-size:12px; color:#dbeafe }
.stock-pill .stock-label { opacity:0.85; font-weight:600 }
.stock-pill .stock-count { background: rgba(255,255,255,0.06); padding:2px 6px; border-radius:6px; font-weight:700; color:#fff }

.cell-tooltip .tooltip-dwarfs {
    margin-top: 6px;
    font-size: 12px;
    color: #cfd8ff;
    word-break: break-word;
    display: none;
}
/* drop-off marker styling */
.cell .drop-off-marker { position: absolute; right: 4px; top: 4px; font-size: 15px; opacity: 0.95; z-index: 4 }

/* warehouse icon for the drop-off */
.drop-off-marker.warehouse { font-size: 18px; transform: translateY(-1px); }

/* house / bed marker */
.drop-off-marker.house { font-size: 18px; transform: translateY(-1px); }

/* workbench marker */
.drop-off-marker.workbench { font-size: 18px; transform: translateY(-1px); }

.drop-grid-panel {
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(2, 2, 2, 0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px) saturate(120%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 150px;
}

.materials-panel {
    margin-top: 12px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px) saturate(120%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 550px;
}

/* Only the materials panel (not functions panel) should have fixed height */
#materials-panel {
    height: 435px;
}

.materials-panel--highlight {
    box-shadow: 0 0 0 2px rgba(59,130,246,0.8), 0 10px 30px rgba(0,0,0,0.6);
}
.materials-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    flex-wrap: wrap;
}

.tab-buttons {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-bottom: 6px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #9fbfe0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: #dbeafe;
}

.tab-btn.active {
    background: rgba(100,181,246,0.2);
    border-color: rgba(100,181,246,0.4);
    color: #fff;
    font-weight: 600;
}

.materials-panel h3 {
    margin: 0;
    font-size: 16px;
}
.materials-panel-subtitle {
    font-size: 12px;
    color: #dbeafe;
    letter-spacing: 0.4px;
}

.btn-sell-all-global {
    background: linear-gradient(180deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    margin-left: 12px;
}
.btn-sell-all-global:hover {
    background: linear-gradient(180deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-gems {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 204, 255, 0.3);
}
.btn-gems:hover {
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
    box-shadow: 0 4px 12px rgba(102, 204, 255, 0.4);
    transform: translateY(-1px);
}

.resting-marker { position: absolute; right: 2px; top: 2px; font-size: 14px; z-index: 5; pointer-events: none; }

.striking-marker { 
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    line-height: 1;
    z-index: 4;
    opacity: 0.95;
    pointer-events: none;
    animation: strikeShake 0.5s ease-in-out infinite;
}

@keyframes strikeShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(-5deg); }
    50% { transform: translate(-50%, -50%) rotate(5deg); }
}

/* unloading (one-tick) animation */
.unloading-marker { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 18px; z-index: 5; pointer-events: none; }
.unloading-marker .crate { display: inline-block; animation: unloadGrow 240ms ease-in-out forwards; transform-origin:center; }
@keyframes unloadGrow {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 1; }
}

/* dwarf status panel in the topbar */
/* dwarf-status cards removed from main view — visible only in the Dwarfs modal now */

/* settings button shares similar visual style but is squared and smaller */
#settings-button, #pause-button, #about-button {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1px;
    padding-left:4px;
    padding-bottom:4px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 18px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex: 1;
}

#settings-button:hover, #pause-button:hover, #about-button:hover, #dig-button:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

/* Paused state for pause button */
#pause-button.paused {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.6);
    animation: pulse-red 1.5s ease-in-out infinite;
}

#pause-button.paused:hover {
    background: rgba(220, 53, 69, 0.4);
    border-color: rgba(220, 53, 69, 0.8);
}

/* Pulsing animation for paused state */
@keyframes pulse-red {
    0%, 100% {
        background: rgba(220, 53, 69, 0.3);
        border-color: rgba(220, 53, 69, 0.6);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        background: rgba(220, 53, 69, 0.5);
        border-color: rgba(220, 53, 69, 0.9);
        box-shadow: 0 0 8px 2px rgba(220, 53, 69, 0.6);
    }
}

/* modal overlay & dialog (glass effect) */
.modal {
    display: none; /* shown by JS */
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal[aria-hidden="false"] { display: flex; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.modal-dialog {
    position: relative;
    width: clamp(280px, 60vw, 720px);
    max-width: 95%;
    border-radius: 12px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(8px) saturate(120%);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    z-index: 2010;
}

.cell-tooltip {
    position: fixed;
    pointer-events: none;
    display: none;
    z-index: 2500;
    padding: 10px 14px;
    min-width: 180px;
    max-width: 260px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px) saturate(120%);
    color: #fff;
    transition: opacity 0.15s ease, transform 0.15s ease;
    opacity: 0;
}
.cell-tooltip.visible {
    display: block;
    opacity: 0.95;
}
.cell-tooltip .tooltip-title {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}
.cell-tooltip .tooltip-hardness {
    margin-top: 6px;
    font-size: 12px;
    color: #dbeafe;
}

.modal-header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.modal-header h2 { margin:0; font-size:20px; }
.modal-close { background:transparent; border:none; color: #fff; font-size:20px; cursor:pointer; }
.modal-body { margin-top: 12px; color: #eaeaea; max-height: 70vh; overflow-y: auto; padding-right: 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.3) transparent; }
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
.modal-footer { display:flex; justify-content:flex-end; gap:8px; margin-top: 16px; }

.btn-primary { background: linear-gradient(180deg,#3b82f6,#2563eb); color: #fff; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.btn-secondary { background: transparent; border: 1px solid rgba(255,255,255,0.08); color: #fff; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.btn-danger { background: linear-gradient(180deg,#ef4444,#dc2626); color: #fff; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.btn-danger:hover { background: linear-gradient(180deg,#dc2626,#b91c1c); }
.btn-cheat { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; border: 2px solid gold; padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: bold; text-shadow: 0 1px 2px rgba(255,255,255,0.5); box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4); transition: all 0.2s; }
.btn-cheat:hover { background: linear-gradient(135deg, #f59e0b, #d97706); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(251, 191, 36, 0.6); }

/* small screen: dialogs slightly smaller */
@media (max-width: 420px) {
    .modal-dialog { width: 92%; padding: 14px; }
}

/* dwarfs list table inside the dwarfs modal */
.dwarfs-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.dwarfs-table th, .dwarfs-table td { padding: 8px 10px; text-align: left; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.dwarfs-table thead th { font-weight: 700; font-size: 13px; color: #dbeafe; }
.dwarfs-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.dwarfs-table tbody tr:hover { background: rgba(255,255,255,0.08); cursor: pointer; }
.dwarfs-table td { color: #e6eefc; }
.dwarfs-table .bucket-line { font-size: 12px; padding: 2px 0; color: #cfe7ff }
.dwarfs-table .bucket-line.empty { opacity: 0.6; color: #9fbfe0 }

/* Warehouse modal stock list */
.warehouse-stock-list { 
    display: flex; 
    flex-direction: column; 
    gap: 0;
}

.warehouse-table-container {
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    backdrop-filter: blur(10px) saturate(120%);
    max-height: 468px;
    width:540px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.warehouse-table-container::-webkit-scrollbar {
    width: 8px;
}

.warehouse-table-container::-webkit-scrollbar-track {
    background: transparent;
}

.warehouse-table-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.warehouse-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.warehouse-table-header {
    display: grid;
    grid-template-columns: 2fr 80px 0.8fr 0.8fr 1fr 1.8fr;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-bottom: none;
    font-weight: 700;
    font-size: 11px;
    color: #bfdbfe;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

.warehouse-table-header span {
    color: #bfdbfe !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    font-family: inherit !important;
}

.warehouse-row {
    display: grid;
    grid-template-columns: 2fr 80px 0.8fr 0.8fr 1fr 1.8fr;
    gap: 8px;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-top: none;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 6px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 6px;
}

.warehouse-row:last-child {
    border-radius: 0 0 6px 6px;
}
.warehouse-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--material-color, #888);
    opacity: 0.3;
    z-index: 0;
}
.warehouse-row > * {
    position: relative;
    z-index: 1;
}

.warehouse-row:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
    cursor: pointer;
    transform: translateX(2px);
    transition: all 0.2s ease;
}

.wh-col-name { 
    font-weight: 700; 
    color: #e6eefc; 
    font-size: 13px; 
}

.wh-col-price { 
    font-size: 12px; 
    color: #ffd700; 
    text-align: right;
}

.wh-col-count { 
    font-weight: 700; 
    color: #fff; 
    font-size: 12px;
    text-align: right;
}

.wh-col-total {
    font-size: 12px; 
    color: #ffd700; 
    font-weight: 600;
    text-align: right;
}

.wh-col-icons {
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
    display: inline-flex;
    gap: 2px;
    justify-content: flex-start;
}

.wh-col-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    padding: 0 4px;
}
.btn-sell, .btn-sell-all {
    background: linear-gradient(180deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}
.btn-sell:hover, .btn-sell-all:hover {
    background: linear-gradient(180deg, #059669, #047857);
}

/* Dwarf panel rows (when shown in materials panel) */
#materials-list {
    max-height: 468px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

#materials-list::-webkit-scrollbar {
    width: 8px;
}

#materials-list::-webkit-scrollbar-track {
    background: transparent;
}

#materials-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

#materials-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

#materials-list[data-view="dwarfs"] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-content: start;
}

.dwarf-row { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    padding: 8px 10px; 
    background: rgba(255,255,255,0.02); 
    border-radius: 6px; 
    border: 1px solid rgba(255,255,255,0.02); 
}

.dwarf-row.can-level-up {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
}

.dwarf-row.dwarf-clickable {
    cursor: pointer;
}

.dwarf-row.dwarf-clickable:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.dwarf-row.can-level-up.dwarf-clickable:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.35);
}

.dwarf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.dwarf-name { 
    font-weight: 700; 
    color: #e6eefc; 
    font-size: 14px; 
    flex: 1;
}

.dwarf-info { 
    font-size: 14px; 
    color: #9fbfe0; 
    line-height: 1.2;
}

.btn-levelup-small {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Tool cards in panel */
.tool-card-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.tool-card-panel:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    cursor: pointer;
    transform: translateX(2px);
}

.tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-card-header .tool-name {
    font-weight: 600;
    color: #e6eefc;
    font-size: 13px;
}

.tool-card-header .tool-power {
    font-weight: 700;
    color: #ffd700;
    font-size: 13px;
}

.tool-card-details {
    font-size: 11px;
}

.tool-card-details .tool-assigned {
    color: #10b981;
}

.tool-card-details .tool-unassigned {
    color: #9fbfe0;
}

.tool-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.assign-select-small {
    flex: 1;
    min-width: 80px;
    padding: 4px 6px;
    font-size: 11px;
    background: #2a3a4a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #dbeafe;
}

.assign-select-small option {
    background: #2a3a4a;
    color: #dbeafe;
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 4px;
}

.btn-primary.btn-tiny {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
}

.btn-secondary.btn-tiny {
    background: linear-gradient(180deg, #6b7280, #4b5563);
    color: #fff;
    border: none;
    cursor: pointer;
}

.btn-danger.btn-tiny {
    background: linear-gradient(180deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    cursor: pointer;
}

.btn-danger.btn-tiny:disabled,
.btn-sell.btn-tiny:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.empty-message {
    text-align: center;
    color: #9fbfe0;
    padding: 20px;
    font-size: 13px;
}

.empty-message p {
    margin: 5px 0;
}

/* Workbench table styles */
.workbench-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.workbench-table th,
.workbench-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.workbench-table th {
    background: rgba(255,255,255,0.03);
    font-weight: 700;
    color: #dbeafe;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.workbench-table td {
    color: #e6eefc;
    font-size: 14px;
}

.workbench-table .tool-name {
    font-weight: 600;
}

.workbench-table .tool-count,
.workbench-table .tool-level {
    text-align: center;
    font-weight: 700;
}

.workbench-table .tool-power {
    text-align: center;
    color: #fbbf24;
    font-weight: 600;
}

.btn-upgrade {
    background: linear-gradient(180deg, #8b5cf6, #7c3aed);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.btn-upgrade:hover:not(.disabled) {
    background: linear-gradient(180deg, #7c3aed, #6d28d9);
}

.btn-upgrade.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Level up modal */
.levelup-options {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.levelup-option {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    border: 2px solid #444;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    text-align: center;
}

.levelup-option h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.levelup-option p {
    margin: 5px 0;
}

.levelup-stats {
    font-weight: bold;
    color: #4CAF50;
    margin-top: 10px;
}

.btn-levelup {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-weight: bold;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-levelup:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

/* Research modal styles */
.active-research {
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid #4CAF50;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
}

.active-research h3 {
    margin: 0 0 6px 0;
    color: #4CAF50;
    font-size: 15px;
}

.active-research p {
    margin: 4px 0;
    font-size: 13px;
}

.active-research p small {
    font-size: 11px;
}

.progress-bar {
    width: 100%;
    height: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
    transition: width 0.3s ease;
}

.research-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.research-table th,
.research-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.research-table th:nth-child(2),
.research-table td:nth-child(2) {
    width: 120px;
}

.research-table th:nth-child(3),
.research-table td:nth-child(3) {
    width: 100px;
}

.research-table th:nth-child(4),
.research-table td:nth-child(4) {
    width: 140px;
}

.research-table th {
    background: rgba(255,255,255,0.05);
    font-weight: 600;
}

.research-table td small {
    color: #9fbfe0;
    font-size: 12px;
}

.btn-research {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-research:hover:not(.disabled):not(:disabled) {
    background: linear-gradient(135deg, #1976D2 0%, #2196F3 100%);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.btn-research.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    cursor: not-allowed;
}

.btn-research.disabled,
.btn-research:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Research queue styles */
.research-queue {
    background: rgba(42, 42, 62, 0.5);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid rgba(68, 68, 68, 0.5);
}

.research-queue h3 {
    margin-top: 0;
    color: #ffa500;
}

.research-queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.research-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 30, 46, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid rgba(85, 85, 85, 0.5);
}

.research-queue-item-info {
    flex: 1;
}

.research-queue-item-gold {
    color: #888;
    font-size: 11px;
    margin-left: 8px;
}

.research-queue-slots {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 11px;
    color: #888;
}

/* Research active section styles */
.active-research-name {
    font-size: 1.2em;
    color: #ffd700;
}

.active-research-progress-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.active-research-progress-row .progress-bar {
    flex: 1;
    margin-top: 0;
}

/* Research cancel/remove buttons */
.btn-cancel-research,
.btn-remove-from-queue {
    padding: 6px 10px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-cancel-research:hover,
.btn-remove-from-queue:hover {
    background: #ff5252;
}

/* Research warning styles */
.research-warning {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
}

/* Research name cell styles */
.research-name-cell {
    line-height: 1.3;
}

/* Completed research section */
.completed-research-section h3 {
    color: #4CAF50;
    margin: 20px 0 10px 0;
}

.research-table.completed tr {
    opacity: 0.7;
}

.research-status-maxed {
    color: #4CAF50;
    font-weight: bold;
}

/* Notification badge pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* ========== Smelter Task List Styles ========== */
.smelter-description {
    color: #9fbfe0;
    margin-bottom: 12px;
    font-size: 13px;
}

.smelter-task-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smelter-task-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.smelter-task-row:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
    border-color: rgba(255,255,255,0.15);
}

.smelter-task-priority {
    font-weight: 700;
    font-size: 14px;
    color: #ffa726;
    min-width: 24px;
    text-align: center;
}

.smelter-task-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.smelter-task-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
}

.smelter-task-desc {
    font-size: 12px;
    color: #9fbfe0;
    display: none; /* Hidden in compact mode */
}

.smelter-task-recipe {
    font-size: 10px;
    color: #81d4fa;
    padding: 3px 6px;
    background: rgba(129, 212, 250, 0.1);
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap;
}

.smelter-task-buttons {
    display: flex;
    flex-direction: row;
    gap: 3px;
    align-items: center;
}

.smelter-btn-info {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(33, 150, 243, 0.1));
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.smelter-btn-info:hover {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

.smelter-btn-move {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.smelter-btn-move:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffa726, #ff9800);
    border-color: #ffa726;
    box-shadow: 0 2px 8px rgba(255, 167, 38, 0.3);
}

.smelter-btn-move:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Smelter task status indicator */
.smelter-task-status {
    font-size: 14px;
    min-width: 20px;
    text-align: center;
}

/* Actionable task row styling */
.smelter-task-actionable {
    border-color: rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
}

.smelter-task-actionable:hover {
    border-color: rgba(76, 175, 80, 0.5);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.08));
}

/* Blocked task row styling (not enough materials) */
.smelter-task-blocked {
    border-color: rgba(158, 158, 158, 0.2);
    background: linear-gradient(135deg, rgba(158, 158, 158, 0.08), rgba(158, 158, 158, 0.03));
    opacity: 0.75;
}

.smelter-task-blocked:hover {
    opacity: 0.9;
    border-color: rgba(158, 158, 158, 0.3);
}

.smelter-task-blocked .smelter-task-name {
    color: #bdbdbd;
}

/* Temperature-related task row styling */
.smelter-task-temp-ok {
    border-color: rgba(255, 193, 7, 0.3);
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), rgba(255, 193, 7, 0.03));
    opacity: 0.85;
}

.smelter-task-temp-ok:hover {
    opacity: 1;
    border-color: rgba(255, 193, 7, 0.4);
}

.smelter-task-temp-ok .smelter-task-name {
    color: #dbbe60;
}

.smelter-task-temp-low {
    border-color: rgba(255, 193, 7, 0.3);
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), rgba(255, 193, 7, 0.03));
    opacity: 0.85;
}

.smelter-task-temp-low:hover {
    opacity: 1;
    border-color: rgba(255, 193, 7, 0.4);
}

.smelter-task-temp-low .smelter-task-name {
    color: #ffd54f;
}

/* Recipe status colors */
.smelter-task-recipe.recipe-ready {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.smelter-task-recipe.recipe-blocked {
    background: rgba(244, 67, 54, 0.1);
    color: #e57373;
}

.smelter-task-recipe.recipe-locked {
    background: rgba(158, 158, 158, 0.1);
    color: #9e9e9e;
}

/* Locked task row styling (not researched) */
.smelter-task-locked {
    border-color: rgba(244, 67, 54, 0.3);
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.08), rgba(244, 67, 54, 0.03));
    opacity: 0.7;
}

.smelter-task-locked:hover {
    opacity: 0.85;
    border-color: rgba(244, 67, 54, 0.4);
}

.smelter-task-locked .smelter-task-name {
    color: #ef5350;
}

/* Unreachable task row styling (below "do-nothing") */
.smelter-task-unreachable {
    border-color: rgba(255, 69, 0, 0.3);
    background: linear-gradient(135deg, rgba(255, 69, 0, 0.1), rgba(139, 0, 0, 0.05));
    opacity: 0.6;
}

.smelter-task-unreachable:hover {
    opacity: 0.75;
    border-color: rgba(255, 69, 0, 0.4);
}

.smelter-task-unreachable .smelter-task-name {
    color: #ff6b6b;
    text-decoration: line-through;
}

.smelter-task-unreachable .smelter-task-desc,
.smelter-task-unreachable .smelter-task-recipe {
    opacity: 0.5;
}

.smelter-task-locked .smelter-task-desc {
    color: #666;
}

/* Notification badge on grid cells (used for house, research, smelter, etc.) */
.grid-badge {
    position: absolute;
    top: -22px;
    right: -40px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 0px solid white;
    box-shadow: 0 1px 3px #1a1a1a;
    padding: 1px;
    background: #484848;
    color: #e2e2e2;
}

/* Smelter Drag and Drop Styles */
.smelter-task-row {
    cursor: grab;
    transition: all 0.2s ease;
}

.smelter-task-row:active {
    cursor: grabbing;
}

.smelter-task-dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.smelter-drop-above {
    border-top: 3px solid #ffa726;
    margin-top: -2px;
}

.smelter-drop-below {
    border-bottom: 3px solid #ffa726;
    margin-bottom: -2px;
}

/* Smelter Temperature Control Panel */
.smelter-temp-control-panel {
    margin-bottom: 16px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.08), rgba(255, 87, 34, 0.04));
    border: 1px solid rgba(255, 152, 0, 0.25);
    border-radius: 8px;
}

.smelter-temp-control-header {
    font-size: 14px;
    font-weight: 600;
    color: #ffa726;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.smelter-temp-control-icon {
    font-size: 16px;
}

.smelter-temp-bar-container {
    width: 100%;
    height: 16px;
    background: #0a1a2a;
    border: 1px solid #3a4a5a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.smelter-temp-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #4488ff, #ff8800, #ff4444);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.smelter-temp-current-display {
    font-size: 12px;
    color: #e0e0e0;
    margin-bottom: 12px;
    text-align: center;
}

.smelter-temp-subsection {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.smelter-temp-subsection-title {
    font-size: 12px;
    font-weight: 600;
    color: #9fbfe0;
    margin-bottom: 6px;
}

.smelter-temp-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smelter-temp-threshold-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.smelter-temp-threshold-label {
    font-size: 12px;
    color: #9fbfe0;
    font-weight: 600;
    min-width: 100px;
}

.smelter-temp-threshold-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smelter-temp-threshold-value {
    font-size: 13px;
    color: #fff;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.smelter-temp-btn {
    padding: 3px 8px;
    font-size: 11px;
    background: #2a3a4a;
    border: 1px solid #3a4a5a;
    color: #fff;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.smelter-temp-btn:hover {
    background: #3a4a5a;
    border-color: #4a5a6a;
}

.smelter-temp-btn:active {
    background: #1a2a3a;
}

/* Centrifuge Tension Panel */
.centrifuge-tension-panel {
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.08), rgba(38, 166, 154, 0.04));
    border-color: rgba(0, 188, 212, 0.25);
}

.centrifuge-tension-panel .smelter-temp-control-header {
    color: #4dd0e1;
}

.centrifuge-tension-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #4488ff, #4dd0e1, #ff8800, #ff4444);
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Task Details Modal Styles */
.task-detail-section {
    margin-bottom: 20px;
}

.task-detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffa726;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 167, 38, 0.3);
    padding-bottom: 6px;
}

.task-detail-section p {
    font-size: 13px;
    color: #e0e0e0;
    line-height: 1.6;
    margin: 0;
}

.task-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.task-detail-table th {
    text-align: left;
    padding: 8px 12px;
    color: #9fbfe0;
    font-weight: 600;
    width: 35%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.task-detail-table td {
    padding: 8px 12px;
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.task-detail-table tr:hover th,
.task-detail-table tr:hover td {
    background: rgba(255, 255, 255, 0.08);
}

/* Forge Interface Styles */
.forge-step {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.affordability-indicator {
    font-size: 14px;
    font-weight: bold;
    margin-left: 8px;
}

.affordability-indicator.affordable {
    color: #4caf50;
}

.affordability-indicator.not-affordable {
    color: #f44336;
}

.forge-step h3 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #ffa726;
    font-size: 16px;
}

.forge-step label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.forge-step select {
    width: 100%;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 6px;
}

.forge-step select:focus {
    outline: none;
    border-color: #ffa726;
}

.forge-step input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    outline: none;
    appearance: none;
    margin-bottom: 6px;
}

.forge-step input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #ffa726;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
}

.forge-step input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #ffa726;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
}

.forge-info {
    color: #90caf9;
    font-size: 12px;
    margin: 6px 0 0 0;
}

.forge-warning {
    color: #ffb74d;
    font-size: 12px;
    margin: 6px 0 0 0;
    padding: 6px;
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
    border-radius: 4px;
}

.forge-action {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

#forge-button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6f00, #ff9800);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#forge-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff8f00, #ffb300);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

#forge-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Forging Animation Modal */
.forging-dialog {
    max-width: 450px;
    min-height: 350px;
    text-align: center;
}

.forging-dialog .modal-body {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.forging-anvil {
    font-size: 80px;
    margin: 30px 0;
    animation: none;
}

.forging-anvil.shake {
    animation: shake 1s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) rotate(-4deg); }
    20%, 40%, 60%, 80% { transform: translateX(8px) rotate(4deg); }
}

.forging-message {
    font-size: 20px;
    font-weight: bold;
    margin: 16px 0;
    color: #ffa726;
}

.forging-quality {
    font-size: 18px;
    font-weight: bold;
    margin: 12px 0;
    color: #64b5f6;
    text-shadow: 0 0 8px rgba(100, 181, 246, 0.3);
}

.forging-message.forging-success {
    color: #4caf50;
    font-size: 28px;
    text-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.forging-message.forging-failure {
    color: #f44336;
    font-size: 24px;
    text-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.forging-result {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 16px;
}

.forging-result p {
    margin: 8px 0;
}

.forging-result strong {
    color: #ffa726;
}

.forging-assign {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.forging-assign label {
    font-size: 13px;
    color: #9fbfe0;
}

.forging-assign select {
    width: 180px;
    padding: 6px 10px;
    font-size: 12px;
    background: #2a3a4a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #dbeafe;
}

.forging-assign select option {
    background: #2a3a4a;
    color: #dbeafe;
}

.forge-name-input {
    width: 180px;
    padding: 6px 10px;
    font-size: 12px;
    background: #2a3a4a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #dbeafe;
    text-align: center;
}

.forge-name-input::placeholder {
    color: #6b7a8a;
}

/* Forge Outcomes Section */
.forge-outcomes {
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 8px;
}

.forge-outcomes-top {
    margin-top: 0;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, rgba(7, 46, 78, 0.95), rgba(5, 55, 95, 0.9));
}


.forge-outcomes h3 {
    margin-top: 0;
    margin-bottom: 6px;
    color: #64b5f6;
    font-size: 16px;
}

.outcome-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.outcome-row:last-child {
    border-bottom: none;
}

.outcome-label {
    font-weight: 500;
    color: #e0e0e0;
    font-size: 13px;
}

.outcome-value {
    font-size: 15px;
    font-weight: bold;
}

.outcome-value.success-high {
    color: #4caf50;
}

.outcome-value.success-medium {
    color: #ff9800;
}

.outcome-value.success-low {
    color: #f44336;
}

/* Forge Tabs - using inline styles like finance tabs for consistency */

/* Tool Inventory */
.inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 4px;
}

.tool-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.tool-card:hover {
    border-color: rgba(255, 152, 0, 0.4);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-header h4 {
    margin: 0;
    font-size: 16px;
    color: #ff9800;
}

.tool-power {
    font-size: 18px;
    font-weight: bold;
    color: #4caf50;
}

.tool-details {
    margin-bottom: 12px;
}

.tool-assigned {
    color: #64b5f6;
    font-size: 13px;
}

.tool-unassigned {
    color: #9e9e9e;
    font-size: 13px;
    font-style: italic;
}

.tool-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.assign-select {
    flex: 1;
    min-width: 150px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.8), rgba(211, 47, 47, 0.8));
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.9), rgba(211, 47, 47, 0.9));
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #9e9e9e;
    font-style: italic;
}

.tool-assigned-note {
    flex: 1;
    padding: 8px 12px;
    background: rgba(100, 181, 246, 0.15);
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: 4px;
    color: #64b5f6;
    font-size: 13px;
    text-align: center;
}

/* Custom width for the Smelter Modal */
#smelter-modal .modal-dialog {
    width: clamp(437px, 62vw, 780px);
}

/* Custom width for the Enrichment/Zentrifuge Modal */
#enrichment-modal .modal-dialog {
    width: clamp(437px, 62vw, 780px);
}

/* Dwarf Detail Modal Styles */
.dwarf-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

.dwarf-stat-box {
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
}

.dwarf-stat-label {
    font-size: 10px;
    opacity: 0.7;
}

.dwarf-stat-value {
    font-size: 18px;
    font-weight: bold;
}

.dwarf-bucket-container {
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    height: 186px;
    overflow-y: auto;
}

.dwarf-bucket-header {
    margin: 0 0 6px 0;
    font-size: 12px;
}

.dwarf-bucket-empty {
    opacity: 0.6;
    text-align: center;
    margin: 4px 0;
    font-size: 16px;
}

.dwarf-bucket-grid {
    display: flex;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.dwarf-bucket-grid::-webkit-scrollbar {
    height: 6px;
}

.dwarf-bucket-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.dwarf-bucket-grid::-webkit-scrollbar-track {
    background: transparent;
}

.dwarf-bucket-item {
    padding: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-align: center;
    min-width: 60px;
    max-height:60px;
    flex-shrink: 0;
}

.dwarf-bucket-item-name {
    font-size: 14px;
    font-weight: bold;
}

.dwarf-bucket-item-count {
    font-size: 18px;
    font-weight: bold;

    margin-top: 1px;
}

/* Dig Power, Wage & Tools Section */
.dwarf-power-wage-tools {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0px;
}

.dwarf-section-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    text-align: center;
}

.dwarf-section-main-value {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.dwarf-digpower-value {
    color: #4CAF50;
}

.dwarf-wage-value {
    color: #FFD700;
}

.dwarf-section-details {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.8;
    text-align: center;
}

.dwarf-section-divider-left {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 10px;
}

.dwarf-section-divider-right {
    padding-left: 10px;
}

.dwarf-wage-next {
    margin-top: 6px;
    font-size: 11px;
    color: #FFD700;
}

.dwarf-tool-current {
    text-align: center;
    margin-bottom: 6px;
}

.dwarf-tool-none {
    opacity: 0.6;
    font-size: 11px;
    margin: 4px 0 6px 0;
}

.dwarf-tool-name {
    font-size: 12px;
    font-weight: bold;
}

.dwarf-tool-power {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 6px;
}

.dwarf-tool-select {
    width: 100%;
    padding: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
}

.dwarf-tool-badges {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 20px;
}

/* Combat Bonuses Section */
.dwarf-combat-bonuses {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 8px;
}

.dwarf-combat-bonus-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.dwarf-combat-bonus-label {
    font-size: 10px;
    opacity: 0.7;
    margin-bottom: 2px;
}

.dwarf-combat-bonus-value {
    font-size: 14px;
    font-weight: bold;
    color: #ff9800;
}

/* Rename Section */
.dwarf-rename-container {
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
}

.dwarf-rename-form {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.dwarf-rename-input {
    flex: 1;
    max-width: 250px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: 12px;
}

.dwarf-rename-btn {
    padding: 6px 12px;
    background: #4CAF50;
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

/* Dwarf Switcher Container */
.dwarf-switcher-container {
    display: flex;
    gap: 8px;
    margin-right: auto;
    align-items: center;
}

/* Dwarf Switcher */
.dwarf-switcher {
    padding: 6px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: 12px;
    min-width: 180px;
    max-width: 180px;
}

/* Next Skillpoint Button */
.btn-next-skillpoint {
    padding: 6px 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.btn-next-skillpoint:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.4);
}

/* Stats Grid Section */
.dwarf-stats-section {
    margin-bottom: 12px;
}

.dwarf-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Stat Card Styles */
.dwarf-stat-card {
    padding: 10px;
}

.dwarf-stat-card-header {
    margin: 0 0 6px 0;
    font-size: 13px;
}

.dwarf-stat-card-points {
    font-size: 16px;
    font-weight: bold;
    margin: 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dwarf-stat-card-desc {
    font-size: 13px;
    opacity: 0.8;
    margin: 0;
    white-space: pre-line;
}

.dwarf-stat-upgrade-btn {
    padding: 2px 8px;
    font-size: 11px;
    margin: 0;
    min-width: auto;
    background: linear-gradient(135deg, #ffd700, #ffa726);
    border-color: #ffa726;
}

/* Dig Power Calculation Details */
.dwarf-digpower-enchant {
    color: #b19cd9;
}

.dwarf-digpower-diamond {
    color: #66ccff;
    margin-left: 10px;
    cursor: help;
}

/* Tool Badge Styles */
.dwarf-tool-badge {
    margin-right: 6px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
}

.dwarf-tool-badge-enchant {
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid rgba(138, 43, 226, 0.4);
    color: #dda0ff;
}

.dwarf-tool-badge-gem {
    background: rgba(102, 204, 255, 0.15);
    border: 1px solid rgba(102, 204, 255, 0.4);
    color: #66ccff;
}

.dwarf-tool-badge-plating {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    cursor: help;
}

/* Bucket Grid in Refresh Modal */
.dwarf-bucket-refresh-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 4px;
}

.dwarf-bucket-refresh-item {
    padding: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    text-align: center;
}

.dwarf-bucket-refresh-item-name {
    font-size: 9px;
    font-weight: bold;
}

.dwarf-bucket-refresh-item-count {
    font-size: 12px;
    margin-top: 1px;
}

.dwarf-bucket-refresh-empty {
    opacity: 0.6;
    text-align: center;
    margin: 4px 0;
    font-size: 11px;
}

/* Move Target Activity */
.dwarf-move-target-activity {
    font-size: 1vw;
}

/* Task Priority Section Title */
.dwarf-task-priority-title {
    margin-bottom: 10px;
}

/* Reset Button Compact Style */
.dwarf-reset-btn-compact {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
}

/* Hidden by default (for next skillpoint button) */
.hidden {
    display: none;
}

/* Gold Display */
.gold-display {
    cursor: pointer;
}

/* Notification Badge */
.notification-badge {
    display: none;
    margin-left: 2px;
}

.notification-badge.visible {
    display: inline;
}

/* Research Options */
.research-options {
    margin-bottom: 10px;
}

/* Finances Tabs */
.finances-tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #3a4a57;
}

.finances-tab {
    flex: 1;
    padding: 10px;
    border: none;
    color: #9fbfe0;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    background: #2a3f5a;
}

.finances-tab.active {
    background: #4a5f7a;
    color: #fff;
    border-bottom-color: #ffd700;
    font-weight: bold;
}

/* Transactions Content */
.transactions-content {
    max-height: 500px;
    overflow-y: auto;
}

/* Investments Tab Styles */
.investments-locked {
    text-align: center;
    padding: 20px;
    color: #9fbfe0;
}

.investments-locked h3 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 16px;
}

.investments-header {
    color: #ffd700;
    margin-bottom: 12px;
    font-size: 16px;
    text-align: center;
}

.investments-balance-card {
    background: #2d3f52;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #4a5f7a;
}

.investments-balance-label {
    color: #9fbfe0;
    font-size: 11px;
    margin-bottom: 3px;
}

.investments-balance-value {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
}

.investments-interest-card {
    background: #1a2a3a;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px solid #3a4a57;
}

.investments-interest-header {
    color: #4ade80;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 4px;
    text-align: left;
}

.investments-interest-total {
    color: #4ade80;
    font-size: 22px;
    font-weight: bold;
    text-align: left;
    margin-bottom: 4px;
}

.investments-breakdown-header {
    color: #9fbfe0;
    font-size: 11px;
    margin-bottom: 4px;
    border-bottom: 1px solid #3a4a57;
    padding-bottom: 3px;
}

.investments-tier {
    margin-bottom: 4px;
    padding: 4px;
    background: #0f1f2f;
    border-radius: 3px;
}

.investments-tier-label {
    color: #9fbfe0;
    font-size: 14px;
}

.investments-tier-value {
    color: #4ade80;
    font-weight: bold;
    font-size: 14px;
}

/* Settings Cheat Section */
.settings-cheat-section {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.settings-cheat-section.visible {
    display: block;
}

.settings-cheat-title {
    color: gold;
    text-align: center;
}

.settings-cheat-description {
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

/* Settings Cheat Button */
.btn-cheat {
    display: none;
}

.btn-cheat.visible {
    display: inline-block;
}

/* ============================================================================
   GEMS MODAL STYLES
   ============================================================================ */

.gems-list {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.gem-type-section {
    display: grid;
    gap: 8px;
}

.gem-type-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gem-type-header:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.gem-type-expand-icon {
    font-size: 12px;
    color: #9fbfe0;
    transition: transform 0.2s ease;
    width: 16px;
    text-align: center;
}

.gem-type-header:not(.collapsed) .gem-type-expand-icon {
    transform: rotate(90deg);
}

.gem-type-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: rotate(45deg);
}

.gem-type-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.gem-type-status-info {
    font-size: 12px;
    font-weight: 500;
    color: #9fbfe0;
    opacity: 0.8;
    margin-left: 8px;
    flex: 1;
}

.gem-type-count {
    font-size: 14px;
    font-weight: 500;
    color: #9fbfe0;
    opacity: 0.8;
}

.gem-type-value {
    font-size: 16px;
    font-weight: 600;
    color: #fbbf24;
    margin-left: 8px;
}

.gem-sell-all-type-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 4px;
    color: #fbbf24;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: auto;
}

.gem-sell-all-type-btn:hover {
    background: rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.6);
    transform: translateY(-1px);
}

.gem-sell-all-type-btn:active {
    transform: translateY(0);
}

.gem-type-items {
    display: grid;
    gap: 8px;
    padding-left: 28px;
    padding-top: 8px;
    padding-bottom: 8px;
    max-height: 2000px;
    opacity: 1;
    transition: all 0.3s ease;
    overflow: hidden;
}

.gem-type-items.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.gem-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.gem-item-compact {
    display: block;
    padding: 8px 12px;
}

.gem-item-compact-content {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.gem-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.gem-item-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gem-item-diamond {
    width: 32px;
    height: 32px;
    transform: rotate(45deg);
    background: radial-gradient(ellipse at center,
        var(--gem-color, #ffffff) 0%,
        color-mix(in srgb, var(--gem-color, #ffffff) 70%, white) 30%,
        color-mix(in srgb, var(--gem-color, #ffffff) 40%, black) 60%,
        color-mix(in srgb, var(--gem-color, #ffffff) 20%, black) 100%);
    border-radius: 4px;
    box-shadow:
        0 0 12px color-mix(in srgb, var(--gem-color, #ffffff) 60%, transparent),
        inset -3px -3px 6px rgba(0, 0, 0, 0.4),
        inset 3px 3px 6px rgba(255, 255, 255, 0.5);
}

.gem-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gem-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.gem-item-details {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gem-item-location {
    font-size: 12px;
    color: #9fbfe0;
    opacity: 0.8;
}

.gem-item-carat {
    font-size: 13px;
    font-weight: 500;
    color: #fbbf24;
    white-space: nowrap;
}

.gem-item-value {
    font-size: 16px;
    font-weight: 600;
    color: #fbbf24;
    white-space: nowrap;
}

.gem-item-count {
    font-size: 14px;
    font-weight: 600;
    color: #9fbfe0;
    white-space: nowrap;
}

.gem-assigned-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #ffffff;
    white-space: nowrap;
    border: 1px solid rgba(138, 43, 226, 0.4);
}

.gem-polished-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: #ffffff;
    white-space: nowrap;
}

.gem-unpolished-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: #9fbfe0;
    white-space: nowrap;
}

.gem-item-quality {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.gem-quality-flawless {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
}

.gem-quality-excellent {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: #ffffff;
}

.gem-quality-good {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #ffffff;
}

.gem-quality-fair {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #ffffff;
}

.gem-quality-poor {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: #ffffff;
}

.gems-list-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9fbfe0;
    opacity: 0.7;
    font-style: italic;
}

.gem-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.gem-sell-one-btn,
.gem-sell-lower-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gem-sell-one-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.gem-sell-one-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.gem-sell-lower-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.gem-sell-lower-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.gem-cut-btn {
    padding: 4px 10px;
    width:60px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #ffffff;
}

.gem-cut-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
}

.gem-cutting-progress {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    white-space: nowrap;
}

.gem-item-status-column {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 200px;
    flex-shrink: 0;
}

/* ============================================================================
   Sell Material Modal Styling
   ============================================================================ */

.sell-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sell-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.sell-info-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.sell-info-value {
    font-weight: 700;
    color: #fbbf24;
    font-size: 15px;
}

.sell-slider-container {
    margin: 25px 0;
}

.sell-slider-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ffffff;
}

#sell-amount-display {
    color: #fbbf24;
    font-weight: 700;
}

.sell-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 10px;
}

.sell-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    cursor: pointer;
    border: 3px solid #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.sell-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: scale(1.1);
}

.sell-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    cursor: pointer;
    border: 3px solid #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.sell-slider::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: scale(1.1);
}

.sell-slider-marks {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 5px;
}

.sell-total {
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    /* Background color set dynamically via JavaScript based on material color */
}

.sell-total-label {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.sell-total-value {
    font-size: 24px;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#sell-modal .modal-dialog {
    max-width: 385px; /* 30% reduction from default 550px */
}

#sell-modal .modal-footer {
    gap: 10px;
    display: flex;
    justify-content: flex-end;
}

#sell-modal .btn-primary {
    padding: 10px 20px;
    font-weight: 600;
}


/* ============================================================================
   Warehouse Sell Modal Styling
   ============================================================================ */

#warehouse-sell-modal .modal-dialog {
    max-width: 500px;
}

.warehouse-sell-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.warehouse-sell-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px 20px;
    background: linear-gradient(135deg, #1f2937, #111827);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    font-weight: 600;
    gap: 8px;
}

.warehouse-sell-option:hover {
    background: linear-gradient(135deg, #374151, #1f2937);
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateX(4px);
}

.warehouse-sell-option.warning {
    border-color: rgba(251, 191, 36, 0.4);
}

.warehouse-sell-option.warning:hover {
    border-color: rgba(251, 191, 36, 0.7);
    background: linear-gradient(135deg, #78350f, #451a03);
}

.warehouse-sell-option.danger {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(135deg, #7f1d1d, #450a0a);
}

.warehouse-sell-option.danger:hover {
    border-color: rgba(239, 68, 68, 0.8);
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    transform: translateX(4px) scale(1.02);
}

.wso-header {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.wso-label {
    color: #ffffff;
    flex: 1;
    text-align: left;
}

.warehouse-sell-option.warning .wso-label,
.warehouse-sell-option.danger .wso-label {
    font-weight: 700;
}

.wso-value {
    color: #fbbf24;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: 20px;
}

.wso-details {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.warehouse-sell-separator {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.5), transparent);
    margin: 8px 0;
}

/* ============================================================================
   TASK PRIORITY SYSTEM
   ============================================================================ */

.dwarf-task-priority-container {
    margin: 12px 0 8px 0;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
    border-radius: 8px;
    text-align: center;
}

.task-priority-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.task-priority-layout-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.task-priority-box {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px;
    min-height: 90px;
}

.task-priority-box-header {
    font-size: 11px;
    font-weight: 600;
    color: #93c5fd;
    margin-bottom: 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(147, 197, 253, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.task-priority-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 60px;
    transition: all 0.15s ease;
}

.task-priority-list.drag-over-list {
    background: rgba(251, 191, 36, 0.08);
    border: 2px dashed #fbbf24;
    border-radius: 4px;
}

.task-priority-item {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 3px;
    padding: 5px 8px;
    color: #e0f2fe;
    font-size: 12px;
    cursor: move;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.task-priority-item:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.task-priority-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-priority-item.drag-over {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
}

.task-priority-item-icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1;
}

.task-priority-item-name {
    flex: 1;
    font-weight: 500;
}

.task-priority-item-handle {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    cursor: grab;
    line-height: 1;
}

/* High priority tasks - Green */
.task-priority-high .task-priority-item {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
}

.task-priority-high .task-priority-item:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.15);
}

/* Normal priority tasks - Blue (default) */
.task-priority-normal .task-priority-item {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
}

.task-priority-normal .task-priority-item:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

/* No priority tasks (blacklist) - Red */
.task-priority-none .task-priority-item,
.task-blacklist .task-priority-item {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

.task-priority-none .task-priority-item:hover,
.task-blacklist .task-priority-item:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Functions grid row styling (first row in digging grid table) */
.functions-cell {
    background: #333333  !important;
    border-bottom: 3px double #000000 !important;
}

.functions-depth-cell {
    background: transparent !important;
    border-bottom: 3px double #000000 !important;
}

/* Center all icons in functions cells - position icons behind dwarfs */
#digging-grid .functions-cell .drop-off-marker {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1;
    font-size: 24px;
    opacity: 0.95;
}

#digging-grid .functions-cell.has-dwarf::before {
    content: '🧍';
    font-size: 24px;
    position: absolute;
    left: 80%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2 !important;
    opacity: 0.9;
    pointer-events: none;
}

#digging-grid .functions-cell .moving-marker,
#digging-grid .functions-cell .digging-marker {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 3;
}

/* Functions grid row needs position: relative for absolute positioning */
#digging-grid .functions-cell {
    position: relative;
    cursor: default !important;
}

#digging-grid .functions-depth-cell {
    background: transparent !important;
}

/* Management Modal Styles */

/* Management modal widths */
#management-modal .modal-dialog {
    max-width: 700px;
}

#add-management-task-modal .modal-dialog,
#edit-management-task-modal .modal-dialog {
    max-width: 400px;
}

/* Form group styling for management modals */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: #dbeafe;
    font-weight: 500;
    font-size: 14px;
}

/* Readonly/disabled styling for edit modal task type field */
#edit-task-type-display:disabled {
    background: #1a1a1a;
    color: #888;
    cursor: not-allowed;
}

.management-task-form {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.management-task-form td {
    padding: 6px 10px;
    vertical-align: middle;
}

.management-task-form .form-label {
    text-align: left;
    color: #dbeafe;
    font-weight: 500;
    width: 45%;
}

.management-task-form .form-input {
    width: 55%;
}

.management-input {
    width: 100%;
    min-width: 200px;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.management-input:focus {
    border-color: #3b82f6;
    background: #333333;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.management-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.management-number-input {
    text-align: right;
}

/* Remove number input spinners */
.management-number-input::-webkit-outer-spin-button,
.management-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.management-number-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Checkbox styling for management tasks */
.management-checkbox-input {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* Dropdown arrow styling for dark theme */
.management-input option {
    background: #2a2a2a;
    color: #fff;
}

/* Style the task type select dropdown */
#task-type-select {
    width: 100%;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#task-type-select:focus {
    border-color: #3b82f6;
    background: #333333;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#task-type-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

#task-type-select option {
    background: #2a2a2a;
    color: #fff;
}

/* Style the form-group label */
.form-group label {
    display: block;
    color: #dbeafe;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Management Task List Styles (matching smelter) */
.management-task-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.management-task-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: grab;
}

.management-task-row:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
    border-color: rgba(255,255,255,0.15);
}

.management-task-row:active {
    cursor: grabbing;
}

.management-task-priority {
    font-weight: 700;
    font-size: 14px;
    color: #ffa726;
    min-width: 24px;
    text-align: center;
}

.management-task-row .drag-handle {
    cursor: grab;
    font-size: 16px;
    color: #888;
    user-select: none;
}

.management-task-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.management-task-name {
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.management-task-active {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    white-space: nowrap;
}

.management-task-inactive {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    white-space: nowrap;
}

.management-task-buttons {
    display: flex;
    gap: 4px;
}

.management-task-detail-btn,
.management-task-delete-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.management-task-detail-btn {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.management-task-detail-btn:hover {
    background: rgba(59, 130, 246, 0.3);
}

.management-task-delete-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.management-task-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ============================================================================
   HOUSING MODAL STYLES
   ============================================================================ */

.housing-section {
    margin-bottom: 24px;
}

.housing-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffa726;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 167, 38, 0.3);
}

.furniture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.furniture-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.furniture-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.furniture-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.furniture-info {
    flex: 1;
    min-width: 0;
}

.furniture-name {
    font-size: 14px;
    font-weight: 600;
    color: #dbeafe;
    margin-bottom: 4px;
}

.furniture-description {
    font-size: 11px;
    color: #9fbfe0;
    line-height: 1.4;
    margin-bottom: 6px;
}

.furniture-effect {
    font-size: 10px;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
    display: inline-block;
}

.furniture-lock-reason {
    font-size: 10px;
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.furniture-card.locked {
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.02);
}

.furniture-card.locked:hover {
    opacity: 0.75;
    background: rgba(255, 255, 255, 0.04);
}

.furniture-card.locked .furniture-icon {
    filter: grayscale(0.5);
}

.furniture-level {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.furniture-level .level-label {
    color: #888;
}

.furniture-level .level-value {
    font-weight: 600;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.furniture-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.furniture-level .level-max {
    color: #666;
    font-size: 11px;
}

.furniture-actions .btn-levelup {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    line-height: 1.3;
}

.furniture-actions .btn-levelup:hover {
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
    transform: translateY(-1px);
}

.furniture-actions .btn-levelup:active {
    transform: translateY(0);
}

.furniture-actions .btn-levelup .levelup-cost {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.9;
}

.furniture-actions .btn-levelup.disabled {
    background: linear-gradient(180deg, #4a4a4a, #3a3a3a);
    cursor: not-allowed;
    opacity: 0.6;
}

.furniture-actions .btn-levelup.disabled:hover {
    background: linear-gradient(180deg, #4a4a4a, #3a3a3a);
    transform: none;
}

.furniture-actions .btn-levelup.cannot-afford {
    background: linear-gradient(180deg, #7c3030, #5c2020);
}

.furniture-actions .btn-levelup.cannot-afford:hover {
    background: linear-gradient(180deg, #8c4040, #6c3030);
}

/* Collapsible section styles */
.housing-section.collapsible {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.housing-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.housing-section-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.housing-section-header .housing-section-title {
    margin: 0;
    padding: 0;
    border: none;
    flex: 1;
}

.collapse-icon {
    font-size: 12px;
    color: #888;
    transition: transform 0.2s ease;
    width: 16px;
    text-align: center;
}

.room-dwarf {
    font-size: 12px;
    color: #dbeafe;
    background: rgba(59, 130, 246, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
}

.room-summary {
    font-size: 12px;
    color: #888;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.housing-section-content {
    padding: 16px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 2000px;
    opacity: 1;
}

.housing-section.collapsed .housing-section-content {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    overflow: hidden;
}

/* Individual room styling */
.individual-room {
    margin-bottom: 8px;
}

.individual-room:last-child {
    margin-bottom: 0;
}

.individual-room .housing-section-title {
    font-size: 14px;
    color: #dbeafe;
}

.room-furniture-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Smaller furniture cards inside individual rooms */
.individual-room .furniture-card {
    padding: 10px;
}

.individual-room .furniture-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
}

.individual-room .furniture-name {
    font-size: 13px;
}

.individual-room .furniture-description {
    font-size: 10px;
}

/* ============================================
   Critical Error Notification
   ============================================ */
#critical-error-notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    max-width: 500px;
    font-family: Arial, sans-serif;
    border: 2px solid #b71c1c;
}

#critical-error-notification .error-content {
    display: flex;
    align-items: start;
    gap: 12px;
}

#critical-error-notification .error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

#critical-error-notification .error-body {
    flex: 1;
}

#critical-error-notification .error-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

#critical-error-notification .error-message {
    font-size: 14px;
    opacity: 0.95;
    margin-bottom: 8px;
}

#critical-error-notification .error-hint {
    font-size: 12px;
    opacity: 0.85;
}

#critical-error-notification .error-close {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

#critical-error-notification .error-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ============================================
   Tool Badges (Plating, Enchant, Gems)
   ============================================ */
.tool-badge {
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    line-height: 1;
}

.tool-badge-plating {
    color: #ffffff;
    text-shadow: 0 2px 3px rgba(0,0,0,0.5);
    cursor: help;
}

.tool-badge-enchant {
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid rgba(138, 43, 226, 0.4);
    color: #dda0ff;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
}

.tool-badge-gems {
    background: rgba(102, 204, 255, 0.2);
    border: 1px solid rgba(102, 204, 255, 0.4);
    color: #66ccff;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ============================================
   Function Bar Progress Bars
   ============================================ */
.function-progress-container {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 4px;
    background: rgba(0,0,0,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.function-progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.research-progress-bar {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.smelter-temp-bar {
    background: linear-gradient(90deg, #ff4500, #ff8c00);
}

/* ============================================
   Disabled/Locked UI State
   ============================================ */
.ui-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Dwarf XP Display States
   ============================================ */
.dwarf-xp-display.can-level {
    cursor: pointer;
    font-size: 16px;
}

.dwarf-xp-display.in-progress {
    font-size: 10px;
    color: #9fbfe0;
    opacity: 0.7;
}

/* ============================================
   Enchant Modal
   ============================================ */
.enchant-tool-info {
    margin-bottom: 16px;
}

.enchant-tool-info h3 {
    margin: 0 0 8px 0;
}

.enchant-tool-power {
    margin: 0;
    color: #9fbfe0;
    font-size: 13px;
}

.enchant-slider-container {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 6px;
}

.enchant-slider-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.enchant-slider-container input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

.enchant-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9fbfe0;
}

#enchant-level-display {
    font-weight: bold;
    color: #dda0ff;
}

.enchant-preview {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.enchant-preview-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.enchant-preview-row:last-of-type {
    margin-bottom: 0;
}

.enchant-power {
    color: #dda0ff;
    font-weight: bold;
}

.enchant-cost {
    color: #ffd700;
    font-weight: bold;
}

.enchant-cost.cannot-afford {
    color: #ff6b6b;
}

.enchant-warning {
    color: #ff6b6b;
    margin: 8px 0 0 0;
    font-size: 12px;
}

.enchant-confirm-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
}

.enchant-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Transaction Modal
   ============================================ */
.transactions-table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table th {
    padding: 8px;
    border-bottom: 2px solid #5b6d7a;
}

.transactions-table td {
    padding: 8px;
}

.transactions-table .th-left {
    text-align: left;
}

.transactions-table .th-right {
    text-align: right;
}

.transactions-table .th-center {
    text-align: center;
}

.transactions-table tbody tr {
    border-bottom: 1px solid #3a4a57;
}

.transactions-table .row-current {
    background: #2d3f52;
}

.transactions-table .cell-hour {
    font-weight: bold;
}

.transactions-table .cell-income {
    text-align: right;
    color: #4ade80;
}

.transactions-table .cell-income-bold {
    text-align: right;
    color: #4ade80;
    font-weight: bold;
}

.transactions-table .cell-expense {
    text-align: right;
    color: #ff6b6b;
}

.transactions-table .cell-expense-bold {
    text-align: right;
    color: #ff6b6b;
    font-weight: bold;
}

.transactions-table .cell-net {
    text-align: right;
    font-weight: bold;
}

.transactions-table .cell-net.positive {
    color: #4ade80;
}

.transactions-table .cell-net.negative {
    color: #ff6b6b;
}

.transactions-table .cell-actions {
    text-align: center;
}

.transactions-table .cell-balance {
    text-align: right;
}

.transactions-table .btn-details {
    padding: 4px 12px;
    font-size: 12px;
}

.transactions-empty {
    text-align: center;
    color: #9fbfe0;
    padding: 20px;
}

.transactions-back-btn {
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #2a3f5a;
}

.transactions-details-header {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 16px;
}

/* Investments Tab */
.investments-locked {
    text-align: center;
    padding: 20px;
    color: #9fbfe0;
}

.investments-header {
    color: #ffd700;
    margin-bottom: 15px;
}

.investments-header-margin {
    margin-top: 30px;
}

.investments-interest-card {
    background: #1e2a35;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.investments-interest-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: #9fbfe0;
}

.investments-interest-total {
    font-size: 1.5em;
    font-weight: bold;
    color: #4ade80;
    margin-bottom: 15px;
}

.investments-breakdown-header {
    font-size: 0.9em;
    color: #7a8a99;
    margin-bottom: 10px;
}

.investments-tier {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.investments-tier-label {
    color: #9fbfe0;
    font-size: 0.9em;
}

.investments-tier-value {
    color: #4ade80;
    font-weight: bold;
}

/* Investment Form */
.investment-form {
    background: #1e2a35;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.investment-form-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #9fbfe0;
}

.investment-form-desc {
    font-size: 0.9em;
    color: #7a8a99;
    margin-bottom: 15px;
}

.investment-amount-label {
    color: #9fbfe0;
    margin-bottom: 8px;
    display: block;
}

.investment-amount-display {
    font-size: 1.5em;
    font-weight: bold;
    color: #4ade80;
    text-align: center;
    margin-bottom: 10px;
}

.investment-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.investment-btn {
    padding: 8px;
    font-size: 1.2em;
    font-weight: bold;
}

.investment-info-display {
    font-size: 0.9em;
    color: #7a8a99;
    margin-bottom: 15px;
    text-align: center;
}

.investment-create-btn {
    width: 100%;
}

.investment-not-enough {
    color: #ff6b6b;
    text-align: center;
    padding: 10px;
}

/* Active Investments */
.active-investments-header {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #9fbfe0;
}

.investment-card {
    background: #1e2a35;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.investment-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.investment-card-title {
    font-weight: bold;
    color: #9fbfe0;
}

.investment-card-amount {
    color: #4ade80;
}

.investment-progress-bar {
    background: #2a3f5a;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.investment-progress-fill {
    background: #4ade80;
    height: 100%;
    transition: width 0.3s;
}

.investment-card-details {
    font-size: 0.9em;
    color: #7a8a99;
}

.investment-card-details div {
    margin-bottom: 2px;
}
