:root {
  --warm-white: #faf8f3;
  --paper: #fffdf8;
  --matte-black: #171717;
  --ink: #202020;
  --muted: #6f6b63;
  --soft-gray: #ece9e1;
  --line: #ddd8ce;
  --orange: #ff8a2a;
  --orange-dark: #d96711;
  --green: #36a66a;
  --shadow: 0 24px 70px rgba(26, 24, 21, 0.13);
  --soft-shadow: 0 12px 36px rgba(26, 24, 21, 0.1);
  color: var(--ink);
  background: var(--warm-white);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 138, 42, 0.13), transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, #f6f2ea 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 52% 42%, rgba(255, 138, 42, 0.2), transparent 28%),
    linear-gradient(135deg, #fffdf8 0%, #f7efe3 44%, #171717 130%);
  animation: splashFade 4s ease forwards;
}

.splash-logo {
  display: grid;
  place-items: center;
  gap: 16px;
  color: var(--matte-black);
  animation: logoIntro 4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.splash-mark {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #171717, #3a352e);
  color: var(--warm-white);
  font-size: 38px;
  font-weight: 900;
  box-shadow: 0 26px 70px rgba(23, 23, 23, 0.24);
}

.splash-logo strong {
  font-size: 54px;
  letter-spacing: 0;
}

.splash-logo p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  opacity: 0;
  animation: sloganIn 4s ease forwards;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
  backdrop-filter: blur(18px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--matte-black);
  font-size: 20px;
  font-weight: 850;
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--matte-black);
  color: var(--warm-white);
}

.category-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.category-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.category-nav a:hover {
  color: var(--matte-black);
  background: rgba(255, 255, 255, 0.75);
}

.header-actions,
.provider-row,
.login-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.language-toggle .active {
  color: var(--matte-black);
}

.login-button,
.secondary-button,
.primary-button,
.provider-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 850;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.login-button:active,
.secondary-button:active,
.primary-button:active,
.provider-button:active {
  transform: scale(0.97);
}

.login-button,
.secondary-button,
.provider-button {
  color: var(--matte-black);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(26, 24, 21, 0.07);
}

.primary-button {
  color: var(--warm-white);
  background: var(--matte-black);
  box-shadow: 0 14px 32px rgba(23, 23, 23, 0.18);
}

.primary-button:disabled {
  cursor: not-allowed;
  color: #a9a49b;
  background: #e2ded6;
  box-shadow: none;
}

.wide-button {
  width: 100%;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 72px;
}

.page-view {
  display: none;
  animation: pageIn 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-view.is-active {
  display: block;
}

.feature-page {
  min-height: calc(100vh - 150px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 5vw, 70px) 0;
}

.feature-page.is-active {
  display: flex;
}

.feature-panel {
  width: min(760px, 100%);
  margin: 0 auto;
}

.category-nav a.is-active {
  color: var(--matte-black);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(26, 24, 21, 0.07);
}

.hero-section {
  min-height: 600px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1fr);
  align-items: center;
  gap: 54px;
}

.hero-copy {
  display: grid;
  gap: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 700px;
  color: var(--matte-black);
  font-size: clamp(38px, 5.3vw, 64px);
  line-height: 1.02;
}

h1 br {
  display: block;
}

h2 {
  color: var(--matte-black);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.06;
}

.hero-description,
.section-heading p,
.member-copy p {
  color: var(--muted);
  font-size: 19px;
  line-height: 1.45;
  font-weight: 650;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.hero-bike {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  border-radius: 36px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(221, 216, 206, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-bike::before {
  content: "";
  position: absolute;
  inset: 10% 8% auto;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 138, 42, 0.22), transparent);
  filter: blur(28px);
}

.hero-bike img {
  position: relative;
  z-index: 1;
  width: min(112%, 760px);
  filter: drop-shadow(0 24px 34px rgba(20, 18, 15, 0.13));
}

.bike-spec-card {
  position: absolute;
  left: 24px;
  top: 24px;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.bike-spec-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.bike-spec-card strong {
  color: var(--matte-black);
  font-size: 19px;
}

.panel {
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.calculator-panel,
.result-panel,
.recommendation-panel,
.led-panel,
.member-panel {
  padding: clamp(22px, 4vw, 36px);
}

.section-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.field-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--matte-black);
  font-size: 16px;
  font-weight: 850;
}

.optional-label {
  color: var(--muted);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 0 18px;
  border-radius: 22px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.input-row span {
  color: var(--muted);
  font-weight: 850;
}

.number-input,
.name-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--matte-black);
  background: transparent;
  font-size: 26px;
  font-weight: 850;
}

.name-input {
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  font-size: 17px;
}

.calculator-panel .wide-button {
  margin-top: 18px;
}

.measurement-card {
  min-height: 196px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 26px;
  border-radius: 26px;
  background: #fff5ea;
  border: 1px solid rgba(255, 138, 42, 0.32);
}

.waiting-card {
  background: #ffffff;
  border-color: var(--line);
}

.measurement-label {
  color: var(--orange-dark);
  font-size: 16px;
  font-weight: 900;
}

.measurement-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--matte-black);
}

.measurement-number,
.measurement-unit {
  font-size: clamp(52px, 7vw, 78px);
  line-height: 0.95;
  font-weight: 900;
}

.result-panel .wide-button {
  margin-top: 16px;
}

