/* === ui_hud.css === */
/* ui_hud.css - Top HUD Bar, Stage Info, and Global Controls */

#settings-btn {
    z-index: 5;
    background: none;
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-size: 10px;
    cursor: pointer;
    width: 18px; 
    height: 18px; 
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
    background: rgba(0,0,0,0.3);
}

#settings-btn:hover {
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    transform: scale(1.1);
    color: #fff;
}

#restart-btn-top, #game-pause-btn {
    min-width: 45px;
    height: 16px;
    background: #1a0000;
    color: #ff4500;
    border: 1px solid #8b0000;
    border-radius: 2px;
    font-family: 'Cinzel', serif;
    font-size: 8px;
    padding: 0 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#restart-btn-top {
    width: 136px;
    height: 14.5px;
    padding: 10px 5px;
    border: 1px solid #8b0000;
}

#restart-btn-top:hover, #game-pause-btn:hover {
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    color: #fff;
    transform: scale(1.05);
}

/* Sleeping Statue Curse Widget — bottom-left corner of game canvas */
#sleeping-statue-widget {
    position: absolute;
    bottom: 2%;
    left: 6px;
    z-index: 10;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: clamp(1px, 0.37vw, 2px) clamp(2px, 0.74vw, 4px);
    border-radius: 6px;
    border: 1px solid rgba(148, 0, 211, 0.30);
    background: rgba(8, 0, 14, 0.60);
    pointer-events: auto;
    backdrop-filter: blur(2px);
}
#sleeping-statue-widget:hover {
    border-color: rgba(200, 80, 255, 0.65);
    box-shadow: 0 0 10px rgba(148, 0, 211, 0.4);
}
#sleeping-statue-icon {
    display: block;
    height: clamp(28px, 8.15vw, 44px);
    width: clamp(28px, 8.15vw, 44px);
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 0 5px rgba(148,0,211,0.4));
    transition: filter 0.3s;
}
#sleeping-statue-icon[data-form="1"] { filter: hue-rotate(-15deg) saturate(1.2) drop-shadow(0 0 6px rgba(255,140,80,0.55)); }
#sleeping-statue-icon[data-form="2"] { filter: hue-rotate(-30deg) saturate(1.35) drop-shadow(0 0 7px rgba(255,80,80,0.65)); }
#sleeping-statue-icon[data-form="3"] { filter: hue-rotate(-50deg) saturate(1.5) brightness(1.1) drop-shadow(0 0 9px rgba(255,30,30,0.8)); }
.sleeping-statue-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}
#sleeping-statue-name {
    font-size: clamp(5px, 1.39vw, 7.5px);
    text-align: center;
    color: #ffb3b3;
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    font-family: 'Cinzel', serif;
    font-weight: 700;
}
.gstat-row {
    display: none; /* hidden in compact mode; visible in tooltip */
}
.gstat-ally  { color: #ff8888; }
.gstat-enemy { color: #ffaa44; }

/* Cursed Status — bottom-right corner of game canvas, same scale as sleeping-statue widget */
#cursed-status-container {
    position: absolute;
    bottom: 2%;
    right: 6px;
    z-index: 10;
    cursor: default;
    padding: clamp(1px, 0.37vw, 2px) clamp(2px, 0.74vw, 4px);
    background: rgba(8, 0, 14, 0.60);
    border: 1px solid rgba(148, 0, 211, 0.30);
    pointer-events: auto;
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: clamp(36px, 9.63vw, 52px);
}
#cursed-status-container:hover {
    border-color: rgba(200, 80, 255, 0.65);
    box-shadow: 0 0 10px rgba(148, 0, 211, 0.4);
}
/* Large PE icon inside cursed-status, mirrors sleeping-statue canvas height */
#cursed-status-icon {
    font-size: clamp(22px, 6.67vw, 36px);
    line-height: 1;
    display: block;
    width: clamp(28px, 8.15vw, 44px);
    height: clamp(28px, 8.15vw, 44px);
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(148,0,211,0.5));
    transition: filter 0.3s;
}
#cursed-status-icon[data-level="0"] { filter: grayscale(0.7) brightness(0.65) drop-shadow(0 0 3px rgba(100,100,100,0.5)); }
#cursed-status-icon[data-level="1"] { filter: hue-rotate(-30deg) saturate(1.2) drop-shadow(0 0 5px rgba(255,165,0,0.7)); }
#cursed-status-icon[data-level="2"] { filter: hue-rotate(-50deg) saturate(1.4) drop-shadow(0 0 7px rgba(255,69,0,0.8)); }
#cursed-status-icon[data-level="3"] { filter: hue-rotate(-70deg) saturate(1.6) brightness(1.1) drop-shadow(0 0 10px rgba(255,34,34,0.9)); animation: cursedPulse 1s infinite alternate; }
#cursed-status {
    font-size: clamp(5px, 1.39vw, 7.5px);
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    font-family: 'Cinzel', serif;
}
#cursed-status[data-level="0"] { color: #44dd88; }
#cursed-status[data-level="1"] { color: #ffa500; }
#cursed-status[data-level="2"] { color: #ff4500; }
#cursed-status[data-level="3"] { color: #ff2222; animation: cursedPulse 1s infinite alternate; }
/* Mini PE progress bar */
#curse-pe-bar {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}
#curse-pe-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s, background 0.4s;
    background: #44dd88;
}

