:root {
  --green: #2e7d32;
  --amber: #f9a825;
  --red: #c62828;
  --blue: #1976d2;
  --text: #222;
  --muted: #555;
  --border: #d9d9d9;
  --background: #f4f6f8;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 16px;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  text-align: center;
}

.subtitle {
  margin: 0 0 28px;
  text-align: center;
  color: var(--muted);
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.inputs,
.results {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.slider-group {
  margin-bottom: 22px;
}

.slider-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.value {
  font-weight: normal;
  color: var(--blue);
}

input[type="range"] {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: #cfd8dc;
  border-radius: 6px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid #ffffff;
  cursor: pointer;
}

.traffic-light-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: #fafafa;
}

.result-card h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.traffic-light {
  width: 100%;
  max-width: 180px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: bold;
  font-size: 18px;
  transition: background-color 0.2s ease;
}

.traffic-light.green {
  background: var(--green);
}

.traffic-light.amber {
  background: var(--amber);
}

.traffic-light.red {
  background: var(--red);
}

.headline {
  margin: 0 0 14px;
  font-size: 16px;
}

.headline span {
  font-weight: bold;
}

.calc-toggle {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
}

.calc-toggle:hover {
  background: #125ea3;
}

.calculations {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.calculations.hidden {
  display: none;
}

.calculations dl {
  margin: 0;
}

.calculations dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--border);
}

.calculations dl > div:last-child {
  border-bottom: none;
}

.calculations dt {
  font-weight: normal;
  color: var(--muted);
}

.calculations dd {
  margin: 0;
  font-weight: bold;
  white-space: nowrap;
}
 
.save-section {
  text-align: center;
  margin-top: 10px;
}

.save-button {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  background: #2e7d32;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
}

.save-button:hover {
  background: #1b5e20;
}

.save-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-weight: bold;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border-radius: 10px;
  padding: 22px;
}

.modal-content h2 {
  margin-top: 0;
}

.modal-content label {
  margin-bottom: 6px;
}

.modal-content input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.secondary-button {
  padding: 10px 16px;
  border: 1px solid #9e9e9e;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.primary-button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #1976d2;
  color: #ffffff;
  cursor: pointer;
}

.primary-button:disabled {
  background: #90a4ae;
  cursor: not-allowed;
}

@media (max-width: 850px) {
  .traffic-light-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 550px) {
  body {
    padding: 16px 10px;
  }

  .inputs,
  .results {
    padding: 16px;
  }

  h1 {
    font-size: 23px;
  }
}
