/* SmartCourse Web UI - Global Styles */

:root {
    --primary-color: #0066cc;
    --primary-dark: #0052a3;
    --secondary-color: #00a86b;
    --danger-color: #d32f2f;
    --warning-color: #ffa500;
    --success-color: #4caf50;
    --neutral-light: #f5f5f5;
    --neutral-dark: #333;
    --border-color: #ddd;
    --spin-color: #4169e1;
    --spin-dark: #3153b6;
    --nonspin-color: #f97316;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fafafa;
    color: var(--neutral-dark);
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

/* Header */
.proposed-parameter-banner {
    flex: 0 0 auto;
    width: 100%;
    background: #6d28d9;
    border-bottom: 6px solid #fff;
    color: #fff;
    text-align: center;
    font-weight: 800;
    font-size: 0.86rem;
    line-height: 1.2;
    padding: 0.28rem 0.75rem;
    letter-spacing: 0;
}

.header {
    background: linear-gradient(135deg, var(--spin-color) 0%, var(--spin-dark) 100%);
    color: white;
    padding: 0.42rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-content h1 {
    font-size: 1.25rem;
    margin-bottom: 0;
    line-height: 1.15;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.header-beta-button {
    border: 1px solid rgba(255,255,255,0.75);
    border-radius: 999px;
    background: rgba(255,255,255,0.13);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 1.45rem;
    height: 1.45rem;
    font-size: 0.58rem;
    font-weight: 500;
    line-height: 1;
    padding: 0 0.34rem;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0.72;
    overflow: hidden;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.header-beta-icon {
    font-size: 0.78rem;
    line-height: 1;
}

.header-beta-label {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.18s ease, opacity 0.16s ease;
}

.header-beta-button:hover,
.header-beta-button:focus-visible {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    opacity: 1;
    outline: none;
}

.header-beta-button.active {
    background: #fff;
    border-color: #fff;
    color: #6d28d9;
    opacity: 1;
}

.chart-beta-button {
    position: absolute;
    left: 0.48rem;
    bottom: 0.48rem;
    z-index: 520;
    background: rgba(31, 41, 55, 0.32);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 1px 4px rgba(0,0,0,0.16);
}

.chart-beta-button:hover,
.chart-beta-button:focus-visible {
    background: rgba(31, 41, 55, 0.58);
}

.chart-beta-button.active {
    background: #fff;
    border-color: #fff;
}

.header-beta-button:hover .header-beta-label,
.header-beta-button:focus-visible .header-beta-label,
.header-beta-button.active .header-beta-label {
    max-width: 2rem;
    opacity: 1;
}

.header-bubble-button {
    width: 2rem;
    height: 2rem;
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    background: rgba(255,255,255,0.16);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.16s ease, transform 0.16s ease;
}

.help-button {
    width: auto;
    min-width: 3.25rem;
    border-radius: 999px;
    padding: 0 0.75rem;
    font-size: 0.88rem;
}

.header-bubble-button:hover,
.header-bubble-button:focus-visible {
    background: rgba(255,255,255,0.26);
    transform: translateY(-1px);
    outline: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.42);
}

.about-modal {
    position: relative;
    width: min(92vw, 520px);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15,23,42,0.28);
    padding: 1.5rem;
}

.about-modal h2 {
    margin: 0 2rem 0.8rem 0;
    color: var(--primary-dark);
    font-size: 1.35rem;
}

.about-modal p {
    margin: 0 0 0.8rem 0;
    line-height: 1.5;
    color: #334155;
}

.about-modal p:last-child {
    margin-bottom: 0;
}

.score-details-modal {
    width: min(94vw, 620px);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.score-details-content {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
    color: #334155;
    font-size: 0.86rem;
    line-height: 1.35;
}

.score-details-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.7rem;
    margin-bottom: 0.85rem;
    padding: 0.65rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f8fafc;
}

.score-details-summary div {
    min-width: 0;
}

.score-details-label {
    display: block;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.score-details-value {
    display: block;
    color: #0f172a;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.86rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.score-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.score-details-table th,
.score-details-table td {
    padding: 0.42rem 0.35rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    vertical-align: top;
}

.score-details-table th:first-child,
.score-details-table td:first-child {
    text-align: left;
}

.score-details-table th {
    color: #475569;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.score-details-total-row td {
    border-bottom: 0;
    color: #0f172a;
    font-weight: 900;
}

.score-details-note {
    margin-top: 0.75rem;
    color: #64748b;
    font-size: 0.74rem;
}

.score-details-explanation {
    margin: 0 0 0.85rem;
    padding: 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.score-details-explanation h3 {
    margin: 0 0 0.42rem;
    color: #1f2937;
    font-size: 0.84rem;
}

.score-details-explanation p {
    margin: 0.28rem 0;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.34;
}

.score-details-explanation ul {
    margin: 0;
    padding-left: 1.1rem;
}

.score-details-explanation li {
    margin: 0.28rem 0;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.34;
}

.score-details-selection-notes,
.score-details-condition-notes {
    margin-top: 0.85rem;
    padding: 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.score-details-condition-notes {
    border-color: #fcd34d;
    background: #fffbeb;
}

.score-details-selection-notes h3,
.score-details-condition-notes h3 {
    margin: 0 0 0.42rem;
    color: #1f2937;
    font-size: 0.84rem;
}

.score-details-selection-notes ul,
.score-details-condition-notes ul {
    margin: 0;
    padding-left: 1.1rem;
}

.score-details-selection-notes li,
.score-details-condition-notes li {
    margin: 0.28rem 0;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.34;
}

.about-links {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid #e5e7eb;
}

.about-links a {
    display: block;
    margin: 0.32rem 0;
    color: var(--primary-color);
    line-height: 1.45;
    text-decoration: none;
}

.about-links a:hover,
.about-links a:focus-visible {
    color: var(--primary-dark);
    text-decoration: underline;
    outline: none;
}

.help-modal {
    width: min(96vw, 1180px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.help-content {
    --help-sample-height: 1.7rem;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.help-content section {
    padding: 0.9rem 0;
    border-top: 1px solid #e5e7eb;
}

.help-content section:first-child {
    border-top: 0;
    padding-top: 0;
}

.help-content h3 {
    margin: 0 0 0.45rem 0;
    color: #0f172a;
    font-size: 1rem;
}

.help-content ol {
    margin: 0;
    padding-left: 1.25rem;
}

.help-content ul {
    margin: 0.25rem 0 0.15rem 0;
    padding-left: 1.65rem;
}

.help-content li {
    margin: 0.28rem 0;
    line-height: 1.42;
    color: #334155;
}

.help-control-sample {
    position: static !important;
    display: inline-flex;
    width: auto;
    height: var(--help-sample-height) !important;
    min-width: 0;
    min-height: var(--help-sample-height);
    align-items: center;
    justify-content: center;
    pointer-events: none;
    cursor: default;
    user-select: none;
    vertical-align: middle;
    margin: 0.08rem 0.12rem;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-family: inherit;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    line-height: 1;
    white-space: nowrap;
}

.help-content .btn-primary.help-control-sample,
.help-content .btn-secondary.help-control-sample,
.help-content .select-course-button.help-control-sample {
    width: auto;
}

.help-content .btn-primary.help-control-sample {
    padding: 0.42rem 0.82rem;
}

.help-content .btn-secondary.help-control-sample {
    padding: 0.34rem 0.68rem;
}

.help-content .compact-action-button.help-control-sample {
    padding: 0.13rem 0.34rem;
}

.help-content .selected-courses-auto-button.help-control-sample,
.help-content .race-setup-edit-button.help-control-sample {
    background: var(--spin-color);
    border-color: var(--spin-color);
    color: #fff;
}

.help-content .selected-courses-auto-button.help-control-sample {
    background: #16a34a;
    border-color: #16a34a;
    justify-content: center;
    padding-top: 0.34rem !important;
    padding-bottom: 0.34rem !important;
}

.help-content .select-course-button.help-control-sample {
    margin-top: 0;
    padding: 0.42rem 0.72rem;
}

.help-content .map-toggle-button.help-control-sample,
.help-content .chart-toggle-button.help-control-sample {
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    box-shadow: 0 2px 7px rgba(0,0,0,0.1);
}

.help-content .satellite-toggle-sample.help-control-sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--help-sample-height);
    min-width: var(--help-sample-height);
    height: var(--help-sample-height);
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.24);
    border-radius: 4px;
    background: #fff;
    color: #333;
    box-shadow: 0 2px 7px rgba(0,0,0,0.16);
}

.help-content .chart-window-button.help-control-sample {
    top: auto !important;
    right: auto !important;
    width: var(--help-sample-height);
    height: var(--help-sample-height) !important;
}

.help-content .drop-mark-option.help-control-sample,
.help-content .course-option.help-control-sample {
    display: inline-flex;
    height: auto !important;
    min-height: 0;
    margin: 0 0.08rem;
    gap: 0.22rem;
    line-height: inherit;
    vertical-align: baseline;
}

.help-content .drop-mark-option.help-control-sample input,
.help-content .course-option.help-control-sample input {
    width: 0.72rem;
    height: 0.72rem;
    flex: 0 0 0.72rem;
    margin: 0;
}

.help-content .drop-mark-option.help-control-sample span,
.help-content .course-option.help-control-sample span {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.help-content .custom-course-tab.help-control-sample {
    flex: 0 0 auto;
}

.help-content .race-setup-link.help-control-sample {
    flex: 0 0 auto;
}

.help-content .mark-toggle.help-control-sample {
    display: inline-flex;
    min-width: var(--help-sample-height);
    width: auto;
    height: var(--help-sample-height) !important;
}

.help-content .course-feedback-link.help-control-sample {
    width: var(--help-sample-height);
    height: var(--help-sample-height) !important;
    padding: 0 !important;
    pointer-events: none;
    vertical-align: middle;
}

.help-content .course-feedback-link.help-feedback-icon-sample {
    color: var(--spin-color);
}

.help-content .course-feedback-link.help-feedback-icon-sample.selected {
    background: var(--spin-color);
    border-color: var(--spin-color);
    color: #fff;
}

.help-content .score-details-button.help-control-sample {
    width: 1.15rem;
    min-width: 1.15rem;
    height: 1.15rem !important;
    min-height: 1.15rem;
    padding: 0 !important;
}

.help-content .help-mark-icon-sample {
    width: var(--help-sample-height);
    height: var(--help-sample-height) !important;
    display: inline-flex;
    overflow: hidden;
    position: relative;
    vertical-align: middle;
    pointer-events: none;
}

.help-content .help-mark-icon-sample.basin-mark {
    width: max-content !important;
    min-width: calc(var(--help-sample-height) * 1.8) !important;
    padding: 0 7px !important;
    box-sizing: border-box;
}

.help-content .help-mark-icon-sample span {
    font-size: inherit;
    font-weight: inherit;
}

.help-map-sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--help-sample-height);
    vertical-align: middle;
    pointer-events: none;
}

.help-content .help-start-finish-mark-sample {
    width: var(--help-sample-height);
    min-width: var(--help-sample-height);
    height: var(--help-sample-height) !important;
    padding: 0 !important;
    border: 2px solid #111;
    border-radius: 999px;
    background: linear-gradient(90deg, #e9d5ff 0 50%, #e7c9a9 50% 100%);
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0,0,0,0.28);
    color: #111;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    line-height: 1;
}

.help-content .help-start-finish-mark-sample span {
    position: relative;
    z-index: 1;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.help-drop-boundary-sample {
    width: 2.8rem;
    height: var(--help-sample-height);
    border: 2px dashed #7e22ce;
    border-radius: 4px;
    background: rgba(255,255,255,0.8);
}

.help-danger-region-sample {
    width: 2.8rem;
    height: var(--help-sample-height);
    border: 1px solid rgba(153, 27, 27, 0.7);
    border-radius: 5px 9px 4px 8px;
    background: rgba(252, 165, 165, 0.32);
    transform: skewX(-8deg);
}

.help-course-sequence {
    font-family: Consolas, 'Courier New', monospace;
    font-weight: 900;
    white-space: nowrap;
}

.help-spin-mark-text {
    color: var(--spin-color);
}

.help-rounding-port-text {
    color: #dc2626;
}

.help-rounding-starboard-text {
    color: #16a34a;
}

.help-danger-leg-sample {
    position: relative;
    display: inline-block;
    width: 3.6rem;
    height: var(--help-sample-height);
    vertical-align: middle;
    pointer-events: none;
}

.help-danger-leg-sample::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: 0.28rem;
    width: 2.4rem;
    height: 1.05rem;
    border: 1px solid rgba(153, 27, 27, 0.7);
    border-radius: 5px 9px 4px 8px;
    background: rgba(252, 165, 165, 0.32);
    transform: skewX(-8deg);
}

.help-danger-leg-sample::after {
    content: "";
    position: absolute;
    left: 0.18rem;
    right: 0.18rem;
    top: 50%;
    border-top: 3px dashed var(--spin-color);
    transform: rotate(-14deg);
    transform-origin: center;
}

.help-rounding-sample,
.help-rounding-conflict-sample {
    display: inline-block;
    width: var(--help-sample-height);
    height: var(--help-sample-height);
    vertical-align: middle;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
}

.help-rounding-port {
    background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.97 4.83A10 10 0 1 0 18.97 19.17' fill='none' stroke='%23d32f2f' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M18.97 19.17L17.27 23.75L14.35 20.73Z' fill='%23d32f2f'/%3E%3C/svg%3E");
}

.help-rounding-starboard {
    background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.03 4.83A10 10 0 1 1 5.03 19.17' fill='none' stroke='%231b8f3a' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M5.03 19.17L9.65 20.73L6.73 23.75Z' fill='%231b8f3a'/%3E%3C/svg%3E");
}

.help-rounding-conflict-sample {
    width: var(--help-sample-height);
    height: var(--help-sample-height);
    background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.97 4.83A10 10 0 1 0 18.97 19.17' fill='none' stroke='%23ff1493' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M18.97 19.17L17.27 23.75L14.35 20.73Z' fill='%23ff1493'/%3E%3Cpath d='M5.03 4.83A10 10 0 1 1 5.03 19.17' fill='none' stroke='%23ff1493' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M5.03 19.17L9.65 20.73L6.73 23.75Z' fill='%23ff1493'/%3E%3C/svg%3E");
}

.modal-close-button {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: #eef2f7;
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close-button:hover,
.modal-close-button:focus-visible {
    background: #dbe4ef;
    outline: none;
}

.subtitle {
    font-size: 0.82rem;
    opacity: 0.85;
    margin: 0;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
    position: relative;
}

.left-panel {
    width: 35%;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    transition: width 0.22s ease, opacity 0.18s ease;
}

.right-panel {
    width: 65%;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow: hidden;
    transition: width 0.22s ease;
}

.main-content.left-panel-hidden .left-panel {
    width: 0;
    opacity: 0;
    overflow: hidden;
    padding-right: 0;
    pointer-events: none;
}

.main-content.left-panel-hidden .right-panel {
    width: 100%;
    flex-direction: row;
}

.main-content.left-panel-hidden {
    gap: 0;
}

.panel-hide-button,
.panel-restore-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;
    border: 0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 5px 2px 8px -5px rgba(0,0,0,0.24);
    width: 22px;
    height: 72px;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.panel-hide-button {
    display: inline-flex;
    border-radius: 0 999px 999px 0;
    left: calc(1rem + 35% - 2px);
}

.panel-restore-button {
    display: none;
    border-radius: 0 999px 999px 0;
    left: 1rem;
}

.main-content.left-panel-hidden .panel-hide-button {
    display: none;
}

.main-content.left-panel-hidden .panel-restore-button {
    display: inline-flex;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}

.card h2, .card h3 {
    margin-bottom: 1rem;
    color: var(--neutral-dark);
    font-size: 1.3rem;
}

.card h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#selectedCoursesCard {
    position: relative;
}

.selected-courses-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.selected-courses-title-row h3 {
    margin-bottom: 0;
    flex: 1 1 9rem;
}

.export-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.28rem;
    flex: 0 1 auto;
    min-width: 0;
}

.export-button {
    width: auto;
    min-width: 0;
    padding: 0.11rem 0.28rem;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    background: var(--spin-color);
    border-color: var(--spin-color);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
}

.export-button:hover {
    background: var(--spin-dark);
    border-color: var(--spin-dark);
    color: white;
}

.export-button:disabled {
    opacity: 0.78;
    cursor: wait;
}

.export-icon {
    width: 0.68rem;
    height: 0.68rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-title-row h2,
.card-title-row h3 {
    margin-bottom: 0;
}

.compact-button {
    display: none;
    padding: 0.35rem 0.7rem;
}

.compact-action-button {
    width: auto;
    padding: 0.13rem 0.34rem;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
}

#autoSelectCoursesBtn.selected-courses-auto-button {
    position: static;
    display: inline-flex;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.55rem;
    padding-top: 0.34rem;
    padding-bottom: 0.34rem;
    background: #16a34a;
    border-color: #16a34a;
    color: white;
}

#autoSelectCoursesBtn.selected-courses-auto-button:hover {
    background: #15803d;
    border-color: #15803d;
    color: white;
}

#editRaceConditionsBtn.race-setup-edit-button {
    background: var(--spin-color);
    border-color: var(--spin-color);
    color: white;
}

#editRaceConditionsBtn.race-setup-edit-button:hover {
    background: var(--spin-dark);
    border-color: var(--spin-dark);
    color: white;
}

.left-panel .card {
    padding: 0.85rem;
}

.left-panel .card h2,
.left-panel .card h3 {
    margin-bottom: 0.55rem;
}

.left-panel .card-title-row {
    margin-bottom: 0.55rem;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.55rem;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--neutral-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group.disabled label {
    color: #94a3b8;
}

.form-group input:disabled,
.form-group select:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

#twd:invalid,
#tws:invalid,
#time:invalid,
#hrrrForecastTime:invalid {
    border-color: var(--danger-color);
}

#twd:invalid:focus,
#tws:invalid:focus,
#time:invalid:focus,
#hrrrForecastTime:invalid:focus {
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.55rem;
}