@keyframes cursedPulse {
    from { text-shadow: 0 0 2px #ff0000; }
    to   { text-shadow: 0 0 8px #ff0000, 0 0 12px #ff4500; }
}

#game-tutorial-toggle-container {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 7px;
    color: #ff4500;
    height: 16px;
}

/* === ui_gauges.css === */
/* ui_gauges.css - Resource and Status Progress Bars */

#gauges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    width: 100%;
    height: clamp(24px, 5.93vw, 32px);
    gap: clamp(4px, 1.48vw, 8px);
    align-items: center;
    background: rgba(0,0,0,0.3);
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gauge-wrapper {
    display: flex;
    flex-direction: row; 
    align-items: center;
    gap: clamp(2px, 0.74vw, 4px);
    position: relative;
    height: clamp(18px, 4.44vw, 24px);
    min-width: 0;
    cursor: pointer;
}

.gauge-wrapper:hover .gauge-icon { transform: scale(1.2); }

.gauge-info {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 8px;
    font-weight: bold;
    color: #888;
    white-space: nowrap;
}

.gauge-icon { font-size: clamp(9px, 2.22vw, 12px); transition: transform 0.2s; }

.gauge-bar {
    flex: 1;
    height: clamp(12px, 2.96vw, 16px);
    background: #000;
    border: 1px solid #333;
    border-radius: 1px;
    position: relative;
    overflow: hidden;
}

.gauge-count {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: clamp(7px, 1.67vw, 9px);
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
    z-index: 5;
}

#se-gauge-fill { height: 100%; background: linear-gradient(90deg, #008ba3, #00e5ff); width: 100%; transition: width 0.3s; }
#portal-gauge-fill { height: 100%; background: linear-gradient(90deg, #4b0082, #9400d3); width: 0%; transition: width 0.3s; }
#rs-gauge-fill { height: 100%; background: linear-gradient(90deg, #b71c1c, #ff1744); width: 100%; transition: width 0.3s; }

/* Gauge Floating Numbers — positioned via JS with position:fixed */
.gauge-floating-num {
    position: fixed;
    font-size: 11px;
    font-weight: 900;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    text-shadow: 1px 1px 2px #000;
}
.gauge-floating-num.pop-up { animation: gaugePopUp 0.9s cubic-bezier(.2,.8,.2,1) forwards; }
.gauge-floating-num.pop-down { animation: gaugePopDown 0.9s cubic-bezier(.2,.8,.2,1) forwards; }
.gauge-floating-num.green { color: #00ff88; }
.gauge-floating-num.red { color: #ff1744; }

@keyframes gaugePopUp {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    10% { opacity: 1; transform: translateY(-8px) scale(1.05); }
    40% { transform: translateY(-28px) scale(1); opacity: 0.8; }
    100% { transform: translateY(-48px) scale(0.95); opacity: 0; }
}
@keyframes gaugePopDown {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    10% { opacity: 1; transform: translateY(8px) scale(1.05); }
    40% { transform: translateY(28px) scale(1); opacity: 0.8; }
    100% { transform: translateY(48px) scale(0.95); opacity: 0; }
}

/* === ui_control_panel.css === */
/* ui_control_panel.css - Bottom Action Hub Cards and Badges */

#bottom-main-ui {
    display: flex;
    flex: 1;
    width: 100%;
    gap: 6px;
    min-height: 0;
    padding-top: 6px;
    overflow: hidden;
}

#control-panel {
    flex: 0 0 45%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    background: linear-gradient(145deg, rgba(30, 25, 0, 0.8), rgba(20, 0, 0, 0.9));
    border: 2px solid #2a2010;
    padding: 4px;
    position: relative;
    overflow: visible;
}

/* Curse Pact card states + gauge */
#pact-card.locked { filter: grayscale(0.85) brightness(0.45); cursor: not-allowed; }
#pact-card.ready { box-shadow: 0 0 14px rgba(255, 0, 102, 0.9); animation: pactReadyPulse 1.2s infinite alternate; }
#pact-card.overflow { animation: pactOverflowShake 0.6s infinite; }
@keyframes pactReadyPulse {
    from { box-shadow: 0 0 6px rgba(255, 0, 102, 0.6); }
    to { box-shadow: 0 0 18px rgba(255, 0, 102, 1), 0 0 26px rgba(255, 80, 140, 0.6); }
}
@keyframes pactOverflowShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
}
#pact-card .pact-gauge {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(to top, rgba(255, 0, 80, 0.55), rgba(148, 0, 211, 0.25) 60%, transparent);
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.4s ease;
}
#pact-card .pact-stage-label {
    position: absolute;
    top: 2px; left: 0; right: 0;
    text-align: center;
    font-size: clamp(7px, 1.1vw, 11px);
    font-weight: 900;
    color: #ffcce0;
    text-shadow: 0 1px 2px #000, 0 0 4px rgba(255, 0, 102, 0.8);
    z-index: 3;
    pointer-events: none;
}
#pact-card .pact-penalty-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #d50000;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 160;
    box-shadow: 0 0 8px rgba(213, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    display: none;
}
#tba-card {
    filter: grayscale(1) brightness(0.4);
    cursor: not-allowed;
    border-color: #444 !important;
    color: #666 !important;
}
#tba-card .tba-label {
    position: relative;
    z-index: 2;
    font-size: clamp(8px, 1.2vw, 11px);
    font-weight: 900;
    color: #888;
    letter-spacing: 1px;
}

.tower-card {
    background: #0a0a0a;
    border: 1px solid #3e2723;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #ffd700;
    position: relative;
    padding: 1px;
    line-height: 1.1;
    min-width: 0;
}

.tower-card .card-icon {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: 0;
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.tower-card .card-icon img {
    width: 100%; height: 100%;
    object-fit: cover;
    image-rendering: auto;
    filter: drop-shadow(0 0 4px currentColor);
    transition: transform 0.2s;
}
.tower-card:hover .card-icon img { transform: scale(1.06); }
.tower-card .card-label { font-size: clamp(9px, 1.8vw, 14px); font-weight: bold; position: relative; z-index: 2; }
.tower-card .card-cost {
    font-size: clamp(8px, 1.3vw, 13px);
    font-weight: 700;
    opacity: 1;
    position: absolute;
    left: 0; right: 0; bottom: 2px;
    text-align: center;
    background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.4) 60%, transparent);
    padding: 6px 2px 2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.7);
    z-index: 2;
    pointer-events: none;
}
.tower-card .card-warning {
    z-index: 3;
}

.card-new-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff1744;
    color: #fff;
    font-size: 7px;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 160;
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    animation: newBadgePulse 1s infinite alternate;
    display: none; /* Hidden by default */
}

@keyframes newBadgePulse {
    from { transform: scale(0.9); box-shadow: 0 0 5px rgba(255, 23, 68, 0.6); }
    to { transform: scale(1.1); box-shadow: 0 0 12px rgba(255, 23, 68, 1); }
}

.tower-card:hover { 
    background: #1a1a1a; 
    transform: scale(1.05);
    border-color: #00e5ff; 
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    color: #fff;
    z-index: 150;
}
.tower-card.disabled { opacity: 0.7; cursor: not-allowed; }

.card-warning {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff1744;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* === ui_info_panel.css === */
/* ui_info_panel.css - Sacred Tablet (Info Panel) Enhanced UI */

#unit-info {
    flex: 1 1 55%;
    background: #050505 url('../images/bg/sacred_tablet_bg.webp') center/cover no-repeat;
    border: 2px solid #3e2723;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(4px, 1.2vw, 10px);
    color: #aaa;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
    text-align: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: tablet;
}

