body {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
  background-color: #15151d;
}

header {
  font-family: "Mrs Saint Delafield", cursive;
  font-weight: 400;
  font-style: normal;
  height: 120px;
  width: 100%;
  font-size: 80px;
  background-color: #ff1e00;
  background-image: linear-gradient(135deg, #ff1e00 0%, #c80f00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
}

.pheader {
  transition: transform 0.3s ease-in-out, text-shadow 0.3s ease;
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  padding: 0 15px;
  margin: 0;
}

.pheader:hover {
  transform: scale(1.15);
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
}

a {
  text-decoration: none;
  color: white;
}

main {
  background-color: #15151d;
  width: 100%;
  color: white;
  min-height: 800px;
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

/* Wider calculator container */
.calculator-container {
  max-width: 1000px; /* Increased from 800px */
  width: 95%;
  background-color: #1e1e2a;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.hidden {
  display: none !important;
}

/* Enhanced Race Type Selection */
#race-type-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  width: 100%;
}

.selection-title {
  color: #ff1e00;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 30px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
}

.selection-title:after {
  content: '';
  position: absolute;
  width: 60px;
  height: 3px;
  background: #ff1e00;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.race-buttons-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  width: 100%;
  max-width: 800px;
  margin: 20px 0 40px;
}

.race-button {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 12px;
  background-color: #2a2a3a;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.17, 0.67, 0.83, 0.67);
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.race-button:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 30, 0, 0.2) 0%, transparent 70%);
  z-index: 1;
}

.button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  z-index: 2;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

/* Race Button SVG Icon Fixes */
.icon {
  width: 50px;
  height: 50px;
  color: #ff1e00;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure SVG fills the container properly */
.icon svg {
  width: 100%;
  height: 100%;
  display: block; /* Prevents unwanted space */
}

/* Fix icon colors in active state */
.race-button.active .icon svg {
  color: white;
}

/* Fix stroke visibility */
.icon svg path,
.icon svg circle {
  stroke-width: 2px;
  vector-effect: non-scaling-stroke; /* Keeps stroke width consistent when scaling */
}

/* Make sure icon container has proper dimensions */
.icon-container {
  margin-bottom: 20px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 30, 0, 0.1);
  transition: all 0.3s ease;
  overflow: visible; /* Allow SVG to overflow if needed */
}
.button-title {
  color: white;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.button-description {
  color: #aaa;
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  transition: opacity 0.3s ease;
}

.race-button:hover {
  background-color: #3a3a4a;
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.race-button:hover .icon-container {
  background-color: rgba(255, 30, 0, 0.2);
  transform: scale(1.1);
}

.race-button:hover .button-title {
  transform: translateY(-5px);
}

.race-button.active {
  background-color: #ff1e00;
  transform: translateY(-5px);
}

.race-button.active:hover {
  transform: translateY(-12px);
}

.race-button.active .icon-container {
  background-color: rgba(255, 255, 255, 0.2);
}
.race-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s ease;
}
/* Active state styling for images */
.race-button.active .race-icon {
  filter: brightness(0) invert(1); /* Makes the icon white */
}

.race-button.active .button-description {
  color: rgba(255, 255, 255, 0.8);
}

.selection-footer {
  color: #aaa;
  font-size: 16px;
  text-align: center;
  font-style: italic;
  margin-top: 20px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .race-buttons-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  
  .race-button {
    width: 100%;
    max-width: 280px;
    height: 240px;
  }
  
  .selection-title {
    font-size: 28px;
  }
}

@media screen and (max-width: 480px) {
  .race-button {
    height: 220px;
  }
  
  .icon-container {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
  }
  
  .icon {
    width: 40px;
    height: 40px;
  }
  
  .button-title {
    font-size: 24px;
    margin-bottom: 10px;
  }
  
  .button-description {
    font-size: 13px;
  }
}
.duration-note {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 5px;
  font-style: italic;
}

.race-button.active .duration-note {
  color: rgba(255, 255, 255, 0.9);
}

/* Adjusting button height to accommodate the additional text */
.race-button {
  height: 300px;
}

@media screen and (max-width: 768px) {
  .race-button {
    height: 260px;
  }
}

@media screen and (max-width: 480px) {
  .race-button {
    height: 240px;
  }
  
  .duration-note {
    font-size: 11px;
    margin-top: 3px;
  }
}
  
/* Calculator Form */
#calculator-form {
  max-width: 800px;  /* Increased from 600px */
  margin: 0 auto;
}

