:root {
  --entry-bg: #17212b;
  --black-bg: #010001;
  --footer-bg: #201f21;
  --text: #e7e9ef;
  --soft-text: #a9a6ad;
  --muted: #77747b;
  --dim: #4f5963;
  --line: rgba(255,255,255,0.11);
  --line-strong: rgba(255,255,255,0.18);
  --red: #bd0b28;
  --red-dark: #3d1015;
  --green: #31ba4c;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #000;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.app-shell {
  width: min(100vw, 455px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--entry-bg);
}
.screen-black .app-shell,
.screen-loading .app-shell { background: var(--black-bg); }

.route-loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--entry-bg);
  opacity: 1;
  transition: opacity 280ms ease;
}
.screen-black .route-loader,
.screen-loading .route-loader { background: var(--black-bg); }
.route-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.bus-pulse {
  width: 54px;
  height: 54px;
  color: #fff;
  opacity: .82;
  animation: busBlink 1180ms ease-in-out infinite;
}
@keyframes busBlink {
  0%, 100% { opacity: .92; transform: scale(1); }
  50% { opacity: .26; transform: scale(.96); }
}

.loading-only {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.code-screen {
  min-height: 100dvh;
  padding: 100px 18px 18px;
  display: flex;
  flex-direction: column;
}
.code-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  width: 100%;
}
.code-slot {
  height: 58px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 510;
  background: rgba(0,0,0,.05);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.code-slot.is-filled {
  border-color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.05);
  transform: translateY(-2px);
}
.code-slot.is-shake {
  animation: slotShake 260ms ease;
}
@keyframes slotShake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}
.code-title {
  margin-top: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.code-title svg {
  width: 20px;
  height: 20px;
  color: #e7e9ef;
  flex: 0 0 auto;
}
.keypad {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 5px;
}
.key {
  height: 61px;
  border: 1px solid #c5cbd1;
  border-radius: 5px;
  background: #f9f9fa;
  color: #07090b;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 430;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 110ms ease, background 110ms ease, box-shadow 110ms ease;
}
.key:active,
.key.is-pressed {
  transform: scale(.965);
  background: #e8ebef;
  box-shadow: inset 0 0 0 999px rgba(0,0,0,.03);
}
.key-scan {
  gap: 3px;
  font-size: 11px;
  font-weight: 520;
}
.key-scan svg {
  width: 24px;
  height: 24px;
}
.key svg {
  width: 30px;
  height: 24px;
}

.form-screen {
  min-height: 100dvh;
  padding: 22px 13px 64px;
}
.form-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.12;
  font-weight: 680;
  letter-spacing: -0.015em;
}
.form-title svg {
  width: 28px;
  height: 28px;
}
.quantity { margin: 0 12px 20px; }
.quantity-label {
  color: var(--soft-text);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 3px 44px;
}
.quantity-control {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 15px;
}
.qty-badge {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 680;
  color: #fff;
}
.range-wrap { position: relative; padding-top: 4px; }
.range-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 16px;
  height: 1px;
  background: rgba(133,83,42,.45);
}
.range-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--qty-pct, 0%);
  background: var(--red);
}
.quantity input[type="range"] {
  position: relative;
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  outline: 0;
  cursor: pointer;
}
.quantity input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #ff1b32;
  background: var(--entry-bg);
  box-shadow: 0 0 0 2px rgba(255,0,28,.12);
  transition: transform 140ms ease;
}
.quantity input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.28); }
.ticks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 2px;
  color: #8c929a;
  font-size: 14px;
  font-weight: 650;
}
.ticks span { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 18px 11px; }
.data-row {
  display: grid;
  grid-template-columns: 39px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 61px;
  padding: 0 22px 0 22px;
}
.data-row svg {
  width: 25px;
  height: 25px;
  color: #dbe2ea;
}
.data-kicker {
  color: #93a0ad;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 4px;
}
.data-value {
  color: #eef3fb;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 650;
}
.data-route { font-size: 14px; color: #99a7b4; }
.subscription {
  margin: 18px 12px 0;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 21px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  background: var(--red-dark);
  border: 1px solid rgba(191,30,49,.55);
}
.switch {
  width: 43px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: #675158;
  padding: 2px;
  cursor: pointer;
}
.switch span {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms ease;
}
.switch.is-on { background: #b70f2b; }
.switch.is-on span { transform: translateX(19px); }
.pay-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 8px 4px;
}
.pay-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  display: grid;
  place-items: center;
}

.ticket-screen {
  min-height: 100dvh;
  padding-bottom: 92px;
  background: #010001;
}
.validity {
  padding-top: 10px;
  text-align: center;
  color: #aba7ad;
  font-size: 27px;
  line-height: 1.28;
  font-weight: 520;
  letter-spacing: -0.015em;
}
.tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}
.tab {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #a8a5ab;
  font-size: 17px;
  border-bottom: 2px solid transparent;
}
.tab svg { width: 22px; height: 22px; }
.tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}
.ticket-details {
  padding: 12px 25px 0;
}
.detail-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 17px;
  align-items: center;
  min-height: 86px;
  border-bottom: 1px solid var(--line);
}
.detail-row svg {
  width: 28px;
  height: 28px;
  color: #aaa7ad;
}
.detail-kicker {
  color: #666269;
  font-size: 16px;
  line-height: 1.35;
}
.detail-value {
  margin-top: 3px;
  color: #a9a5ac;
  font-size: 27px;
  line-height: 1.18;
  font-weight: 540;
  letter-spacing: -0.015em;
}
.detail-route { font-size: 17px; color: #69656c; }
.qr-content {
  padding-top: 18px;
  text-align: center;
}
.qr-zone {
  position: relative;
  width: min(76.4vw, 344px);
  aspect-ratio: 1;
  margin: 0 auto;
  background: #cfcfcf;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.qr-host,
.qr-host svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-host svg { background: #cfcfcf; }
.qr-finger {
  position: absolute;
  left: 38px;
  top: calc(100% - 38px);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #b60e29;
  color: #e8e4e7;
  transform: translate(-50%, -50%);
  box-shadow: 0 7px 16px rgba(0,0,0,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
.qr-finger.is-visible { opacity: 1; }
.qr-finger svg {
  width: 52px;
  height: 52px;
}
.qr-number {
  margin-top: 8px;
  color: #b5b1b8;
  font-size: clamp(30px, 8vw, 37px);
  line-height: 1.15;
  letter-spacing: .01em;
  font-weight: 430;
}
.close-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 91px;
  padding: 11px 14px 0;
  background: var(--footer-bg);
}
.close-button {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #e5dfe3;
  font-size: 15px;
  line-height: 1;
  font-weight: 780;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  cursor: pointer;
}

@media (max-width: 360px) {
  .code-screen { padding-left: 14px; padding-right: 14px; }
  .code-slot { height: 54px; }
  .key { height: 58px; }
  .validity { font-size: 25px; }
  .tab { font-size: 16px; }
  .detail-value { font-size: 24px; }
}
