html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#top-half {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 40% 60%;
    height: 65vh;
    flex: 0 0 65vh;
    border-bottom: 2px solid #333;
    background-color: #faf8f8;
}

.filter-container {
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.filter-container:nth-child(3n) {
    border-right: none;
}

#filter-court {
    grid-column: 1 / 3;
    min-height: 0;
    padding: 10px;
}

.filter-container h3 {
    margin-top: 0;
    font-size: 16px;
    text-align: center;
}

.court-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.court-header h3 {
    margin: 0;
}

.stat-help {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #97a6ba;
    background: #f7f9fc;
    color: #2f3b4b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.stat-help:focus {
    outline: 2px solid #6ea8ff;
    outline-offset: 1px;
}

.stat-help-tooltip {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 230px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #c4cdd8;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(24, 39, 75, 0.15);
    font-size: 12px;
    line-height: 1.4;
    color: #243447;
    z-index: 30;
    display: none;
    text-align: left;
}

.stat-help-tooltip p {
    margin: 0 0 4px 0;
    font-weight: 700;
}

.stat-help-tooltip .tip-line {
    margin: 2px 0;
}

.stat-help:hover+.stat-help-tooltip,
.stat-help:focus+.stat-help-tooltip {
    display: block;
}

#bottom-half {
    min-height: 35vh;
    flex: 0 0 35vh;
    background-color: #ebebeb;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.portrait {
    width: 120px;
    height: 140px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.portrait:hover {
    transform: scale(1.05);
}

.portrait .team-name {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.portrait .stat {
    font-size: 12px;
    color: #555;
}

#win-graph-container,
#year-selector,
#seeding-container,
#bracket-container {
    flex-grow: 1;
    width: 100%;
    height: 120%;
}

#court-layout {
    flex: 1;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 8px;
    min-height: 0;
}

#basketball-courts {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    min-height: 0;
    align-items: stretch;
}

.court-box {
    border: 1px solid #c4cdd8;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

.court-box svg {
    width: 100%;
    height: 100%;
}

#court-legend {
    border: 1px solid #c4cdd8;
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
    box-sizing: border-box;
    font-size: 13px;
    color: #243447;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#court-legend h4 {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #4a5568;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}