.saddle-result {
  min-height: 248px;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 24px;
  border-radius: 26px;
  background: #ffffff;
  border: 1px solid var(--line);
  text-align: center;
}

.saddle-result img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.saddle-result span {
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
}

.saddle-result strong {
  color: var(--matte-black);
  font-size: 34px;
  line-height: 1.1;
}

.saddle-height-value {
  font-size: 56px !important;
  font-weight: 900 !important;
}

.fit-reason {
  max-width: 400px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}

.led-action-wrap {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 30px 0 14px;
}

.led-connect-button {
  position: relative;
  isolation: isolate;
  width: clamp(210px, 26vw, 280px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--matte-black);
  background: #fffdf8;
  border: 2px solid var(--line);
  box-shadow:
    0 26px 70px rgba(26, 24, 21, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 500;
  line-height: 1.18;
  transition: transform 180ms ease, box-shadow 220ms ease;
}

.led-connect-button [data-led-label] {
  position: relative;
  z-index: 1;
  display: block;
  font-weight: 500;
  letter-spacing: 0;
}

.led-connect-button::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from 0deg, rgba(255, 232, 170, 0), rgba(255, 232, 170, 0.72), rgba(255, 246, 206, 0.94), rgba(255, 232, 170, 0));
  opacity: 0;
  filter: blur(12px);
  transition: opacity 200ms ease;
}

.led-connect-button:active {
  transform: scale(0.97);
}

.led-connect-button.is-connecting {
  color: var(--matte-black);
  background: #fffdf8;
  border-color: var(--line);
  box-shadow:
    0 28px 76px rgba(26, 24, 21, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition: transform 180ms ease, box-shadow 220ms ease;
}

.led-connect-button.is-connecting::before {
  opacity: 1;
  animation: ledConnectBlink 1200ms ease-in-out 3;
}

.led-connect-button.is-connecting [data-led-label] {
  color: var(--matte-black);
}

.led-connect-button.is-complete {
  color: var(--orange-dark);
  background: #fff3e7;
  border-color: rgba(255, 138, 42, 0.24);
  box-shadow:
    0 28px 76px rgba(255, 138, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.led-connect-button:disabled {
  cursor: default;
  opacity: 1;
}

@keyframes ledConnectBlink {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  38% {
    opacity: 0.88;
    transform: scale(1.055);
  }
  74% {
    opacity: 0.18;
    transform: scale(1.025);
  }
  100% {
    opacity: 0;
    transform: scale(0.99);
  }
}

.member-section {
  margin-top: 22px;
}

.member-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 28px;
  align-items: center;
}

.member-copy {
  display: grid;
  gap: 10px;
}

.member-title {
  font-size: clamp(28px, 3.1vw, 38px);
  white-space: nowrap;
}

.member-action {
  display: grid;
  gap: 12px;
}

.member-status,
.auth-notice {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 18px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  font-weight: 800;
}

.fit-summary {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 18px;
  border-radius: 22px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.fit-summary h3 {
  margin: 0 0 4px;
  color: var(--matte-black);
  font-size: 18px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.summary-row strong {
  color: var(--matte-black);
  white-space: nowrap;
}

.auth-notice:empty {
  display: none;
}

.save-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  color: var(--green);
  font-weight: 900;
  animation: successPop 440ms cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

.success-check {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eaf8ef;
}

.login-dialog {
  width: min(460px, calc(100% - 40px));
  border: 0;
  border-radius: 30px;
  padding: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(23, 23, 23, 0.26);
  backdrop-filter: blur(12px);
}

.login-dialog form {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 30px;
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--matte-black);
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 24px;
}

.is-hidden {
  display: none !important;
}

@keyframes splashFade {
  0%,
  78% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@keyframes logoIntro {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.92);
  }
  32% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  72%,
  100% {
    opacity: 1;
    transform: translateY(-34px) scale(0.94);
  }
}

@keyframes sloganIn {
  0%,
  42% {
    opacity: 0;
    transform: translateY(10px);
  }
  62%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wave {
  0%,
  100% {
    height: 9px;
  }
  50% {
    height: 24px;
  }
}

@keyframes successPop {
  from {
    opacity: 0;
    transform: scale(0.78);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .category-nav {
    order: 3;
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero-section,
  .member-panel {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
    padding-top: 36px;
  }
}

@media (max-width: 620px) {
  .site-header,
  main {
    width: min(100% - 28px, 1180px);
  }

  .header-actions {
    gap: 8px;
  }

  .login-button {
    min-height: 42px;
    padding: 0 14px;
  }

  .language-toggle {
    min-height: 42px;
  }

  h1 {
    font-size: 38px;
  }

  .hero-description,
  .section-heading p,
  .member-copy p {
    font-size: 17px;
  }

  .member-title {
    font-size: clamp(25px, 7vw, 34px);
  }

  .hero-cta-row,
  .login-action-row,
  .provider-row {
    display: grid;
  }

  .hero-bike {
    min-height: 290px;
    border-radius: 26px;
  }

  .led-action-wrap {
    min-height: 300px;
    padding-top: 18px;
  }

  .led-connect-button {
    width: min(220px, 68vw);
  }

  .bike-spec-card {
    left: 16px;
    top: 16px;
    min-width: 170px;
  }

  .panel {
    border-radius: 24px;
  }
}
