:root {
  --navy-950: #04142d;
  --navy-900: #071b3b;
  --navy-800: #0b2b59;
  --blue-600: #0787df;
  --blue-500: #0797f2;
  --blue-100: #dff2ff;
  --mist: #eef5fa;
  --paper: #f7f9fc;
  --white: #ffffff;
  --ink: #07152e;
  --muted: #53627a;
  --line: #d7e0ea;
  --success: #087b54;
  --warning: #9a5b00;
  --danger: #b42335;
  --radius: 14px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
  color: var(--ink);
  font-family: Bahnschrift, "DIN Alternate", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--navy-900) 0 280px, var(--paper) 280px 100%);
  color: var(--white);
}

body, button, input, select { font: inherit; }
button, input, select { font-size: 1rem; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 0.2em; }
img, svg { display: block; }

::selection { background: var(--blue-100); color: var(--navy-950); }
* { scrollbar-color: var(--blue-600) var(--mist); scrollbar-width: thin; }

:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}
main h1[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--white);
  color: var(--navy-950);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.app-shell { min-height: 100vh; }
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--white);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--navy-900) 94%, transparent);
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
}
.brand img { width: 112px; height: 56px; object-fit: contain; }
.topbar-actions { display: flex; gap: 8px; }

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}
.icon-button svg, .nav-link svg, .button svg { width: 22px; height: 22px; }

.page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 18px calc(104px + env(safe-area-inset-bottom));
}

.route-hero {
  min-height: 230px;
  display: grid;
  align-content: center;
  gap: 22px;
  color: var(--white);
  padding: 26px 2px 34px;
}

.route-hero h1,
.page-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.7rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.route-hero p { margin: 10px 0 0; max-width: 52ch; color: #c8daef; font-size: 1.06rem; }

.route-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: relative;
  max-width: 600px;
}
.route-line::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: #5c7190;
}
.route-stop { position: relative; z-index: 1; display: grid; gap: 7px; color: #b8c8da; font-size: .82rem; }
.route-stop:nth-child(2) { justify-items: center; }
.route-stop:nth-child(3) { justify-items: end; }
.route-stop b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--navy-800);
  border: 2px solid #7790ae;
  border-radius: 8px;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.route-stop.active { color: var(--white); font-weight: 700; }
.route-stop.active b { background: var(--blue-500); border-color: var(--blue-500); }

.workspace {
  min-height: 400px;
  padding: 22px 18px 34px;
  margin-inline: -18px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
}

.section-block + .section-block { margin-top: 34px; }
.section-heading {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}
.section-heading .number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--navy-900);
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.section-heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); }
.text-action { border: 0; background: none; color: var(--blue-600); font-weight: 700; padding: 8px 0; }

