*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #1578e8;
  --blue-deep: #0b5ed7;
  --blue-navy: #0a2f6b;
  --blue-sky: #4fc3f7;
  --gold: #ffd54f;
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #16324f;
  --muted: #6b7c90;
  --font: "Noto Sans Thai", "Segoe UI", sans-serif;
  --shadow: 0 16px 40px rgba(10, 47, 107, 0.16);
  --radius: 22px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body.shop-page {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
}

button,
input,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(21, 120, 232, 0.18);
}

.site-header {
  position: relative;
  z-index: 4;
  background: linear-gradient(180deg, #0d63d8 0%, var(--blue) 100%);
  color: #fff;
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem max(1.25rem, env(safe-area-inset-right)) 0.7rem max(1.25rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #0b5ed7;
}

.brand-text {
  display: grid;
  line-height: 1.15;
}

.brand-text strong {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-text small {
  font-size: 0.75rem;
  opacity: 0.88;
  font-weight: 500;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: rgba(255, 255, 255, 0.18);
}

.hero {
  position: relative;
  background: var(--blue);
  padding: 0.4rem max(1rem, env(safe-area-inset-right)) 5.5rem max(1rem, env(safe-area-inset-left));
}

.hero-curve {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 92px;
  background:
    radial-gradient(120% 90px at 50% -10px, transparent 62%, var(--bg) 63%);
}

.hero-tagline {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  margin-bottom: 1.1rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.search-panel {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}

.search-promo {
  position: relative;
  min-height: 220px;
  background: linear-gradient(180deg, #0a3d91, #1578e8);
}

.search-promo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  display: block;
}

.search-promo-copy {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.9rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.search-promo-copy p {
  font-size: 0.85rem;
  opacity: 0.92;
}

.search-promo-copy strong {
  display: block;
  font-size: 1.15rem;
}

.search-main {
  padding: 1.25rem 1.35rem 1.15rem;
}

.search-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.search-kicker {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.search-head h1 {
  font-size: 1.25rem;
  color: var(--blue-deep);
}

.shop-round {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
}

.shop-closed {
  background: #ffe8e8;
  color: #c62828;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.search-digits {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
  max-width: 26rem;
}

.search-digit {
  width: 100%;
  min-width: 0;
  height: 3.35rem;
  border: 0;
  border-radius: 12px;
  background: #f3f6fb;
  text-align: center;
  font: inherit;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
}

.search-digit:focus {
  outline: 3px solid rgba(21, 120, 232, 0.28);
  background: #fff;
}

.search-hint {
  margin: 0.55rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 12px;
  padding: 0.78rem 1.4rem;
  min-width: 7.5rem;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(21, 120, 232, 0.28);
}

.btn-primary:hover {
  background: var(--blue-deep);
}

.btn-navy {
  background: var(--blue-navy);
  color: #fff;
}

.btn-ghost {
  background: #eef3f9;
  color: var(--text);
}

.shop-status {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.shop-body {
  max-width: 1120px;
  margin: -2.4rem auto 2rem;
  padding: 0 max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  position: relative;
  z-index: 3;
}

.ticket-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.ticket-toolbar h2 {
  font-size: 1.15rem;
}

.ticket-toolbar p {
  color: var(--muted);
  font-size: 0.88rem;
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.ticket-skeleton {
  pointer-events: none;
}

.ticket-skeleton .ticket-frame-inner,
.ticket-skeleton .ticket-slip,
.ticket-skeleton .btn-ticket-buy {
  background: linear-gradient(90deg, #dbe7f6 0%, #eef4fb 45%, #dbe7f6 100%);
  background-size: 180% 100%;
  animation: ticket-shimmer 1.1s ease-in-out infinite;
}

.ticket-skeleton .ticket-rail,
.ticket-skeleton .ticket-spine {
  opacity: 0.55;
}

.ticket-skeleton .btn-ticket-buy {
  min-height: 42px;
  border-radius: 10px;
}

@keyframes ticket-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -80% 0; }
}

.ticket-frame {
  background: linear-gradient(180deg, #124ea8 0%, #0a2f6b 100%);
  border-radius: 18px;
  padding: 10px 10px 8px;
  box-shadow: 0 14px 28px rgba(10, 47, 107, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-frame-inner {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 32px;
  min-height: 176px;
  background: #f4f7fb;
  border-radius: 12px;
  overflow: hidden;
}

.ticket-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.25rem;
  background: #071f4a;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ticket-rail span,
.ticket-rail strong,
.ticket-rail em {
  display: block;
  width: 100%;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 0;
}

.ticket-rail span {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}

.ticket-rail strong {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
}

.ticket-rail em {
  font-size: 1.02rem;
  font-weight: 900;
  color: #ffe082;
}

.ticket-photo {
  min-width: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
}

.ticket-photo-img {
  width: 100%;
  height: 148px;
  object-fit: cover;
  border-radius: 6px;
}

.ticket-slip {
  width: 100%;
  min-height: 148px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 30%),
    repeating-linear-gradient(90deg, #fff8e8 0 12px, #fff3d6 12px 24px);
  border: 1px solid #e6d3a8;
  padding: 0.55rem 0.45rem 0.45rem;
  text-align: center;
}

.ticket-slip-brand {
  font-size: 0.72rem;
  font-weight: 800;
  color: #9b1c1c;
}

.ticket-slip-meta {
  margin: 0.15rem 0 0.45rem;
  font-size: 0.68rem;
  color: #6b5a3a;
}

.ticket-slip-digits {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.18rem;
}

.ticket-slip-digits span {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 0.72;
  background: #fff;
  border: 1px solid #c9b48a;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: clamp(0.78rem, 1.8vw, 1.05rem);
  font-weight: 900;
  color: #1a1a1a;
}

.ticket-slip-foot {
  margin-top: 0.4rem;
  font-size: 0.68rem;
  color: #0a2f6b;
  font-weight: 700;
}

.ticket-spine {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.22), transparent 40%),
    linear-gradient(180deg, #1a6fe0 0%, #0b4cb5 55%, #072e73 100%);
  padding: 0.2rem 0;
}

.marvel-logo {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 0.4px #063a8a;
  text-shadow:
    0 1px 0 #0a3d91,
    1px 2px 0 rgba(6, 40, 110, 0.55),
    0 0 8px rgba(255, 255, 255, 0.35);
}

.btn-ticket-buy {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #0a2f6b;
  font: inherit;
  font-weight: 800;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-ticket-buy:hover {
  background: #ffd54f;
}

.btn-ticket-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-empty,
.shop-more {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border-radius: 16px;
  padding: 1.4rem;
}

.site-footer {
  text-align: center;
  padding: 1.5rem max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  color: var(--muted);
}

.site-footer strong {
  display: block;
  color: var(--blue-navy);
  margin-bottom: 0.25rem;
}

@media (max-width: 820px) {
  .site-header-inner {
    padding-top: 0.7rem;
    padding-bottom: 0.6rem;
    gap: 0.5rem;
  }

  .brand {
    min-width: 0;
    gap: 0.5rem;
  }

  .brand-mark img {
    width: 36px;
    height: 36px;
  }

  .brand-text small {
    display: none;
  }

  .site-nav {
    flex-shrink: 0;
    gap: 0.2rem;
  }

  .site-nav a {
    font-size: 0.8rem;
    padding: 0.38rem 0.7rem;
  }

  .hero {
    padding-top: 0.25rem;
    padding-bottom: 4.25rem;
  }

  .hero-tagline {
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 auto 0.85rem;
    max-width: 22rem;
    padding: 0 0.25rem;
  }

  .search-panel {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .search-promo {
    min-height: 108px;
    max-height: 108px;
  }

  .search-promo-copy {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.6rem;
  }

  .search-promo-copy strong {
    font-size: 1rem;
  }

  .search-main {
    padding: 1rem 0.95rem 1rem;
  }

  .search-head {
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.7rem;
  }

  .search-head h1 {
    font-size: 1.12rem;
  }

  .shop-round {
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .search-digits {
    gap: 0.4rem;
    max-width: none;
  }

  .search-digit {
    height: 3.1rem;
    font-size: 1.2rem;
    border-radius: 10px;
  }

  .search-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
  }

  .btn {
    min-width: 0;
    width: 100%;
    padding: 0.72rem 0.35rem;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .shop-body {
    margin-top: -1.8rem;
  }

  .ticket-toolbar {
    align-items: center;
  }

  .ticket-toolbar h2 {
    font-size: 1.05rem;
  }

  .ticket-toolbar p {
    font-size: 0.8rem;
  }

  .ticket-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .ticket-frame {
    padding: 8px 8px 7px;
    border-radius: 14px;
    gap: 7px;
  }

  .ticket-frame-inner {
    grid-template-columns: 44px minmax(0, 1fr) 26px;
    min-height: 148px;
  }

  .ticket-rail {
    gap: 0.28rem;
    padding: 0.4rem 0.15rem;
  }

  .ticket-rail span {
    font-size: 0.72rem;
  }

  .ticket-rail strong {
    font-size: 0.95rem;
  }

  .ticket-rail em {
    font-size: 0.82rem;
  }

  .ticket-photo {
    padding: 0.28rem;
  }

  .ticket-photo-img,
  .ticket-slip {
    min-height: 124px;
    height: 124px;
  }

  .ticket-slip {
    padding: 0.4rem 0.28rem 0.3rem;
  }

  .ticket-slip-brand {
    font-size: 0.58rem;
  }

  .ticket-slip-meta {
    font-size: 0.58rem;
    margin-bottom: 0.3rem;
  }

  .ticket-slip-digits span {
    font-size: 0.78rem;
  }

  .ticket-slip-foot {
    font-size: 0.58rem;
    margin-top: 0.28rem;
  }

  .marvel-logo {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }

  .btn-ticket-buy {
    min-height: 42px;
    font-size: 0.82rem;
    padding: 0.45rem 0.4rem;
  }
}

@media (max-width: 480px) {
  .hero-curve {
    height: 72px;
  }

  .search-promo {
    min-height: 92px;
    max-height: 92px;
  }

  .search-promo-copy {
    display: none;
  }

  .brand-text {
    min-width: 0;
  }

  .brand-text strong {
    font-size: 0.92rem;
    white-space: nowrap;
    letter-spacing: -0.02em;
  }

  .search-digit {
    height: 2.85rem;
    font-size: 1.05rem;
  }

  .ticket-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .ticket-frame-inner {
    grid-template-columns: 38px minmax(0, 1fr) 22px;
    min-height: 132px;
  }

  .ticket-rail span {
    font-size: 0.62rem;
  }

  .ticket-rail strong {
    font-size: 0.82rem;
  }

  .ticket-rail em {
    font-size: 0.7rem;
  }

  .ticket-photo-img,
  .ticket-slip {
    min-height: 108px;
    height: 108px;
  }

  .ticket-slip-digits span {
    font-size: 0.72rem;
  }

  .marvel-logo {
    font-size: 0.64rem;
    letter-spacing: 0.1em;
  }

  .btn-ticket-buy {
    min-height: 38px;
    font-size: 0.72rem;
    padding: 0.35rem 0.25rem;
  }
}

@media (max-width: 360px) {
  .brand-text strong {
    font-size: 0.84rem;
  }

  .site-nav a {
    padding: 0.34rem 0.55rem;
    font-size: 0.74rem;
  }

  .search-actions {
    grid-template-columns: 1fr 1fr;
  }

  .search-actions .btn-ghost {
    grid-column: 1 / -1;
  }
}
