:root {
  --ticket-ink: #342b22;
  --ticket-muted: #756a5b;
  --ticket-line: rgba(126, 91, 52, 0.22);
  --ticket-card: rgba(255, 250, 241, 0.94);
  --ticket-card-soft: rgba(255, 252, 246, 0.74);
  --ticket-gold: #a87a3e;
  --ticket-gold-deep: #87642f;
  --ticket-red: #a84334;
  --ticket-sage: #6f8172;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.tickets-page {
  min-width: 320px;
  color: var(--ticket-ink);
  background:
    linear-gradient(180deg, rgba(255, 251, 243, 0.78) 0%, rgba(255, 251, 243, 0.4) 280px),
    linear-gradient(180deg, #f6efe3 0%, #fbf6ec 46%, #f1e3d1 100%);
}

.tickets-page::before {
  opacity: 0.5;
}

.ticket-header,
.ticket-main {
  width: min(calc(100% - 28px), 1240px);
  margin-inline: auto;
}

.ticket-header {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(142, 107, 65, 0.22);
  border-radius: 24px;
  background: rgba(255, 251, 243, 0.9);
  box-shadow: 0 10px 28px rgba(77, 58, 35, 0.08);
  backdrop-filter: blur(10px);
}

.ticket-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ticket-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.ticket-brand span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ticket-brand strong {
  font-size: 1rem;
  line-height: 1.1;
}

.ticket-brand small {
  color: var(--ticket-muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.home-link,
.error-actions a,
.ticket-actions button,
.category-filters button,
.map-marker-list button {
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.home-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  background: #3f332a;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(63, 51, 42, 0.18);
}

.ticket-main {
  padding: 22px 0 54px;
}

.ticket-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 300px);
  gap: 24px;
  align-items: end;
  min-height: 360px;
  padding: clamp(22px, 5vw, 48px);
  border: 1px solid var(--ticket-line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(247, 237, 221, 0.82));
  box-shadow: 0 16px 42px rgba(78, 58, 36, 0.1);
}

.ticket-hero-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 1;
  filter: saturate(1.08) contrast(1.08) brightness(1.02);
  transform: scale(1.002);
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.ticket-hero-image.is-switching {
  opacity: 0;
}

.ticket-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(249, 247, 243, 0.94) 0%, rgba(249, 247, 243, 0.60) 44%, rgba(249, 247, 243, 0.02) 100%);
  pointer-events: none;
}

.ticket-hero::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -42px;
  width: 220px;
  height: 128px;
  border: 18px solid rgba(63, 51, 42, 0.05);
  border-top: 0;
  border-radius: 0 0 120px 120px;
  z-index: 2;
  pointer-events: none;
}

.ticket-hero > :not(.ticket-hero-image) {
  position: relative;
  z-index: 3;
}

.ticket-eyebrow {
  margin: 0 0 10px;
  color: var(--ticket-gold);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}


.ticket-build-stamp {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 9px;
  border: 1px solid rgba(135, 100, 47, 0.28);
  border-radius: 999px;
  color: #5c462c;
  background: rgba(255, 252, 246, 0.76);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.ticket-hero h1 {
  max-width: 820px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.78rem, 5vw, 3.35rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.ticket-hero p:last-child {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--ticket-muted);
  font-size: clamp(0.96rem, 2.3vw, 1.08rem);
}

.hero-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(126, 91, 52, 0.18);
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.78);
  box-shadow: 0 12px 28px rgba(78, 58, 36, 0.08);
}

.hero-panel strong {
  font-size: 1.42rem;
}

