:root {
    --hpi-primary: #FF9800;
    --hpi-primary-soft: #fff8e1;
    --hpi-text-dark: #1a1a1a;
    --hpi-text-medium: #666666;
    --hpi-bg-light: #f8f9fa;
    --hpi-border: #eeeeee;
    --hpi-green: #4CAF50;
    --hpi-green-soft: #e8f5e9;
    --hpi-red: #ff9800;
    --hpi-red-soft: #fff3e0;
    --hpi-blue: #2196F3;
    --hpi-radius: 16px;
    --hpi-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Wrapper */
.hpi-wrapper {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Trigger Button */
.hpi-trigger-button {
    background: #fff;
    border: 1px solid var(--hpi-border);
    padding: 12px 20px;
    border-radius: 30px;
    color: var(--hpi-text-dark);
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.hpi-trigger-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hpi-trigger-button .hpi-icon-sparkle {
    color: var(--hpi-primary);
    font-size: 18px;
}

.hpi-trigger-button.hpi-hidden {
    display: none;
}

/* Container (Hidden by default) */
.hpi-container {
    max-width: 600px;
    background: #fff;
    border-radius: var(--hpi-radius);
    box-shadow: var(--hpi-shadow);
    border: 1px solid var(--hpi-border);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    display: none;
    /* Fully hidden initially to prevent layout shifts */
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hpi-container.hpi-active {
    display: block;
    animation: hpiFadeIn 0.5s forwards;
}

@keyframes hpiFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Section */
.hpi-header {
    padding: 20px;
    border-bottom: 1px solid var(--hpi-border);
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.hpi-score-box {
    background: var(--hpi-primary);
    color: white;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    flex-shrink: 0;
}

.hpi-header-content h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: var(--hpi-text-dark);
    font-weight: 700;
    line-height: 1.2;
}

.hpi-label {
    font-size: 14px;
    color: var(--hpi-text-medium);
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.hpi-verdict-text {
    font-size: 14px;
    color: var(--hpi-text-medium);
    margin: 0;
    line-height: 1.4;
}

/* Sections */
.hpi-section {
    position: relative;
    padding-bottom: 8px;
}

.hpi-section-header {
    padding: 20px 24px 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--hpi-text-dark);
    font-size: 16px;
    letter-spacing: -0.01em;
}

.hpi-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hpi-section-title svg {
    width: 20px;
    height: 20px;
    color: var(--hpi-primary);
    opacity: 0.9;
}

.hpi-content {
    padding: 0 24px 24px 24px;
}

/* Metrics Grid (Performance) */
.hpi-metrics-grid {
    display: grid;
    gap: 16px;
}

.hpi-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}

.hpi-metric-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hpi-text-dark);
    width: 45%;
}

.hpi-metric-bar-container {
    flex-grow: 1;
    margin: 0 16px;
    height: 8px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

/* Animated Bar */
.hpi-metric-bar {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--hpi-green) 0%, #66BB6A 100%);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.hpi-metric-score {
    width: 30px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    color: var(--hpi-text-dark);
}

/* List Items (Modern Card Style) */
.hpi-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hpi-list-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--hpi-text-dark);
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hpi-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
    border-color: transparent;
}

.hpi-list-item svg {
    flex-shrink: 0;
    margin-top: 3px;
    color: var(--hpi-text-medium);
}

/* Context/Warning Styles */
.hpi-item-design_boundary .hpi-list-item {
    background: #fff5f5;
    border-color: #ffebee;
}

.hpi-item-design_boundary .hpi-list-item svg {
    color: #ef5350;
}

.hpi-item-strength .hpi-list-item {
    background: #f1f8e9;
    border-color: #e8f5e9;
}

.hpi-item-strength .hpi-list-item svg {
    color: #66bb6a;
}

/* Footer */
.hpi-footer {
    padding: 16px;
    display: flex;
    justify-content: flex-end;
    background: var(--hpi-bg-light);
}

/* =========================================
   FLOATING SCORE PILL & MODAL
   ========================================= */

/* The Pill Widget */
.hpi-pill {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    background: #fff;
    border-radius: 50px;
    padding: 6px 20px 6px 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
    user-select: none;
    /* For dragging */
    touch-action: none;
    min-width: 180px;
}

.hpi-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.hpi-pill.is-dragging {
    cursor: grabbing;
    opacity: 0.95;
    transform: scale(1.02);
}

/* Close Button (Little Cross) */
.hpi-pill-close {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 20px;
    height: 20px;
    background: #fff;
    color: #999;
    border-radius: 50%;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
}

.hpi-pill:hover .hpi-pill-close {
    opacity: 1;
}

.hpi-pill-close:hover {
    color: #ff5252;
    background: #fff0f0;
}

/* Filled Green Circle with White Text inside */
.hpi-pill-circle {
    width: 42px;
    height: 42px;
    background: var(--score-color);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.hpi-circular-chart {
    display: none;
}

/* Pill Text */
.hpi-pill-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hpi-pill-title {
    font-weight: 700;
    color: var(--hpi-text-dark);
    font-size: 15px;
    line-height: 1.2;
}

.hpi-pill-subtitle {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hpi-pill-arrow {
    margin-left: auto;
    font-size: 20px;
    color: #ccc;
    font-weight: 300;
}


.hpi-trust-badge {
    background: #fff;
    border: 1px solid var(--hpi-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hpi-text-medium);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}