#unit-info::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.7) 75%, rgba(0,0,0,0.9) 100%);
    pointer-events: none;
    z-index: 0;
}
#unit-info > * { position: relative; z-index: 1; }

#unit-info.inspecting {
    border-color: var(--inspect-color, #ffd700);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.9), 0 0 15px var(--inspect-shadow, rgba(255, 215, 0, 0.3));
}

/* Content Fade-in Animation */
.info-content-fade {
    animation: infoFadeIn 0.4s ease-out forwards;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.5vw, 4px);
}

@keyframes infoFadeIn {
    from { opacity: 0; transform: translateY(8px); filter: blur(3px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ── Sacred Tablet (st-*) Redesign ── */
.st-shell {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: clamp(5px, 1.2vw, 9px);
    padding: clamp(6px, 1.4vw, 12px) clamp(8px, 1.6vw, 14px);
    box-sizing: border-box;
    animation: stFadeIn 0.35s ease-out forwards;
}

@keyframes stFadeIn {
    from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
    to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

.st-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--inspect-color, #d4a840);
    opacity: 0.7;
    pointer-events: none;
    filter: drop-shadow(0 0 3px currentColor);
}
.st-corner.tl { top: 3px;    left: 3px;    border-top: 1.5px solid;    border-left: 1.5px solid; }
.st-corner.tr { top: 3px;    right: 3px;   border-top: 1.5px solid;    border-right: 1.5px solid; }
.st-corner.bl { bottom: 3px; left: 3px;    border-bottom: 1.5px solid; border-left: 1.5px solid; }
.st-corner.br { bottom: 3px; right: 3px;   border-bottom: 1.5px solid; border-right: 1.5px solid; }

/* ── Default state ── */
.st-default-shell { justify-content: center; align-items: center; text-align: center; }
.st-default { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }
.st-default { gap: clamp(4px, 1vw, 8px); padding: clamp(4px, 1vw, 8px) 0; }
.st-sigil {
    font-family: 'Cinzel', serif;
    font-size: clamp(22px, 22cqi, 36px);
    color: #e6b855;
    text-shadow:
        0 0 18px rgba(212,168,64,0.7),
        0 0 6px rgba(255,230,150,0.45),
        0 2px 3px rgba(0,0,0,0.95);
    line-height: 1;
    animation: sigilGlow 3s infinite ease-in-out;
    margin-bottom: clamp(2px, 0.5vw, 4px);
}
@keyframes sigilGlow {
    0%,100% { opacity: 0.88; transform: scale(1);     filter: brightness(1); }
    50%     { opacity: 1;    transform: scale(1.06);  filter: brightness(1.15); }
}
.st-default-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(11px, 11cqi, 16px);
    font-weight: 900;
    color: #e8c170;
    letter-spacing: clamp(2px, 0.6vw, 5px);
    text-shadow:
        0 0 14px rgba(212,168,64,0.6),
        0 1px 0 rgba(0,0,0,0.95),
        0 2px 6px rgba(0,0,0,0.9),
        0 -1px 0 rgba(255,230,160,0.15);
    line-height: 1.1;
}
.st-default-sub {
    color: #b8a890;
    font-family: 'Cinzel', serif;
    font-size: clamp(6px, 5.5cqi, 9px);
    letter-spacing: clamp(3px, 0.8vw, 6px);
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.95);
    margin-top: 1px;
}
.st-rule {
    width: 75%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,168,64,0.55) 30%, rgba(255,230,150,0.7) 50%, rgba(212,168,64,0.55) 70%, transparent);
    margin: clamp(3px, 0.8vw, 6px) 0;
    box-shadow: 0 0 4px rgba(212,168,64,0.35);
}
.st-lore {
    color: #c8b89a;
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(7px, 6cqi, 10px);
    line-height: 1.55;
    max-width: 88%;
    font-style: italic;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.95);
    letter-spacing: 0.3px;
    quotes: '"' '"';
}
.st-hint {
    margin-top: clamp(3px, 0.7vw, 6px);
    font-size: clamp(6px, 5cqi, 8px);
    color: #8898b0;
    text-transform: uppercase;
    letter-spacing: clamp(2px, 0.5vw, 3px);
    font-weight: 700;
    opacity: 0.78;
    text-shadow: 0 1px 2px rgba(0,0,0,0.85);
}

