/**
 * ============================================================================
 * CODEX VOLO ET BELLUM - COMPONENT UPGRADE STATION CSS
 * Leonardo da Vinci Parchment Workshop & Enhancement Blueprint Style
 * Author: Yura (Senior Multi-Disciplinary Game Engineer)
 * ============================================================================
 */

/* Modal Overlay & Base Container */
#component-upgrade-modal.modal-overlay {
    padding: 6px 16px !important;
}

.upgrade-station-modal {
    width: 1260px !important;
    max-width: 96% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
}

.upgrade-parchment-sheet {
    background: #f4ecd8 url('assets/deckle-paper.jpg') repeat;
    border: 3px double #8c5d2e;
    border-radius: 10px;
    padding: 20px 28px;
    box-shadow: inset 0 0 40px rgba(106, 68, 30, 0.35);
    position: relative;
    color: #2b1d0c;
    font-family: 'Cinzel', 'Georgia', serif;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 14px;
    box-sizing: border-box;
    justify-content: space-between;
}

/* Header */
.upgrade-header {
    border-bottom: 2px solid #8c5d2e;
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center; /* Symmetrical center alignment */
}

.upgrade-title-group {
    display: flex;
    flex-direction: column;
}

.upgrade-subtitle {
    font-size: 13px;
    letter-spacing: 2.5px;
    color: #8c5d2e;
    font-weight: 700;
}

.upgrade-title {
    margin: 3px 0 0 0;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #3d240f;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.upgrade-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 10;
}

.upgrade-source-badge {
    font-size: 18.5px; /* Scaled +50% from 12.5px */
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 0 24px; /* Scaled +50% from 16px */
    height: 57px; /* Scaled +50% from 38px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2a1a08;
    color: #e6c587;
    border: 2px solid #c9933b;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(201, 147, 59, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    white-space: nowrap;
}

.upgrade-close-btn {
    width: 57px; /* Scaled +50% from 38px */
    height: 57px; /* Scaled +50% from 38px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #fdfbf7 0%, #f3ece0 100%);
    border: 2px solid #8c5d2e;
    border-radius: 8px;
    color: #5a3814; /* Tanda close button warna cokelat per instruksi pengguna */
    font-size: 38px; /* Scaled +50% from 26px */
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(90, 56, 22, 0.18), inset 0 0 8px rgba(140, 93, 46, 0.1);
    box-sizing: border-box;
    padding: 0;
}

.upgrade-close-btn:hover {
    background: #5a3814;
    border-color: #3b230f;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(90, 56, 22, 0.35);
}

/* 2-Column Split Grid */
.upgrade-split-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

/* Left Column: 3D Viewport & Identity */
.upgrade-left-col {
    background: rgba(40, 26, 12, 0.06);
    border: 1.5px solid #ab7a4e;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    box-shadow: inset 0 0 16px rgba(70, 44, 18, 0.12);
    min-height: 0;
    box-sizing: border-box;
}

.upgrade-viewport-container {
    width: 100%;
    height: 270px;
    flex: 1 1 auto;
    min-height: 270px;
    margin-bottom: 12px;
    background: #0e1014 !important;
    border: 2px solid #8c5d2e;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.95), 0 4px 12px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    flex-shrink: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
}

.upgrade-viewport-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #0e1014 !important;
    cursor: grab;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.upgrade-viewport-canvas:active {
    cursor: grabbing;
}

.upgrade-fx-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    background: transparent !important;
}

.upgrade-flash-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0 !important;
    display: none !important;
    visibility: hidden !important;
    z-index: -1;
}

.upgrade-viewport-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    z-index: 2;
}

.upgrade-part-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto 0;
    text-align: center;
    width: 100%;
    display: none !important; /* Disembunyikan: ga usah ada tulisan itu */
}

.upgrade-part-name {
    margin: 0 0 6px 0;
    font-size: 19px;
    font-weight: 800;
    color: #2b1708;
    text-align: center;
    line-height: 1.25;
}

.upgrade-part-type {
    font-size: 13px;
    color: #7d5024;
    font-style: italic;
    margin: 0;
}

