/* General Body Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom right, #f4f7fa, #dce3eb);
    margin: 0;
    padding: 20px;
    color: #333;
}

/* Headings */
h1, h2, h3 {
    font-weight: 600;
    color: #2c3e50;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: auto;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Input Field */
input[type="text"] {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    margin-right: 10px;
}

/* Tables */
table {
    font-size: 0.9rem;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

table thead {
    background-color: #2c3e50;
    color: #fff;
    font-weight: 600;
}

table th, table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e3e6ea;
    text-align: center;
    vertical-align: middle;
}

table th:first-child,
table td:first-child {
    border-left: none;
}

table th:last-child,
table td:last-child {
    border-right: none;
}

.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
}

.top-team {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Card Component */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 1rem;
    background-color: #ffffffd9;
    margin-bottom: 1.5rem;
}

/* Chart Canvas Fix */
canvas {
    width: 100% !important;
    height: 400px !important;
}

/* Table Hover (Optional Enhancement) */
table tbody tr:hover {
    background-color: #f1f1f1;
    transition: background-color 0.2s ease;
}

/* Responsive Form */
form {
    margin-bottom: 1rem;
}

/* Round Selector */
#round {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

/* Chart titles inside cards */
.card h3 {
    margin-top: 0.5rem;
    font-size: 1.2rem;
    color: #333;
}

.small-scorecard {
    font-size: 0.9rem;
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd;
}
.small-scorecard div {
    margin-bottom: 2px;
}

.form-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 0.85rem;
    color: #52606d;
    font-size: 0.85rem;
}

.form-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-legend-note {
    font-weight: 600;
    color: #2c3e50;
}

.form-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    overflow: visible;
    gap: 3px;
    max-width: none;
    padding: 6px 8px;
    min-width: 180px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(237,242,247,0.9));
}

.form-segment {
    position: relative;
    --heat: 1;
    width: 14px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
    border: 1px solid rgba(80, 96, 109, 0.2);
    transition: transform 0.15s ease;
    cursor: pointer;
}

.form-segment:hover,
.form-segment:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.form-segment::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    min-width: 140px;
    max-width: 220px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(23, 32, 42, 0.96);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.45;
    white-space: pre-line;
    text-align: left;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.15s ease;
}

.form-segment::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(23, 32, 42, 0.96) transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    z-index: 29;
    transition: opacity 0.15s ease;
}

.form-segment:hover::after,
.form-segment:hover::before,
.form-segment:focus-visible::after,
.form-segment:focus-visible::before {
    opacity: 1;
}

.form-group-break {
    margin-right: 10px;
}

.form-w {
    background-color: rgba(31, 157, 85, var(--heat));
    border-color: #1f9d55;
}

.form-l {
    background-color: rgba(214, 69, 69, var(--heat));
    border-color: #d64545;
}

.form-t {
    background-color: rgba(207, 214, 221, var(--heat));
}

.form-latest {
    transform: scale(1.08);
    box-shadow: 0 0 0 2px #0d6efd, 0 2px 8px rgba(13, 110, 253, 0.3);
}

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

    table {
        font-size: 0.8rem;
    }

    table th, table td {
        padding: 0.45rem 0.5rem;
    }

    .form-legend {
        justify-content: flex-start;
        gap: 8px;
        font-size: 0.78rem;
    }

    .form-box {
        min-width: 140px;
        gap: 2px;
        padding: 5px 6px;
    }

    .form-segment {
        width: 10px;
        height: 8px;
    }

    .form-segment::after {
        left: 0;
        transform: none;
        bottom: calc(100% + 8px);
        min-width: 120px;
        max-width: 170px;
        font-size: 0.7rem;
    }

    .form-segment::before {
        left: 8px;
        transform: none;
    }

    .form-group-break {
        margin-right: 7px;
    }

    .form-latest {
        transform: scale(1.06);
        box-shadow: 0 0 0 1.5px #0d6efd;
    }
}