.hero-panel span {
  color: var(--ticket-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ticket-workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 360px;
  grid-template-areas: "controls results map";
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.ticket-controls {
  grid-area: controls;
  display: grid;
  gap: 12px;
}

.ticket-results {
  grid-area: results;
  min-width: 0;
}

.ticket-map-panel {
  grid-area: map;
}

.control-card,
.ticket-map-panel,
.ticket-card,
.ticket-empty,
.ticket-error {
  border: 1px solid var(--ticket-line);
  border-radius: 22px;
  background: var(--ticket-card);
  box-shadow: 0 12px 28px rgba(78, 58, 36, 0.08);
}

.control-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.control-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.control-field span,
.control-label,
.result-head p,
.map-head p {
  color: var(--ticket-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.control-field select,
.control-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(126, 91, 52, 0.28);
  border-radius: 14px;
  padding: 0 13px;
  color: var(--ticket-ink);
  background: #fffaf2;
  outline: none;
}

.control-field select:focus,
.control-field input:focus {
  border-color: rgba(168, 122, 62, 0.75);
  box-shadow: 0 0 0 3px rgba(168, 122, 62, 0.14);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-filters button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #604c32;
  background: rgba(168, 122, 62, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.category-filters button.is-active {
  color: #fff;
  background: var(--ticket-gold-deep);
  box-shadow: 0 8px 18px rgba(135, 100, 47, 0.22);
}

.source-note p {
  margin: 0;
  color: var(--ticket-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.result-head,
.map-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}

.result-head h2,
.map-head h2 {
  margin: 0;
  font-size: 1.22rem;
}

.result-head p,
.map-head p {
  margin: 0 0 4px;
}

#resultCount,
#mapStatus {
  margin: 0;
  color: var(--ticket-muted);
  font-size: 0.88rem;
  text-transform: none;
}

.ticket-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.ticket-card {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.ticket-card.is-active {
  border-color: rgba(168, 122, 62, 0.72);
  box-shadow: 0 18px 42px rgba(135, 100, 47, 0.16);
}

.ticket-cover {
  aspect-ratio: 16 / 6.2;
  overflow: hidden;
  background: #eadcc7;
}

.ticket-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ticket-card-body {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 15px;
}

.ticket-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ticket-card h3 {
  margin: 0;
  font-size: 1.14rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ticket-zh {
  margin: 4px 0 0;
  color: var(--ticket-muted);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ticket-price {
  flex: 0 0 auto;
  max-width: 170px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--ticket-red);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ticket-city,
.ticket-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.ticket-city {
  color: #fff;
  background: var(--ticket-sage);
}

.ticket-tag {
  color: #604c32;
  background: rgba(168, 122, 62, 0.12);
}

.ticket-desc,
.ticket-note,
.ticket-best-time {
  margin: 0;
  color: #554a3d;
  font-size: 0.91rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ticket-desc-zh {
  color: #7a6d5e;
  font-size: 0.84rem;
}

.ticket-best-time,
.ticket-note {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
}

.ticket-best-time strong,
.ticket-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ticket-ink);
  font-size: 0.82rem;
}

.social-digest {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(126, 91, 52, 0.15);
  border-radius: 15px;
  background: rgba(248, 242, 232, 0.72);
}

.social-digest h4 {
  margin: 0;
  font-size: 0.92rem;
}

.social-digest p {
  margin: 0;
  color: #554a3d;
  font-size: 0.86rem;
  line-height: 1.45;
}

.social-digest a {
  width: fit-content;
  color: var(--ticket-gold-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.ticket-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 15px 15px;
}

.ticket-actions button {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 8px;
  color: #fff;
  background: #3f332a;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.18;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.ticket-actions button:nth-child(2) {
  background: var(--ticket-gold);
}

.ticket-actions button:nth-child(3) {
  background: var(--ticket-red);
}

.ticket-actions button:nth-child(4) {
  color: #3f332a;
  background: rgba(111, 129, 114, 0.18);
}

.ticket-actions button:disabled {
  opacity: 0.72;
  cursor: pointer;
}

.ticket-empty,
.ticket-error {
  padding: 18px;
  color: var(--ticket-muted);
}

.ticket-error {
  color: #7b332b;
  background: rgba(255, 241, 235, 0.94);
}

.ticket-error p {
  margin: 0 0 12px;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.error-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  color: #fff;
  background: #3f332a;
  font-weight: 800;
}

.error-actions a:last-child {
  background: var(--ticket-red);
}

.ticket-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  width: min(calc(100% - 28px), 560px);
  transform: translate(-50%, 130%);
  padding: 13px 16px;
  border-radius: 16px;
  color: #fff;
  background: rgba(63, 51, 42, 0.96);
  box-shadow: 0 16px 34px rgba(63, 51, 42, 0.24);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
  transition: transform 180ms ease;
}

.ticket-toast.is-visible {
  transform: translate(-50%, 0);
}

@media (hover: hover) and (pointer: fine) {
  .home-link:hover,
  .ticket-actions button:hover,
  .category-filters button:hover,
  .map-marker-list button:hover,
  .error-actions a:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 1160px) {
  .ticket-workspace {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-areas:
      "controls map"
      "results results";
  }
}

@media (max-width: 760px) {
  .ticket-header,
  .ticket-main {
    width: min(calc(100% - 20px), 1240px);
  }

  .ticket-hero,
  .ticket-workspace {
    grid-template-columns: 1fr;
  }

  .ticket-hero {
    min-height: 420px;
  }

  .ticket-hero-image {
    object-position: center top;
  }

  .ticket-hero::before {
    background: linear-gradient(180deg, rgba(249, 247, 243, 0.90) 0%, rgba(249, 247, 243, 0.60) 46%, rgba(249, 247, 243, 0.20) 100%);
  }

  .ticket-workspace {
    grid-template-areas:
      "controls"
      "map"
      "results";
  }

  .hero-panel {
    max-width: none;
  }

  .ticket-cover {
    aspect-ratio: 16 / 8.4;
  }

  .ticket-actions {
    grid-template-columns: 1fr;
  }

  .ticket-actions button,
  .control-field select,
  .control-field input {
    min-height: 46px;
  }
}

@media (max-width: 430px) {
  .ticket-hero {
    min-height: 460px;
    padding: 20px 18px 18px;
  }

  .ticket-hero-image {
    object-position: center 20%;
  }

  .ticket-header {
    align-items: flex-start;
    border-radius: 20px;
  }

  .ticket-brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .ticket-brand strong {
    font-size: 0.92rem;
  }

  .ticket-brand small,
  .home-link {
    font-size: 0.72rem;
  }

  .home-link {
    min-height: 36px;
    padding: 0 10px;
  }

  .ticket-hero {
    padding: 20px;
    border-radius: 22px;
  }

  .ticket-hero h1 {
    font-size: 1.64rem;
  }

  .ticket-card-top {
    flex-direction: column;
  }

  .ticket-price {
    align-self: flex-start;
    max-width: 100%;
  }
}

@media (max-width: 390px) {
  .ticket-hero p:last-child,
  .ticket-desc,
  .ticket-note,
  .ticket-best-time,
  .social-digest p {
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .ticket-header,
  .ticket-main {
    width: calc(100% - 16px);
  }

  .ticket-header {
    gap: 8px;
    padding: 8px;
  }

  .ticket-card-body {
    padding: 12px;
  }

  .ticket-actions {
    padding: 0 12px 12px;
  }
}

@media (max-width: 560px) {
  .ticket-build-stamp {
    display: flex;
    width: fit-content;
    margin: 7px 0 0;
  }
}