.drop-mark-option,
.course-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.15rem 0 0.65rem;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 700;
}

.drop-mark-option input,
.course-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.drop-mark-option.disabled,
.course-option.disabled {
    color: #94a3b8;
}

.drop-mark-option.disabled input,
.course-option.disabled input {
    cursor: not-allowed;
}

.mark-availability-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.mark-control-label {
    margin: 0.18rem 0 0.25rem;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.start-mark-control-label {
    margin-top: 0.5rem;
}

.mark-toggle {
    min-width: 22px;
    width: auto;
    height: 22px;
    border: 2px solid #111;
    border-radius: 999px;
    background: #ffea00;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.52rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.22rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.mark-toggle:hover:not(:disabled),
.mark-toggle:focus-visible:not(:disabled) {
    animation: markToggleWiggle 260ms ease-in-out;
    filter: brightness(0.88);
    transform: translateY(-1px) rotate(-3deg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.26);
}

.mark-toggle:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

@keyframes markToggleWiggle {
    0% { transform: translate(0, 0) rotate(0deg); }
    35% { transform: translate(-1px, -1px) rotate(-4deg); }
    70% { transform: translate(1px, -1px) rotate(3deg); }
    100% { transform: translateY(-1px) rotate(-3deg); }
}

.mark-toggle.excluded {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
    box-shadow: none;
}

.mark-toggle.start-mark-toggle {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
}

.mark-toggle.start-mark-toggle.default-start {
    border-color: #7e22ce;
}

.mark-toggle.start-mark-toggle.selected-start {
    background: #e9d5ff;
    border-color: #7e22ce;
    color: #111;
}

.mark-toggle.finish-mark-toggle {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
}

.mark-toggle.finish-mark-toggle.default-finish {
    border-color: #5c3718;
}

.mark-toggle.finish-mark-toggle.selected-finish {
    background: #e7c9a9;
    border-color: #5c3718;
    color: #111;
}

.mark-toggle.start-mark-toggle.excluded-course-mark {
    border-style: dashed;
}

.mark-toggle.start-mark-toggle.excluded-course-mark:not(.selected-start) {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.mark-toggle.start-mark-toggle.excluded-course-mark.selected-start {
    background: #e9d5ff;
    border-color: #7e22ce;
    color: #111;
}

.start-mark-selection-warning {
    display: none;
    margin-top: 0.35rem;
    color: #9a3412;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
}

.start-mark-selection-warning.visible {
    display: block;
}

.btn-secondary.custom-course-toggle {
    width: auto;
    margin-top: 0.45rem;
    padding: 0.32rem 0.58rem;
    background: #fce7f3;
    border-color: #f9a8d4;
    color: #9d174d;
    font-size: 0.76rem;
    font-weight: 700;
}

.btn-secondary.custom-course-toggle:hover {
    background: #fbcfe8;
}

.btn-secondary.custom-course-toggle.disabled,
.btn-secondary.custom-course-toggle:disabled {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.custom-course-builder {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid #e5e7eb;
}

.custom-course-tabs,
.custom-course-actions {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.custom-course-tab {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    font-weight: 700;
}

.custom-course-tab.active {
    background: #edf4ff;
    border-color: var(--spin-color);
    color: var(--primary-dark);
}

.custom-course-list {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.custom-label {
    font-weight: 800;
}

/* Buttons */
.btn-primary {
    background: var(--spin-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: var(--spin-dark);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--neutral-light);
    color: var(--neutral-dark);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-secondary.compact-action-button {
    padding: 0.13rem 0.34rem;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
}

.btn-secondary.export-button {
    width: auto;
    min-width: 0;
    padding: 0.11rem 0.28rem;
    border-color: var(--spin-color);
    background: var(--spin-color);
    color: white;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
}

.btn-secondary.export-button:hover {
    border-color: var(--spin-dark);
    background: var(--spin-dark);
    color: white;
}

body.export-map-capture .leaflet-control,
body.export-map-capture .leaflet-control-container,
body.export-map-capture .map-toggle-button,
body.export-map-capture .chart-toggle-button,
body.export-map-capture .center-courses-button,
body.export-map-capture .custom-builder-title {
    display: none !important;
}

/* Conditions Display */
.conditions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    background: var(--neutral-light);
    padding: 0.55rem;
    border-radius: 6px;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.condition-item .label {
    font-weight: 600;
    color: var(--primary-color);
}

.condition-item .value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--neutral-dark);
}

.race-setup-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.race-conditions-weather-section {
    margin: 0.1rem 0 0.65rem;
}

.race-conditions-weather-title {
    margin-bottom: 0.3rem;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
}

.race-conditions-weather-links {
    margin: 0;
}

.race-setup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.22rem 0.45rem;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.weather-summary-link {
    flex: 1 0 100%;
    border: 1px solid rgba(0, 102, 204, 0.22);
    background: rgba(239, 246, 255, 0.96);
    color: var(--primary-dark);
    font-family: inherit;
    cursor: pointer;
}

.race-setup-link:hover,
.race-setup-link:focus-visible {
    text-decoration: underline;
    outline: none;
}

.weather-summary-link:hover,
.weather-summary-link:focus-visible {
    border-color: rgba(0, 82, 163, 0.36);
    background: #dbeafe;
    color: var(--primary-dark);
}

.tampa-weather-link {
    border: 1px solid rgba(0, 168, 107, 0.28);
    background: rgba(236, 253, 245, 0.96);
    color: #047857;
}

.tampa-weather-link:hover,
.tampa-weather-link:focus-visible {
    border-color: rgba(4, 120, 87, 0.42);
    background: #d1fae5;
    color: #065f46;
}

.racecast-link {
    border: 1px solid rgba(249, 115, 22, 0.32);
    background: rgba(255, 247, 237, 0.96);
    color: #c2410c;
}

.racecast-link:hover,
.racecast-link:focus-visible {
    border-color: rgba(194, 65, 12, 0.44);
    background: #ffedd5;
    color: #9a3412;
}

.weather-summary-content {
    color: #334155;
    line-height: 1.5;
}

.weather-summary-updated {
    margin-bottom: 0.8rem;
    color: #475569;
}

.weather-summary-content p {
    margin: 0 0 0.75rem 0;
}

.weather-summary-content p:last-child {
    margin-bottom: 0;
}

.weather-summary-source {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    font-weight: 800;
}

.weather-summary-source a {
    color: var(--spin-color);
    text-decoration: none;
}

.weather-summary-source a:hover,
.weather-summary-source a:focus-visible {
    color: var(--spin-dark);
    text-decoration: underline;
    outline: none;
}

.weather-summary-error {
    color: #b91c1c;
    font-weight: 700;
}

.forecast-note {
    margin-top: 0.45rem;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.35;
}

.forecast-note-row + .forecast-note-row {
    margin-top: 0.35rem;
}

.hrrr-forecast-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin: -0.2rem 0 0.65rem;
}

.forecast-flag {
    display: inline-flex;
    align-items: center;
    margin-right: 0.35rem;
    padding: 0.12rem 0.35rem;
    border: 1px solid rgba(0, 102, 204, 0.18);
    border-radius: 4px;
    background: rgba(239, 246, 255, 0.95);
    color: var(--primary-dark);
    font-weight: 700;
}

.forecast-use-button {
    margin-right: 0;
    font-family: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

.forecast-use-button:hover,
.forecast-use-button:focus-visible {
    border-color: rgba(0, 82, 163, 0.36);
    background: #dbeafe;
    outline: none;
}

.forecast-use-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.hrrr-forecast-summary,
.forecast-values {
    min-width: 0;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.3;
}

.hrrr-forecast-summary {
    flex: 1 1 12rem;
}

.forecast-run-time {
    display: block;
    margin-top: 0.08rem;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 600;
}

.forecast-stale-alert {
    color: var(--warning-color);
    font-weight: 900;
}

.forecast-warning {
    color: var(--warning-color);
    font-weight: 800;
}

/* Courses List */
.courses-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.alternate-courses-card > h3:not(.results-section-title) {
    display: none;
}

.alternate-courses-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.alternate-courses-notice {
    display: none;
    margin: -0.1rem 0 0.55rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #f59e0b;
    border-left: 4px solid var(--warning-color);
    border-radius: 6px;
    background: #fff7ed;
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.alternate-courses-list .course-item {
    min-width: 0;
    height: 100%;
}

.alternate-courses-list .course-compact-layout {
    grid-template-columns: 1fr;
}

.alternate-courses-list .pos-breakdown {
    border-right: 0;
    padding-right: 0;
}

.alternate-courses-list .mini-course-preview {
    width: 100%;
    height: 118px;
    margin-top: -0.1rem;
}

.course-item {
    background: var(--neutral-light);
    padding: 0.65rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.course-item.spin {
    border-left-color: var(--spin-color);
}

.course-item.nonspin {
    border-left-color: var(--nonspin-color);
}

.course-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateX(4px);
}

.course-item.selected {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
    border: 2px solid var(--primary-color);
}

.course-item.nonspin.selected {
    border-color: var(--nonspin-color);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.22);
}

.course-item.preview-selected {
    background: #edf4ff;
    border-color: rgba(65, 105, 225, 0.9);
}

.course-item.nonspin.preview-selected {
    background: #fff7ed;
    border-color: var(--nonspin-color);
}

.course-item.original-pick-course {
    background: #f8fafc;
    border-style: dashed;
}

.select-course-button {
    margin-top: 0.45rem;
    width: 100%;
    padding: 0.55rem;
    background: var(--spin-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.select-course-button:hover {
    background: var(--spin-dark);
}

.course-feedback-row {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.course-feedback-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(65, 105, 225, 0.28);
    background: #f8fafc;
    color: var(--spin-color);
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.course-feedback-link:hover,
.course-feedback-link:focus-visible {
    background: #fff;
    border-color: currentColor;
    box-shadow: 0 3px 9px rgba(15, 23, 42, 0.14);
    transform: translateY(-2px) scale(1.06);
}

.course-feedback-link:active {
    transform: translateY(0) scale(0.98);
}

.course-feedback-link.selected {
    background: var(--spin-color);
    border-color: var(--spin-color);
    color: #fff;
    box-shadow: 0 3px 9px rgba(65, 105, 225, 0.24);
}

.course-feedback-icon {
    width: 1.12rem;
    height: 1.12rem;
    fill: currentColor;
}

.course-item.nonspin .course-feedback-link {
    border-color: rgba(249, 115, 22, 0.32);
    color: var(--nonspin-color);
}

.course-item.nonspin .course-feedback-link.selected {
    background: var(--nonspin-color);
    border-color: var(--nonspin-color);
    color: #fff;
    box-shadow: 0 3px 9px rgba(249, 115, 22, 0.24);
}

.score-details-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.72rem;
    height: 0.72rem;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #e5e7eb;
    color: #94a3b8;
    font-size: 0.48rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    opacity: 0.68;
    transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.score-details-button:hover,
.score-details-button:focus-visible {
    background: #d1d5db;
    color: #64748b;
    opacity: 1;
    outline: none;
    transform: translateY(-1px);
}

.course-item.nonspin .select-course-button {
    background: #ea580c;
}

.course-item.nonspin .select-course-button:hover {
    background: #c2410c;
}

.map-toggle-button,
.chart-toggle-button {
    position: absolute;
    top: 1rem;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    background: rgba(255,255,255,0.95);
    color: var(--primary-color);
    border: 1px solid rgba(0, 102, 204, 0.15);
    border-radius: 999px;
    padding: 0.34rem 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.visibility-toggle-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.68;
}

.layers-control-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.satellite-layer-control,
.satellite-layer-control.leaflet-bar {
    position: relative;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.satellite-layer-control .leaflet-satellite-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.24);
    border-radius: 4px;
    background: #fff;
    color: #333;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

.satellite-layer-control .leaflet-satellite-menu-toggle.active {
    color: var(--primary-color);
}

.satellite-layer-control .leaflet-satellite-menu-toggle:hover,
.satellite-layer-control .leaflet-satellite-menu-toggle:focus-visible {
    background: #f4f4f4;
    outline: none;
}

.satellite-layer-menu {
    position: absolute;
    top: 34px;
    left: 0;
    min-width: 9.5rem;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.satellite-layer-menu[hidden] {
    display: none;
}

.satellite-layer-option {
    display: block;
    width: 100%;
    padding: 0.48rem 0.7rem;
    border: 0;
    background: transparent;
    color: #0f172a;
    font: 700 0.8rem/1.1 Segoe UI, Arial, sans-serif;
    text-align: left;
    cursor: pointer;
}

.satellite-layer-option:hover,
.satellite-layer-option:focus-visible {
    background: #eff6ff;
    outline: none;
}

.satellite-layer-option.active {
    background: #dbeafe;
    color: #1d4ed8;
}

#map.satellite-basemap-active,
#map.satellite-basemap-active .leaflet-tile-pane,
#map.nautical-chart-basemap-active,
#map.nautical-chart-basemap-active .leaflet-tile-pane {
    background: transparent;
}

#map .smartcourse-satellite-tile,
#map .smartcourse-nautical-chart-tile {
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.chart-toggle-button:hover {
    background: white;
}

.chart-toggle-button {
    right: 1rem;
}

.danger-toggle-button {
    right: 1rem;
    top: 3.2rem;
    color: #991b1b;
    border-color: rgba(153, 27, 27, 0.2);
}

.danger-toggle-button.active {
    background: rgba(254, 242, 242, 0.96);
}

.danger-toggle-button:hover {
    background: white;
}

.all-marks-toggle-button {
    right: 1rem;
    top: 5.4rem;
    color: #854d0e;
    border-color: rgba(161, 98, 7, 0.2);
    background: rgba(254, 249, 195, 0.92);
}

.all-marks-toggle-button.active {
    background: rgba(254, 240, 138, 0.96);
}

.all-marks-toggle-button:hover {
    background: #fffbea;
}

.wind-toggle-button {
    right: 1rem;
    top: 7.6rem;
    color: #4b5563;
    border-color: rgba(75, 85, 99, 0.2);
    background: rgba(243, 244, 246, 0.94);
}

.wind-toggle-button.active {
    background: rgba(229, 231, 235, 0.96);
}

.wind-toggle-button:hover {
    background: white;
}

.drop-boundary-toggle-button {
    right: 1rem;
    top: 9.8rem;
    color: #7e22ce;
    border-color: rgba(126, 34, 206, 0.28);
    background: rgba(250, 245, 255, 0.94);
}

.drop-boundary-toggle-button.active {
    background: rgba(233, 213, 255, 0.96);
    border-color: #7e22ce;
}

.drop-boundary-toggle-button:hover {
    background: white;
}

.drop-boundary-toggle-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.center-courses-button {
    right: 1rem;
    bottom: 2.25rem;
    top: auto;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.18);
    background: rgba(255,255,255,0.95);
}

.center-courses-button:hover {
    background: white;
}

.floating-warning-pane {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 2400;
    width: min(420px, calc(100vw - 2rem));
    max-height: min(42vh, 320px);
    overflow-y: auto;
    padding: 0.65rem 2.2rem 0.7rem 0.8rem;
    border-radius: 6px;
    background: rgba(251, 146, 60, 0.96);
    color: #7c2d12;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
}

.floating-warning-pane ul {
    margin: 0.35rem 0 0 1rem;
    padding: 0;
}

.floating-warning-pane li {
    margin: 0.18rem 0;
}

.warning-title {
    padding-right: 0.25rem;
    animation: warning-title-blink 1.5s steps(1, end) infinite;
}

@keyframes warning-title-blink {
    0%,
    49% {
        color: #7c2d12;
    }
    50%,
    100% {
        color: #fff;
    }
}

.warning-minimize-button {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.45rem;
    height: 1.45rem;
    border: 1px solid rgba(124, 45, 18, 0.22);
    border-radius: 999px;
    background: rgba(255,255,255,0.46);
    color: #7c2d12;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.warning-minimize-button:hover,
.warning-rib:hover {
    background: rgba(255,255,255,0.62);
}

.warning-rib {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2400;
    border: 0;
    border-radius: 0;
    padding: 0.45rem 0.8rem;
    background: rgba(251, 146, 60, 0.96);
    color: #7c2d12;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    cursor: pointer;
    animation: warning-rib-flash 1.5s steps(1, end) infinite;
}

@keyframes warning-rib-flash {
    0%,
    49% {
        background: rgba(251, 146, 60, 0.96);
    }
    50%,
    100% {
        background: rgba(255,255,255,0.62);
    }
}

@media (max-width: 560px) {
    .floating-warning-pane {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        width: auto;
        max-height: 38vh;
    }

    .warning-rib {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        border-radius: 0;
        text-align: left;
    }
}

.custom-builder-title {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #111827;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    font-size: 0.9rem;
    font-weight: 800;
}

.custom-builder-title span {
    display: block;
    margin-top: 0.1rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
}

.chart-wrapper {
    height: 160px;
    min-height: 135px;
}

.course-breakdown-panel {
    display: none;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 0.55rem;
    max-height: 42%;
    overflow-y: auto;
}

#chartCard {
    position: relative;
    flex: 0 0 auto;
    padding: 0.85rem;
}

.leg-breakdown-card {
    flex: 0 0 auto;
    padding: 0.85rem;
}

.right-panel:not(.chart-maximized) .course-breakdown-panel:not(.maximized) {
    flex: 0 0 auto;
    max-height: 42%;
}

.right-panel:not(.chart-maximized) .course-breakdown-panel.resized {
    max-height: none;
}

.course-breakdown-panel.resized {
    max-height: none;
}

#chartCard h3 {
    margin-bottom: 0.55rem;
    padding-right: 4rem;
}

.chart-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 9px;
    cursor: ns-resize;
    z-index: 2;
}

.chart-resize-handle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    width: 46px;
    height: 3px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translateX(-50%);
}

.main-content.left-panel-hidden .right-panel:not(.chart-maximized) .chart-resize-handle {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 9px;
    height: auto;
    cursor: ew-resize;
}

.main-content.left-panel-hidden .right-panel:not(.chart-maximized) .chart-resize-handle::after {
    top: 50%;
    left: 3px;
    width: 3px;
    height: 46px;
    transform: translateY(-50%);
}

.course-breakdown-panel.resizing,
.course-breakdown-panel.resizing * {
    user-select: none;
}

.chart-window-button {
    position: absolute;
    top: 0.72rem;
    width: 1.35rem;
    height: 1.35rem;
    border: 1px solid rgba(0, 102, 204, 0.18);
    border-radius: 4px;
    background: rgba(255,255,255,0.94);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 7px rgba(0,0,0,0.08);
}

.chart-card-hide-button {
    right: 0.85rem;
}

.chart-card-maximize-button {
    right: 2.45rem;
}

.chart-window-button:hover {
    background: rgba(0, 102, 204, 0.08);
    border-color: rgba(0, 102, 204, 0.28);
}

.chart-card-hide-button:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.32);
    color: #b91c1c;
}

.right-panel.chart-maximized .map-container {
    display: none;
}

.course-breakdown-panel.maximized {
    flex: 1 1 auto;
    max-height: none;
    height: auto !important;
}

#chartCard.maximized {
    flex: 0 0 auto;
}

#chartCard.maximized .chart-wrapper {
    height: min(45vh, 360px);
}

