:root {
    --bg-light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.94);
    --card-border: rgba(226, 232, 240, 0.9);
    --accent-yellow: #f59e0b;
    --accent-orange: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.16);
    --badge-bg: linear-gradient(135deg, #fff7ed, #fef3c7);
    --badge-text: #b45309;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --progress-bg: #e2e8f0;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-lg: 18px;
    --radius-sm: 8px;
    --shadow-card: 0 10px 30px -5px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(245, 158, 11, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background-color: var(--bg-light);
    font-family: var(--font-body);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
}

/* Background Atmosphere */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    top: -80px;
    left: -80px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, var(--accent-glow) 0%, rgba(248, 250, 252, 0) 70%);
    z-index: 2;
    pointer-events: none;
}

/* Construction Widget - Top Left Anchor with top spacing to prevent clipping speech bubble */
.construction-widget {
    position: fixed;
    top: 60px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: calc(100vw - 40px);
    width: 360px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.construction-widget:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 14px 36px -5px rgba(245, 158, 11, 0.15), 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* Speech Bubble - Placed cleanly above avatar */
.speech-bubble {
    position: absolute;
    top: -52px;
    left: 10px;
    background: #ffffff;
    border: 1.5px solid var(--accent-yellow);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom left;
    z-index: 110;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 24px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid var(--accent-yellow);
}

.speech-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.speech-close:hover {
    color: var(--text-main);
}

/* Main Widget Layout */
.widget-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Chibi Worker Avatar */
.chibi-container {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent-yellow), var(--accent-orange), var(--accent-yellow));
    animation: rotateRing 6s linear infinite;
    opacity: 0.85;
}

.chibi-img {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid #ffffff;
    animation: floatBob 3s ease-in-out infinite;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.chibi-container:hover .chibi-img {
    transform: scale(1.1) rotate(4deg);
}

.chibi-container:active .chibi-img {
    transform: scale(0.95);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 13px;
    height: 13px;
    background-color: var(--accent-yellow);
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

/* Under Construction Sign Box */
.sign-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow: hidden;
}

.construction-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: var(--badge-bg);
    border: 1px solid var(--accent-yellow);
    border-radius: 6px;
    padding: 5px 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.12);
}

.hazard-stripe {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(245, 158, 11, 0.18),
        rgba(245, 158, 11, 0.18) 10px,
        transparent 10px,
        transparent 20px
    );
    animation: stripeMove 4s linear infinite;
}

.badge-text {
    position: relative;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.88rem;
    letter-spacing: 0.8px;
    color: var(--badge-text);
    text-transform: uppercase;
}

.sign-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.pulse-icon {
    display: inline-block;
    color: var(--accent-orange);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Expanded Card Details */
.widget-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.progress-bar-bg {
    width: 100%;
    height: 7px;
    background: var(--progress-bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 8%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-yellow), var(--accent-orange));
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    transition: width 0.5s ease-in-out;
}

/* Buttons */
.widget-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
}

.action-btn.outline {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.action-btn.outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* Animations */
@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes stripeMove {
    from { background-position: 0 0; }
    to { background-position: 40px 0; }
}

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

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.6) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Mobile Responsive Tweaks */
@media (max-width: 480px) {
    .construction-widget {
        top: 50px;
        left: 12px;
        width: calc(100vw - 24px);
        padding: 12px;
    }

    .chibi-container {
        width: 52px;
        height: 52px;
    }

    .badge-text {
        font-size: 0.78rem;
    }

    .speech-bubble {
        top: -48px;
        left: 5px;
        font-size: 0.78rem;
    }
}