/* Big Rank Transition Box */
.upgrade-rank-transition {
    width: 100%;
    box-sizing: border-box;
    background: #251609;
    border: 1px solid #c9933b;
    border-radius: 5px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.rank-badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rank-badge-label {
    font-size: 11px;
    color: #a88258;
    letter-spacing: 1.2px;
    margin-bottom: 3px;
}

.rank-badge-val {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 1.5px;
}

.rank-badge-val.current {
    color: #d1d5db;
}

.rank-badge-val.next {
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.rank-arrow {
    font-size: 22px;
    color: #c9933b;
    font-weight: bold;
}

/* Right Column: Stat Comparison & Requirements */
.upgrade-right-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

/* Stat Comparison Table */
.upgrade-stats-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid #ab7a4e;
    border-radius: 8px;
    padding: 18px 22px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.05);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}

.upgrade-stats-header {
    font-size: 17.8px; /* Scaled +15% from 15.5px */
    font-weight: 800;
    color: #5a3816;
    letter-spacing: 1.2px;
    border-bottom: 1.5px solid #d4b896;
    padding-bottom: 10px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

.upgrade-stat-list {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 8px;
    flex: 1;
    margin: auto 0;
}

.upgrade-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18.4px; /* Scaled +15% from 16px */
    padding: 8px 0;
    border-bottom: 1px dashed rgba(171, 122, 78, 0.35);
}

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

.upgrade-stat-label {
    font-weight: 700;
    color: #3b2817;
    letter-spacing: 0.5px;
    font-size: 17.8px; /* Scaled +15% from 15.5px */
}

.upgrade-stat-values {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 800;
    font-size: 19px; /* Scaled +15% from 16.5px */
}

.stat-val-old {
    color: #6b7280;
}

.stat-val-arrow {
    color: #92400e;
    font-size: 15px; /* Scaled +15% from 13px */
}

.stat-val-new {
    color: #15803d;
    font-weight: 900;
}

.stat-val-bonus {
    font-size: 14.5px; /* Scaled +15% from 12.5px */
    color: #047857;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 4px;
    padding: 3px 8px;
}

.stat-val-static {
    font-size: 18.4px;
    font-weight: 800;
    color: #4b5563;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Requirements Box (Shard & Chance) */
.upgrade-req-card {
    background: #251609;
    border: 1.5px solid #c9933b;
    border-radius: 8px;
    padding: 16px 20px;
    color: #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.7);
    flex-shrink: 0;
}

.upgrade-shard-cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.upgrade-shard-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upgrade-shard-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border: 1.5px solid #78350f;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px;
}

.upgrade-shard-texts {
    display: flex;
    flex-direction: column;
}

.upgrade-shard-name {
    font-size: 15px;
    font-weight: 800;
    color: #fef3c7;
    letter-spacing: 0.8px;
}

.upgrade-shard-stock {
    font-size: 12.5px;
    margin-top: 2px;
}

.upgrade-shard-stock.sufficient {
    color: #4ade80;
}

.upgrade-shard-stock.insufficient {
    color: #f87171;
}

/* Gold Requirement Block (Above Forge Action Button) */
.upgrade-gold-info {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #2a1608 0%, #150b04 100%);
    border: 1.5px solid #c9933b;
    border-radius: 8px;
    padding: 10px 18px;
    min-height: 48px;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 1px rgba(212, 175, 55, 0.4);
    flex-shrink: 0;
}

