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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

h1 {
    color: #1f2937;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.browser-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.browser-detail {
    background: #f9fafb;
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.browser-detail:hover {
    border-color: #d1d5db;
    background: #ffffff;
}

.browser-detail strong {
    color: #6b7280;
    display: block;
    font-size: 0.75em;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.browser-detail span {
    color: #1f2937;
    font-size: 1.1em;
    font-weight: 500;
}

/* Overall Score Section */
.overall-score-section {
    margin-bottom: 40px;
}

.score-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.score-title {
    text-align: center;
    font-size: 1.8em;
    color: #1f2937;
    margin-bottom: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.score-circle {
    position: relative;
    width: 200px;
    height: 200px;
}

.score-svg {
    transform: rotate(-90deg);
    width: 200px;
    height: 200px;
}

.score-bg {
    fill: none;
    stroke: #f3f4f6;
    stroke-width: 12;
}

.score-progress {
    fill: none;
    stroke: #10b981;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease-in-out, stroke 1.5s ease;
}

.score-circle.excellent .score-progress {
    stroke: #10b981;
}

.score-circle.very-good .score-progress {
    stroke: #22c55e;
}

.score-circle.good .score-progress {
    stroke: #84cc16;
}

.score-circle.fair .score-progress {
    stroke: #eab308;
}

.score-circle.poor .score-progress {
    stroke: #f97316;
}

.score-circle.very-poor .score-progress {
    stroke: #ef4444;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 3.5em;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.score-percent {
    font-size: 1.5em;
    color: #6b7280;
    font-weight: 600;
}

.score-details {
    flex: 1;
    min-width: 300px;
}

.score-rating {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.rating-label {
    font-size: 1em;
    color: #6b7280;
    margin-right: 10px;
}

.rating-value {
    font-size: 1.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rating-value.excellent {
    color: #10b981;
}

.rating-value.very-good {
    color: #22c55e;
}

.rating-value.good {
    color: #84cc16;
}

.rating-value.fair {
    color: #eab308;
}

.rating-value.poor {
    color: #f97316;
}

.rating-value.very-poor {
    color: #ef4444;
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: #fafbfc;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.4em;
    color: #1f2937;
    font-weight: 700;
}

.stat-value.good {
    color: #10b981;
}

.stat-value.poor {
    color: #ef4444;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
}

.info-icon {
    display: inline-block;
    margin-left: 5px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-size: 0.75em;
    cursor: help;
    transition: background 0.2s ease;
}

.info-icon:hover {
    background: #2563eb;
}

.tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: 90vw;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

/* Custom scrollbar for tooltip */
.tooltip::-webkit-scrollbar {
    width: 6px;
}

.tooltip::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.tooltip::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.tooltip::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Arrow pointing up (tooltip is below the element) */
.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid #d1d5db;
    z-index: -1;
}

.tooltip-header {
    font-size: 1.1em;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.tooltip-content {
    font-size: 0.9em;
    color: #4b5563;
    line-height: 1.6;
}

.tooltip-section {
    margin-bottom: 12px;
}

.tooltip-section:last-child {
    margin-bottom: 0;
}

.tooltip-section strong {
    color: #374151;
    display: block;
    margin-bottom: 6px;
}

.tooltip-section ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.tooltip-section li {
    margin: 4px 0;
}

.tooltip-section p {
    margin: 8px 0 0 0;
}

/* Category tooltip styles */
.category-title-container {
    display: flex;
    align-items: center;
    position: relative;
    gap: 8px;
}

.category-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 50%;
    font-size: 0.8em;
    cursor: help;
    transition: all 0.2s ease;
}

.category-info-icon:hover {
    background: #3b82f6;
    color: white;
}

.category-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 320px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.category-title-container:hover .category-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.category-tooltip strong {
    color: #1f2937;
    display: block;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.category-tooltip p {
    color: #4b5563;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 8px 0;
}

.category-tooltip ul {
    margin: 8px 0 0 18px;
    padding: 0;
    font-size: 0.85em;
    color: #4b5563;
}

.category-tooltip li {
    margin: 4px 0;
    line-height: 1.4;
}

.category-tooltip li strong {
    color: #374151;
    display: inline;
    margin: 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.category-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.category-title {
    font-size: 1.25em;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

.category-score {
    font-size: 1em;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #374151;
    letter-spacing: 0.01em;
}

.feature-list {
    list-style: none;
}

.feature-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin: 6px 0;
    background: #fafbfc;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.feature-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.feature-name {
    font-size: 0.925em;
    color: #4b5563;
    flex: 1;
    font-weight: 500;
}

.status-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
}

.status-indicator.supported {
    background: #10b981;
    color: white;
}

.status-indicator.supported::after {
    content: '✓';
}

.status-indicator.partial {
    background: #f59e0b;
    color: white;
}

.status-indicator.partial::after {
    content: '~';
    font-size: 1.1em;
}

.status-indicator.unsupported {
    background: #ef4444;
    color: white;
}

.status-indicator.unsupported::after {
    content: '✕';
}

.legend {
    background: white;
    padding: 24px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    color: #4b5563;
    font-weight: 500;
}

@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    h1 {
        font-size: 2em;
    }

    header {
        padding: 30px 20px;
    }

    .score-card {
        padding: 25px 20px;
    }

    .score-title {
        font-size: 1.4em;
        margin-bottom: 25px;
    }

    .score-display {
        gap: 30px;
    }

    .score-circle {
        width: 160px;
        height: 160px;
    }

    .score-svg {
        width: 160px;
        height: 160px;
    }

    .score-bg,
    .score-progress {
        stroke-width: 10;
    }

    .score-number {
        font-size: 2.5em;
    }

    .score-percent {
        font-size: 1.2em;
    }

    .rating-value {
        font-size: 1.4em;
    }

    .score-stats {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .browser-info {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .browser-detail {
        width: 100%;
        text-align: center;
    }

    .legend {
        gap: 20px;
    }

    /* Adjust tooltips for mobile */
    .tooltip {
        width: calc(100vw - 40px);
        max-height: 300px;
        left: 20px;
        right: 20px;
        transform: translateX(0);
    }

    .category-tooltip {
        width: calc(100vw - 40px);
        max-height: 250px;
        left: -10px;
        transform: translateX(0);
    }
}

/* Loading animation */
.loading {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 16px;
    margin: 20px 0;
    border: 1px solid #e5e7eb;
}

.loading::before {
    content: 'Running Compatibility Tests';
    display: block;
    margin-bottom: 20px;
    color: #6b7280;
    font-size: 1.1em;
    font-weight: 500;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Smooth fade-in for results */
.category-card {
    animation: fadeIn 0.4s ease-in-out;
}

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

/* Debug Information Section */
.debug-section {
    margin-top: 40px;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.button-group {
    display: flex;
    gap: 12px;
}

.debug-header h2 {
    font-size: 1.4em;
    color: #111827;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.debug-description {
    color: #6b7280;
    font-size: 0.95em;
    margin-bottom: 16px;
}

.debug-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    color: #374151;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    resize: vertical;
    cursor: text;
}

.debug-textarea:focus {
    outline: none;
    border-color: #d1d5db;
    background: #ffffff;
}

.copy-btn,
.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.print-btn {
    background: #10b981;
}

.copy-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.print-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.copy-btn:active,
.print-btn:active {
    transform: translateY(0);
}

.copy-feedback {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease;
}

.copy-feedback.show {
    display: block;
}

.copy-feedback.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.copy-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .debug-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .button-group {
        flex-direction: column;
    }

    .copy-btn,
    .print-btn {
        width: 100%;
        justify-content: center;
    }

    .debug-textarea {
        min-height: 200px;
        font-size: 0.8em;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .container {
        max-width: 100%;
        padding: 20px;
    }

    header {
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .overall-score-section {
        margin-bottom: 30px;
        page-break-inside: avoid;
    }

    .score-card {
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 30px;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-svg {
        width: 150px;
        height: 150px;
    }

    .score-progress {
        stroke: #333 !important;
    }

    .score-number {
        font-size: 2.5em;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .browser-info {
        margin-top: 20px;
    }

    .browser-detail {
        border: 1px solid #ddd;
        background: white;
    }

    .results-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        page-break-inside: avoid;
    }

    .category-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        padding: 15px;
    }

    .category-card:hover {
        transform: none;
        box-shadow: none;
    }

    .category-header {
        border-bottom: 1px solid #ddd;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .category-score {
        background: #f0f0f0 !important;
        color: #333 !important;
        border: 1px solid #ddd;
    }

    .feature-item {
        padding: 8px;
        margin: 4px 0;
        border: 1px solid #e5e7eb;
        background: white;
    }

    .feature-item:hover {
        background: white;
    }

    .status-indicator {
        width: 20px;
        height: 20px;
        position: relative;
    }

    .status-indicator.supported {
        background: white !important;
        border: 2px solid #10b981;
        color: #10b981;
    }

    .status-indicator.supported::after {
        content: '✓';
        color: #10b981;
    }

    .status-indicator.unsupported {
        background: white !important;
        border: 2px solid #ef4444;
        color: #ef4444;
    }

    .status-indicator.unsupported::after {
        content: '✕';
        color: #ef4444;
    }

    .legend {
        border: 1px solid #ddd;
        box-shadow: none;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    /* Hide non-essential elements */
    .debug-section,
    .copy-btn,
    .print-btn,
    .copy-feedback,
    .debug-textarea,
    .debug-description,
    .tooltip,
    .category-tooltip,
    .info-icon,
    .category-info-icon {
        display: none !important;
    }

    /* Add print-specific header info */
    header::after {
        content: "Browser Compatibility Report - " attr(data-date);
        display: block;
        margin-top: 10px;
        font-size: 0.9em;
        color: #666;
    }

    /* Ensure proper page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    .category-card {
        page-break-inside: avoid;
    }

    /* Add page numbers */
    @page {
        margin: 1.5cm;
        @bottom-right {
            content: "Page " counter(page);
        }
    }
}

/* Special print mode styles when print button is clicked */
body.print-mode .debug-section {
    page-break-before: always;
}

body.print-mode .debug-header h2::after {
    content: " - Technical Details";
}

@media print {
    body.print-mode .debug-section {
        display: block !important;
        page-break-before: always;
    }

    body.print-mode .debug-header {
        display: block !important;
    }

    body.print-mode .button-group {
        display: none !important;
    }

    body.print-mode .debug-textarea {
        display: block !important;
        border: 1px solid #ddd !important;
        background: white !important;
        min-height: auto !important;
        font-size: 0.7em !important;
        white-space: pre-wrap !important;
        page-break-inside: auto !important;
    }

    body.print-mode .debug-description {
        display: block !important;
        font-size: 0.9em;
        color: #666;
    }
}