/* --- Siege Calculator: Refined App Theme --- */

.siege-calculator-container {
    display: flex; flex-direction: column; gap: 8px;
    color: var(--text-color); height: 100%; min-height: 600px;
    width: 100%; /* Maximize width */
    overflow-x: hidden;
    font-family: var(--font-body);
    padding: 2px; /* Minimal padding */
    background: transparent;
}

/* --- Sections --- */
.calc-section {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    box-shadow: var(--shadow-card);
}

.section-header {
    font-family: var(--font-header);
    font-size: 0.85rem; /* Reduced font */
    color: var(--text-color);
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid var(--border-light-color);
    padding-bottom: 4px;
    margin-bottom: 6px;
    font-weight: 700;
}
.section-header.center-text { text-align: center; }
.section-header.small { font-size: 0.8rem; color: var(--color-muted); }

/* --- TOP: SETUP --- */
.top-setup {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.setup-col { display: flex; flex-direction: column; gap: 6px; }

/* Vertical Input Stack */
.input-stack { display: flex; flex-direction: column; gap: 4px; }
.input-group { display: flex; align-items: center; gap: 4px; justify-content: space-between; }
.input-group.full-width { flex-direction: column; align-items: flex-start; gap: 2px; }
.input-group label { font-size: 0.7rem; color: #aaa; width: 45px; } /* Smaller label */
.input-group.full-width label { width: 100%; }

.app-input, .app-select {
    background: rgba(0, 0, 0, 0.966);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 6px; /* Compact padding */
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8rem; /* Smaller font */
    width: 100%;
    transition: border-color var(--transition-fast);
}
.app-input.compact { padding: 2px 4px; font-size: 0.75rem; height: 24px; }
.app-input:focus, .app-select:focus { border-color: var(--accent-color); outline: none; }

/* Timer Trigger */
.timer-trigger {
    background: rgba(0,0,0,0.3); border: 1px solid var(--border-color);
    color: var(--accent-color); font-family: var(--font-header);
    font-size: 1.2rem; font-weight: bold; text-align: center;
    padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
    width: 100%; transition: all 0.2s;
}
.timer-trigger:hover { border-color: var(--accent-color); background: rgba(255, 153, 0, 0.1); }
.timer-trigger.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* --- MID: BATTLE --- */
.mid-battle { display: flex; flex-direction: column; gap: 8px; flex-grow: 1; position: relative; }

.hp-area { background: rgba(0,0,0,0.2); padding: 8px; border-radius: var(--radius-sm); }
.hp-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.hp-label { font-family: var(--font-header); color: #aaa; font-size: 0.8rem; text-transform: uppercase; }
.hp-value { font-family: var(--font-mono); color: var(--accent-color); font-weight: bold; font-size: 0.9rem; }

.info-icon-wrapper { position: relative; }
.info-icon { color: var(--accent-color); cursor: pointer; font-size: 0.9rem; }
.tooltip-popup {
    position: absolute; top: 20px; right: 0; width: 200px;
    background: var(--primary-bg); border: 1px solid var(--accent-color);
    padding: 8px; border-radius: var(--radius-sm); z-index: 100;
    font-size: 0.7rem; color: var(--text-color); line-height: 1.4;
    box-shadow: var(--shadow-modal);
}
.tooltip-popup.hidden { display: none; }

.hp-bar-wrapper { position: relative; height: 20px; }
.hp-bar-track { background: #111; height: 10px; border-radius: 5px; overflow: hidden; position: relative; top: 5px; border: 1px solid #333; }
.hp-bar-fill { height: 100%; background: var(--accent-color); width: 100%; transition: width 0.3s ease-out; }
.hp-marker {
    position: absolute; top: 0; width: 10px; height: 10px; transform: rotate(45deg);
    border: 2px solid #fff; z-index: 2; box-shadow: 0 0 4px #000;
}
#marker-ally { background: #33dd88; }
#marker-foe { background: #ff5555; }
.hp-labels { display: flex; justify-content: space-between; font-size: 0.65rem; color: #666; margin-top: 6px; }

.logs-area {
    flex-grow: 1; height: 200px; /* Increased height */
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 4px;
    display: flex; flex-direction: column;
}
.event-log { overflow-y: auto; flex-grow: 1; font-family: var(--font-mono); font-size: 0.75rem; }
.log-entry { padding: 1px 0; border-bottom: 1px solid rgba(255,255,255,0.05); color: #aaa; }
.log-entry.hit-ally { color: #33dd88; }
.log-entry.hit-enemy { color: #ff5555; }
.log-entry.system { color: var(--accent-color); }

.controls-area { display: flex; flex-direction: column; gap: 6px; background: rgba(0,0,0,0.2); padding: 6px; border-radius: var(--radius-sm); }
.selected-fleet-info { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: #ccc; }
.selected-fleet-info .highlight { color: var(--accent-color); font-weight: bold; }
.selected-left { display: flex; flex-direction: column; gap: 2px; }
.eta-text { font-size: 0.7rem; color: #888; font-family: var(--font-mono); }

.delay-row { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.delay-row .label { font-size: 0.75rem; color: #888; }
.fleet-ops { display: flex; gap: 4px; }

.btn-sm { padding: 2px 6px; font-size: 0.7rem; height: 22px; }

.sep { width: 1px; height: 16px; background: #444; margin: 0 4px; }
.speed-btn { width: 30px; padding: 0; }
.speed-btn.active { background: var(--accent-color); color: #000; border-color: var(--accent-color); font-weight: bold; }

/* Overlays */
.overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 50;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.overlay-content {
    background: var(--secondary-bg); border: 1px solid var(--border-color);
    padding: 12px; border-radius: var(--radius-md); text-align: center;
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: var(--shadow-modal); min-width: 250px;
}
.overlay-title { font-family: var(--font-header); color: #fff; font-size: 0.9rem; font-weight: bold; }
.overlay-timer { font-family: var(--font-mono); font-size: 2rem; color: var(--accent-color); font-weight: bold; }
/* --- Siege Calculator: Refined App Theme --- */

.siege-calculator-container {
    display: flex; flex-direction: column; gap: 8px;
    color: var(--text-color); height: 100%; min-height: 600px;
    width: 100%; /* Maximize width */
    overflow-x: hidden;
    font-family: var(--font-body);
    padding: 2px; /* Minimal padding */
    background: transparent;
}

/* --- Sections --- */
.calc-section {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    box-shadow: var(--shadow-card);
}

.section-header {
    font-family: var(--font-header);
    font-size: 0.85rem; /* Reduced font */
    color: var(--text-color);
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid var(--border-light-color);
    padding-bottom: 4px;
    margin-bottom: 6px;
    font-weight: 700;
}
.section-header.center-text { text-align: center; }
.section-header.small { font-size: 0.8rem; color: var(--color-muted); }

/* --- TOP: SETUP --- */
.top-setup {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.setup-col { display: flex; flex-direction: column; gap: 6px; }

/* Vertical Input Stack */
.input-stack { display: flex; flex-direction: column; gap: 4px; }
.input-group { display: flex; align-items: center; gap: 4px; justify-content: space-between; }
.input-group.full-width { flex-direction: column; align-items: flex-start; gap: 2px; }
.input-group label { font-size: 0.7rem; color: #aaa; width: 45px; } /* Smaller label */
.input-group.full-width label { width: 100%; }

.app-input, .app-select {
    background: rgba(0, 0, 0, 0.966);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 6px; /* Compact padding */
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8rem; /* Smaller font */
    width: 100%;
    transition: border-color var(--transition-fast);
}
.app-input.compact { padding: 2px 4px; font-size: 0.75rem; height: 24px; }
.app-input:focus, .app-select:focus { border-color: var(--accent-color); outline: none; }

/* Timer Trigger */
.timer-trigger {
    background: rgba(0,0,0,0.3); border: 1px solid var(--border-color);
    color: var(--accent-color); font-family: var(--font-header);
    font-size: 1.2rem; font-weight: bold; text-align: center;
    padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
    width: 100%; transition: all 0.2s;
}
.timer-trigger:hover { border-color: var(--accent-color); background: rgba(255, 153, 0, 0.1); }
.timer-trigger.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* --- MID: BATTLE --- */
.mid-battle { display: flex; flex-direction: column; gap: 8px; flex-grow: 1; position: relative; }

.hp-area { background: rgba(0,0,0,0.2); padding: 8px; border-radius: var(--radius-sm); }
.hp-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.hp-label { font-family: var(--font-header); color: #aaa; font-size: 0.8rem; text-transform: uppercase; }
.hp-value { font-family: var(--font-mono); color: var(--accent-color); font-weight: bold; font-size: 0.9rem; }

.info-icon-wrapper { position: relative; }
.info-icon { color: var(--accent-color); cursor: pointer; font-size: 0.9rem; }
.tooltip-popup {
    position: absolute; top: 20px; right: 0; width: 200px;
    background: var(--primary-bg); border: 1px solid var(--accent-color);
    padding: 8px; border-radius: var(--radius-sm); z-index: 100;
    font-size: 0.7rem; color: var(--text-color); line-height: 1.4;
    box-shadow: var(--shadow-modal);
}
.tooltip-popup.hidden { display: none; }

.hp-bar-wrapper { position: relative; height: 20px; }
.hp-bar-track { background: #111; height: 10px; border-radius: 5px; overflow: hidden; position: relative; top: 5px; border: 1px solid #333; }
.hp-bar-fill { height: 100%; background: var(--accent-color); width: 100%; transition: width 0.3s ease-out; }
.hp-marker {
    position: absolute; top: 0; width: 10px; height: 10px; transform: rotate(45deg);
    border: 2px solid #fff; z-index: 2; box-shadow: 0 0 4px #000;
}
#marker-ally { background: #33dd88; }
#marker-foe { background: #ff5555; }
.hp-labels { display: flex; justify-content: space-between; font-size: 0.65rem; color: #666; margin-top: 6px; }

.logs-area {
    flex-grow: 1; height: 200px; /* Increased height */
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 4px;
    display: flex; flex-direction: column;
}
.event-log { overflow-y: auto; flex-grow: 1; font-family: var(--font-mono); font-size: 0.75rem; }
.log-entry { padding: 1px 0; border-bottom: 1px solid rgba(255,255,255,0.05); color: #aaa; }
.log-entry.hit-ally { color: #33dd88; }
.log-entry.hit-enemy { color: #ff5555; }
.log-entry.system { color: var(--accent-color); }

.controls-area { display: flex; flex-direction: column; gap: 6px; background: rgba(0,0,0,0.2); padding: 6px; border-radius: var(--radius-sm); }
.selected-fleet-info { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: #ccc; }
.selected-fleet-info .highlight { color: var(--accent-color); font-weight: bold; }
.selected-left { display: flex; flex-direction: column; gap: 2px; }
.eta-text { font-size: 0.7rem; color: #888; font-family: var(--font-mono); }

.delay-row { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.delay-row .label { font-size: 0.75rem; color: #888; }
.fleet-ops { display: flex; gap: 4px; }

.btn-sm { padding: 2px 6px; font-size: 0.7rem; height: 22px; }

.sep { width: 1px; height: 16px; background: #444; margin: 0 4px; }
.speed-btn { width: 30px; padding: 0; }
.speed-btn.active { background: var(--accent-color); color: #000; border-color: var(--accent-color); font-weight: bold; }

/* Overlays */
.overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 50;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.overlay-content {
    background: var(--secondary-bg); border: 1px solid var(--border-color);
    padding: 12px; border-radius: var(--radius-md); text-align: center;
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: var(--shadow-modal); min-width: 250px;
}
.overlay-title { font-family: var(--font-header); color: #fff; font-size: 0.9rem; font-weight: bold; }
.overlay-timer { font-family: var(--font-mono); font-size: 2rem; color: var(--accent-color); font-weight: bold; }

/* Fleet Type Selector */
.fleet-type-selector {
    display: flex; gap: 10px; justify-content: center; margin-bottom: 5px;
}
.type-option input { display: none; }
.type-btn {
    padding: 6px 12px; border-radius: 4px; font-size: 0.8rem; cursor: pointer;
    border: 1px solid #444; background: rgba(0,0,0,0.3); color: #888;
    transition: all 0.2s;
}
.type-option input:checked + .type-btn.ally {
    background: rgba(51, 221, 136, 0.2); border-color: #33dd88; color: #33dd88;
}
.type-option input:checked + .type-btn.foe {
    background: rgba(255, 85, 85, 0.2); border-color: #ff5555; color: #ff5555;
}

/* Roller Modal Styles */
.roller-content { width: 280px; }
.roller-container {
    display: flex; justify-content: center; align-items: center; gap: 5px;
    height: 150px; background: #000; border-radius: 6px; border: 1px solid #333;
    position: relative; overflow: hidden;
}
.roller-container::before {
    content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 30px; margin-top: -15px;
    background: rgba(255, 153, 0, 0.1); border-top: 1px solid var(--accent-color); border-bottom: 1px solid var(--accent-color);
    pointer-events: none; z-index: 10;
}
.roller-col {
    height: 100%; width: 60px; overflow-y: scroll; scroll-behavior: smooth;
    scrollbar-width: none; -ms-overflow-style: none;
    display: flex; flex-direction: column; align-items: center;
    scroll-snap-type: y mandatory;
}
.roller-col::-webkit-scrollbar { display: none; }
.roller-item {
    height: 30px; width: 100%; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 1.1rem; color: #666;
    scroll-snap-align: center; cursor: pointer; flex-shrink: 0;
}
.roller-item.selected { color: var(--accent-color); font-weight: bold; font-size: 1.3rem; }
.roller-pad { height: 60px; flex-shrink: 0; } /* Padding to center first/last items */
.roller-sep { font-size: 1.2rem; color: #444; font-weight: bold; padding-bottom: 3px; }

.modal-content { text-align: left; }
.modal-inputs { display: flex; flex-direction: column; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }

/* --- BOT: DASHBOARD --- */
.bot-dashboard {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
    height: 160px;
}
.dash-panel { 
    display: flex; flex-direction: column; 
    background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); 
    padding: 4px; border: 1px solid var(--border-light-color);
    max-height: 160px; /* Ensure fixed height for scroll */
}
.dash-header { font-size: 0.75rem; color: #aaa; text-align: center; border-bottom: 1px solid var(--border-color); padding-bottom: 2px; margin-bottom: 2px; text-transform: uppercase; font-family: var(--font-header); }
.dash-list { 
    flex-grow: 1; overflow-y: auto; /* Enable scroll */
    display: flex; flex-direction: column; gap: 2px; 
    padding-right: 2px; /* Space for scrollbar */
}

/* Custom Scrollbar for Dash List */
.dash-list::-webkit-scrollbar { width: 4px; }
.dash-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.dash-list::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.fleet-item, .hit-item {
    display: flex; align-items: center; gap: 6px; padding: 2px 4px; /* Reduced padding */
    background: rgba(255,255,255,0.03); border-radius: var(--radius-sm); font-size: 0.7rem; /* Smaller font */
    cursor: pointer; border: 1px solid transparent; transition: background 0.2s;
    flex-shrink: 0; /* Prevent shrinking */
}
.fleet-item:hover { background: rgba(255,255,255,0.06); }
.fleet-item.selected { border-color: var(--accent-color); background: rgba(255, 153, 0, 0.1); }
.fleet-item.ally .icon, .hit-item.ally .icon { color: #33dd88; }
.fleet-item.foe .icon, .hit-item.foe .icon { color: #ff5555; }
.hit-item .name { 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; 
}
.hit-item .timer { 
    margin-left: auto; font-family: var(--font-mono); color: #fff; font-size: 0.7rem;
    white-space: nowrap; /* Prevent wrapping */
}

.snipe-content {
    flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); padding: 4px;
}
#snipe-timer { font-size: 1rem; font-family: var(--font-mono); font-weight: bold; color: #fff; }
.snipe-details { font-size: 0.7rem; color: #888; text-align: center; margin-top: 2px; }

/* --- FOOTER --- */
.footer-controls {
    display: flex; gap: 8px; padding: 8px;
    background: var(--secondary-bg); border-radius: var(--radius-md); border: 1px solid var(--border-color);
    position: sticky; bottom: 0; z-index: 10;
}
.footer-controls .btn { flex: 1; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; padding: 8px; }

/* Mobile */
@media (max-width: 550px) {
    .top-setup { grid-template-columns: 1fr; }
    .setup-col { margin-bottom: 6px; }
    .bot-dashboard { grid-template-columns: 1fr; height: auto; }
    .dash-panel { height: 120px; }
    .selected-fleet-info { flex-direction: column; gap: 4px; align-items: flex-start; }
    .fleet-ops { width: 100%; justify-content: space-between; }
}

/* --- Basic Siege Calculator --- */
.basic-siege-calc {
    padding: 20px;
    color: var(--text-color);
    max-width: 480px;
    margin: 0 auto;
    font-family: var(--font-body);
}

.basic-siege-calc .calc-header {
    text-align: center;
    margin-bottom: 25px;
}

.basic-siege-calc h3 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.basic-siege-calc .subtitle {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.basic-siege-calc .calc-body {
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.9), rgba(20, 20, 25, 0.95));
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.basic-siege-calc .form-row {
    display: flex;
    gap: 15px;
}

.basic-siege-calc .form-group {
    margin-bottom: 20px;
    flex: 1;
}

.basic-siege-calc label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-color-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.basic-siege-calc .hp-preview {
    font-size: 0.8rem;
    color: var(--accent-color);
    text-align: right;
    margin-top: 6px;
    font-family: var(--font-mono);
}

.basic-siege-calc .btn.full-width {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.basic-siege-calc .btn.full-width:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Results Grid */
.basic-siege-calc .results-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-light-color);
    animation: fadeIn 0.4s ease-out;
}
.basic-siege-calc .results-section.hidden { display: none; }

.basic-siege-calc .result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.basic-siege-calc .result-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid transparent;
    transition: background 0.2s;
}

.basic-siege-calc .result-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.basic-siege-calc .result-card.highlight {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent-color);
    grid-column: span 2; /* Time takes full width */
}

.basic-siege-calc .result-card .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.basic-siege-calc .result-card .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.basic-siege-calc .result-card.highlight .value {
    color: var(--accent-color);
    font-size: 1.4rem;
}

/* Warning Box */
.basic-siege-calc .warning-box {
    margin-top: 20px;
    background: rgba(255, 60, 60, 0.1);
    border-left: 4px solid #ff4444;
    padding: 12px 15px;
    border-radius: 4px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.basic-siege-calc .warning-box.hidden { display: none; }

.basic-siege-calc .warning-icon {
    font-size: 1.5rem;
}

.basic-siege-calc .warning-text strong {
    display: block;
    color: #ff6666;
    font-size: 0.9rem;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.basic-siege-calc .warning-text p {
    color: #ffaaaa;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}



/* --- FOOTER --- */
.footer-controls {
    display: flex; gap: 8px; padding: 8px;
    background: var(--secondary-bg); border-radius: var(--radius-md); border: 1px solid var(--border-color);
    position: sticky; bottom: 0; z-index: 10;
}
.footer-controls .btn { flex: 1; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; padding: 8px; }

/* Mobile */
@media (max-width: 550px) {
    /* --- Advanced Siege Calc: 3-Column Compact Grid --- */
    .top-setup { 
        grid-template-columns: 1fr 1fr 1fr; 
        gap: 2px; 
    }
    .bot-dashboard { 
        grid-template-columns: 1fr 1fr 1fr;
        height: auto;
        gap: 2px;
    }
    
    /* Compact Columns */
    .setup-col { margin-bottom: 0; gap: 2px; }
    
    /* Headers: Small & Tight */
    .section-header {
        font-size: 0.6rem;
        padding-bottom: 2px;
        margin-bottom: 2px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* Input Stacks */
    .input-stack { gap: 2px; }
    .input-group { gap: 2px; }
    
    /* Input Labels: Ultra Small */
    .input-group label {
        font-size: 0.55rem;
        width: auto;
    }

    /* Form Elements: Ultra Compact */
    .app-input.compact, .app-select.compact {
        padding: 0 4px;
        font-size: 0.7rem;
        height: 20px;
        line-height: 20px;
    }
    
    /* Ensure div triggers look like inputs */
    div.app-select {
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        display: flex;
        align-items: center;
    }
    
    /* Dashboard Lists */
    .dash-panel { height: 110px; padding: 2px; }
    .dash-header { font-size: 0.6rem; padding-bottom: 1px; margin-bottom: 1px; }
    
    .fleet-item, .hit-item {
        font-size: 0.6rem;
        padding: 0 2px;
        height: 18px;
    }
    .hit-item .name { max-width: 50px; }
    
    /* Mid Battle */
    .mid-battle { gap: 4px; }
    .hp-area { padding: 4px; }
    .hp-label { font-size: 0.65rem; }
    .hp-value { font-size: 0.75rem; }
    
    .logs-area { height: 110px; }
    .event-log { font-size: 0.6rem; }
    .log-entry { padding: 0; }

    .controls-area { padding: 4px; gap: 4px; }
    .selected-fleet-info { flex-direction: column; gap: 2px; align-items: flex-start; font-size: 0.7rem; }
    .fleet-ops { width: 100%; justify-content: space-between; gap: 2px; }
    .btn-sm { font-size: 0.6rem; height: 20px; padding: 0 4px; }
    
    /* Delay Row - Stacked Layout (Label Top, Buttons Bottom) */
    /* Delay Row - Grouped Layout (Label Top / Buttons Bottom) */
    .delay-row { 
        display: flex !important; 
        flex-direction: row !important; 
        justify-content: space-between !important; 
        align-items: flex-start !important;
        background: transparent !important;
        height: auto !important;
        padding: 4px 0;
        width: 100%;
    }

    .control-group {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 2px !important;
    }
    .control-group.delay-metrics { align-items: flex-start !important; } /* Delay Left */
    .control-group.speed-metrics { align-items: flex-end !important; }   /* Speed Right */

    .control-group .label { 
        font-size: 0.65rem !important; 
        font-weight: bold;
        color: #888;
        margin-bottom: 2px !important;
        width: auto !important;
        text-align: center;
    } 
    
    .btn-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 2px !important;
    }
    
    /* Buttons */
    .delay-row button[data-action="delay"],
    .delay-row .speed-btn {
        margin: 0 !important;
    }
    
    /* --- Basic Siege Calc: FORCE Centering (Flex Method) --- */
    .basic-siege-calc {
        padding: 0.5em; 
        width: 98%; 
        max-width: none;
        margin: 0 auto;
    }
    
    .basic-siege-calc .calc-body {
        width: 100%; 
        padding: 15px 10px; 
    }

    /* Flex Centering for Form Groups */
    .basic-siege-calc .form-group {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important; /* Centers items horizontally */
        justify-content: center !important;
        text-align: center !important;
        width: 100%;
    }
    
    .basic-siege-calc label { 
        text-align: center !important; 
        width: 100% !important; 
    }
    
    .basic-siege-calc input.app-input,
    .basic-siege-calc .app-select {
        text-align: center !important;
        margin: 0 auto !important;
        width: 80% !important; /* width to nice size but centered */
        max-width: 250px;
    }
    .basic-siege-calc input[type="number"] {
        text-align: center !important;
        padding-left: 0 !important;
    }

    /* Ensure trigger div is visible using same logic */
    .basic-siege-calc #basic-structure-trigger {
        width: 80% !important;
        max-width: 250px;
        height: 35px; /* Comfortable touch size */
        background: rgba(0,0,0,0.3);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        margin-bottom: 5px;
        display: flex;
        justify-content: space-between; /* Text left, arrow right inside the box */
        align-items: center;
        padding: 0 15px; 
        position: relative;
    }
    .basic-siege-calc #basic-structure-trigger span:first-child {
         flex-grow: 1; text-align: center; /* Center text inside box */
    }
    .basic-siege-calc #basic-structure-trigger span:last-child {
        margin-left: 10px; 
    }

    /* --- Siege Mode Selector: Constraint --- */
    .siege-mode-selector {
        height: auto;
        max-height: 80vh;
        width: 95%;
        margin: 20px auto;
        padding: 10px;
        display: block;
        overflow-y: auto;
    }
    .mode-card {
        margin-bottom: 15px;
        padding: 15px;
    }
}

/* --- Custom Overlay for Stacking --- */
.custom-selector-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999; /* Higher than normal modal */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.structure-select-modal {
    width: 320px;
    max-width: 95%;
    background: #1a1b20;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    display: flex; flex-direction: column;
    max-height: 70vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.structure-select-header {
    padding: 12px;
    background: rgba(var(--accent-rgb), 0.15);
    border-bottom: 1px solid var(--accent-color);
    font-family: var(--font-header);
    text-align: center;
    font-weight: bold;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.structure-select-list {
    overflow-y: auto;
    padding: 5px 0;
}

.structure-group-label {
    padding: 8px 15px;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.structure-option {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #ddd;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: all 0.2s;
}
.structure-option:hover { background: rgba(255,255,255,0.08); color: #fff; }
.structure-option.selected { 
    background: rgba(var(--accent-rgb), 0.1); 
    color: var(--accent-color);
    font-weight: bold;
    border-left: 3px solid var(--accent-color);
}

.basic-siege-calc select.app-select optgroup {
    color: var(--accent-color);
    background: #1a1a1a;
    font-weight: bold;
}
.basic-siege-calc select.app-select option {
    color: #fff;
    background: #000;
}

.basic-siege-calc .hp-preview {
    font-size: 0.75rem;
    color: var(--accent-color);
    text-align: right;
    margin-top: 2px;
    font-family: var(--font-mono);
}

.basic-siege-calc .btn.full-width {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    margin-top: 8px;
    /* Standard primary button style is handled by .btn-primary class in HTML */
}

/* Results Grid */
.basic-siege-calc .results-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light-color);
    animation: fadeIn 0.3s ease-out;
}
.basic-siege-calc .results-section.hidden { display: none; }

.basic-siege-calc .result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.basic-siege-calc .result-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid transparent;
}

.basic-siege-calc .result-card.highlight {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent-color);
    grid-column: span 2;
}

.basic-siege-calc .result-card .label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.basic-siege-calc .result-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.basic-siege-calc .result-card.highlight .value {
    color: var(--accent-color);
    font-size: 1.2rem;
}

/* Warning Box */
.basic-siege-calc .warning-box {
    margin-top: 15px;
    background: rgba(255, 60, 60, 0.1);
    border-left: 3px solid #ff4444;
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.basic-siege-calc .warning-box.hidden { display: none; }

.basic-siege-calc .warning-icon {
    font-size: 1.2rem;
}

.basic-siege-calc .warning-text strong {
    display: block;
    color: #ff6666;
    font-size: 0.8rem;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.basic-siege-calc .warning-text p {
    color: #ffaaaa;
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mode Selection (Sketch-Based Layout) --- */
.siege-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.mode-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-color: #666;
}

/* Header Row: Image + Title */
.card-header-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.mode-image-placeholder {
    width: 60px;
    height: 60px;
    background: #222;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.mode-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mode-card h3 {
    font-family: var(--font-header);
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 0;
    font-weight: bold;
    white-space: nowrap; /* Ensure single line */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Body Text */
.card-body-text {
    margin-bottom: 15px;
    padding: 0 5px;
}

.card-body-text p {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Buttons */
/*.mode-card .btn {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    background: #000;
    padding: 4px;
}*/

.basic-siege-calc .hp-preview {
    font-size: 0.75rem;
    color: var(--accent-color);
    text-align: right;
    margin-top: 2px;
    font-family: var(--font-mono);
}

.basic-siege-calc .btn.full-width {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    margin-top: 8px;
    /* Standard primary button style is handled by .btn-primary class in HTML */
}

/* Results Grid */
.basic-siege-calc .results-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light-color);
    animation: fadeIn 0.3s ease-out;
}
.basic-siege-calc .results-section.hidden { display: none; }

.basic-siege-calc .result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.basic-siege-calc .result-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid transparent;
}

.basic-siege-calc .result-card.highlight {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent-color);
    grid-column: span 2;
}

.basic-siege-calc .result-card .label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.basic-siege-calc .result-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.basic-siege-calc .result-card.highlight .value {
    color: var(--accent-color);
    font-size: 1.2rem;
}

/* Warning Box */
.basic-siege-calc .warning-box {
    margin-top: 15px;
    background: rgba(255, 60, 60, 0.1);
    border-left: 3px solid #ff4444;
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.basic-siege-calc .warning-box.hidden { display: none; }

.basic-siege-calc .warning-icon {
    font-size: 1.2rem;
}

.basic-siege-calc .warning-text strong {
    display: block;
    color: #ff6666;
    font-size: 0.8rem;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.basic-siege-calc .warning-text p {
    color: #ffaaaa;
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mode Selection (Sketch-Based Layout) --- */
.siege-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.mode-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-color: var(--accent-color); /* Hover border lights up */
}

/* Header Row: Image + Title */
.card-header-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.mode-image-placeholder {
    width: 60px;
    height: 60px;
    background: #222;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.mode-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mode-card h3 {
    font-family: var(--font-header);
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 0;
    font-weight: bold;
    white-space: nowrap; /* Ensure single line */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Body Text */
.card-body-text {
    margin-bottom: 15px;
    padding: 0 5px;
}

.card-body-text p {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Buttons */
.mode-card .btn {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    /* Removed background: #000 override to let btn-primary work */
}

.basic-siege-calc .hp-preview {
    font-size: 0.75rem;
    color: var(--accent-color);
    text-align: right;
    margin-top: 2px;
    font-family: var(--font-mono);
}

.basic-siege-calc .btn.full-width {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    margin-top: 8px;
    /* Standard primary button style is handled by .btn-primary class in HTML */
}

/* Results Grid */
.basic-siege-calc .results-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light-color);
    animation: fadeIn 0.3s ease-out;
}
.basic-siege-calc .results-section.hidden { display: none; }

.basic-siege-calc .result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.basic-siege-calc .result-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid transparent;
}

.basic-siege-calc .result-card.highlight {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent-color);
    grid-column: span 2;
}

.basic-siege-calc .result-card .label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.basic-siege-calc .result-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.basic-siege-calc .result-card.highlight .value {
    color: var(--accent-color);
    font-size: 1.2rem;
}

/* Warning Box */
.basic-siege-calc .warning-box {
    margin-top: 15px;
    background: rgba(255, 60, 60, 0.1);
    border-left: 3px solid #ff4444;
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.basic-siege-calc .warning-box.hidden { display: none; }

.basic-siege-calc .warning-icon {
    font-size: 1.2rem;
}

.basic-siege-calc .warning-text strong {
    display: block;
    color: #ff6666;
    font-size: 0.8rem;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.basic-siege-calc .warning-text p {
    color: #ffaaaa;
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

/* Locked / Premium Card Specifics - Matching Corp Management (tools.css) */
.mode-card.locked-premium {
    position: relative;
    cursor: pointer;
    border-color: #444;
}

.mode-card.locked-premium:hover {
    border-color: var(--accent-color); /* Ensure locked card also lights up on hover */
}

/* Dim the content inside the locked card */
.mode-card.locked-premium .card-header-row,
.mode-card.locked-premium .card-body-text,
.mode-card.locked-premium .btn {
    opacity: 0.3;
    filter: grayscale(100%);
    pointer-events: none; /* Prevent interaction with inner elements */
}

/* Lock Icon in top-right (::before) */
.mode-card.locked-premium::before {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
    z-index: 5;
    opacity: 0.8;
}

/* Unlock Button/Badge in center (::after) */
.mode-card.locked-premium::after {
    content: 'UNLOCK';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1.5px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    pointer-events: none; /* Allow click to pass through to card container */
}

.mode-card.locked-premium:hover::after {
    background-color: var(--accent-color);
    color: #000;
    box-shadow: 0 0 20px rgba(var(--accent-color-rgb), 0.4);
    transform: translate(-50%, -50%) scale(1.05);
}

/* Hide the manual lock icon div since we use ::before now */
.mode-card.locked-premium .lock-icon {
    display: none;
}

/* START FIX: Remove redundant padlock on the button itself (keep only card top-right) */
.mode-card.locked-premium .btn-locked::before {
    display: none;
}
/* END FIX */

/* Unlocked Premium State */
.mode-card.unlocked {
    background: var(--secondary-bg);
}
.mode-card.unlocked h3 {
    color: var(--text-color); /* Standard text color */
    background: none;
    -webkit-text-fill-color: initial;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .siege-mode-selector {
        padding: 10px;
    }
    .card-header-row {
        gap: 10px;
    }
    .mode-card h3 {
        font-size: 1rem;
    }
}

/* --- Add/Edit Fleet Modal Specifics --- */
#add-fleet-modal .overlay-content {
    width: 90% !important;
    max-width: 600px; /* Increased cap */
    min-width: unset; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
    border: 1px solid var(--border-color);
}