.upgrade-gold-texts {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.upgrade-gold-cost {
    font-size: 15.5px;
    font-weight: 800;
    color: #fde047;
    letter-spacing: 0.9px;
    font-family: 'Cinzel', serif;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(250, 204, 21, 0.3);
}

.upgrade-gold-stock {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.6px;
    font-family: 'Cinzel', 'Georgia', serif;
    padding: 4px 10px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.upgrade-gold-stock.sufficient {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.4);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(74, 222, 128, 0.15);
}

.upgrade-gold-stock.insufficient {
    color: #f87171;
    font-weight: 800;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(239, 68, 68, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(239, 68, 68, 0.2);
}

/* Requirements Box in Left Column */
.upgrade-left-col .upgrade-req-card {
    width: 100%;
    background: #251609;
    border: 1px solid #c9933b;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 12px 14px;
    box-sizing: border-box;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-left-col .upgrade-shard-cost-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.upgrade-left-col .upgrade-shard-info {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.45);
    border: 1.5px solid rgba(201, 147, 59, 0.55);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}

.upgrade-left-col .upgrade-shard-icon {
    width: 46px;
    height: 46px;
    border: 1.5px solid #ab7a4e;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.25);
}

.upgrade-left-col .upgrade-shard-texts {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    gap: 10px;
}

.upgrade-left-col .upgrade-shard-name {
    font-size: 15.5px;
    font-weight: 800;
    color: #fef3c7;
    letter-spacing: 0.8px;
    font-family: 'Cinzel', serif;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.upgrade-left-col .upgrade-shard-stock {
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 0;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.upgrade-left-col .upgrade-gold-info {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(148, 115, 67, 0.45);
    border-radius: 5px;
    padding: 5px 8px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box;
}

.upgrade-left-col .upgrade-gold-texts {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.upgrade-left-col .upgrade-gold-cost {
    font-size: 12.5px;
    font-weight: 800;
    color: #fef08a;
    letter-spacing: 0.5px;
    font-family: 'Cinzel', serif;
    white-space: nowrap;
}

.upgrade-left-col .upgrade-gold-stock {
    font-size: 11px;
    white-space: nowrap;
    margin-top: 0;
    flex-shrink: 0;
}

.upgrade-left-col .upgrade-warning-notice {
    display: none !important; /* Dihilangkan: keterangan di bawahnya ilangin aja */
}

/* Success Chance Meter */
.upgrade-chance-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upgrade-left-col .upgrade-chance-row {
    width: 100%;
    background: #251609;
    border: 1px solid #c9933b;
    border-bottom: 1px solid rgba(201, 147, 59, 0.4);
    border-radius: 6px 6px 0 0;
    padding: 10px 14px;
    box-sizing: border-box;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    margin: 0;
}

.upgrade-left-col .upgrade-rank-transition {
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    border-top: none;
    border-bottom: 1px solid rgba(201, 147, 59, 0.4);
    margin: 0;
    padding: 10px 14px;
}

.upgrade-chance-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
}

.chance-title {
    color: #d1d5db;
    letter-spacing: 1px;
    font-size: 13px;
    font-weight: 700;
}

.chance-value {
    color: #fbbf24;
    font-size: 15.5px;
    font-weight: 900;
    font-family: monospace;
}

.upgrade-chance-bar-bg {
    width: 100%;
    height: 10px;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.upgrade-chance-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #d97706, #fbbf24, #10b981);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Alchemy Warning Notice */
.upgrade-warning-notice {
    font-size: 9.5px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid #f59e0b;
    padding: 5px 8px;
    border-radius: 0 4px 4px 0;
    line-height: 1.35;
    font-family: 'Cinzel', 'Georgia', serif;
    transition: all 0.3s ease;
}

.upgrade-warning-notice.warning-high-risk {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border-left: 2px solid #ef4444;
    box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.1);
}

/* Action Button */
.upgrade-action-btn {
    width: 100%;
    padding: 17px 22px;
    min-height: 56px;
    background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
    color: #fff;
    border: 1.5px solid #fbbf24;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1.8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    text-transform: uppercase;
    flex-shrink: 0;
}

.upgrade-action-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
    border-color: #fde68a;
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.upgrade-action-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.upgrade-action-btn:disabled {
    background: #4b5563;
    border-color: #6b7280;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
    transform: none;
}

/* Banner Feedback (Toast) - Diperbesar 2X Lipat Sesuai Instruksi */
.upgrade-banner {
    position: absolute;
    top: 76px;
    left: 24px;
    right: 24px;
    margin: 0 auto;
    z-index: 50;
    max-width: 900px;
    width: calc(100% - 48px);
    box-sizing: border-box;
    padding: 16px 28px;
    border-radius: 12px;
    font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.35;
    text-align: center;
    display: none;
    pointer-events: none;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), inset 0 0 16px rgba(255, 255, 255, 0.15);
    animation: cuBannerPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cuBannerPop {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1.0);
    }
}

.upgrade-banner.success {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(16, 75, 38, 0.98) 0%, rgba(8, 42, 20, 0.98) 100%);
    border: 2.5px solid #4ade80;
    color: #f0fdf4;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 16px rgba(74, 222, 128, 0.5);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), inset 0 0 18px rgba(74, 222, 128, 0.3);
}

.upgrade-banner.failed {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(110, 20, 20, 0.98) 0%, rgba(55, 10, 10, 0.98) 100%);
    border: 2.5px solid #f87171;
    color: #fef2f2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 14px rgba(248, 113, 113, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), inset 0 0 18px rgba(248, 113, 113, 0.25);
}

