body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #333; /* Dark background for boat dashboard */
    color: #f0f0f0;
    font-size: 16px; /* Base font size, will be overridden for inputs */
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh issues */
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

.app-header {
    background-color: #444;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.app-header h1 {
    margin: 0 0 10px 0;
    font-size: 1.8em;
    color: #00c6ff;
}

.status-indicators {
    display: flex;
    justify-content: space-around;
    font-size: 0.9em;
    margin-bottom: 10px;
}
#saveStatus { color: #a0e8a0; }
#syncStatus { color: #a0c4e8; }

.main-controls {
    display: flex;
    justify-content: space-around;
}

.control-button, .action-button {
    padding: 15px 20px; /* Larger buttons */
    font-size: 1.2em;   /* Larger text on buttons */
    border-radius: 8px;
    border: none;
    cursor: pointer;
    color: white;
    min-width: 120px;
}

.btn-new { background-color: #007bff; }
.btn-sync { background-color: #17a2b8; }
.btn-start { background-color: #28a745; }
.btn-end { background-color: #dc3545; }
.btn-event { background-color: #ffc107; color: #333; }

.tow-log-form fieldset {
    background-color: #4a4a4a;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.tow-log-form legend {
    font-size: 1.4em;
    font-weight: bold;
    color: #00c6ff;
    padding: 0 10px;
}

.form-group {
    /* MODIFIED: Increased spacing between questions */
    margin-bottom: 40px;
}

.form-group label, .form-group .radio-group label {
    display: block;
    font-size: 1.3em; /* Larger labels */
    /* MODIFIED: Increased label bottom margin for more separation */
    margin-bottom: 12px;
    font-weight: 500;
}

/* Common styling for text-like inputs and select */
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select { /* Added select here */
    width: 100%;
    padding: 15px;
    font-size: 1.4em;
    border-radius: 6px;
    border: 1px solid #666;
    background-color: #555;
    color: #f0f0f0;
    box-sizing: border-box;
}

.form-group input[type="range"] {
    width: 100%;
    height: 24px; /* Overall height for the slider's clickable area, track will be smaller */
    padding: 0;
    margin-top: 8px;
    margin-bottom: 8px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Slider Thumb Styling (Draggable Part) */
.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;  /* Larger thumb width */
    height: 32px; /* Larger thumb height */
    background: #00c6ff;
    border-radius: 50%;
    border: 2px solid #2a2a2a;
    margin-top: -12px; /* Adjust to center thumb on track: -(thumbHeight - trackHeight)/2 */
}
.form-group input[type="range"]::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: #00c6ff;
    border-radius: 50%;
    border: 2px solid #2a2a2a;
    cursor: pointer;
}
.form-group input[type="range"]::-ms-thumb { /* For older Edge/IE */
    width: 32px;
    height: 32px;
    background: #00c6ff;
    border-radius: 50%;
    border: 2px solid #2a2a2a;
    cursor: pointer;
    margin-top: 0; /* IE often handles this differently */
}

/* Slider Track Styling */
.form-group input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px; /* Thickness of the actual track bar */
    background: #666;
    border-radius: 4px;
}
.form-group input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    background: #666;
    border-radius: 4px;
}
.form-group input[type="range"]::-ms-track { /* For older Edge/IE */
    width: 100%;
    height: 8px;
    background: transparent;
    border-color: transparent;
    color: transparent;
}
.form-group input[type="range"]::-ms-fill-lower {
    background: #00c6ff;
    border-radius: 4px;
}
.form-group input[type="range"]::-ms-fill-upper {
    background: #666;
    border-radius: 4px;
}


/* Specific styling for select to make it look better */
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23f0f0f0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-13z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 1em;
    cursor: pointer;
}

/* Ensure the "new pilot/wing" text input also matches other text inputs */
#pilotNameNew, #wingNewInput {
    /* Inherits from common text input styles */
    margin-top: 10px; /* From HTML inline style, can be kept here */
}


.form-group output {
    font-weight: bold;
    color: #7fddff;
    margin-left: 8px; /* Space after label text, before output value */
}

.radio-group {
    display: flex; /* Using flex for alignment */
    align-items: center;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    margin-right: 30px; /* Spacing between radio options */
    font-size: 1.2em; /* Font size of the label text */
    font-weight: normal;
    cursor: pointer;
}
.radio-group input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 32px;  /* Twice the typical default size (e.g. 16px -> 32px) */
    height: 32px;
    border: 3px solid #f0f0f0; /* Slightly thicker border */
    border-radius: 50%;
    margin-right: 10px; /* Space between custom radio and its label text */
    outline: none;
    cursor: pointer;
    position: relative;
    vertical-align: middle; /* Fallback if flex alignment isn't perfect */
    flex-shrink: 0; /* Prevent radio from shrinking if label text is long */
}

.radio-group input[type="radio"]:checked {
    border-color: #00c6ff;
}

.radio-group input[type="radio"]:checked::after {
    content: '';
    display: block;
    width: 20px;  /* Size of the inner "dot" */
    height: 20px;
    background-color: #00c6ff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


.timestamp-buttons {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
}
.timestamp-buttons .action-button {
    width: 80%;
    max-width: 400px;
    margin-bottom: 5px;
}
.timestamp-display {
    display: block;
    font-size: 1em;
    color: #ccc;
    margin-top: 5px;
}

/* Pilot Management Styles */
.pilot-management-container {
    background-color: #444;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px; /* Space before previous tows */
}
.pilot-management-container h2 {
    font-size: 1.5em;
    margin-top: 0;
    text-align: left;
    color: #00c6ff;
}
#pilotManagementList .pilot-item {
    background-color: #505050;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#pilotManagementList .pilot-name {
    font-size: 1.1em;
}
#pilotManagementList .pilot-actions button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
    font-size: 0.9em;
}
#pilotManagementList .pilot-actions button.btn-delete {
    background-color: #dc3545;
}
#pilotManagementList .pilot-actions button:hover {
    opacity: 0.8;
}


.previous-tows-container {
    background-color: #444;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px; /* Space before summary table */
}
.previous-tows-container h2 {
    font-size: 1.5em;
    margin-top: 0;
    text-align: left;
    color: #00c6ff; /* Match legend color */
}
#previousTowsList div {
    background-color: #505050;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 5px solid #007bff;
}
#previousTowsList div.synced {
    border-left-color: #28a745; /* Green for synced */
}
#previousTowsList div.unsynced {
    border-left-color: #ffc107; /* Yellow for unsynced/pending */
}
#previousTowsList h3 {
    font-size: 1.1em; margin: 0 0 5px 0;
}
#previousTowsList p {
    font-size: 0.9em; margin: 3px 0;
}

/* Pilot Summary Table Styles */
.pilot-summary-container {
    background-color: #444;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}
.pilot-summary-container h2 {
    font-size: 1.5em;
    margin-top: 0;
    text-align: left;
    color: #00c6ff; /* Match legend color */
}
#pilotSummaryTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
#pilotSummaryTable th, #pilotSummaryTable td {
    border: 1px solid #555;
    padding: 10px;
    text-align: left;
    font-size: 1em;
}
#pilotSummaryTable th {
    background-color: #505050;
    color: #f0f0f0;
    font-weight: bold;
}
#pilotSummaryTable td {
    background-color: #4a4a4a;
}
#pilotSummaryTable tbody tr:nth-child(even) td {
    background-color: #505050; /* Slightly different for zebra striping if desired */
}


@media (orientation: landscape) {
    /* No specific landscape overrides for now */
}