.main-content.left-panel-hidden .right-panel:not(.chart-maximized) .course-breakdown-panel {
    width: var(--chart-panel-width, min(38%, 560px));
    flex: 0 0 var(--chart-panel-width, min(38%, 560px));
    min-width: 320px;
    max-width: 58%;
    max-height: none;
    height: auto;
}

.main-content.left-panel-hidden .right-panel:not(.chart-maximized) .course-breakdown-panel.resized {
    width: var(--chart-panel-width, min(38%, 560px));
    flex-basis: var(--chart-panel-width, min(38%, 560px));
}

.main-content.left-panel-hidden .right-panel:not(.chart-maximized) #chartCard .chart-wrapper {
    height: 220px;
}

.leg-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
    margin-top: 0.65rem;
    padding-right: 0.25rem;
}

.leg-breakdown-course {
    border-left: 3px solid var(--spin-color);
    padding-left: 0.65rem;
}

.leg-breakdown-course.nonspin {
    border-left-color: var(--nonspin-color);
}

.leg-breakdown-title {
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    color: #111827;
}

.leg-breakdown-rows {
    display: grid;
    gap: 0.22rem;
}

.leg-breakdown-row {
    display: grid;
    grid-template-columns: minmax(4.5rem, 1fr) 3.1rem 4.4rem;
    gap: 0.45rem;
    align-items: baseline;
    font-size: 0.76rem;
}

