:root {
  --bg: #0d1117;
  --main: #508fce;
  --line: #ff5a4d;
  --ink: #f5f7fa;
  --purple: #a78bfa;
  --dim: #8b949e;
  --soft: #c9d1d9;
  --card: #161b22;
  --edge: rgba(240, 246, 252, 0.1);
  --danger: #f85149;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
button,
label,
.title,
.subtitle,
.menu-label,
.app-name {
  font-family: var(--font-display);
}

.stage {
  width: min(92vw, 1000px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.menu {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
}

.menu-svg {
  width: 160px;
  height: auto;
  display: block;
  overflow: visible;
}

.menu-line,
.menu-toggle-ring,
.menu-stop,
.menu-bars line {
  fill: none;
  stroke: var(--main);
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.menu-line {
  stroke-width: 8;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.5s ease;
}

.menu.open .menu-line {
  stroke-dashoffset: 0;
}

.menu-toggle-ring,
.menu-stop {
  fill: var(--bg);
  stroke-width: 8;
}

.menu-toggle {
  cursor: pointer;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
  border-radius: 50%;
}

.menu-bars line {
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu.open .bar-top {
  transform: translateY(6px) rotate(45deg);
}

.menu.open .bar-mid {
  opacity: 0;
}

.menu.open .bar-bot {
  transform: translateY(-6px) rotate(-45deg);
}

.menu-stop {
  opacity: 0;
  transform: scale(0);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.menu.open .menu-stop {
  opacity: 1;
  transform: scale(1);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d),
    opacity 0.35s ease var(--d);
}

.menu.open.ready .menu-stop,
.menu.open.ready .menu-label {
  transition-delay: 0s;
}

.menu-label {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.menu.open .menu-label {
  opacity: 1;
  transition: opacity 0.35s ease var(--d);
}

.menu-item {
  text-decoration: none;
  pointer-events: none;
}

.menu-item:nth-child(1) {
  --d: 0.15s;
}

.menu-item:nth-child(2) {
  --d: 0.27s;
}

.menu-item:nth-child(3) {
  --d: 0.39s;
}

.menu.open .menu-item {
  pointer-events: auto;
}

.title {
  margin: 0 0 4px;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  opacity: 0;
}

.subtitle {
  margin: 10px 0 0;
  text-align: center;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  color: var(--dim);
  opacity: 0;
}

.map {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.map-desktop {
  display: block;
}

.map-mobile {
  display: none;
}

.track {
  fill: none;
  stroke: var(--main);
  stroke-width: 8;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.station {
  fill: var(--bg);
  stroke: var(--main);
  stroke-width: 8;
  opacity: 0;
  vector-effect: non-scaling-stroke;
}

.station-link,
.app-link {
  cursor: pointer;
}

.app {
  opacity: 0;
}

.app-icon {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s ease;
}

.app.expanded .app-icon {
  transform: scale(1.15);
}

.app-name {
  fill: var(--ink);
  font-size: 19px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: bold;
}

.app-desc div {
  color: #8b949e;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .title,
  .subtitle,
  .station,
  .app,
  .about,
  .menu-toggle-ring,
  .menu-bars {
    opacity: 1;
  }
  .menu-toggle-ring {
    r: 22;
  }
}

@media (max-width: 600px) {
  .map-desktop {
    display: none;
  }
  .map-mobile {
    display: block;
  }
  .track {
    stroke-width: 4;
  }
  .station {
    stroke-width: 4;
  }
}

.about {
  min-height: 100vh;
  width: min(92vw, 1000px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  opacity: 0;
  text-align: center;
}

.about-content {
  max-width: 700px;
  text-align: left;
}

.about h2 {
  margin: 0 0 20px;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--main);
}

.about p {
  margin: 0 0 14px;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.6;
  color: #c9d1d9;
}
.about a {
  color: var(--main);
  text-decoration: none;
}

.about a:hover {
  text-decoration: underline;
}

.about .about-sign {
  margin-top: 24px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
}

.about .about-small {
  font-size: clamp(0.82rem, 1.2vw, 0.92rem);
  color: var(--dim);
}


/* ---------------------------------------------------------------------------
   Our apps: a small App Store page for each, between the line and About.
   --------------------------------------------------------------------------- */

.app-pages {
  width: min(92vw, 1080px);
  margin: 0 auto;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.app-page {
  position: relative;
  padding: 36px;
  border: 1px solid var(--edge);
  border-radius: 32px;
  background: rgba(13, 17, 23, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  scroll-margin-top: 32px;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.can-reveal .app-page:not(.is-visible) {
  opacity: 0;
  transform: translateY(24px);
}

.app-page-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.app-page-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.app-page-name h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-page-name p {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: var(--dim);
}

.app-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.app-page-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.app-page-actions .btn-primary {
  background: var(--main);
  color: var(--bg);
  border: 2px solid var(--main);
}

.app-page-actions .btn-primary:hover {
  background: #6aa3db;
  border-color: #6aa3db;
}

.app-page-actions .btn-ghost {
  border: 2px solid rgba(80, 143, 206, 0.45);
  color: var(--ink);
}

.app-page-actions .btn-ghost:hover {
  border-color: var(--main);
  color: var(--main);
}

.app-page-actions .btn-pending {
  border: 2px dashed rgba(139, 148, 158, 0.4);
  color: var(--dim);
  cursor: default;
}

.shelf {
  position: relative;
  margin: 32px -36px 0;
}

.shelf-track {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 4px 36px 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 36px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.shelf-track::-webkit-scrollbar {
  display: none;
}

.shelf-track:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
  border-radius: 12px;
}

.shelf-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.shelf-item img {
  display: block;
  height: clamp(380px, 56vh, 540px);
  width: auto;
  border-radius: 24px;
  border: 1px solid var(--edge);
  background: var(--card);
}

.shelf-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-top: -30px;
  border: 3px solid var(--main);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.shelf-arrow:hover {
  background: var(--main);
  color: var(--bg);
}

.shelf-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.shelf-arrow.is-prev {
  left: 12px;
}

.shelf-arrow.is-next {
  right: 12px;
}

.app-page-text {
  max-width: 660px;
  margin: 24px 0 0;
  font-size: clamp(0.98rem, 1.4vw, 1.1rem);
  line-height: 1.6;
  color: var(--soft);
}

@media (hover: none) {
  .shelf-arrow {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Sign in and Pick a username: a board over the lines, like the 404 page.
   --------------------------------------------------------------------------- */

.board-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 16px 64px;
}

.board {
  width: min(100%, 560px);
  padding: 48px 32px;
  text-align: center;
  background: radial-gradient(closest-side, rgba(13, 17, 23, 0.97) 74%, rgba(13, 17, 23, 0));
}

.board-station {
  display: block;
  width: 64px;
  height: 96px;
  margin: 0 auto 24px;
  overflow: visible;
}

.board-station line {
  stroke: var(--main);
  stroke-width: 8;
  stroke-linecap: round;
}

.board-station circle {
  fill: var(--bg);
  stroke: var(--main);
  stroke-width: 8;
}

.board-title {
  margin: 0;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

.board-lead {
  max-width: 440px;
  margin: 18px auto 0;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.6;
  color: var(--soft);
  text-wrap: balance;
}

.board-actions {
  margin-top: 32px;
}

.apple-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 260px;
  min-height: 52px;
  padding: 12px 28px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}

.apple-button svg {
  width: 17px;
  height: 20px;
  fill: currentColor;
  margin-top: -3px;
}

.apple-button:hover {
  box-shadow: 0 0 0 4px rgba(80, 143, 206, 0.45);
}

.apple-button:active {
  transform: scale(0.98);
}

.apple-button:focus-visible,
.board-form .btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

.board-note {
  margin: 16px 0 0;
  font-size: 0.88rem;
  color: var(--dim);
}

.board-form {
  max-width: 400px;
  margin: 32px auto 0;
  text-align: left;
}

.board-form .btn {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border-radius: 999px;
  font-size: 1rem;
}

.board .form-message {
  text-align: left;
  max-width: 400px;
  margin: 16px auto 0;
}

/* ---------------------------------------------------------------------------
   The account page: sections down the right, and a line map down the left
   whose stations jump to them.
   --------------------------------------------------------------------------- */

.account-page {
  width: min(92vw, 1080px);
  margin: 0 auto;
  padding: 112px 0 96px;
}

.account-header {
  margin-bottom: 48px;
  text-align: center;
}

.account-header .title,
.account-header .subtitle {
  opacity: 1;
}

.account-header .title {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: 0.1em;
  text-indent: 0.1em;
}

.account-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.account-layout[hidden] {
  display: none;
}

.account-loading {
  text-align: center;
  color: var(--dim);
  padding: 24px;
}

/* The line map. Each station draws the line above and below its own dot, so
   the line starts at the first station and ends at the last. */

.route-map {
  position: sticky;
  top: 112px;
}

.route-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-station {
  --dot: 24px;
  --rail: 6px;
  position: relative;
  height: 44px;
}

.route-station.is-minor {
  --dot: 12px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: height 0.25s ease, opacity 0.2s ease;
}

.route-map.is-expanded .route-station.is-minor {
  height: 32px;
  opacity: 1;
  pointer-events: auto;
}

.route-station::before,
.route-station::after {
  content: '';
  position: absolute;
  left: calc(12px - var(--rail) / 2);
  width: var(--rail);
  background: var(--main);
}

.route-station::before {
  top: 0;
  height: 50%;
}

.route-station::after {
  top: 50%;
  bottom: 0;
}

.route-station:first-child::before,
.route-station:last-child::after {
  display: none;
}

.route-station a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  color: var(--dim);
  text-decoration: none;
  border-radius: 8px;
}

.route-dot {
  flex: 0 0 auto;
  width: var(--dot);
  height: var(--dot);
  margin-left: calc(12px - var(--dot) / 2);
  margin-right: calc(12px - var(--dot) / 2);
  border-radius: 50%;
  border: 5px solid var(--main);
  background: var(--bg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease;
}

.is-minor .route-dot {
  border-width: 3px;
}

.route-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

.is-minor .route-label {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.route-station a:hover .route-label,
.route-station.is-current .route-label {
  color: var(--ink);
}

.route-station a:hover .route-dot {
  transform: scale(1.2);
}

.route-station.is-current .route-dot {
  background: var(--main);
  transform: scale(1.15);
}

.route-station a:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

/* Sections and cards. */

.account-section {
  margin-bottom: 64px;
  scroll-margin-top: 112px;
}

.account-section:last-child {
  margin-bottom: 0;
}

.account-section h2,
.hw-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--main);
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.section-lead {
  margin: -6px 0 24px;
  color: var(--dim);
  font-size: 0.95rem;
}

.account-card {
  padding: 24px;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--card);
}

.account-card + .account-card {
  margin-top: 16px;
}

.account-card.danger {
  border-color: rgba(248, 81, 73, 0.35);
}

.account-card.danger .card-row-title {
  color: var(--danger);
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-row .small {
  margin: 4px 0 0;
}

.card-row-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--main), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--bg);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.profile-since {
  font-size: 0.85rem;
  color: var(--dim);
  margin-top: 2px;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--soft);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .text-input {
  flex: 1;
  min-width: 0;
}

.text-input {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
  border-color: var(--main);
  box-shadow: 0 0 0 3px rgba(80, 143, 206, 0.2);
}

.text-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn {
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s, border-color 0.2s, color 0.2s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--main);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(240, 246, 252, 0.2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--main);
  color: var(--main);
}

.btn-danger {
  background: #da3633;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--dim);
}

.token-count {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
}

.token-count .unit {
  margin-left: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--dim);
}

.token-count.problem {
  font-size: 1rem;
  font-weight: 500;
  color: var(--dim);
}

.more {
  display: inline-block;
  margin-top: 12px;
  color: var(--main);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
}

.more:hover {
  text-decoration: underline;
}

.form-message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.form-message.ok {
  background: rgba(38, 139, 88, 0.16);
  border: 1px solid rgba(38, 139, 88, 0.4);
  color: #7ee787;
}

.form-message.error {
  background: rgba(218, 54, 51, 0.16);
  border: 1px solid rgba(218, 54, 51, 0.4);
  color: var(--danger);
}

.small {
  font-size: 0.88rem;
  line-height: 1.5;
}

.muted {
  color: var(--dim);
}

/* Headways settings: boxes to tap, like a store's configurator, not menus to open. */

/* Whether the last change saved, floating at the bottom wherever you are on the page. */
.save-status {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  padding: 10px 18px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--soft);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.save-status.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.save-status.is-ok {
  color: #7ee787;
}

.save-status.is-error {
  color: var(--danger);
}

.hw-group {
  margin-bottom: 36px;
  scroll-margin-top: 112px;
}

.hw-group-title {
  font-size: 0.8rem;
  color: var(--dim);
}

.hw-card {
  padding: 4px 24px;
}

.hw-card.is-magic {
  border-color: rgba(167, 139, 250, 0.4);
  background: linear-gradient(135deg, rgba(62, 34, 154, 0.55), rgba(22, 27, 34, 0.9));
}

.hw-row {
  padding: 20px 0;
  border-top: 1px solid rgba(240, 246, 252, 0.07);
}

/* Rows that only matter when another setting is on come after it, so the
   first row is always shown. */
.hw-row:first-child {
  border-top: none;
}

.hw-row[hidden] {
  display: none;
}

.hw-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}

.hw-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.hw-hint {
  margin: 6px 0 0;
  max-width: 520px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--dim);
}

.hw-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.hw-options.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
}

.hw-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 36px 12px 14px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.hw-option:hover {
  border-color: rgba(240, 246, 252, 0.4);
}

.hw-option.is-selected {
  border-color: var(--main);
  box-shadow: inset 0 0 0 1px var(--main);
  background: rgba(80, 143, 206, 0.1);
}

.hw-option:focus-visible,
.hw-switch:focus-visible,
.hw-step:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.hw-check {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(240, 246, 252, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.is-selected .hw-check {
  border-color: var(--main);
  background: var(--main) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230d1117' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.hw-swatch {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.hw-switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(240, 246, 252, 0.18);
  cursor: pointer;
  transition: background 0.25s ease;
}

.hw-switch[aria-checked="true"] {
  background: var(--main);
}

.hw-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.hw-switch[aria-checked="true"] .hw-knob {
  transform: translateX(20px);
}

.is-magic .hw-switch[aria-checked="true"] {
  background: var(--purple);
}

.hw-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-step {
  width: 40px;
  height: 36px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 1.15rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.hw-step:hover:not(:disabled) {
  border-color: var(--main);
  color: var(--main);
}

.hw-step:disabled {
  opacity: 0.35;
  cursor: default;
}

.hw-step-value,
.hw-value {
  min-width: 96px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hw-value {
  min-width: 0;
  color: var(--soft);
}

.hw-slider {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  accent-color: var(--main);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Phones and narrow windows.
   --------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .account-page {
    padding-top: 88px;
  }

  .account-layout {
    display: block;
  }

  /* The logo and menu scroll away here, so the line map can have the top. */
  .account-body .corner-mark,
  .account-body .menu {
    position: absolute;
  }

  /* The line map turns sideways and sticks to the top, with the main stations only. */
  .route-map {
    top: 0;
    z-index: 5;
    margin: 0 -4vw 32px;
    padding: 12px 4vw;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(13, 17, 23, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--edge);
  }

  .route-map::-webkit-scrollbar {
    display: none;
  }

  .route-list {
    display: flex;
    width: max-content;
  }

  .route-station.is-minor {
    display: none;
  }

  .route-station {
    height: auto;
    padding: 0 14px;
  }

  .route-station:first-child {
    padding-left: 0;
  }

  .route-station:last-child {
    padding-right: 0;
  }

  .route-station::before,
  .route-station::after {
    top: 22px;
    bottom: auto;
    height: var(--rail);
    margin-top: calc(var(--rail) / -2);
    left: auto;
    width: auto;
  }

  .route-station::before {
    left: 0;
    right: 50%;
  }

  .route-station::after {
    left: 50%;
    right: 0;
  }

  .route-station a {
    flex-direction: column;
    gap: 6px;
  }

  .route-dot {
    margin: 10px 0 0;
  }

  .route-label {
    font-size: 0.7rem;
  }

  .account-section,
  .hw-group {
    scroll-margin-top: 104px;
  }
}

@media (max-width: 600px) {
  .menu {
    top: 16px;
    right: 16px;
  }
  .menu-svg {
    width: 130px;
  }
  .menu-label {
    font-size: 15px;
  }
  .stage {
    padding-top: 60px;
  }
  .title {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
    letter-spacing: 0.1em;
    text-indent: 0.1em;
  }
  .subtitle {
    font-size: clamp(0.65rem, 2vw, 0.85rem);
    letter-spacing: 0.1em;
    text-indent: 0.1em;
  }
  .map {
    max-width: 100%;
  }
  .app-name {
    font-size: 16px;
  }
  .app-desc div {
    font-size: 13px;
    max-width: 160px;
  }
  .about {
    min-height: auto;
    padding: 64px 20px 80px;
  }
  .about h2 {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    letter-spacing: 0.12em;
  }
  .about p {
    font-size: 0.95rem;
  }

  .app-pages {
    gap: 40px;
  }
  .app-page {
    padding: 24px 20px;
    border-radius: 24px;
  }
  .app-page-head {
    grid-template-columns: auto 1fr;
    gap: 16px;
  }
  .app-page-icon {
    width: 72px;
    height: 72px;
    border-radius: 17px;
  }
  .app-page-name p {
    font-size: 0.95rem;
  }
  .app-page-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .app-page-actions > * {
    flex: 1 1 0;
    padding: 10px 14px;
  }
  .shelf {
    margin: 24px -20px 0;
  }
  .shelf-track {
    gap: 12px;
    padding: 4px 20px 12px;
    scroll-padding: 0 20px;
  }
  .shelf-item img {
    height: 420px;
    border-radius: 20px;
  }

  .account-card {
    padding: 20px;
  }
  .hw-card {
    padding: 0 18px;
  }
  .hw-options,
  .hw-options.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hw-step-value {
    min-width: 76px;
  }
  .field-row {
    flex-direction: column;
  }
  .card-row {
    flex-direction: column;
    align-items: stretch;
  }
  .board {
    padding: 32px 8px;
  }
  .board-title {
    letter-spacing: 0.12em;
    text-indent: 0.12em;
  }
  .apple-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 400px) {
  .menu-svg {
    width: 110px;
  }
  .title {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-page,
  .route-dot,
  .hw-knob {
    transition: none;
  }
  .can-reveal .app-page:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
  .shelf-track {
    scroll-behavior: auto;
  }
}

/* The home page sits over slowly moving transit lines, like the 404 page.
   A dark glow behind each part keeps the words easy to read. */
.has-lines .stage,
.has-lines .about,
.has-lines .app-pages {
  position: relative;
  z-index: 1;
}

.has-lines .stage::before,
.has-lines .about::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(13, 17, 23, 0.95) 55%, rgba(13, 17, 23, 0));
}