/* ── Header (unit/shrine/enemy) ── */
.st-header {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 8px);
    width: 100%;
}
.st-header.centered {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: clamp(3px, 0.7vw, 6px);
}
.st-header.centered .st-header-text {
    align-items: center;
    text-align: center;
    width: 100%;
    gap: clamp(2px, 0.5vw, 4px);
}
.st-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(5px, 1.2vw, 9px);
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
}
.st-name-row .st-name {
    flex: 0 1 auto;
    min-width: 0;
}
.st-name-row .st-tier-badge {
    flex: 0 0 auto;
}
.st-avatar {
    flex: 0 0 auto;
    width: clamp(24px, 22cqi, 34px);
    height: clamp(24px, 22cqi, 34px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 13cqi, 18px);
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08), rgba(0,0,0,0.6));
    border: 1px solid rgba(255,215,0,0.25);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 6px rgba(0,0,0,0.5);
    line-height: 1;
}
.st-avatar.tier1 { border-color: #ffffff66; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 8px rgba(255,255,255,0.3); }
.st-avatar.tier2 { border-color: #00e5ff66; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 10px rgba(0,229,255,0.4); }
.st-avatar.tier3 { border-color: #bf5af266; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 10px rgba(191,90,242,0.45); }
.st-avatar.tier4 { border-color: #ff9f0a66; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 12px rgba(255,159,10,0.5); }
.st-avatar.shrine { border-color: #00ff8866; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 10px rgba(0,255,136,0.4); }
.st-avatar.evil   { border-color: #ff450066; box-shadow: inset 0 0 8px rgba(0,0,0,0.7), 0 0 12px rgba(255,69,0,0.5); animation: evilPulse 1.8s infinite alternate; }
.st-avatar.sprite {
    width: clamp(40px, 32cqi, 56px);
    height: clamp(40px, 32cqi, 56px);
    padding: 2px;
    overflow: hidden;
}
.st-sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    display: block;
}
@keyframes evilPulse {
    from { filter: drop-shadow(0 0 4px #ff4500); }
    to   { filter: drop-shadow(0 0 12px #ff0000); }
}

.st-header-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}
.st-name {
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(10px, 9cqi, 14px);
    font-weight: 700;
    color: #ffd700;
    letter-spacing: 0.5px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow:
        0 0 10px rgba(255,215,0,0.35),
        0 1px 0 rgba(0,0,0,0.95),
        0 2px 4px rgba(0,0,0,0.9);
}
.st-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 1px;
}
.st-header.centered .st-meta {
    justify-content: center;
}
.st-tier-badge {
    font-family: 'Cinzel', serif;
    font-size: clamp(6px, 5cqi, 8px);
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 1.5px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4));
    border: 1px solid currentColor;
    text-shadow: 0 0 6px currentColor, 0 1px 1px rgba(0,0,0,0.95);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
}
.st-tier-badge.tier1 { color: #ffffff; }
.st-tier-badge.tier2 { color: #00e5ff; }
.st-tier-badge.tier3 { color: #bf5af2; }
.st-tier-badge.tier4 { color: #ff9f0a; }
.st-tier-badge.evil  { color: #ff4500; }
.st-tier-badge.shrine { color: #00ff88; }
.st-name.shrine { color: #00ff88; text-shadow: 0 0 10px rgba(0,255,136,0.4), 0 1px 0 rgba(0,0,0,0.95), 0 2px 4px rgba(0,0,0,0.9); }
.st-role {
    font-size: clamp(6px, 5cqi, 8px);
    color: #c8c8c8;
    font-style: italic;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
}
.st-role-chip {
    flex: 0 0 auto;
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(6px, 5cqi, 8.5px);
    font-weight: 700;
    font-style: italic;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.8px;
    color: #c8c8c8;
    background: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4));
    border: 1px solid rgba(255,215,0,0.18);
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
    white-space: nowrap;
}
.st-role-chip.tier1 { color: #e8e8e8; border-color: rgba(255,255,255,0.3); }
.st-role-chip.tier2 { color: #7fe9ff; border-color: rgba(0,229,255,0.35); }
.st-role-chip.tier3 { color: #d49bff; border-color: rgba(191,90,242,0.4); }
.st-role-chip.tier4 { color: #ffc46b; border-color: rgba(255,159,10,0.45); }
.st-tag {
    font-size: clamp(6px, 5cqi, 8px);
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0.35));
    border: 1px solid rgba(255,215,0,0.2);
    color: #ddd;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}
.st-tag.shrine { color: #00ff88; border-color: rgba(0,255,136,0.3); }
.st-tag.scope  { color: #ffd54f; }
.st-tag.count  { color: #00e5ff; border-color: rgba(0,229,255,0.3); }
.st-tag.kills  { color: #fff; }
.st-tag.speed  { color: #ffb74d; }

/* ── Stat grid (3×2) ── */
.st-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(2px, 0.6vw, 4px);
    width: 100%;
}
.st-stat {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.9vw, 7px);
    padding: clamp(3px, 0.8vw, 6px) clamp(5px, 1vw, 8px);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.65));
    border: 1px solid rgba(255,215,0,0.18);
    border-radius: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.7);
    min-width: 0;
}
.st-stat-ic {
    flex: 0 0 auto;
    width: clamp(14px, 12cqi, 20px);
    height: clamp(14px, 12cqi, 20px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 9cqi, 14px);
    line-height: 1;
    filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 1px 1px rgba(0,0,0,0.9));
}
.st-stat-ic.atk  { color: #ff5252; }
.st-stat-ic.spd  { color: #ffd54a; }
.st-stat-ic.rng  { color: #42a5f5; }
.st-stat-ic.dps  { color: #ff8a3d; }
.st-stat-ic.crit { color: #ff2e88; }
.st-stat-ic.kil  { color: #e0e0e0; }
.st-stat-svg {
    width: 100%;
    height: 100%;
    display: block;
    color: inherit;
    overflow: visible;
}
.st-stat-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.st-stat-lbl {
    font-family: 'Cinzel', serif;
    font-size: clamp(6px, 4.8cqi, 8px);
    font-weight: 900;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #a0a0a0;
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
    line-height: 1;
}
.st-stat-val {
    font-family: 'JetBrains Mono', 'Cinzel', monospace;
    font-size: clamp(9px, 8cqi, 12px);
    font-weight: 900;
    color: #fff;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow:
        0 0 8px rgba(255,255,255,0.2),
        0 1px 0 rgba(0,0,0,0.95),
        0 2px 3px rgba(0,0,0,0.9);
    font-variant-numeric: tabular-nums;
}
.st-stat-bonus {
    font-size: 0.72em;
    font-weight: 900;
    margin-left: 4px;
    font-family: 'JetBrains Mono', monospace;
}
.st-stat-bonus.pos { color: #00ff88; text-shadow: 0 0 7px rgba(0,255,136,0.65), 0 1px 1px rgba(0,0,0,0.95); }
.st-stat-bonus.neg { color: #ff5252; text-shadow: 0 0 7px rgba(255,82,82,0.65), 0 1px 1px rgba(0,0,0,0.95); }
.st-stat-sub {
    font-size: 0.62em;
    font-weight: 700;
    margin-left: 3px;
    color: #8c8c9a;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.9);
    font-variant-numeric: tabular-nums;
}

/* ── HP bar (enemy) ── */
.st-hp-bar {
    position: relative;
    width: 100%;
    height: clamp(12px, 10cqi, 16px);
    background: linear-gradient(180deg, #1a0000, #000);
    border: 1px solid rgba(255,69,0,0.35);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.8);
}
.st-hp-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, #ff4500, #ff1744);
    box-shadow: 0 0 10px rgba(255,69,0,0.6);
    transition: width 0.3s ease;
}
.st-hp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(8px, 6.5cqi, 10px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 4px #000, 0 0 4px #000, 0 1px 2px rgba(0,0,0,0.95);
    letter-spacing: 0.8px;
    font-variant-numeric: tabular-nums;
    z-index: 1;
}

/* ── Lore / description box ── */
.st-lore-box {
    position: relative;
    width: 100%;
    padding: clamp(5px, 1vw, 8px) clamp(8px, 1.4vw, 12px) clamp(5px, 1vw, 8px) clamp(10px, 1.6vw, 14px);
    background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.35));
    border-left: 3px solid var(--inspect-color, #ffd700);
    border-radius: 0 5px 5px 0;
    color: #d0d0d0;
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(7.5px, 6cqi, 10px);
    line-height: 1.5;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0,0,0,0.95);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    box-sizing: border-box;
}
.st-lore-box.shrine { color: #ffc977; border-left-color: #00ff88; }
.st-lore-box.evil   { color: #cfc4c4; }

.st-warn-line {
    width: 100%;
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(6.5px, 5cqi, 8.5px);
    color: #888;
    font-style: italic;
    text-align: left;
    padding: 0 4px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
    letter-spacing: 0.3px;
}

.st-flavor {
    margin-top: 3px;
    color: #908070;
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(6.5px, 5cqi, 8.5px);
    font-style: italic;
    letter-spacing: 1.2px;
    text-align: center;
    opacity: 0.85;
    text-shadow: 0 1px 2px rgba(0,0,0,0.95);
}

/* ── Action row & buttons ── */
.st-action-row {
    display: flex;
    width: 100%;
    gap: clamp(5px, 1vw, 8px);
    height: clamp(26px, 22cqi, 34px);
    margin-top: clamp(3px, 0.8vw, 6px);
}
.st-btn {
    flex: 1;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
    border: 1.5px solid rgba(255,215,0,0.18);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 45%),
        linear-gradient(180deg, #1f0c08 0%, #0a0303 100%);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.65),
        inset 0 1px 0 rgba(255,255,255,0.10),
        inset 0 -1px 0 rgba(0,0,0,0.7),
        inset 0 0 14px rgba(0,0,0,0.55);
    color: #b8a888;
    font-size: clamp(6.5px, 5.5cqi, 8.5px);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 2px 6px;
    overflow: hidden;
    isolation: isolate;
}
.st-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.25) 100%);
    pointer-events: none;
    z-index: 0;
}
.st-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.18) 50%, transparent 62%);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
    pointer-events: none;
    z-index: 1;
}
.st-btn:hover::after { transform: translateX(120%); }
.st-btn > * { position: relative; z-index: 2; }
.st-btn:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(0,0,0,0.7), inset 0 1px 0 rgba(0,0,0,0.5), inset 0 0 12px rgba(0,0,0,0.7); }

.st-btn.promote { flex: 1.6; color: #fff; }
.st-btn.promote.tier1 { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0)) , linear-gradient(160deg, #546e7a 0%, #1c272c 100%); border-color: #cfd8dc; }
.st-btn.promote.tier2 { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0)) , linear-gradient(160deg, #007c91 0%, #00272e 100%); border-color: #00e5ff; }
.st-btn.promote.tier3 { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0)) , linear-gradient(160deg, #5e35b1 0%, #1a0a3a 100%); border-color: #bf5af2; }
.st-btn.promote.tier4 { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0)) , linear-gradient(160deg, #ef6c00 0%, #3b1100 100%); border-color: #ff9f0a; }
.st-btn.promote.cant-afford { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.85); }
.st-btn.promote.cant-afford::after { display: none; }
.st-btn.promote:not(.cant-afford):hover {
    transform: translateY(-1.5px);
    border-color: #ffd700;
    box-shadow:
        0 6px 16px rgba(124,77,255,0.45),
        0 0 0 1px rgba(255,215,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 0 18px rgba(255,215,0,0.18);
    filter: brightness(1.08);
}
.st-btn-lbl {
    font-family: 'Cinzel', serif;
    font-size: clamp(7.5px, 6.5cqi, 10px);
    font-weight: 900;
    color: #ffd700;
    line-height: 1.05;
    letter-spacing: 1.3px;
    text-shadow: 0 0 8px rgba(255,215,0,0.5), 0 1px 1px rgba(0,0,0,0.95);
}
.st-btn-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(6px, 5cqi, 8px);
    font-weight: 800;
    opacity: 0.95;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.95);
    margin-top: 1px;
}

.st-btn.demolish {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0) 40%),
        linear-gradient(180deg, #1a0606 0%, #050000 100%);
    border-color: #4a2622;
    color: #8a7a7a;
}
.st-btn.demolish:hover {
    color: #ff5566;
    border-color: #ff1744;
    box-shadow:
        0 4px 14px rgba(255,23,68,0.45),
        inset 0 1px 0 rgba(255,255,255,0.12),
        inset 0 0 14px rgba(255,23,68,0.22);
    filter: brightness(1.1);
}
.st-btn.demolish.full { flex: 1; }
.st-btn.demolish.shrine:hover {
    color: #ffeb3b;
    border-color: #ffeb3b;
    box-shadow:
        0 4px 14px rgba(255,235,59,0.4),
        inset 0 1px 0 rgba(255,255,255,0.14),
        inset 0 0 14px rgba(255,235,59,0.22);
}

/* ── Warning state ── */
.st-shell.warn { align-items: center; justify-content: center; text-align: center; }
.st-warn-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.st-warn-icon {
    font-size: clamp(16px, 16cqi, 26px);
    color: #ff1744;
    filter: drop-shadow(0 0 10px rgba(255,23,68,0.6));
    animation: warnFlash 0.6s infinite alternate;
}
@keyframes warnFlash {
    from { transform: scale(1);    opacity: 0.85; }
    to   { transform: scale(1.08); opacity: 1; }
}
.st-warn-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(11px, 10cqi, 14px);
    font-weight: 900;
    color: #ff1744;
    text-shadow:
        0 0 14px rgba(255,23,68,0.6),
        0 1px 0 rgba(0,0,0,0.95),
        0 2px 4px rgba(0,0,0,0.9);
    letter-spacing: 3px;
    line-height: 1.1;
}
.st-warn-msg {
    font-family: 'Cinzel', 'Noto Serif KR', serif;
    font-size: clamp(8px, 7cqi, 10px);
    font-weight: 700;
    color: #f0e0e0;
    max-width: 92%;
    line-height: 1.35;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.95);
}

/* Typography & Titles */
.unit-info-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(10px, 2.5vw, 14px);
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-bottom: 2px;
}

.info-row {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: clamp(2px, 0.8vw, 6px);
    margin: clamp(2px, 0.5vw, 4px) 0;
}

/* ── Simplified & Styled Stat Boxes ── */
.unit-info-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.unit-info-stats::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.unit-info-stats span:first-child { 
    font-size: clamp(5.5px, 1.4vw, 7.5px); 
    color: var(--stat-color, #ffd700); 
    font-weight: 900; 
    opacity: 0.7; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.unit-info-stats span:last-child { 
    font-size: clamp(9px, 2.2vw, 12px); 
    font-weight: 900; 
    color: #fff; 
    text-shadow: 0 0 10px var(--stat-glow, rgba(255,255,255,0.2));
}

.stat-bonus { font-size: 0.8em; margin-left: 2px; font-weight: 900; }
.stat-bonus.positive { color: #00ff88; }
.stat-bonus.negative { color: #ff1744; }

/* ── Action Button Row (Side-by-Side) ── */
.action-button-row {
    display: flex;
    width: 95%;
    gap: 6px;
    margin-top: 4px;
    justify-content: center;
    height: clamp(24px, 6vw, 32px);
}

.promo-container {
    flex: 1.5;
    margin: 0;
    height: 100%;
}

.info-promo-btn {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4a148c, #311b92);
    border: 1.5px solid #7c4dff;
    border-radius: 6px;
    color: #fff;
    padding: 2px 4px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.info-promo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.4);
    border-color: #ffd700;
}

.info-promo-btn.cant-afford {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(1);
}

.promo-label {
    font-size: clamp(7px, 1.8vw, 9px);
    font-weight: 900;
    color: #ffd700;
    line-height: 1;
}

.promo-cost-val {
    font-size: clamp(6px, 1.5vw, 8px);
    font-weight: bold;
    opacity: 0.9;
    margin-top: 1px;
}

.info-sacrifice-btn {
    flex: 1;
    margin: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #1a0000, #000);
    border: 1px solid #3e2723;
    border-radius: 4px;
    color: #666;
    font-size: clamp(7px, 1.5vw, 9px);
    font-family: 'Cinzel', serif;
    padding: 0 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-sacrifice-btn:hover {
    color: #ff1744;
    border-color: #ff1744;
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.4);
    background: #000;
}

/* Enemy Info Specialized Styles */
.enemy-info-avatar {
    font-size: clamp(20px, 5vw, 32px);
    margin: clamp(2px, 0.5vw, 4px) 0;
    filter: drop-shadow(0 0 10px rgba(255, 69, 0, 0.6));
    animation: enemyPulse 2s infinite alternate ease-in-out;
}

@keyframes enemyPulse {
    from { transform: scale(1); filter: drop-shadow(0 0 8px #ff4500); }
    to { transform: scale(1.1); filter: drop-shadow(0 0 20px #ff0000); }
}

.info-divider {
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(180, 130, 60, 0.4), transparent);
    margin: clamp(4px, 1vw, 8px) 0;
}

.info-default-text {
    font-family: 'Cinzel', serif;
    font-size: clamp(10px, 2.8vw, 16px);
    font-weight: 900;
    color: #d4a840;
    opacity: 0.92;
    letter-spacing: 3px;
    z-index: 2;
    text-shadow: 0 0 12px rgba(210,155,40,0.55), 0 1px 4px rgba(0,0,0,0.9);
}

.info-subtitle { color: #8fa8b8; font-size: clamp(6px, 1.6vw, 9px); margin-top: 2px; letter-spacing: 3px; font-weight: bold; z-index: 2; }
.info-lore-text { color: #8fa0b0; font-size: clamp(7px, 1.8vw, 10px); line-height: 1.5; max-width: 90%; margin: 8px 0; z-index: 2; }
.info-hint-text { font-size: clamp(6px, 1.5vw, 8px); color: #7080a0; text-transform: uppercase; letter-spacing: 1px; font-weight: bold; z-index: 2; }

/* === ui_feedback.css === */
/* ui_feedback.css - Tooltips, Switches, and Interactive Feedback */

.floating-tooltip {
    position: absolute;
    z-index: 2400;
    background: linear-gradient(145deg, #1a0000, #050505);
    border: 1px solid #ff00ff;
    border-radius: 4px;
    padding: 5px 8px;
    box-shadow: 0 0 20px rgba(148, 0, 211, 0.4), inset 0 0 10px rgba(0,0,0,0.8);
    pointer-events: auto;
    animation: tooltipPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 160px;
}

.floating-tooltip.fixed-width {
    width: 160px;
    max-width: 160px;
}

.floating-tooltip::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #ff00ff;
}

.floating-tooltip.bottom-mode::after {
    bottom: auto;
    top: -5px;
    border-top: none;
    border-bottom: 5px solid #ff00ff;
}

@keyframes tooltipPop {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tooltip-title { color: #ff00ff; font-weight: bold; font-size: 9px; margin-bottom: 3px; border-bottom: 1px solid rgba(255,0,255,0.2); padding-bottom: 1px; }
.tooltip-content { color: #ccc; font-size: 7.5px; line-height: 1.2; }
.tooltip-stat { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 7px; }
.tooltip-stat span:first-child { color: #888; }
.tooltip-stat span:last-child { color: #ffa500; font-weight: bold; }

/* Switch Styling */
.switch { position: relative; display: inline-block; width: 24px; height: 14px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; border-radius: 14px; }
.slider:before { position: absolute; content: ""; height: 10px; width: 10px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
/* ── Encounter Toast (non-blocking, slides in from right) ───────────────────── */
.encounter-toast {
    position: absolute;
    right: 6px;
    top: 4%;
    /* Responsive font-size: slightly smaller base, better scaling */
    font-size: clamp(8px, 1.2vw, 11px);
    width: clamp(120px, 28%, 200px);
    background: linear-gradient(135deg, #0d0012 85%, #1a0030);
    border: 1px solid rgba(148, 0, 211, 0.6);
    border-left: 0.4em solid #9400d3;
    border-radius: 0.5em;
    padding: 0.7em 0.9em;
    box-shadow: 0 0.5em 2.5em rgba(0, 0, 0, 0.8), 0 0 1.5em rgba(100, 0, 180, 0.3);
    z-index: 1800;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: encounterSlideIn 0.35s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.encounter-toast:hover {
    transform: scale(1.02);
    box-shadow: 0 0.6em 3em rgba(0, 0, 0, 0.9), 0 0 2em rgba(148, 0, 211, 0.4);
}
/* Left-side toast: slides in from LEFT (relics = gold, equipment = cyan) */
.left-toast {
    right: auto;
    left: 6px;
    border-left: 1px solid rgba(148,0,211,0.55);
    border-right: 0.4em solid #9400d3;
    animation: leftSlideIn 0.35s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.relic-toast {
    border-color: rgba(255, 120, 0, 0.6);
    border-right-color: #ff8800;
    background: linear-gradient(135deg, #0d0800 85%, #1a0e00);
}
.equip-toast {
    border-color: rgba(0, 180, 220, 0.6);
    border-right-color: #00c4e8;
    background: linear-gradient(135deg, #00080d 85%, #001a22);
}
.encounter-toast-out { animation: encounterSlideOut 0.38s ease-in forwards; }
.left-toast.encounter-toast-out { animation: leftSlideOut 0.38s ease-in forwards; }

@keyframes encounterSlideIn {
    from { opacity: 0; transform: translateX(115%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes encounterSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(115%); }
}
@keyframes leftSlideIn {
    from { opacity: 0; transform: translateX(-115%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes leftSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-115%); }
}

.encounter-toast-header {
    font-size: 0.75em;
    color: #9400d3;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25em;
}
.relic-toast .encounter-toast-header  { color: #ff8800; }
.equip-toast .encounter-toast-header  { color: #00c4e8; }
.encounter-toast-cat {
    font-size: 0.9em;
    color: #ff4488;
    font-weight: bold;
    margin-bottom: 0.45em;
    border-bottom: 1px solid rgba(148, 0, 211, 0.25);
    padding-bottom: 0.35em;
}
.relic-toast .encounter-toast-cat { color: #ffaa44; border-color: rgba(255,100,0,0.25); }
.equip-toast .encounter-toast-cat { color: #44c8e8; border-color: rgba(0,180,220,0.25); }
.encounter-toast-body {
    display: flex;
    gap: 0.7em;
    align-items: flex-start;
}
.encounter-toast-art {
    flex-shrink: 0;
    /* More compact art: 2.4em to 3.2em */
    width: clamp(2.4em, 6vw, 3.2em);
    height: clamp(2.4em, 6vw, 3.2em);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 4, 14, 0.95);
    border: 1px solid rgba(148,0,211,0.3);
    overflow: hidden;
    border-radius: 0.4em;
    font-size: 1.4em;
    image-rendering: pixelated;
}
.relic-toast .encounter-toast-art { border-color: rgba(255,100,0,0.3); }
.equip-toast .encounter-toast-art  { border-color: rgba(0,180,220,0.3); }
.encounter-toast-art canvas { image-rendering: pixelated; width: 100%; height: 100%; display: block; }
.encounter-toast-art img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 0 4px rgba(0,180,220,0.4)); }
.encounter-toast-info { flex: 1; min-width: 0; }
.encounter-toast-name {
    font-size: 1em;
    color: #fff;
    font-weight: bold;
    margin-bottom: 0.3em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.encounter-toast-stats {
    display: flex;
    gap: 0.3em;
    margin-bottom: 0.3em;
    flex-wrap: wrap;
}
.et-stat {
    font-size: 0.65em;
    font-weight: bold;
    padding: 0.1em 0.4em;
    border-radius: 0.3em;
    white-space: nowrap;
}
.et-hp  { color: #ff5555; background: rgba(255,30,30,0.14); border: 1px solid rgba(255,50,50,0.3); }
.et-def { color: #aaa;    background: rgba(150,150,150,0.1); border: 1px solid rgba(150,150,150,0.2); }
.et-spd { color: #00e5ff; background: rgba(0,229,255,0.1);   border: 1px solid rgba(0,229,255,0.25); }
.et-eff { color: #00ff88; background: rgba(0,255,100,0.1);   border: 1px solid rgba(0,255,100,0.25); }
.encounter-toast-lore {
    font-size: 0.75em;
    color: #776;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Encounter Toast v2 (enemy: render + name + stats) ───────────────────── */
.enc-toast-v2 {
    width: clamp(150px, 30%, 220px);
    padding: 0.55em 0.7em 0.7em;
    background:
        radial-gradient(circle at 50% 38%, rgba(148,0,211,0.18), transparent 60%),
        linear-gradient(160deg, #0d0012 80%, #1a0030);
    overflow: hidden;
}
.enc-toast-v2 .encounter-toast-header {
    text-align: center;
    margin-bottom: 0.15em;
    font-size: 0.7em;
    opacity: 0.92;
    text-shadow: 0 0 6px rgba(148,0,211,0.6);
}
.enc-toast-v2 .encounter-toast-cat {
    text-align: center;
    border-bottom: 1px solid rgba(255, 68, 136, 0.28);
    padding-bottom: 0.3em;
    margin-bottom: 0.5em;
    font-size: 0.85em;
    text-shadow: 0 0 6px rgba(255,68,136,0.4);
}
.enc-render-stage {
    position: relative;
    width: 100%;
    height: clamp(70px, 14vw, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.45em;
}
.enc-render-stage .enc-halo {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 78%;
    height: 78%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(148,0,211,0.45) 0%, rgba(255,68,136,0.18) 38%, transparent 70%);
    filter: blur(6px);
    animation: encHaloPulse 2.4s ease-in-out infinite;
    pointer-events: none;
}
.enc-render-stage .enc-ring {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 92%;
    height: 92%;
    transform: translate(-50%, -50%);
    border: 1px dashed rgba(255,68,136,0.55);
    border-radius: 50%;
    animation: encRingSpin 6s linear infinite;
    box-shadow: 0 0 12px rgba(148,0,211,0.35) inset, 0 0 10px rgba(148,0,211,0.3);
    pointer-events: none;
}
.enc-render-stage .enc-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.enc-render-stage .enc-sparkles span {
    position: absolute;
    width: 3px; height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px #ff44aa, 0 0 12px #9400d3;
    opacity: 0;
    animation: encSparkle 2.2s ease-in-out infinite;
}
.enc-render-stage .enc-sparkles span:nth-child(1) { top: 12%; left: 18%; animation-delay: 0s; }
.enc-render-stage .enc-sparkles span:nth-child(2) { top: 22%; right: 14%; animation-delay: 0.6s; }
.enc-render-stage .enc-sparkles span:nth-child(3) { bottom: 18%; left: 22%; animation-delay: 1.1s; }
.enc-render-stage .enc-sparkles span:nth-child(4) { bottom: 12%; right: 20%; animation-delay: 1.7s; }
.enc-render-art {
    position: relative;
    width: 75%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    filter: drop-shadow(0 0 6px rgba(255,68,136,0.5)) drop-shadow(0 0 14px rgba(148,0,211,0.45));
    animation: encArtFloat 3s ease-in-out infinite;
}
.enc-render-art canvas {
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}
.enc-name-plate {
    text-align: center;
    font-size: 0.95em;
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.05em;
    margin: 0.15em 0 0.4em;
    padding: 0.2em 0;
    background: linear-gradient(90deg, transparent, rgba(148,0,211,0.35), transparent);
    border-top: 1px solid rgba(255,68,136,0.25);
    border-bottom: 1px solid rgba(255,68,136,0.25);
    text-shadow: 0 0 6px rgba(255,68,136,0.7), 0 0 12px rgba(148,0,211,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.enc-stats-row {
    display: flex;
    justify-content: space-between;
    gap: 0.25em;
}
.enc-stats-row .et-stat {
    flex: 1;
    text-align: center;
    font-size: 0.7em;
    padding: 0.22em 0.3em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25em;
}
.enc-stats-row .et-stat i {
    font-style: normal;
    font-size: 0.9em;
    opacity: 0.85;
}
@keyframes encHaloPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
    50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}
@keyframes encRingSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes encSparkle {
    0%, 100%   { opacity: 0; transform: scale(0.4); }
    40%, 60%   { opacity: 1; transform: scale(1.2); }
}
@keyframes encArtFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* ── Card-style Toast (Relic / Equipment: image-bg + bottom name + badge) ── */
.card-toast {
    width: clamp(150px, 28%, 200px);
    height: clamp(180px, 30vw, 230px);
    padding: 0;
    overflow: hidden;
    position: absolute;
    display: block;
}
.card-toast-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.06), transparent 60%);
}
.card-toast-bg .relic-icon-img,
.card-toast-bg .equip-icon-img {
    width: 88% !important;
    height: 88% !important;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255,180,80,0.55)) drop-shadow(0 0 22px rgba(255,120,0,0.35));
    animation: cardArtFloat 3.4s ease-in-out infinite;
}
.equip-toast.card-toast .card-toast-bg .equip-icon-img {
    filter: drop-shadow(0 0 10px rgba(0,200,232,0.55)) drop-shadow(0 0 22px rgba(0,120,200,0.4));
}
.card-toast::before {
    /* Radial ambient halo behind art */
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 42%, rgba(255,140,0,0.22), transparent 55%);
    pointer-events: none;
    z-index: 1;
    animation: cardHaloPulse 3s ease-in-out infinite;
}
.equip-toast.card-toast::before {
    background: radial-gradient(circle at 50% 42%, rgba(0,200,232,0.22), transparent 55%);
}
.card-toast::after {
    /* Top inset shine */
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent);
    pointer-events: none;
    z-index: 2;
}
.card-toast-kind {
    position: absolute;
    top: 0.5em;
    left: 0.55em;
    z-index: 5;
    font-size: 0.6em;
    font-weight: bold;
    letter-spacing: 0.18em;
    color: rgba(255,200,140,0.85);
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
    padding: 0.15em 0.4em;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,170,68,0.35);
    border-radius: 0.25em;
}
.equip-toast.card-toast .card-toast-kind {
    color: rgba(120,220,240,0.9);
    border-color: rgba(0,200,232,0.35);
}
.card-toast-badge {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    z-index: 5;
    font-size: 0.7em;
    font-weight: 900;
    letter-spacing: 0.12em;
    padding: 0.25em 0.55em;
    border-radius: 0.25em;
    text-shadow: 0 0 4px rgba(0,0,0,0.7);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.18);
}
.card-toast-badge.badge-new {
    background: linear-gradient(135deg, #00ff88, #00b86b);
    color: #002616;
    box-shadow: 0 0 12px rgba(0,255,136,0.55), 0 2px 8px rgba(0,0,0,0.5);
    animation: badgePulse 1.4s ease-in-out infinite;
}
.card-toast-badge.badge-upgrade {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #2a1500;
    box-shadow: 0 0 14px rgba(255,200,0,0.6), 0 2px 8px rgba(0,0,0,0.5);
    animation: badgePulse 1.1s ease-in-out infinite;
}
.card-toast-badge.badge-existing {
    background: linear-gradient(135deg, #6a6a78, #3a3a48);
    color: #d8d8e0;
    opacity: 0.92;
}
.card-toast-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 4;
    padding: 0.7em 0.7em 0.6em;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.85) 45%, rgba(0,0,0,0.95));
    border-top: 1px solid rgba(255,170,68,0.25);
}
.equip-toast.card-toast .card-toast-overlay {
    border-top-color: rgba(0,200,232,0.28);
}
.card-toast-sub {
    font-size: 0.65em;
    color: #ffaa44;
    font-weight: bold;
    letter-spacing: 0.06em;
    margin-bottom: 0.15em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}
.equip-toast.card-toast .card-toast-sub { color: #44c8e8; }
.card-toast-name {
    font-size: 1em;
    color: #fff;
    font-weight: bold;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 8px rgba(255,140,0,0.6), 0 1px 2px rgba(0,0,0,0.95);
}
.equip-toast.card-toast .card-toast-name {
    text-shadow: 0 0 8px rgba(0,200,232,0.6), 0 1px 2px rgba(0,0,0,0.95);
}
@keyframes cardArtFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-4px) scale(1.03); }
}
@keyframes cardHaloPulse {
    0%, 100% { opacity: 0.75; }
    50%      { opacity: 1; }
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

input:checked + .slider { background-color: #ff4500; }
input:checked + .slider:before { transform: translateX(10px); }

/* === slots.css === */
/* slots.css - Functional Hitbox Layer (Visuals handled by Canvas) */

.slot-area {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 12px;
    padding: 15px;
    z-index: 10; /* Transparent layer above canvas for clicks/drag */
    background: transparent;
    margin-top: 208px; /* Updated from 148px to match new START_Y shift */
    pointer-events: none;
}

.card-slot {
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    pointer-events: auto;
}

/* Selected Slot Visual Aid (Subtle) */
.card-slot.selected-slot {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.2);
}

/* Drag & Drop Functional Feedback */
.card-slot.drag-valid {
    background-color: rgba(0, 255, 0, 0.1) !important;
    border: 1px dashed #0f0 !important;
}

.card-slot.drag-invalid {
    background-color: rgba(255, 0, 0, 0.1) !important;
    border: 1px dashed #f00 !important;
    cursor: no-drop;
}

.card-slot.drag-over {
    background-color: rgba(255, 215, 0, 0.15);
    border: 1px solid #ffd700;
}

/* Hitbox for Units */
.unit {
    position: relative;
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    background: transparent;
    /* Visuals are in Canvas, this is just for clicks */
    color: transparent !important;
}

/* Selection and status indicators are now handled in Canvas drawUnits loop */

