.ticket-entry {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #000;
  perspective: 1100px;
  transition: opacity 0.45s ease;
}

.ticket-entry.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.ticket-entry__inner {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ticket-entry__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  text-align: center;
  transition: opacity 0.35s ease;
}

.ticket-entry__sub {
  margin: 0 0 24px;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  transition: opacity 0.35s ease;
}

.ticket-entry.is-tearing .ticket-entry__title,
.ticket-entry.is-tearing .ticket-entry__sub {
  opacity: 0;
}

.ticket-card {
  width: 100%;
  position: relative;
  filter: drop-shadow(0 20px 48px rgba(0, 0, 0, 0.45));
  transform-style: preserve-3d;
  animation: ticketSpin3d 12s linear infinite;
}

.ticket-card.is-dragging,
.ticket-entry.is-tearing .ticket-card {
  animation-play-state: paused;
}

@keyframes ticketSpin3d {
  0% {
    transform: rotateY(0deg) rotateX(8deg);
  }
  25% {
    transform: rotateY(90deg) rotateX(-4deg);
  }
  50% {
    transform: rotateY(180deg) rotateX(8deg);
  }
  75% {
    transform: rotateY(270deg) rotateX(-4deg);
  }
  100% {
    transform: rotateY(360deg) rotateX(8deg);
  }
}

.ticket-card__main {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 22px 20px 14px;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease;
  transform-origin: center top;
  backface-visibility: hidden;
}

.ticket-entry.is-tearing .ticket-card__main {
  transform: scale(1.04);
  opacity: 0;
}

.ticket-route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  margin-bottom: 18px;
}

.ticket-route__col {
  min-width: 0;
}

.ticket-route__col--right {
  text-align: right;
}

.ticket-route__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 4px;
}

.ticket-route__code {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #111;
  line-height: 1;
  margin-bottom: 4px;
}

.ticket-route__airport {
  font-size: 0.68rem;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.35;
}

.ticket-route__mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 14px;
  min-width: 88px;
}

.ticket-route__line {
  width: 100%;
  height: 0;
  border-top: 2px dotted #d1d5db;
  position: relative;
  margin-bottom: 6px;
}

.ticket-route__plane {
  position: absolute;
  left: 50%;
  top: -9px;
  transform: translateX(-50%);
  font-size: 14px;
  background: #fff;
  padding: 0 4px;
  line-height: 1;
}

.ticket-route__duration {
  font-size: 0.62rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 5px;
  white-space: nowrap;
}

.ticket-route__stop {
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8f4fd;
  color: #2563eb;
  font-size: 0.62rem;
  font-weight: 800;
}

.ticket-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.ticket-times__col--right {
  text-align: right;
}

.ticket-times__time {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #111;
  margin-bottom: 2px;
}

.ticket-times__date {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
}

.ticket-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px 10px;
  border-radius: 12px;
  background: #eef6fc;
  margin-bottom: 16px;
}

.ticket-info__item {
  text-align: center;
  min-width: 0;
}

.ticket-info__label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 3px;
  line-height: 1.2;
}

.ticket-info__val {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: #111;
  line-height: 1.2;
}

.ticket-passenger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ticket-passenger__label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  color: #9ca3af;
  margin-bottom: 3px;
}

.ticket-passenger__val {
  font-size: 0.82rem;
  font-weight: 800;
  color: #111;
}

.ticket-card__tear {
  position: relative;
  height: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  backface-visibility: hidden;
}

.ticket-card__notch {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000;
  transform: translateY(-50%);
  z-index: 2;
}

.ticket-card__notch--left { left: -9px; }
.ticket-card__notch--right { right: -9px; }

.ticket-card__perf {
  flex: 1;
  margin: 0 14px;
  border-top: 2px dashed #d1d5db;
}

.ticket-card__stub {
  background: #fff;
  border-radius: 0 0 20px 20px;
  padding: 16px 24px 22px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.38s ease;
  backface-visibility: hidden;
}

.ticket-card__stub.is-dragging {
  cursor: grabbing;
  transition: none;
}

.ticket-entry.is-tearing .ticket-card__stub {
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.ticket-barcode {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  height: 72px;
  margin: 0 auto;
  max-width: 220px;
}

.ticket-barcode span {
  display: block;
  width: 3px;
  background: #111;
  border-radius: 1px;
}

@media (max-width: 380px) {
  .ticket-route__code { font-size: 1.5rem; }
  .ticket-times__time { font-size: 1.15rem; }
  .ticket-info__val { font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-card__main,
  .ticket-card__stub,
  .ticket-entry {
    transition: none !important;
  }

  .ticket-card {
    animation: none !important;
  }
}
