:root {
  --ink: #14211f;
  --muted: #68716d;
  --paper: #f4f0e7;
  --paper-deep: #e7e0d3;
  --teal: #173c39;
  --teal-bright: #1e5b55;
  --orange: #e5663b;
  --line: rgba(20, 33, 31, .14);
  --shadow: 0 22px 60px rgba(20, 33, 31, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, .button:focus-visible { outline: 3px solid rgba(229,102,59,.35); outline-offset: 2px; }
.shell { min-height: 100vh; overflow: hidden; }
.topbar, main, footer { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }

.topbar {
  min-height: 102px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font: 600 13px/1.15 "Unbounded"; text-transform: uppercase; letter-spacing: .08em; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--paper); border-radius: 50% 50% 50% 10%; background: var(--teal); font-size: 24px; }
.topbar-actions { display: flex; gap: 10px; }
.button {color: #111; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; white-space: nowrap; transition: transform .18s, background .18s, border-color .18s, box-shadow .18s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--orange); box-shadow: 0 8px 22px rgba(229,102,59,.22); }
.button-primary:hover { background: #d95830; }
.button-ghost { border: 1px solid var(--line); background: rgba(255,255,255,.28); }
.button-yandex { color: #111; background: #ffdb4d; }
.button-yandex:hover { background: #ffd633; }
.button-chip { min-height: 36px; padding: 0 12px; color: var(--teal); border-color: var(--line); background: rgba(255,255,255,.45); font-size: 12px; }
.profile-bar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.profile-identity { display: flex; align-items: center; gap: 17px; }
.profile-identity h2 { font-size: 23px; }
.profile-avatar { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: white; background: var(--teal); font-size: 24px; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-actions { display: flex; gap: 8px; }
.social-links { display: flex; gap: 10px; margin-top: 7px; }
.social-links a { color: var(--teal-bright); font-size: 11px; font-weight: 800; text-transform: uppercase; text-decoration: none; }

.hero { min-height: 390px; display: flex; align-items: center; justify-content: space-between; position: relative; }
.hero::after { content: ""; position: absolute; width: 520px; height: 240px; right: 110px; top: 65px; border: 1px solid rgba(23,60,57,.09); border-radius: 50%; transform: rotate(-12deg); pointer-events: none; }
.hero-copy { max-width: 780px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 14px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: "Unbounded", sans-serif; }
h1 { font-size: clamp(48px, 6vw, 86px); line-height: .98; letter-spacing: -.055em; }
h1 em { color: var(--teal-bright); font-style: normal; }
.hero-subtitle { max-width: 570px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.passport-stamp { width: 154px; height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px solid rgba(229,102,59,.48); outline: 1px solid rgba(229,102,59,.35); outline-offset: 5px; border-radius: 50%; color: rgba(214,80,42,.78); transform: rotate(10deg); text-align: center; text-transform: uppercase; position: relative; z-index: 1; }
.passport-stamp span { width: 110px; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.passport-stamp strong { font: 600 22px "Unbounded"; }

.stats-grid { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); border: 1px solid var(--line); background: rgba(255,255,255,.24); box-shadow: var(--shadow); }
.stat-card { min-height: 205px; padding: 28px; border-right: 1px solid var(--line); position: relative; }
.stat-card:last-child { border: 0; }
.stat-card p { margin: 18px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { display: block; font: 600 clamp(28px, 3vw, 40px) "Unbounded"; letter-spacing: -.04em; white-space: nowrap; }
.stat-card small { font: 600 14px "Manrope"; color: var(--muted); }
.stat-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--paper-deep); }
.stat-note { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.stat-primary { background: var(--teal); color: #fff; }
.stat-primary p, .stat-primary small, .stat-primary .stat-note { color: rgba(255,255,255,.65); }
.stat-primary .stat-icon { color: white; background: rgba(255,255,255,.12); }

.map-section, .journal-section { padding-top: 100px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.section-heading h2, .fact-banner h2, .dialog-header h2 { font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.filters { display: flex; gap: 8px; }
select { height: 42px; min-width: 145px; border: 1px solid var(--line); padding: 0 34px 0 13px; background: rgba(255,255,255,.35); color: var(--ink); border-radius: 3px; }
.map-frame { height: min(68vh, 690px); min-height: 510px; position: relative; background: #cfd8d2; box-shadow: var(--shadow); overflow: hidden; }
#map { height: 100%; width: 100%; background: #d9ddd6; }
.map-error { height: 100%; display: grid; place-items: center; padding: 32px; text-align: center; background: #d9ddd6; }
.map-error div { max-width: 520px; padding: 28px; color: white; background: var(--teal); box-shadow: var(--shadow); }
.map-error strong { display: block; margin-bottom: 10px; font: 600 18px "Unbounded"; }
.map-error p { margin: 0; color: rgba(255,255,255,.72); line-height: 1.6; }
.map-legend { position: absolute; z-index: 500; left: 24px; bottom: 20px; display: flex; gap: 18px; padding: 12px 15px; color: white; background: rgba(20,33,31,.9); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend i { display: inline-block; }
.legend-airport { width: 8px; height: 8px; border: 2px solid white; border-radius: 50%; background: var(--orange); }
.legend-route { width: 23px; border-top: 2px solid var(--orange); }
.legend-repeat { width: 23px; border-top: 5px solid var(--orange); opacity: .8; }
.map-summary { position: absolute; z-index: 500; right: 20px; top: 20px; display: flex; align-items: center; gap: 10px; min-width: 150px; padding: 13px 16px; background: rgba(244,240,231,.94); box-shadow: 0 8px 24px rgba(20,33,31,.15); }
.map-summary strong { font: 600 25px "Unbounded"; }
.map-summary span { color: var(--muted); font-size: 10px; line-height: 1.3; text-transform: uppercase; letter-spacing: .08em; }

.text-button { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--teal); cursor: pointer; font-weight: 800; transition: background .18s, border-color .18s; }
.text-button:hover { border-color: var(--teal); background: rgba(255,255,255,.35); }
.text-button span { color: var(--orange); margin-left: 7px; }
.flight-list { border-top: 1px solid var(--ink); }
.flight-row { min-height: 105px; display: grid; grid-template-columns: 120px 190px 1fr 160px 90px auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); transition: padding .18s, background .18s; }
.flight-row:hover { padding-inline: 12px; background: rgba(255,255,255,.35); }
.flight-row time, .flight-meta span, .flight-distance span { color: var(--muted); font-size: 11px; }
.route-codes { display: flex; align-items: center; gap: 13px; }
.route-codes strong { font: 600 24px "Unbounded"; }
.route-codes span { color: var(--orange); }
.route-names { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.flight-meta, .flight-distance { display: flex; flex-direction: column; gap: 5px; }
.flight-meta strong { font-size: 13px; }
.flight-distance { text-align: right; }
.flight-distance strong { font: 600 16px "Unbounded"; }
.flight-actions { display: none; gap: 5px; }
.edit-mode .flight-actions { display: flex; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; transition: background .18s, border-color .18s; }
.icon-button:hover { border-color: var(--teal); background: rgba(255,255,255,.5); }
.delete-flight { color: #b43f2c; }

.people-section { padding-top: 100px; }
.people-tabs { display: flex; gap: 24px; margin: -10px 0 25px; border-bottom: 1px solid var(--line); }
.people-tabs .text-button { padding-bottom: 12px; color: var(--muted); }
.people-tabs .active { color: var(--orange); border-bottom: 2px solid var(--orange); }
.people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.person-card { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 20px; color: inherit; border: 1px solid var(--line); background: rgba(255,255,255,.25); text-decoration: none; }
.person-card img, .person-card .avatar-fallback { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; object-fit: cover; color: white; background: var(--teal); }
.person-card strong { display: block; margin: 3px 0 7px; }
.person-card span { color: var(--muted); font-size: 11px; }
.checkbox-label { min-height: 42px; flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 12px; }
.checkbox-label input { width: 20px; height: 20px; }

.fact-banner { min-height: 245px; margin: 100px 0; padding: 46px 60px; display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 35px; color: white; background: var(--teal); position: relative; overflow: hidden; }
.fact-banner::after { content: ""; position: absolute; width: 440px; height: 440px; right: -150px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.fact-banner h2 { max-width: 780px; line-height: 1.3; }
.fact-orbit { width: 112px; height: 112px; display: grid; place-items: center; border: 1px dashed rgba(255,255,255,.3); border-radius: 50%; position: relative; }
.fact-orbit::before { content: ""; width: 68px; height: 68px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.fact-orbit span { position: absolute; color: var(--orange); transform: translate(42px,-26px); }
.round-button { width: 48px; height: 48px; display: grid; place-items: center; z-index: 1; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; background: transparent; color: white; cursor: pointer; font-size: 22px; transition: background .18s; }
.round-button:hover { background: rgba(255,255,255,.1); }
footer { min-height: 120px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
footer > span { color: var(--ink); font: 600 12px "Unbounded"; text-transform: uppercase; }

dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 4px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,24,22,.7); backdrop-filter: blur(4px); }
#flightForm { padding: 34px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 26px; }
.dialog-header h2 { font-size: 30px; }
.close-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 28px; cursor: pointer; }
.lookup-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.button-lookup { border: 1px solid var(--teal); color: var(--teal); background: transparent; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px; background: rgba(255,255,255,.5); color: var(--ink); text-transform: none; }
input:focus, select:focus { outline: 2px solid rgba(229,102,59,.35); border-color: var(--orange); }
.span-2 { grid-column: span 2; }
.form-status { min-height: 20px; margin: 10px 0; color: var(--orange); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.landing-body { background: var(--teal); color: white; }
.landing-body .topbar { border-color: rgba(255,255,255,.16); }
.landing-body .brand { color: white; }
.landing-body .brand-mark { color: var(--teal); background: var(--paper); }
.landing-main { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.landing-hero { min-height: 680px; display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 70px; }
.landing-hero h1 { font-size: clamp(52px,7vw,96px); }
.landing-hero h1 em { color: #f3976f; }
.landing-lead { max-width: 650px; margin: 28px 0; color: rgba(255,255,255,.7); font-size: 18px; line-height: 1.7; }
.landing-actions { display: flex; gap: 12px; }
.landing-preview { padding: 30px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); transform: rotate(2deg); }
.landing-preview strong { display: block; font: 600 52px "Unbounded"; }
.landing-preview span { color: rgba(255,255,255,.65); }
.landing-features { padding: 90px 0; color: var(--ink); background: var(--paper); box-shadow: 0 0 0 100vmax var(--paper); clip-path: inset(0 -100vmax); }
.landing-features h2, .landing-community h2 { font-size: clamp(32px,4vw,52px); }
.feature-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin-top: 36px; background: var(--line); }
.feature-card { min-height: 220px; padding: 30px; background: var(--paper); }
.feature-card b { color: var(--orange); font: 600 24px "Unbounded"; }
.feature-card h3 { margin: 30px 0 10px; font: 600 17px "Unbounded"; }
.feature-card p { color: var(--muted); line-height: 1.6; }
.landing-community { padding: 90px 0; }
.landing-community .people-grid { margin-top: 35px; }
.landing-body .person-card { color: white; border-color: rgba(255,255,255,.17); background: rgba(255,255,255,.06); }
.landing-body .person-card span { color: rgba(255,255,255,.65); }

.profile-page { padding-bottom: 100px; }
.profile-heading { max-width: 850px; padding: 90px 0 55px; }
.profile-heading h1 { font-size: clamp(46px, 6vw, 78px); }
.profile-heading > p:last-child { max-width: 650px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.profile-form-card { border: 1px solid var(--line); background: rgba(255,255,255,.25); box-shadow: var(--shadow); }
.profile-form-section { display: grid; grid-template-columns: minmax(220px,.75fr) minmax(0,1.25fr); gap: 55px; padding: 42px; border-bottom: 1px solid var(--line); }
.profile-section-title { display: grid; grid-template-columns: 42px 1fr; gap: 15px; }
.profile-section-title > span { color: var(--orange); font: 600 15px "Unbounded"; }
.profile-section-title h2 { font-size: 20px; letter-spacing: -.03em; }
.profile-section-title p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-check { min-height: 20px; margin: 10px 0 0; font-size: 12px; font-weight: 700; }
.login-check.is-available { color: var(--teal-bright); }
.login-check.is-unavailable { color: #b43f2c; }
.login-suggestions { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.login-suggestions > span { width: 100%; color: var(--muted); font-size: 11px; }
.settings-list { border-top: 1px solid var(--line); }
.setting-row { min-height: 84px; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 25px; border-bottom: 1px solid var(--line); color: var(--ink); text-transform: none; letter-spacing: normal; }
.setting-row span { display: flex; flex-direction: column; gap: 5px; }
.setting-row strong { font-size: 13px; }
.setting-row small { color: var(--muted); font-size: 11px; font-weight: 500; }
.setting-row input { width: 22px; height: 22px; flex: 0 0 auto; }
.profile-save-status { margin: 18px 42px 0; }
.profile-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 42px 34px; }

@media (max-width: 900px) {
  .topbar, main, footer { width: min(100% - 32px, 1280px); }
  .hero { min-height: 430px; }
  .passport-stamp { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card { border-bottom: 1px solid var(--line); }
  .flight-row { grid-template-columns: 85px 160px 1fr 80px; }
  .route-names { display: none; }
  .fact-banner { grid-template-columns: 90px 1fr auto; padding: 35px; }
  .people-grid { grid-template-columns: 1fr 1fr; }
  .fact-orbit { width: 80px; height: 80px; }
  .landing-hero { grid-template-columns: 1fr; padding: 90px 0; }
  .landing-preview { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .profile-form-section { grid-template-columns: 1fr; gap: 26px; }
  .login-suggestions { grid-column: 1; }
}

@media (max-width: 620px) {
  .topbar { min-height: 82px; }
  .topbar-actions .button-ghost, .brand br { display: none; }
  #browseProfiles, #profileButton { display: none; }
  .brand { font-size: 10px; }
  .hero { min-height: 360px; }
  h1 { font-size: 46px; }
  .hero-subtitle { font-size: 14px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 165px; border-right: 0; }
  .map-section, .journal-section { padding-top: 70px; }
  .map-heading { align-items: start; flex-direction: column; gap: 20px; }
  .filters { width: 100%; }
  .filters label, .filters select { width: 100%; min-width: 0; }
  .map-frame { min-height: 510px; }
  .map-legend { display: none; }
  .flight-row { min-height: 120px; grid-template-columns: 1fr auto; gap: 10px; padding: 16px 0; }
  .flight-row time { grid-column: 1; }
  .route-codes { grid-column: 1; }
  .flight-meta { grid-column: 1; }
  .flight-distance { grid-column: 2; grid-row: 1 / span 3; }
  .flight-actions { grid-column: 2; grid-row: 3; }
  .profile-bar { align-items: flex-start; flex-direction: column; padding: 20px 0; }
  .profile-actions .button-ghost { display: inline-block; }
  .people-grid { grid-template-columns: 1fr; }
  .fact-banner { grid-template-columns: 1fr auto; margin: 70px -16px; padding: 38px 24px; }
  .fact-orbit { display: none; }
  .fact-banner h2 { font-size: 24px; }
  footer { flex-direction: column; justify-content: center; align-items: start; gap: 10px; }
  .lookup-row, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  #flightForm { padding: 24px; }
  .landing-main { width: min(100% - 32px, 1280px); }
  .landing-hero { min-height: 620px; }
  .landing-actions { align-items: stretch; flex-direction: column; }
  .landing-actions .button { display: grid; place-items: center; }
  .profile-heading { padding: 65px 0 38px; }
  .profile-heading h1 { font-size: 44px; }
  .profile-form-section { padding: 28px 22px; }
  .profile-form-actions { padding: 22px; }
  .profile-save-status { margin-inline: 22px; }
}