#calculator-form h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #ff1e00;
}

#calculator-form h3 {
  color: #ff1e00;
  margin-top: 30px;
  margin-bottom: 15px;
  border-bottom: 1px solid #3a3a4a;
  padding-bottom: 8px;
}

.form-group {
  margin-bottom: 25px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

input[type="number"] {
  background-color: #2a2a3a;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  padding: 12px;
  color: white;
  width: 100%;
  margin-bottom: 15px;
  font-size: 16px;
}

/* Toggle Switch - Updated Style */
.toggle-switch {
  position: relative;
  width: 180px;
  height: 40px;
}

.toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #2a2a3a;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.switch-label:after {
  content: '';
  position: absolute;
  width: 50%;
  height: 100%;
  border-radius: 30px;
  background-color: #ff1e00;
  top: 0;
  left: 0;
  transition: 0.3s;
  z-index: 1;
}

.toggle-option {
  color: white;
  font-size: 16px;
  font-weight: 600;
  z-index: 2;
  flex: 1;
  text-align: center;
  padding: 10px 0;
}

input[type="checkbox"]:checked + .switch-label:after {
  transform: translateX(100%);
}

/* Active text state */
.toggle-option:first-child {
  color: white;
}

.toggle-option:last-child {
  color: rgba(255, 255, 255, 0.7);
}

input[type="checkbox"]:checked + .switch-label .toggle-option:first-child {
  color: rgba(255, 255, 255, 0.7);
}

input[type="checkbox"]:checked + .switch-label .toggle-option:last-child {
  color: white;
}

.input-with-switch {
  display: flex;
  align-items: center;
  gap: 15px;
}

.input-with-switch input[type="number"] {
  width: 70%;
  margin-bottom: 0;
}

/* Time Input */
.time-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-input input {
  width: calc(50% - 10px);
}

.time-separator {
  font-size: 20px;
  font-weight: bold;
}

/* Custom Checkbox Styling */
.checkbox-container {
  display: flex;
  align-items: center;
  margin-top: 15px;
}

.custom-checkbox {
  position: absolute;
  opacity: 0;
}

.checkbox-label {
  position: relative;
  padding-left: 35px;
  cursor: pointer;
  display: inline-block;
  font-weight: 500;
  user-select: none;
}

.checkbox-label:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #3a3a4a;
  background: #2a2a3a;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.custom-checkbox:checked + .checkbox-label:before {
  background: #ff1e00;
  border-color: #ff1e00;
}

.checkbox-label:after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 12px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: all 0.3s ease;
}

.custom-checkbox:checked + .checkbox-label:after {
  opacity: 1;
}

.custom-checkbox:focus + .checkbox-label:before {
  box-shadow: 0 0 0 3px rgba(255, 30, 0, 0.2);
}

.checkbox-label:hover:before {
  border-color: #ff1e00;
}

/* Weather Section Styles */
.weather-inputs {
  background-color: #2a2a3a;
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.weather-toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #3a3a4a;
}

.temperature-inputs {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.temperature-inputs.show {
  max-height: 400px; /* Limited max height */
  overflow-y: auto; /* Add scrollbar if needed */
}

/* Grid layout for hour inputs */
#hour-inputs-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.hour-input {
  display: flex;
  align-items: center;
  margin-bottom: 0; /* Remove margin as grid handles spacing */
  padding: 8px;
  border-radius: 4px;
  background-color: #1e1e2a;
}

.hour-label {
  width: 70px;
  font-weight: 600;
  margin-right: 15px;
}

.temp-input-container {
  display: flex;
  align-items: center;
  flex: 1;
}

.temp-input-container input {
  margin-bottom: 0;
}

.temp-unit {
  margin-left: 10px;
  color: #aaa;
  font-weight: 500;
}

.sim-time-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  margin-bottom: 10px;
}

.sim-time-input {
  display: flex;
  align-items: center;
  width: 130px;
}

.sim-time-input input {
  width: 60px;
  text-align: center;
  margin-bottom: 0;
}