.leg-breakdown-name {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #374151;
    overflow-wrap: anywhere;
}

.leg-breakdown-rounding.port {
    color: #dc2626;
}

.leg-breakdown-rounding.starboard {
    color: #16a34a;
}

.leg-breakdown-bearing,
.leg-breakdown-distance {
    color: #475569;
    text-align: right;
    white-space: nowrap;
}

.leg-breakdown-total {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.38rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e5e7eb;
    color: #111827;
    font-size: 0.78rem;
    font-weight: 800;
}

.course-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.08rem;
}

.course-score {
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    margin-bottom: 0.12rem;
    font-size: 0.58rem;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.course-card-note {
    margin: 0.12rem 0 0.08rem;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
}

.course-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0.3rem;
}

.course-rank {
    background: var(--spin-color);
    color: white;
    min-width: 24px;
    height: 28px;
    padding: 0 0.35rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.course-rank.best-course-rank {
    min-width: 42px;
    padding: 0 0.48rem;
    white-space: nowrap;
}

.course-item.custom-course-item .course-rank {
    width: auto;
    min-width: 58px;
    border-radius: 999px;
    font-size: 0.72rem;
    white-space: nowrap;
}

.course-item.nonspin .course-rank {
    background: var(--nonspin-color);
}

.course-marks {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: bold;
    color: var(--neutral-dark);
    margin-bottom: 0.3rem;
}

.course-item.alternate-course-card .course-marks,
.course-item.custom-course-item .course-marks,
.course-item.top-course .course-marks {
    box-sizing: border-box;
    text-align: center;
    margin: 0.45rem 0;
    padding: 0.5rem 0.45rem;
    border: 1.5px solid var(--spin-color);
    border-radius: 6px;
    background: #f8fafc;
    line-height: 1.22;
}

.course-item.top-course .course-marks,
.alternate-courses-list .course-marks {
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-marks-inner {
    min-width: 0;
    max-width: 100%;
}

.course-item.alternate-course-card .course-marks,
.course-item.custom-course-item .course-marks,
.course-item.top-course .course-marks {
    font-size: 1rem;
}

.course-item.nonspin.alternate-course-card .course-marks,
.course-item.nonspin.custom-course-item .course-marks {
    border-color: var(--nonspin-color);
}

.course-item.nonspin.top-course .course-marks {
    border-color: var(--nonspin-color);
}

.course-sequence-mark.spin {
    color: var(--spin-color);
}

.course-sequence-mark.alternate-start-mismatch {
    display: inline-block;
    font-size: 1.25em;
    font-weight: 900;
    line-height: 0.9;
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.12em;
}

.course-sequence-mark.nonspin {
    color: var(--nonspin-color);
}

.course-sequence-rounding.port {
    color: #dc2626;
}

.course-sequence-rounding.starboard {
    color: #16a34a;
}

.course-sequence-separator {
    color: #475569;
}

.drop-mark-position {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0 0 0.35rem;
    padding: 0.22rem 0.35rem;
    border-radius: 4px;
    background: #f5f3ff;
    color: #5b21b6;
    font-size: 0.72rem;
    line-height: 1.25;
}

.drop-mark-position span {
    font-weight: 900;
}

.drop-mark-position strong {
    color: #312e81;
    font-family: 'Courier New', monospace;
    font-size: 0.74rem;
    overflow-wrap: anywhere;
}

.drop-mark-position.split {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.12rem 0.4rem;
}

.drop-mark-position.split span {
    grid-row: 1 / span 2;
}

.drop-mark-position.split strong {
    display: block;
}

.course-compact-layout {
    display: grid;
    grid-template-columns: minmax(82px, 0.52fr) minmax(132px, 1fr);
    gap: 0.5rem;
    align-items: stretch;
    margin-top: 0.45rem;
}

.courses-list:not(.alternate-courses-list) .course-compact-layout,
#customCoursesList .course-compact-layout,
#dropMarkCoursesList .course-compact-layout {
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.course-compact-layout:has(.pos-breakdown:only-child) {
    grid-template-columns: 1fr;
}

.course-compact-layout:has(.pos-breakdown:only-child) .pos-breakdown {
    border-right: 0;
    padding-right: 0;
}

.mini-course-preview {
    min-width: 0;
    height: 86px;
    align-self: stretch;
}

.courses-list:not(.alternate-courses-list) .mini-course-preview,
#customCoursesList .mini-course-preview,
#dropMarkCoursesList .mini-course-preview {
    min-width: 0;
    width: 100%;
    height: 118px;
}

.mini-course-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mini-course-route line,
.mini-course-travel path {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mini-course-route line {
    opacity: 0.72;
}

.mini-wind-arrow path {
    fill: #cbd5e1;
    stroke: #374151;
    stroke-width: 2px;
    stroke-opacity: 1;
    opacity: 0.8;
}

.mini-course-travel path {
    stroke-width: 2.2;
    opacity: 0.86;
}

.mini-course-mark circle {
    fill: #ffea00;
    stroke: #111827;
    stroke-width: 1.5;
}

.mini-course-mark rect {
    fill: #ffea00;
    stroke: #111827;
    stroke-width: 1.5;
}

.mini-course-mark.start-mark circle,
.mini-course-mark.start-mark rect {
    fill: #e9d5ff;
    stroke: #7e22ce;
}

.mini-course-mark.finish-mark circle,
.mini-course-mark.finish-mark rect {
    fill: #e7c9a9;
    stroke: #5c3718;
}

.mini-course-mark .mini-start-half {
    fill: #e9d5ff;
    stroke: #7e22ce;
    stroke-width: 1.5;
}

.mini-course-mark .mini-finish-half {
    fill: #e7c9a9;
    stroke: #5c3718;
    stroke-width: 1.5;
}

.mini-course-mark text {
    fill: #111827;
    font-size: 5.8px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: middle;
    alignment-baseline: middle;
    pointer-events: none;
}

.mini-course-mark.basin-mark text {
    font-size: 5.1px;
}

.mini-rounding-arrow path {
    fill: none;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mini-rounding-arrow.port path {
    stroke: #dc2626;
}

.mini-rounding-arrow.starboard path {
    stroke: #16a34a;
}

.mini-rounding-arrow .mini-rounding-head {
    stroke: none;
}

.mini-rounding-arrow.port .mini-rounding-head {
    fill: #dc2626;
}

.mini-rounding-arrow.starboard .mini-rounding-head {
    fill: #16a34a;
}

.course-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

.selected-courses .course-item .course-stats {
    grid-template-columns: 1fr;
}

.alternate-courses-list .course-stats {
    grid-template-columns: 1fr;
}

.stat {
    display: flex;
    justify-content: space-between;
}

.courses-list:not(.alternate-courses-list) .stat,
#customCoursesList .stat,
#dropMarkCoursesList .stat {
    justify-content: flex-start;
    gap: 0.3rem;
}

.stat-label {
    font-weight: 600;
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: var(--primary-color);
}

.course-item.nonspin .stat-value {
    color: var(--nonspin-color);
}

/* Map Container */
.map-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

#map {
    flex: 1;
    border-radius: 8px 8px 0 0;
}

.mark-icon {
    background: #ffea00;
    border: 2px solid #111;
    border-radius: 50%;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 8px;
    line-height: 1;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.28);
    overflow: hidden;
}

