:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: #151513;
  --surface-raised: rgba(20, 20, 18, .9);
  --text: #f7f7f2;
  --muted: #999991;
  --faint: #62625c;
  --line: #282825;
  --button: #f7f7f2;
  --button-text: #090909;
  --danger: #ff7b72;
  --shadow: 0 12px 40px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body[data-page="legal"] { padding-bottom: 0; }
body[data-page="legal"] .bottom-nav { display: none; }
body.login-page { background: #000; }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }
.material-symbols-rounded { font-family: "Material Symbols Rounded"; font-style: normal; font-weight: 400; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; word-wrap: normal; direction: ltr; font-feature-settings: "liga"; -webkit-font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; }

.bottom-nav {
  position: fixed;
  z-index: 1000;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: 680px;
  margin: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.bottom-nav-item { min-width: 0; height: 52px; display: grid; place-content: center; justify-items: center; gap: 2px; border-radius: 14px; color: var(--muted); transition: color .15s ease, background .15s ease; }
.bottom-nav-item > .material-symbols-rounded { height: 20px; font-size: 20px; line-height: 20px; }
.bottom-nav-item small { max-width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
.bottom-nav-item.active { background: var(--button); color: var(--button-text); }

.page-shell { width: min(100%, 680px); margin: auto; padding: 92px 20px 48px; }
.app-page { animation: appear .22s ease both; }
.page-heading { margin-bottom: 42px; }
.page-heading p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: clamp(38px, 11vw, 56px); line-height: 1.02; letter-spacing: -.055em; font-weight: 560; }
.primary-button { width: 100%; min-height: 54px; display: inline-flex; align-items: center; justify-content: center; padding: 0 22px; border: 0; border-radius: 14px; background: var(--button); color: var(--button-text); font-weight: 650; cursor: pointer; transition: opacity .15s ease, transform .15s ease; }
.primary-button:hover { opacity: .86; }
.primary-button:active { transform: scale(.985); }
.primary-button:disabled { opacity: .45; cursor: wait; }
.secondary-button { width: 100%; min-height: 54px; display: inline-flex; align-items: center; justify-content: center; padding: 0 22px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--text); font-weight: 560; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.secondary-button:hover { border-color: var(--faint); background: var(--surface); }
.secondary-button:active { transform: scale(.985); }

.welcome { min-height: calc(100vh - 160px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.welcome-logo { width: clamp(132px, 36vw, 180px); height: auto; display: block; border: 1px solid #3a3a38; border-radius: 50%; }
.welcome .lede { max-width: 460px; margin: 28px 0 36px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.login-form { width: min(100%, 380px); }
.yandex-button { width: min(100%, 380px); min-height: 56px; display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 12px; padding: 0 16px; border: 1px solid #fff; border-radius: 14px; background: #fff; color: #111; font-size: 15px; font-weight: 600; transition: opacity .15s ease, transform .15s ease; }
.yandex-button img { display: block; }
.yandex-button span { grid-column: 2; }
.yandex-button:hover { opacity: .9; }
.yandex-button:active { transform: scale(.985); }
.legal-consent { max-width: 430px; margin: 17px 0 0; color: var(--faint); font-size: 11px; line-height: 1.55; }
.legal-consent a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

.record-main h1 { margin-bottom: 0; }
.active-record-page { padding-top: max(22px, env(safe-area-inset-top)); }
.form-intro { margin: 14px 0 0; color: var(--muted); line-height: 1.5; }
.trip-form { margin-top: 44px; }
.start-form { margin-top: 0; }
.start-origin-stage { border: 1px solid transparent; border-radius: 0; transition: padding .38s cubic-bezier(.2,.75,.25,1), border-color .38s ease, border-radius .38s ease, background .38s ease, transform .38s cubic-bezier(.2,.75,.25,1); }
.start-origin-stage .field-group { margin-top: 44px; transition: margin .38s ease; }
.start-origin-stage h1, .start-origin-stage input { transition: color .3s ease, font-size .38s cubic-bezier(.2,.75,.25,1), border-color .3s ease; }
.start-form > .save-actions { transition: opacity .2s ease, transform .3s ease; }
.start-form.is-transitioning .start-origin-stage { padding: 18px 20px 19px; border-color: var(--line); border-radius: 18px; background: var(--bg); transform: translateY(-56px); }
.start-form.is-transitioning .start-origin-stage h1 { font-size: clamp(26px, 7.5vw, 38px); }
.start-form.is-transitioning .start-origin-stage .field-group { margin: 30px 0 0; }
.start-form.is-transitioning .start-origin-stage input { padding-bottom: 0; border-color: transparent; font-size: 14px; }
.start-form.is-transitioning > .save-actions { opacity: 0; transform: translateY(-34px); pointer-events: none; }
.finish-form { margin-top: 30px; }
.field-group { position: relative; margin-bottom: 30px; }
.field-group label, .select-group label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.field-group input, .field-group textarea {
  width: 100%;
  padding: 8px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  transition: border-color .15s ease;
}
.field-group textarea { resize: vertical; font-size: 16px; line-height: 1.5; }
.field-group input:focus, .field-group textarea:focus { border-color: var(--text); }
.field-group select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); cursor: pointer; }
.field-group select:focus { border-color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.save-actions { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 9px; }
.clock-button { position: relative; display: grid; place-items: center; min-height: 54px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; transition: border-color .15s ease, color .15s ease, transform .15s ease; }
.clock-button .material-symbols-rounded { font-size: 25px; }
.clock-button:hover, .clock-button.custom-time { border-color: var(--text); color: var(--text); }
.clock-button:active { transform: scale(.96); }
.clock-button.custom-time::after { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--text); content: ""; }
.time-picker-dialog { width: min(calc(100% - 24px), 440px); padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.time-picker-dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.time-picker-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0 16px; }
.time-picker-fields label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; }
.time-picker-fields input { width: 100%; min-width: 0; padding: 13px 12px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); color-scheme: dark; font-size: 14px; }
.time-picker-fields input:focus { border-color: var(--text); }
.timezone-note { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 22px; color: var(--muted); font-size: 11px; }
.timezone-note a { margin-left: auto; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.select-group { margin-bottom: 28px; }
.select-group select { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); cursor: pointer; }
.select-group select:focus { border-color: var(--text); }
.conditional-fields { margin-bottom: 28px; animation: reveal .18s ease both; }
.conditional-fields.taxi-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 12px; }
.conditional-fields.taxi-layout .field-group { margin-bottom: 0; }
.conditional-fields.taxi-layout [data-cost-field] input { padding: 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; }
.taxi-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.clear-start-form { display: flex; justify-content: center; }
.clear-start-button, .logout-form button { padding: 16px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.clear-start-button:hover, .logout-form button:hover { color: var(--danger); }
.active-origin-card { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); animation: settle-origin .62s cubic-bezier(.2,.75,.25,1) both; }
.active-origin-card strong { min-width: 0; overflow: hidden; font-size: 16px; font-weight: 500; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.active-origin-card time { flex: none; color: var(--muted); font-size: 11px; white-space: nowrap; }
.transport-carousel { display: flex; gap: 9px; overflow-x: auto; margin: 30px -20px 44px; padding: 0 20px 8px; scrollbar-width: none; scroll-padding-inline: 20px; scroll-snap-type: x proximity; animation: appear .38s .15s ease both; }
.transport-carousel::-webkit-scrollbar { display: none; }
.transport-card { position: relative; flex: 0 0 94px; scroll-snap-align: start; cursor: pointer; transition: opacity .2s ease; }
.transport-card.is-muted { opacity: .18; }
.transport-card.is-muted:hover, .transport-card.is-muted:focus-within { opacity: .5; }
.transport-card input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.transport-card > span { height: 88px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 9px 7px 8px; border: 1px solid var(--text); border-radius: 17px; background: transparent; transition: background .16s ease, color .16s ease, transform .16s ease; }
.transport-card img { width: 66px; height: 43px; object-fit: contain; transition: filter .16s ease; }
.transport-card small { display: block; max-width: 78px; overflow: hidden; color: var(--text); font-size: 10px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.transport-card input:checked + span { border-color: var(--text); background: var(--text); color: var(--bg); transform: translateY(-2px); }
.transport-card input:checked + span img { filter: invert(1); }
.transport-card input:checked + span small { color: var(--bg); }
.transport-card input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 3px; }
.active-transport-details { margin: -18px 0 40px; }
.destination-title { margin-bottom: 40px !important; animation: appear .38s .26s ease both; }

.suggestions { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .12s ease, transform .12s ease; }
.suggestions.open { opacity: 1; transform: none; pointer-events: auto; }
.suggestion { width: 100%; padding: 14px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.suggestion:hover, .suggestion:focus { background: var(--surface); outline: none; }
.suggestion.is-active { background: #292926; color: var(--text); outline: none; }
.new-place-notice { padding: 13px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.4; }

.calculator-grid { display: grid; gap: 46px; margin-top: 48px; }
.point-row { position: relative; display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 10px; margin-bottom: 22px; }
.point-index { color: var(--muted); font-size: 10px; }
.point-row input { width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; color: var(--text); font-size: 17px; }
.point-row .suggestions { left: 38px; right: 38px; }
.remove-point, .add-point { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.remove-point { width: 28px; height: 40px; font-size: 20px; }
.remove-point:hover { color: var(--danger); }
.add-point { margin: 0 0 30px 36px; padding: 8px 0; }
.add-point span { margin-right: 8px; color: var(--text); }
.result-panel { min-height: 220px; padding-top: 32px; border-top: 1px solid var(--line); }
.result-placeholder { min-height: 160px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.result-placeholder p { margin: 0; font-size: 12px; }
.result-summary { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.result-summary p { margin: 0 0 6px; color: var(--muted); font-size: 11px; }
.result-summary strong { font-size: 42px; letter-spacing: -.04em; }
.result-summary small, .confidence { color: var(--muted); font-size: 11px; }
.segment { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.segment h3 { margin: 0 0 6px; font-size: 14px; font-weight: 560; }
.segment h3 span { color: var(--muted); }
.segment p { margin: 0; color: var(--muted); font-size: 11px; }
.segment strong { font-size: 15px; }
.segment.unknown strong { color: var(--danger); font-size: 11px; }

.route-result-page { width: min(100%, 760px); margin: auto; }
.route-portrait { position: relative; overflow: hidden; padding: max(28px, env(safe-area-inset-top)) 20px 34px; background: #090909; }
.route-portrait::before { position: absolute; inset: 0; opacity: .18; pointer-events: none; content: ""; background-image: radial-gradient(circle at 1px 1px, #777 1px, transparent 0); background-size: 28px 28px; mask-image: linear-gradient(to bottom, #000, transparent 75%); }
.route-portrait h1 { position: relative; z-index: 1; max-width: 620px; margin-top: 24px; overflow-wrap: anywhere; font-size: clamp(40px, 11vw, 72px); }
.route-portrait h1 span { color: var(--muted); }
.track-stage { position: relative; height: 250px; margin: 10px -20px 0; }
.track-stage canvas { width: 100%; height: 100%; display: block; }
.route-details { padding: 26px 20px 64px; }
.route-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.route-stats article { min-width: 0; min-height: 128px; padding: 17px 14px; border-radius: 18px; background: #1b1b19; color: var(--text); }
.route-stats span { display: block; margin-bottom: 23px; color: var(--muted); font-size: 10px; }
.route-stats strong { font-size: clamp(28px, 8vw, 46px); font-weight: 560; letter-spacing: -.06em; }
.route-stats small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.route-segments { margin-top: 0; }
.route-section-label { display: flex; justify-content: space-between; margin-bottom: 12px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.route-segment { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; margin-bottom: 12px; padding: 24px 20px 26px; border: 1px solid var(--line); border-radius: 20px; animation: appear .3s ease both; }
.segment-marker { display: flex; flex-direction: column; align-items: center; gap: 7px; padding-top: 3px; color: var(--muted); font-size: 9px; }
.segment-marker i { width: 11px; height: 11px; border: 2px solid var(--text); border-radius: 50%; }
.route-segment.is-unknown .segment-marker i { border-color: var(--faint); }
.segment-copy h2 { margin: 0; font-size: 17px; font-weight: 560; letter-spacing: -.025em; }
.segment-copy h2 span { color: var(--muted); }
.segment-copy > p { margin: 7px 0 19px; color: var(--muted); font-size: 11px; }
.segment-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.segment-metrics span { color: var(--muted); font-size: 9px; }
.segment-metrics b { margin-right: 3px; color: var(--text); font-size: 17px; font-weight: 560; }
.segment-copy > small { display: block; margin-top: 15px; color: var(--faint); font-size: 9px; }
.route-segment.is-unknown .segment-copy > p, .route-segment.is-unknown .segment-metrics b { color: var(--faint); }
.route-method-note { margin-top: 42px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; line-height: 1.55; }
.route-method-note p { margin: 0 0 7px; }

.journey-list { display: grid; gap: 12px; }
.journey-card { position: relative; min-height: 132px; padding: 24px 66px 24px 22px; border: 1px solid var(--line); border-radius: 20px; }
.journey-card > time { color: var(--muted); font-size: 11px; }
.journey-route { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-size: 17px; }
.journey-route strong { font-weight: 560; }
.journey-route span { color: var(--muted); }
.journey-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 11px; }
.journey-card > b { position: absolute; top: 48px; right: 22px; font-size: 15px; font-weight: 600; }
.journey-card > b small { color: var(--muted); font-size: 9px; font-weight: 400; }
.trip-delete-form { margin-top: 17px; }
.trip-delete-form button, .delete-history-form button { padding: 0; border: 0; background: transparent; color: var(--faint); font-size: 10px; cursor: pointer; }
.trip-delete-form button:hover, .delete-history-form button:hover { color: var(--danger); }
.delete-history-form { display: flex; justify-content: center; margin-top: 34px; }
.quiet-empty { padding: 80px 0; color: var(--muted); text-align: center; }
.quiet-empty a { display: inline-block; margin-top: 8px; color: var(--text); text-decoration: underline; text-underline-offset: 4px; }

.places-list { display: grid; gap: 12px; }
.place-editor { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; }
.place-editor > summary { display: flex; align-items: center; gap: 13px; min-height: 78px; padding: 19px 20px; cursor: pointer; list-style: none; }
.place-editor > summary::-webkit-details-marker { display: none; }
.place-editor > summary i { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--marker); }
.place-editor > summary > span { display: grid; gap: 4px; font-weight: 550; }
.place-editor > summary small { color: var(--muted); font-size: 11px; font-weight: 400; }
.place-editor > summary b { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 400; }
.new-place { margin-bottom: 32px; }
.new-place > summary { font-weight: 600; }
.place-form { padding: 2px 20px 22px; }
.place-form .field-group input, .place-form .field-group textarea { padding: 13px 14px; border: 0; border-radius: 14px; background: var(--surface); }
.map-pick-button { width: 100%; min-height: 52px; margin: 0 0 30px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--surface); color: var(--text); font-size: 12px; cursor: pointer; }
.map-pick-button:hover { background: #1d1d1a; }
.color-field { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; color: var(--muted); font-size: 12px; }
.color-field input { width: 44px; height: 32px; padding: 2px; border: 0; border-radius: 8px; background: var(--surface); }

.map-dialog { width: min(calc(100% - 24px), 620px); padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.map-dialog::backdrop { background: rgba(0, 0, 0, .42); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head button { width: 38px; height: 38px; border: 0; background: transparent; color: var(--text); font-size: 24px; cursor: pointer; }
#coordinate-map { height: min(54vh, 420px); margin: 16px 0; border-radius: 14px; background: var(--surface); }

.map-page { position: relative; height: calc(100dvh - 88px - env(safe-area-inset-bottom)); padding-top: 0; }
.map-heading { position: absolute; z-index: 500; top: max(18px, env(safe-area-inset-top)); left: 18px; max-width: calc(100% - 36px); padding: 12px 14px; border-radius: 12px; background: rgba(9, 9, 9, .82); backdrop-filter: blur(12px); }
.map-heading h1 { font-size: 25px; letter-spacing: -.04em; }
.map-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.journey-map { width: 100%; height: 100%; background: var(--surface); }
.map-page .ol-zoom { right: .5em; left: auto; }
.map-popup { min-width: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); font-size: 11px; line-height: 1.4; transform: translateY(-8px); }
.map-popup strong { font-size: 12px; }

.profile-card { display: grid; justify-items: center; padding-top: 14px; text-align: center; }
.avatar-fallback { width: 112px; height: 112px; border-radius: 50%; background: var(--surface); }
.avatar-fallback { display: grid; place-items: center; font-size: 40px; }
.profile-card h1 { margin-top: 22px; font-size: 34px; }
.profile-card p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 52px; }
.stats-grid article { min-width: 0; min-height: 126px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; border-radius: 18px; background: #1b1b19; }
.stats-grid strong { overflow-wrap: anywhere; font-size: clamp(25px, 8vw, 38px); font-weight: 560; letter-spacing: -.045em; }
.stats-grid span { color: var(--muted); font-size: 10px; }
.profile-settings { margin-top: 42px; padding-top: 24px; border-top: 1px solid var(--line); }
.profile-settings h2 { margin: 0 0 22px; font-size: 19px; font-weight: 560; }
.profile-settings form { display: grid; gap: 10px; }
.profile-settings label { color: var(--muted); font-size: 11px; }
.profile-settings select { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); cursor: pointer; }
.profile-settings select:focus { border-color: var(--text); }
.profile-settings .secondary-button { margin-top: 6px; }
.logout-form { display: flex; justify-content: center; margin-top: 26px; }
.profile-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 22px; color: var(--muted); font-size: 10px; }
.profile-legal-links a { text-decoration: underline; text-underline-offset: 3px; }
.delete-account { margin-top: 44px; border: 1px solid rgba(255, 123, 114, .25); border-radius: 18px; }
.delete-account summary { padding: 18px; color: var(--danger); font-size: 12px; cursor: pointer; list-style-position: inside; }
.delete-account > div { padding: 0 18px 18px; }
.delete-account p { margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.delete-account form { display: grid; gap: 10px; }
.delete-account label { color: var(--muted); font-size: 10px; }
.delete-account input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); }
.delete-account input:focus { border-color: var(--danger); }
.delete-account button { min-height: 48px; border: 0; border-radius: 12px; background: var(--danger); color: #160504; font-weight: 650; cursor: pointer; }

.legal-page { width: min(100%, 760px); margin: auto; padding: max(28px, env(safe-area-inset-top)) 20px 72px; }
.legal-back { margin-bottom: 56px; color: var(--muted); font-size: 11px; }
.legal-document header { margin-bottom: 54px; }
.legal-document header p { margin: 0 0 12px; color: var(--faint); font-size: 10px; }
.legal-document h1 { max-width: 680px; font-size: clamp(38px, 9vw, 62px); overflow-wrap: anywhere; }
.legal-document section { margin-top: 42px; }
.legal-document h2 { margin: 0 0 14px; font-size: 18px; font-weight: 580; letter-spacing: -.02em; }
.legal-document p, .legal-document li, .legal-document dd { color: var(--muted); font-size: 13px; line-height: 1.72; }
.legal-document p { margin: 0 0 12px; }
.legal-document ul { margin: 0; padding-left: 20px; }
.legal-document li + li { margin-top: 8px; }
.legal-document a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.legal-document dl { display: grid; grid-template-columns: minmax(120px, .45fr) 1fr; gap: 10px 20px; margin: 0; }
.legal-document dt { color: var(--faint); font-size: 11px; }
.legal-document dd { margin: 0; overflow-wrap: anywhere; }
.legal-warning { margin: -22px 0 48px; padding: 14px 16px; border: 1px solid rgba(255, 123, 114, .3); border-radius: 12px; color: var(--danger); font-size: 11px; line-height: 1.5; }

@media (max-width: 480px) {
  .legal-document dl { grid-template-columns: 1fr; gap: 4px; }
  .legal-document dd + dt { margin-top: 12px; }
}

.toast-stack { position: fixed; z-index: 1200; top: max(18px, env(safe-area-inset-top)); left: 16px; right: 16px; display: grid; gap: 8px; }
.toast { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s both, toast-out .25s 4s forwards; }
.toast.error { color: var(--danger); }
.error-page { min-height: 70vh; display: grid; place-content: center; justify-items: center; padding: 20px; text-align: center; }
.error-page p { color: var(--muted); }
.error-page a { margin-top: 26px; color: var(--muted); }

@keyframes appear { from { opacity: 0; transform: translateY(5px); } }
@keyframes settle-origin { from { opacity: .25; border-color: transparent; border-radius: 0; transform: translateY(54px) scale(1.025); } to { opacity: 1; border-color: var(--line); border-radius: 18px; transform: none; } }
@keyframes reveal { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 190px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); pointer-events: none; } }

@media (min-width: 700px) {
  .page-shell { padding-top: 110px; }
  .calculator-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .map-heading { left: max(24px, calc(50% - 330px)); }
  .route-portrait { padding-inline: 38px; }
  .track-stage { height: 280px; margin-inline: -38px; }
  .route-details { padding-inline: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