.colon {
  margin: 0 5px;
  font-weight: bold;
}

/* Button Styles */
.calculate-btn {
  background-color: #ff1e00;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.calculate-btn:hover {
  background-color: #d41700;
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(255, 30, 0, 0.3);
}

.back-btn {
  background-color: transparent;
  color: white;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  padding: 12px 25px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 30px;
  width: auto;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background-color: #2a2a3a;
  border-color: #ff1e00;
}

/* Loading Spinner */
#loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.loading-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-message p {
  font-size: 20px;
  font-weight: 600;
  color: #ff1e00;
  margin: 0;
  font-family: monospace;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 30, 0, 0.3);
  border-radius: 50%;
  border-top-color: #ff1e00;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Strategy Results */
#strategy-result {
  padding: 20px 0;
}

.strategy-title, .stint-title {
  color: #ff1e00;
  font-size: 22px;
  font-weight: 700;
  margin: 30px 0 20px;
  text-align: center;
  letter-spacing: 1px;
}

.strategy-overview {
  background-color: #2a2a3a;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.strategy-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #3a3a4a;
}

.strategy-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.strategy-label {
  font-weight: 600;
  color: #ccc;
}

.strategy-value {
  font-weight: 700;
  color: white;
}

/* Box Lap Highlighting */
.highlight-cell {
  color: #ff1e00;
  font-weight: 700;
}

/* Enhanced Table Styling */
.stint-table-container {
  max-width: 100%;
  overflow-x: auto;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  padding-bottom: 5px;
}

.stint-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 auto;
  min-width: 850px;
}

.stint-table th {
  background-color: #1a1a24;
  color: #ff1e00;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.8px;
  padding: 12px 8px;
  border: none;
  border-bottom: 2px solid #ff1e00;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.stint-table td {
  background-color: #25253a;
  padding: 10px 8px;
  text-align: center;
  border: none;
  border-bottom: 1px solid #3a3a4a;
  color: white;
  font-size: 14px;
}

.stint-table tr:nth-child(even) td {
  background-color: #2a2a42;
}

.stint-table tr:hover td {
  background-color: #303050;
}

.stint-table tr:last-child td {
  background-color: rgba(255, 30, 0, 0.15);
  border-bottom: 2px solid #ff1e00;
  font-weight: 600;
}

/* Column widths */
.stint-table th:nth-child(1), 
.stint-table td:nth-child(1) {
  width: 7%;
}

.stint-table th:nth-child(2), 
.stint-table td:nth-child(2) {
  width: 8%;
}

.stint-table th:nth-child(3), 
.stint-table td:nth-child(3) {
  width: 12%;
}

.stint-table th:nth-child(4), 
.stint-table td:nth-child(4) {
  width: 12%;
}

.stint-table th:nth-child(5), 
.stint-table td:nth-child(5) {
  width: 28%;
}

.stint-table th:nth-child(6), 
.stint-table td:nth-child(6) {
  width: 16%;
}

.stint-table th:nth-child(7), 
.stint-table td:nth-child(7) {
  width: 17%;
}

.stint-table thead {
  background-color: #2a2a3a;
}

.stint-table th {
  color: #ff1e00;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
  background-color: #252532;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid #ff1e00;
}

.stint-table tbody tr {
  background-color: #1e1e2a;
  transition: background-color 0.3s;
}

.stint-table tbody tr:hover {
  background-color: #2a2a3a;
}

.stint-table tbody tr:nth-child(even) {
  background-color: #25252f;
}

.stint-table tbody tr:last-child {
  background-color: rgba(255, 30, 0, 0.15);
  border-bottom: 2px solid #ff1e00;
}

.stint-table tbody tr td:nth-child(3) {
  font-weight: 600;
}

.stint-table tbody tr:last-child td:nth-child(3) {
  color: #7fff00;
  font-weight: 700;
}

/* Enhanced Fuel Display Styling */
/* Better Fuel Display */
/* Enhanced Fuel Display Styling */
.fuel-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px;
  background-color: #1e1e30;
  border-radius: 4px;
}

.fuel-exact {
  font-weight: 700;
  font-size: 16px;
  color: white;
}