.mark-icon.selected {
    border-width: 2px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.9), 0 2px 5px rgba(0,0,0,0.35);
}

.mark-icon.basin-mark {
    border-radius: 999px;
    font-size: 7px;
    padding: 0 2px;
}

.mark-icon.start-mark {
    background: #e9d5ff;
    border-color: #7e22ce;
}

.mark-icon.finish-mark {
    background: #e7c9a9;
    border-color: #5c3718;
    color: #111;
}

.mark-icon.excluded {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
    box-shadow: none;
}

.mark-icon.excluded.selected {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.9), 0 2px 5px rgba(0,0,0,0.25);
}

.mark-icon.excluded.finish-mark {
    background: #e7c9a9;
    border-color: #5c3718;
    color: #111;
    box-shadow: 0 1px 4px rgba(0,0,0,0.28);
}

.mark-icon.excluded.start-mark {
    background: #e9d5ff;
    border-color: #7e22ce;
    color: #111;
    box-shadow: 0 1px 4px rgba(0,0,0,0.28);
}

.mark-icon.start-mark.finish-mark {
    background: linear-gradient(90deg, #e9d5ff 0 50%, #e7c9a9 50% 100%);
    border-color: #111;
    box-shadow: 0 1px 4px rgba(0,0,0,0.28);
}

.mark-icon.start-mark.finish-mark::before {
    display: none;
}

.mark-icon.start-mark.finish-mark span {
    display: block;
}

.mark-icon.start-mark.invalid-start {
    background: #581c87;
    border-color: #e9d5ff;
    color: #e9d5ff;
}

.mark-icon.finish-mark.invalid-finish {
    background: #5c3718;
    border-color: #e7c9a9;
    color: #fff;
}

.mark-icon.invalid-mark {
    background: #111;
    border-color: #ffea00;
    color: #ffea00;
}

.mark-icon.rounding-conflict {
    background: #111;
    border-color: #ffea00;
    color: #ffea00;
}

.mark-icon.disabled-course-mark {
    background: #374151;
    border-color: #d1d5db;
    color: #fff;
}

.mark-icon span {
    display: block;
    white-space: nowrap;
}

.course-item.unpaired-alternate-course {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16);
}

