* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Insights Modal Styles */
.insights-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlay-appear 0.3s ease-out;
}

.insights-modal {
    background: #2a2a2a;
    border: 2px solid #555;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 95vh; /* Changed from 85vh to use more screen space */
    overflow: visible; /* Changed from auto to prevent scroll */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: modal-slide-up 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #444;
}

.insights-header h2 {
    margin: 0;
    font-size: 24px;
    color: #fff;
}

.insights-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.insights-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.insights-content {
    padding: 20px 24px;
    overflow: visible;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.position-info {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: #333;
    border-radius: 8px;
}

.current-position,
.range-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.position-label,
.range-label {
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    font-weight: 500;
}

.insights-modal .position-name,
.insights-modal .range-name {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b35;
}

.insights-range-display {
    margin-bottom: 16px; /* Reduced from 24px */
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Allow flexbox to shrink */
}

.insights-range-display .range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
}

.insights-range-display .range-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.insights-range-display .range-stats {
    font-size: 14px;
    color: #aaa;
}

.insights-range-display .range-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 2px;
    margin-bottom: 12px; /* Reduced from 16px */
    overflow: visible;
    flex-shrink: 0; /* Prevent grid from shrinking */
}

.insights-range-display .hand-row {
    display: flex;
    gap: 1px;
}

.insights-range-display .hand-cell {
    width: 34px; /* Reduced from 36px */
    height: 34px; /* Reduced from 36px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px; /* Reduced from 11px */
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 2px;
    border: 1px solid #444;
    position: relative;
}

.insights-range-display .hand-cell.frequency-fill {
    overflow: visible; /* Changed from hidden to allow popup to show */
    color: #fff !important;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
    font-weight: 700;
    box-sizing: border-box;
}

.insights-range-display .hand-cell.frequency-fill:hover {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    font-size: 12px;
    font-weight: 900;
}

.insights-range-display .hand-cell.frequency-fill:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.insights-range-display .range-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px; /* Reduced from 12px */
}

.insights-range-display .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #aaa;
}

.insights-range-display .legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.strategy-tips-section {
    background: #333;
    border-radius: 8px;
    padding: 16px;
}

.strategy-tips-section h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #fff;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.tips-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tip-item {
    font-size: 14px;
    color: #aaa;
    padding: 8px 12px;
    background: #2a2a2a;
    border-radius: 6px;
    border-left: 3px solid #ff6b35;
}

.no-range-message {
    text-align: center;
    padding: 40px 20px;
    background: #333;
    border-radius: 8px;
    margin-bottom: 24px;
}

.no-range-message h4 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #fff;
}

.no-range-message p {
    margin: 8px 0;
    color: #aaa;
    font-size: 14px;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .insights-modal {
        width: 95%;
        margin: 10px auto; /* Reduced from 20px */
        max-height: 95vh;
    }

    .insights-header {
        padding: 12px 16px; /* Reduced padding */
    }

    .insights-header h2 {
        font-size: 18px; /* Reduced from 20px */
    }

    .insights-content {
        padding: 12px 16px; /* Reduced padding */
    }

    .position-info {
        flex-direction: column;
        gap: 12px;
    }

    .insights-range-display .hand-cell {
        width: 22px; /* Reduced from 24px */
        height: 22px; /* Reduced from 24px */
        font-size: 8px; /* Reduced from 9px */
    }

    .insights-range-display .range-legend {
        gap: 8px; /* Reduced from 12px */
        margin-top: 6px;
    }

    .insights-range-display .legend-item {
        font-size: 11px; /* Reduced from 12px */
    }

    .insights-range-display .legend-color {
        width: 10px; /* Reduced from 12px */
        height: 10px; /* Reduced from 12px */
    }

    .insights-range-display {
        margin-bottom: 12px;
    }
}

:root {
    --all-in-color: #8b0000;
    --raise-5-color: #a50000;
    --raise-4-color: #c62d42;
    --raise-3-color: #dc143c;
    --raise-2-color: #e85d75;
    --raise-1-color: #ff4757;
    --call-color: #5ea514;
    --check-color: #7fb931;
    --fold-color: #4a90e2;
}

/* Expanded square styling */
.insights-range-display .hand-cell.square-expanded {
    z-index: 100;
    border-color: #49a14a;
}

.insights-range-display .hand-cell.square-expanded:hover {
    transform: scale(1);
}

/* Expanded box container */
.square-expanded-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    min-height: 150px;
    background: #1a1a1a;
    border: 2px solid #49a14a;
    border-radius: 5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* Position adjustments for edges and corners */
.square-expanded-box.expand-right {
    left: 100%;
    margin-left: 5px;
}

.square-expanded-box.expand-left {
    right: 100%;
    left: auto;
    margin-right: 5px;
}

.square-expanded-box.expand-down {
    top: 100%;
    margin-top: 5px;
}

.square-expanded-box.expand-up {
    bottom: 100%;
    top: auto;
    margin-bottom: 5px;
}

/* Corner adjustments - combine directions */
.square-expanded-box.expand-right.expand-down {
    left: 100%;
    top: 0;
}

.square-expanded-box.expand-right.expand-up {
    left: 100%;
    bottom: 0;
    top: auto;
}

.square-expanded-box.expand-left.expand-down {
    right: 100%;
    left: auto;
    top: 0;
}

.square-expanded-box.expand-left.expand-up {
    right: 100%;
    left: auto;
    bottom: 0;
    top: auto;
}

/* Expanded box header (combo display) */
.expanded-box-header {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    letter-spacing: 1px;
}

/* Actions container */
.expanded-box-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

/* Individual action item */
.expanded-action-item {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

/* Action color bar */
.expanded-action-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    transition: width 0.3s ease;
    opacity: 0.8;
}

/* Action label */
.expanded-action-label {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 600;
    padding-left: 10px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* Action percentage */
.expanded-action-percentage {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 700;
    margin-left: auto;
    padding-right: 10px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}