.fuel-full {
  font-size: 14px;
  color: #00bfff;
  font-weight: 700;
  text-transform: uppercase;
}

.fuel-safe {
  font-size: 14px;
  color: #4dff4d;
  font-weight: 700;
  text-transform: uppercase;
}

.no-fuel {
  color: #aaaaaa;
  font-weight: 600;
  font-size: 14px;
}

.safe-amount {
  font-size: 12px;
  color: #7fff00;
  background-color: rgba(127, 255, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.highlight-cell {
  color: #ff1e00;
  font-weight: 700;
  background-color: rgba(255, 30, 0, 0.1) !important;
}

/* Make fuel info more visible */
.stint-table td:nth-child(5) {
  font-weight: 600;
}

/* Enhanced safe fuel display */
.safe-fuel, .safe-amount {
  color: #7fff00;
  font-size: 0.9em;
  margin-left: 5px;
  font-weight: 600;
  padding: 1px 4px;
  background-color: rgba(127, 255, 0, 0.1);
  border-radius: 3px;
}

footer {
  width: 100%;
  height: 100px;
  border-top: solid 3px #ff1e00;
  background-color: #15151d;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

#typewriter {
  font-size: 30px;
  font-family: monospace;
  padding: 0 20px;
  text-align: center;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
  .calculator-container {
    width: 95%;
    padding: 25px;
  }
  
  #calculator-form {
    max-width: 90%;
  }
  
  .stint-table {
    min-width: 750px;
  }
}

@media screen and (max-width: 768px) {
  .stint-table th,
  .stint-table td {
    padding: 8px 4px;
    font-size: 13px;
  }
  #race-type-selection {
    flex-direction: column;
    align-items: center;
  }
 
  .icon {
    width: 40px;
    height: 40px;
  }
  .race-button {
    width: 90%;
    max-width: 300px;
  }
  
  .input-with-switch {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .input-with-switch input[type="number"] {
    width: 100%;
    margin-bottom: 10px;
  }
  
  .strategy-item {
    flex-direction: column;
    gap: 5px;
  }
  
  .stint-table {
    min-width: 650px;
  }
  
  .stint-table th, 
  .stint-table td {
    padding: 6px 4px;
    font-size: 13px;
  }
  
  .stint-title, .strategy-title {
    font-size: 20px;
  }
  
  .weather-toggle-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .sim-time-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Hide less critical columns on smaller screens */
  .stint-table th:nth-child(7), 
  .stint-table td:nth-child(7) {
    display: none;
  }
  
  .fuel-display {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .fuel-exact {
    font-size: 13px;
  }
  
  .fuel-full {
    font-size: 10px;
    padding: 2px 5px;
  }
  
  .stint-table th:nth-child(7), 
  .stint-table td:nth-child(7) {
    display: none;
  }
  
  .safe-amount {
    font-size: 0.8em;
    display: block;
    margin-top: 2px;
    margin-left: 0;
  }
}

@media screen and (max-width: 480px) {
  .stint-table th,
  .stint-table td {
    padding: 6px 3px;
    font-size: 12px;
  }
  .stint-table th:nth-child(6), 
  .stint-table td:nth-child(6) {
    display: none;
  }
  .icon {
    width: 30px;
    height: 30px;
  }
  .fuel-display {
    padding: 0;
  }
  
  .fuel-exact {
    font-size: 12px;
  }
  
  #calculator-form h2 {
    font-size: 24px;
  }
  
  .race-button {
    height: 120px;
  }
  
  .race-button span {
    font-size: 20px;
  }
  
  input[type="number"] {
    padding: 10px;
  }
  
  .strategy-title, .stint-title {
    font-size: 18px;
  }
  
  .stint-table {
    min-width: 480px;
  }
  
  .stint-table th, 
  .stint-table td {
    padding: 5px 3px;
    font-size: 12px;
  }
  
  /* Hide additional columns on very small screens */
  .stint-table th:nth-child(6), 
  .stint-table td:nth-child(6) {
    display: none;
  }
  
  .safe-amount {
    display: block;
    margin-top: 3px;
    margin-left: 0;
    font-size: 10px;
  }
  
  #typewriter {
    font-size: 20px;
  }
  
  footer {
    height: 80px;
  }
}