.course-pair-review {
    margin: 0.12rem 0 0.22rem;
    padding: 0.22rem 0.35rem;
    border-radius: 4px;
    background: #fff7ed;
    color: #92400e;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

.travel-arrow-icon {
    background: transparent;
    border: 0;
    pointer-events: none;
}

.travel-arrow-icon svg,
.rounding-conflict-icon svg {
    display: block;
}

.rounding-conflict-icon {
    background: transparent;
    border: 0;
    pointer-events: none;
}

.danger-region-label {
    background: transparent;
    border: 0;
    color: #7f1d1d;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255,255,255,0.75);
    white-space: normal;
}

.danger-region-label span {
    display: block;
    overflow-wrap: break-word;
}

.map-info {
    padding: 1.5rem;
    background: var(--neutral-light);
    border-top: 1px solid var(--border-color);
}

.map-info h4 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

#mapCourseDetails {
    font-size: 0.9rem;
    line-height: 1.6;
}

.calculation-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(229, 231, 235, 0.74);
    backdrop-filter: blur(1px);
}

.calculation-overlay-panel {
    width: min(420px, calc(100vw - 40px));
    padding: 1.65rem 1.4rem;
    border: 3px solid var(--primary-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.34);
    text-align: center;
}

.calculation-overlay-title {
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.15;
}