.upgrade-banner.animating {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(88, 38, 8, 0.98) 0%, rgba(45, 18, 4, 0.98) 100%);
    border: 2.5px solid #fbbf24;
    color: #fff8db;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 12px rgba(251, 191, 36, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), inset 0 0 16px rgba(251, 191, 36, 0.25);
    animation: cuBannerPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards, cuBannerPulse 1.2s infinite alternate ease-in-out;
}

@keyframes cuBannerPulse {
    0% {
        border-color: #fbbf24;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), inset 0 0 16px rgba(251, 191, 36, 0.25);
    }
    100% {
        border-color: #f59e0b;
        box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(245, 158, 11, 0.4), inset 0 0 22px rgba(251, 191, 36, 0.4);
    }
}

@media (max-width: 600px) {
    .upgrade-banner {
        top: 66px;
        left: 12px;
        right: 12px;
        width: calc(100% - 24px);
        padding: 12px 16px;
        font-size: 18px;
        border-radius: 8px;
        letter-spacing: 0.5px;
    }
}

@keyframes cu-compositor-pulse {
    from { opacity: 0.82; }
    to { opacity: 1.0; }
}

/* ============================================================================
 * WORKBENCH & INSPECTOR INTEGRATION HOOKS
 * ============================================================================ */

/* Upgrade button on Workbench Tray Part Card */
.part-btn-upgrade {
    background: linear-gradient(180deg, #3d2514 0%, #1e1208 100%);
    border: 1px solid #c9a86a;
    color: #ffd700;
    height: 32px;
    width: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 4px;
    font-size: 15.5px;
    cursor: pointer;
    font-family: 'Cinzel', Georgia, serif;
    font-weight: bold;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.part-btn-upgrade:hover {
    background: linear-gradient(180deg, #5a381f 0%, #2e1c10 100%);
    border-color: #ffd700;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    transform: translateY(-1px);
}

.part-btn-upgrade:active {
    transform: translateY(1px);
}

/* Upgrade Level Badges on Component Cards (Hidden per User Instruction: Level already in Part Name) */
.part-upgrade-badge {
    display: none !important;
}

.part-upgrade-badge.rank-tier-b {
    color: #93c5fd;
    border-color: #3b82f6;
    background: #0f172a;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.35);
}

.part-upgrade-badge.rank-tier-a {
    color: #fef08a;
    border-color: #eab308;
    background: #231d04;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.4);
}

.part-upgrade-badge.rank-tier-s {
    color: #f472b6;
    border-color: #d946ef;
    background: #2a082e;
    box-shadow: 0 0 8px rgba(217, 70, 239, 0.5);
}

/* Secondary Button in Drone Component Inspector Tray */
.ci-action-tray {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ci-action-btn.upgrade {
    background: linear-gradient(180deg, #2b1708 0%, #170d05 100%);
    border: 1.2px solid #c9a86a;
    color: #e6c88b;
}

.ci-action-btn.upgrade:hover {
    background: linear-gradient(180deg, #42240d 0%, #201308 100%);
    border-color: #ffd700;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(201, 168, 106, 0.4);
    transform: translateY(-1px);
}

/* ============================================================================
 * DRAMATIC FORGE ANIMATIONS & SUSPENSE EFFECTS
 * ============================================================================ */

/* Flash Overlay States - Completely disabled & hidden to eliminate all white overlay flashing */
.upgrade-flash-overlay.flash-strike,
.upgrade-flash-overlay.flash-success,
.upgrade-flash-overlay.flash-failure,
.upgrade-flash-overlay.flash-tension {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    background: transparent !important;
    animation: none !important;
}

/* Screen Shakes on Viewport - Delegated 100% to internal Three.js Camera Shake */
.cu-shake-strike-1,
.cu-shake-strike-2,
.cu-shake-strike-3,
.cu-shake-failure {
    transform: none !important;
    animation: none !important;
}

@keyframes cu-anim-shake-1 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    20% { transform: translate3d(-3px, 2px, 0); }
    40% { transform: translate3d(3px, -2px, 0); }
    60% { transform: translate3d(-2px, 1px, 0); }
    80% { transform: translate3d(2px, -1px, 0); }
}

@keyframes cu-anim-shake-2 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    15% { transform: translate3d(-4px, 3px, 0); }
    35% { transform: translate3d(4px, -3px, 0); }
    55% { transform: translate3d(-3px, 2px, 0); }
    75% { transform: translate3d(2px, -2px, 0); }
}

@keyframes cu-anim-shake-3 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10% { transform: translate3d(-6px, 4px, 0); }
    25% { transform: translate3d(5px, -4px, 0); }
    40% { transform: translate3d(-4px, 3px, 0); }
    60% { transform: translate3d(4px, -2px, 0); }
    80% { transform: translate3d(-2px, 1px, 0); }
}

@keyframes cu-anim-shake-fail {
    0%, 100% { transform: translate3d(0, 0, 0); }
    15% { transform: translate3d(-8px, 0, 0); }
    30% { transform: translate3d(7px, 0, 0); }
    45% { transform: translate3d(-5px, 0, 0); }
    60% { transform: translate3d(4px, 0, 0); }
    75% { transform: translate3d(-2px, 0, 0); }
}

@keyframes cu-suspense-breathe {
    from { opacity: 0.15; }
    to { opacity: 0.55; }
}

/* Rank Pop Celebration Animation */
.rank-badge-val.rank-pop {
    animation: cu-anim-rank-pop 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes cu-anim-rank-pop {
    0% { transform: scale(1); }
    40% { 
        transform: scale(1.65); 
        color: #ffffff; 
        text-shadow: 0 0 20px #fbbf24, 0 0 40px #f59e0b, 0 0 60px #d97706; 
    }
    100% { 
        transform: scale(1); 
        color: #fbbf24; 
        text-shadow: 0 0 10px rgba(251, 191, 36, 0.8); 
    }
}

/* Disable 2D FX Canvas & any overlays during forging to eliminate white blinking/flicker */
.upgrade-station-modal.is-forging .upgrade-fx-canvas {
    display: none !important;
    opacity: 0 !important;
}

/* Modal Tension Glow while Forging - Zero Transition to prevent Android WebView composite flashing */
.upgrade-station-modal.is-forging .upgrade-parchment-sheet {
    box-shadow: inset 0 0 50px rgba(180, 83, 9, 0.45), 0 0 30px rgba(245, 158, 11, 0.3);
    transition: none !important;
}

.upgrade-station-modal.is-success .upgrade-parchment-sheet {
    box-shadow: inset 0 0 50px rgba(16, 185, 129, 0.5), 0 0 40px rgba(52, 211, 153, 0.4);
    transition: none !important;
}

.upgrade-station-modal.is-failed .upgrade-parchment-sheet {
    box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.4), 0 0 30px rgba(220, 38, 38, 0.3);
    transition: none !important;
}

/* Suspense Pulsing on Chance Bar (compositor-only opacity prevents main-thread box-shadow repaints) */
.upgrade-chance-bar-fill.suspense-pulse {
    animation: cu-chance-pulse 0.4s infinite alternate ease-in-out;
}

@keyframes cu-chance-pulse {
    from { opacity: 0.72; }
    to { opacity: 1.0; }
}

/* Action button states during dramatic forging */
.upgrade-action-btn.btn-forging {
    background: linear-gradient(180deg, #78350f 0%, #451a03 100%) !important;
    border-color: #fbbf24 !important;
    color: #fef3c7 !important;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.55);
    animation: cu-btn-forging-pulse 0.7s infinite alternate ease-in-out;
    cursor: wait !important;
}

.upgrade-action-btn.btn-success {
    background: linear-gradient(180deg, #059669 0%, #065f46 100%) !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.6) !important;
}

.upgrade-action-btn.btn-failed {
    background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 100%) !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(248, 113, 113, 0.5) !important;
}

@keyframes cu-btn-forging-pulse {
    from { opacity: 0.85; }
    to { opacity: 1.0; }
}
