:root {
  --comfort-slider-length: min(60vw, 400px);
}

body {
  padding: 20px 8px;
  overflow: hidden;
}

.container {
  padding: 32px 24px;
  width: calc(100dvw - 16px);
  max-width: min(100%, 600px);
  height: auto;
  max-height: calc(100dvh - 24px);
  gap: clamp(16px, 3vw, 24px);
  overflow-y: hidden;
}

/* feedback adds vertical margins to the logo */
.logo-text {
  margin: 0 auto;
  margin-top: clamp(8px, 2vw, 16px);
  margin-bottom: clamp(8px, 2vw, 16px);
}

.location-box {
  width: clamp(140px, 40vw, 220px);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 24px;
  text-align: center;
  font-size: clamp(0.9rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(20px, 5vw, 36px);
  color: var(--color-text);
}

.question {
  font-size: clamp(0.9rem, 2.5vw, 1.5rem);
  color: var(--color-text);
  text-align: center;
  margin-bottom: clamp(16px, 3vw, 24px);
  line-height: 1.6;
}

.slider-container {
  margin-bottom: clamp(20px, 5vw, 36px);
  width: 100%;
}

.vertical-slider-wrapper {
  position: relative;
  width: 100%;
  height: calc(var(--comfort-slider-length) + 30px);
  display: flex;
  align-items: center;
  justify-content: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 60px;
  background: transparent;
  outline: none;
  cursor: pointer;
}

#comfortSlider {
  -webkit-appearance: none;
  appearance: none;
  width: var(--comfort-slider-length);
  height: 60px;
  transform: rotate(90deg) scaleX(-1);
  position: absolute;
}

#comfortSlider:focus {
  outline: none;
}

/* The comfort spectrum is a data scale — intentionally NOT tokenised,
   it should read identically in light and dark. */
#comfortSlider::-webkit-slider-runnable-track {
  width: 100%;
  height: 60px;
  background: linear-gradient(
    to left,
    #e74c3c 0%,
    #e67e22 14%,
    #f39c12 28%,
    #95c97d 42%,
    #5fb876 50%,
    #52b5a8 58%,
    #4a9db8 72%,
    #3b7ea1 86%,
    #2e5f8d 100%
  );
  border-radius: 30px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

#comfortSlider::-moz-range-track {
  width: 100%;
  height: 60px;
  background: linear-gradient(
    to left,
    #e74c3c 0%,
    #e67e22 14%,
    #f39c12 28%,
    #95c97d 42%,
    #5fb876 50%,
    #52b5a8 58%,
    #4a9db8 72%,
    #3b7ea1 86%,
    #2e5f8d 100%
  );
  border-radius: 30px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 80px;
  background: var(--color-surface);
  border: 4px solid var(--color-border);
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 50px;
  height: 80px;
  background: var(--color-surface);
  border: 4px solid var(--color-border);
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.05);
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.05);
}

.tick-marks {
  position: absolute;
  height: calc(var(--comfort-slider-length) - 10px);
  left: 50%;
  transform: translateX(-50px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  padding: 10px;
}

.tick {
  width: 18px;
  height: 2px;
  background: rgba(0, 0, 0, 0.3);
}

.vertical-labels {
  position: absolute;
  height: var(--comfort-slider-length);
  left: 50%;
  transform: translateX(-180px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
}

.vertical-labels span {
  width: 100px;
  display: inline-block;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.1;
  text-align: right;
  transform-origin: right center;
  transition:
    font-weight 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.vertical-labels span.active {
  font-weight: bold;
  color: var(--color-accent-active);
  transform: scale(1.2);
}

.submit-button {
  display: block;
  width: clamp(140px, 40vw, 220px);
  height: clamp(60px, 20vw, 70px);
  padding: 18px 40px;
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  border: 3px solid var(--color-border);
  border-radius: var(--radius);
  font-size: clamp(0.9rem, 2.5vw, 1.5rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin-bottom: clamp(16px, 3vw, 24px);
  margin-left: auto;
  margin-right: auto;
}

.submit-button:hover:not(:disabled) {
  background-color: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.submit-button:active:not(:disabled) {
  transform: translateY(0);
}

.submit-button:disabled {
  background-color: var(--color-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-content {
  background-color: var(--color-surface);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  width: 400px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--color-link);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  input[type="range"]::-webkit-slider-thumb {
    transition: none;
  }
  input[type="range"]::-moz-range-thumb {
    transition: none;
  }
  .submit-button {
    transition: none;
  }
  .loading-spinner {
    animation: none;
  }
}

.submit-button:focus {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

input[type="range"]:focus {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  :root {
    --comfort-slider-length: min(75vw, 420px);
  }
  body {
    padding: 30px 12px;
  }
  .container {
    padding: 20px 15px;
    width: calc(100dvw - 24px);
    gap: 18px;
  }
  .location-box {
    padding: 8px 16px;
  }
  .question {
    line-height: 1.5;
  }
  .slider-wrapper {
    padding: 0 15px;
  }
  .tick {
    width: 12px;
    height: 2px;
  }
  .vertical-labels {
    transform: translateX(-130px);
  }
  .vertical-labels span {
    width: 80px;
  }
  .tick-marks {
    transform: translateX(-40px);
  }
  input[type="range"] {
    height: 50px;
    margin: 15px 0;
  }
  #comfortSlider::-webkit-slider-runnable-track,
  #tempSlider::-webkit-slider-runnable-track {
    height: 50px;
  }
  #comfortSlider::-moz-range-track,
  #tempSlider::-moz-range-track {
    height: 50px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 36px;
    height: 60px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 36px;
    height: 60px;
  }
  .submit-button {
    padding: 14px 28px;
  }
  .loading-content {
    padding: 30px;
  }
  .loading-text {
    font-size: 1rem;
  }
}

@media (max-width: 414px) {
  :root {
    --comfort-slider-length: min(80vw, 340px);
  }
  body {
    padding: 20px 10px;
  }
  .container {
    padding: 15px 10px;
    width: calc(100dvw - 20px);
    gap: 12px;
  }
  .location-box {
    padding: 8px 16px;
  }
  .question {
    line-height: 1.3;
  }
  .slider-wrapper {
    padding: 0 12px;
  }
  .vertical-labels {
    transform: translateX(-130px);
  }
  input[type="range"] {
    height: 40px;
    margin: 10px 0;
  }
  #comfortSlider::-webkit-slider-runnable-track,
  #tempSlider::-webkit-slider-runnable-track {
    height: 45px;
  }
  #comfortSlider::-moz-range-track,
  #tempSlider::-moz-range-track {
    height: 45px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 60px;
    border: 3px solid var(--color-border);
  }
  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 60px;
    border: 3px solid var(--color-border);
  }
  .submit-button {
    padding: 10px 20px;
  }
  .loading-content {
    padding: 25px;
  }
  .loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
  }
  .loading-text {
    font-size: 0.9rem;
  }
}