.calculation-overlay-message {
    margin-top: 0.45rem;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 1rem auto;
    border: 4px solid var(--neutral-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Card */
.error-card {
    background: #ffebee;
    border-color: var(--danger-color);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.error-card h3 {
    color: var(--danger-color);
    margin-bottom: 0.5rem;
}

.error-card p {
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Scrollbar styling */
.left-panel::-webkit-scrollbar {
    width: 6px;
}

.left-panel::-webkit-scrollbar-track {
    background: var(--neutral-light);
    border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        height: auto;
        min-height: 100vh;
    }

    .main-content {
        flex-direction: column;
        overflow: visible;
    }

    .left-panel {
        width: 100%;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .right-panel {
        width: 100%;
        flex: 0 0 auto;
        overflow: visible;
    }

    .right-panel.responsive-empty {
        display: none;
    }

    .main-content.left-panel-hidden .left-panel,
    .main-content.left-panel-hidden .right-panel {
        width: 100%;
        opacity: 1;
        overflow: visible;
        pointer-events: auto;
    }

    .main-content.left-panel-hidden .right-panel {
        flex-direction: column;
    }

    .panel-hide-button,
    .panel-restore-button {
        display: none !important;
    }

    .map-container {
        flex: 0 0 auto;
        height: clamp(360px, 52vh, 560px);
        min-height: 360px;
    }

    .right-panel .course-breakdown-panel,
    #resultsContainer .course-breakdown-panel {
        width: 100%;
        flex: 0 0 auto;
        max-height: none;
        flex-basis: auto;
    }

    .right-panel:not(.chart-maximized) .course-breakdown-panel:not(.maximized) {
        flex: 0 0 auto;
        max-height: none;
    }

    #resultsContainer .course-breakdown-panel {
        margin-top: 0.55rem;
        margin-bottom: 0.55rem;
    }

    .course-breakdown-panel.resized {
        height: auto !important;
    }

    #chartCard .chart-wrapper {
        height: min(36vh, 260px);
        min-height: 190px;
    }

    .main-content.left-panel-hidden .right-panel:not(.chart-maximized) .course-breakdown-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .main-content.left-panel-hidden .right-panel:not(.chart-maximized) .chart-resize-handle {
        top: 0;
        bottom: auto;
        left: 0;
        right: 0;
        width: auto;
        height: 9px;
        cursor: ns-resize;
    }

    .main-content.left-panel-hidden .right-panel:not(.chart-maximized) .chart-resize-handle::after {
        top: 3px;
        left: 50%;
        width: 46px;
        height: 3px;
        transform: translateX(-50%);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .conditions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    .conditions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

/* Point of Sail breakdown chart styles */
.pos-breakdown {
    min-width: 0;
    padding-right: 0.45rem;
    border-right: 1px solid #e5e7eb;
}

.pos-section-label {
    margin: 0 0 0.28rem;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.1;
}

.pos-compact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.16rem 0.32rem;
}

.pos-item {
    display: flex;
    flex-direction: column;
    gap: 0.03rem;
    min-width: 0;
    padding: 0.16rem 0.18rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.72);
    font-size: 0.68rem;
}

.pos-label {
    color: #64748b;
    font-size: 0.56rem;
    font-weight: 800;
    line-height: 1.05;
}

.pos-distance {
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1.05;
    white-space: nowrap;
}

.courses-list:not(.alternate-courses-list) .pos-breakdown,
#customCoursesList .pos-breakdown,
#dropMarkCoursesList .pos-breakdown {
    padding-right: 0;
    border-right: 0;
}