.choice-list { display: grid; gap: 10px; }
.choice {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.choice.selected { border: 2px solid var(--blue-500); padding: 15px; background: #f2faff; }
.choice.service-choice { grid-template-columns: auto 1fr auto auto; }
.choice-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--navy-900);
}
.choice-icon svg { width: 34px; height: 34px; }
.choice-copy { min-width: 0; }
.choice-copy strong { display: block; font-size: 1.05rem; }
.choice-copy small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.choice-price { font-size: 1.15rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.selection-mark { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid #7e8da1; border-radius: 7px; }
.selection-mark svg { width: 15px; height: 15px; }
.selected .selection-mark { color: var(--white); border-color: var(--blue-600); background: var(--blue-600); }

.button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border-radius: 12px;
  border: 0;
  font-weight: 800;
  text-decoration: none;
}
.button-primary { color: var(--white); background: var(--blue-600); }
.button-primary:hover { background: #056fbd; }
.button-secondary { color: var(--navy-900); background: var(--white); border: 1px solid var(--line); }
.button-danger { color: var(--danger); background: #fff1f3; }
.button:disabled { cursor: not-allowed; background: #c9d1db; color: #687588; }
.button-wide { width: 100%; margin-top: 22px; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97);
  color: var(--ink);
  border-top: 1px solid var(--line);
}
.nav-link {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 2px;
  color: #627188;
  text-decoration: none;
  font-size: .75rem;
  border-bottom: 3px solid transparent;
}
.nav-link.active { color: var(--blue-600); border-color: var(--blue-500); font-weight: 700; }

.page-heading { color: var(--white); padding: 38px 2px 44px; }
.page-heading p { margin: 10px 0 0; color: #c8daef; max-width: 60ch; }
.content-sheet {
  min-height: 500px;
  margin-inline: -18px;
  padding: 24px 18px 40px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
}

.stack { display: grid; gap: 14px; }
.panel {
  padding: 18px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--line);
}
.panel h2, .panel h3 { margin: 0; }
.panel p { color: var(--muted); }
.space-top { margin-top: 24px; }
.result-panel { margin-top: 18px; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.meta { color: var(--muted); font-size: .9rem; }
.money { font-weight: 800; font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.status::before { content: ""; width: 9px; height: 9px; background: currentColor; border-radius: 2px; }
.status-paid, .status-available { color: var(--success); }
.status-pending_payment { color: var(--warning); }
.status-cancelled, .status-expired { color: var(--danger); text-decoration: line-through; }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field span { font-size: .9rem; font-weight: 700; }
.field input, .field select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #acb9c8;
  border-radius: 10px;
}
.field input:focus, .field select:focus { border-color: var(--blue-600); }
.form-note { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.form-error { color: var(--danger); min-height: 1.25em; margin: 0; }

.auth-layout {
  min-height: calc(100vh - 70px);
  display: grid;
  align-items: center;
  padding: 34px 0 70px;
}
.auth-card { width: min(100%, 480px); margin: 0 auto; padding: 24px; color: var(--ink); background: var(--white); border-radius: 18px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.auth-switch { margin: 20px 0 0; text-align: center; }

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 26px 4px;
  max-width: 54ch;
}
.empty-state svg { width: 44px; height: 44px; color: var(--blue-600); }
.empty-state h2 { margin: 0; }
.empty-state p { margin: 0 0 8px; color: var(--muted); line-height: 1.55; }

.voucher-code {
  display: block;
  margin: 12px 0;
  font-size: clamp(1.4rem, 8vw, 2.6rem);
  font-weight: 800;
  letter-spacing: .09em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.operation-banner {
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--white);
  background: var(--navy-900);
  border-radius: 12px;
}

.review-sheet { display: grid; gap: 2px; }
.review-row {
  display: grid;
  grid-template-columns: minmax(90px, .55fr) 1fr;
  gap: 4px 18px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
}
.review-row > span { color: var(--muted); }
.review-row > small { grid-column: 2; color: var(--muted); }
.review-total { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 26px 4px 18px; }
.review-total strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.notice { margin-top: 12px; padding: 16px; color: var(--navy-900); background: var(--blue-100); border-radius: 12px; }
.notice p { margin: 6px 0 0; line-height: 1.5; }

.skeleton { min-height: 86px; border-radius: var(--radius); background: linear-gradient(100deg, #edf1f5 20%, #fff 40%, #edf1f5 60%); background-size: 240% 100%; animation: sweep 1.4s ease-in-out infinite; }
@keyframes sweep { to { background-position: -140% 0; } }

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 460px);
  padding: 13px 16px;
  color: var(--white);
  background: var(--navy-950);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 150%);
  transition: transform .45s cubic-bezier(.19, 1, .22, 1);
}
.toast.visible { transform: translate(-50%, 0); }

.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; }

@media (min-width: 760px) {
  body { background: var(--navy-900); }
  .topbar { padding-inline: max(34px, calc((100vw - 1120px) / 2)); }
  .page { padding-inline: 34px; padding-bottom: 42px; }
  .route-hero { min-height: 280px; grid-template-columns: 1.15fr .85fr; align-items: center; }
  .workspace, .content-sheet { margin-inline: 0; padding: 34px; border-radius: 24px 24px 0 0; }
  .purchase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 42px; }
  .purchase-grid .section-block + .section-block { margin-top: 0; }
  .purchase-grid .service-block { grid-column: 1 / -1; }
  .bottom-nav { position: sticky; width: min(720px, calc(100% - 48px)); margin: -28px auto 0; border: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .auth-card { padding: 34px; }
}

@media (max-width: 759px) {
  .purchase-actions {
    position: sticky;
    z-index: 12;
    bottom: calc(74px + env(safe-area-inset-bottom));
    margin-inline: -8px;
    padding: 10px 8px 12px;
    background: var(--paper);
    box-shadow: 0 -12px 26px rgba(0, 0, 0, .08);
  }
  .purchase-actions .button-wide { margin-top: 0; }
  .purchase-actions .form-note { margin-top: 9px; }
}

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