.courses-list:not(.alternate-courses-list) .pos-compact-grid,
#customCoursesList .pos-compact-grid,
#dropMarkCoursesList .pos-compact-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.18rem;
}

.courses-list:not(.alternate-courses-list) .pos-item,
#customCoursesList .pos-item,
#dropMarkCoursesList .pos-item {
    align-items: center;
    padding: 0.18rem 0.12rem;
    text-align: center;
}

.course-item.nonspin .pos-distance {
    color: var(--nonspin-color);
}

.pos-distance small {
    margin-left: 0.18rem;
    color: #64748b;
    font-size: 0.54rem;
    font-weight: 800;
}

.selected-courses .pos-distance small,
.courses-list:not(.alternate-courses-list) .pos-distance small {
    display: block;
    margin-left: 0;
    margin-top: 0.04rem;
}

.pos-bar {
    width: 100%;
    height: 3px;
    background: var(--neutral-light);
    border-radius: 2px;
    margin-top: 0.12rem;
    overflow: hidden;
}

.pos-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    transition: width 0.3s;
}

/* Selected courses area */
.selected-courses {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
}

.selected-courses .course-item {
    flex: 1 1 50%;
    min-width: 0;
}

#customCoursesList.selected-courses .course-item,
#dropMarkCoursesList.selected-courses .course-item {
    flex: 1 1 50%;
    min-width: 0;
}

.results-section-title {
    margin: 0 0 0.35rem 0;
    color: var(--neutral-dark);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#spinCard > h3,
#nonSpinCard > h3,
.alternate-fleet-title {
    margin-bottom: 0.65rem;
    margin-top: 0;
    color: #475569;
    font-size: 0.96rem;
    font-weight: 800;
}

/* Fleet badge */
.fleet-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 0.58rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.72rem;
    color: white;
}
.fleet-badge.spin { background: var(--spin-color); }
.fleet-badge.nonspin { background: var(--nonspin-color); }
