:root {
  --visakha-blue: #062f63;
  --crest-blue: #0b5793;
  --visakha-gold: #f4be2f;
  --flame-gold: #ffd85a;
  --match-red: #d8242f;
  --floodlight-white: #f7faff;
  --pitch-green: #117142;
  --night-navy: #031226;
  --ticket-silver: #d9e2f2;
  --ink: #0b1735;
  --muted: #65708a;
  --surface: rgba(247, 250, 255, 0.95);
  --line: rgba(217, 226, 242, 0.72);
  --shadow: 0 24px 70px rgba(7, 20, 46, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--floodlight-white);
  background:
    linear-gradient(180deg, rgba(3, 18, 38, 0.54), rgba(3, 18, 38, 0.86) 54%, rgba(3, 18, 38, 0.96)),
    radial-gradient(circle at 18% 0%, rgba(244, 190, 47, 0.22), transparent 24rem),
    radial-gradient(circle at 92% 16%, rgba(35, 182, 211, 0.18), transparent 20rem),
    url("assets/event-background.png"),
    linear-gradient(150deg, var(--night-navy), #062f63 58%, #041b3a);
  background-attachment: fixed, fixed, fixed, fixed, fixed;
  background-position: center top, center, center, center top, center;
  background-repeat: no-repeat;
  background-size: cover, auto, auto, cover, cover;
  font-family: "Noto Sans Khmer", system-ui, sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

#stadiumCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.58;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 16px 116px;
}

.topbar,
.hero,
.result-section {
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--floodlight-white);
  text-decoration: none;
}

.club-mark {
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
}

.club-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name,
.brand-event {
  display: block;
  line-height: 1.1;
}

.brand-name {
  font-family: "Oswald", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-event {
  font-size: 12px;
  color: rgba(247, 250, 255, 0.76);
}

.language-toggle {
  display: flex;
  min-height: 44px;
  padding: 4px;
  border: 1px solid rgba(247, 250, 255, 0.24);
  border-radius: 999px;
  background: rgba(7, 20, 46, 0.36);
  backdrop-filter: blur(14px);
}

.lang-button {
  min-width: 54px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  color: rgba(247, 250, 255, 0.74);
  background: transparent;
  cursor: pointer;
}

.lang-button.is-active {
  color: var(--night-navy);
  background: var(--visakha-gold);
}

.hero {
  display: grid;
  gap: 24px;
  padding: 38px 0 28px;
}

.hero-copy {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-shadow: 0 3px 18px rgba(3, 18, 38, 0.78);
}

.event-kicker,
.pass-chip,
.pass-label,
.pass-topline {
  font-family: "Oswald", "Noto Sans Khmer", sans-serif;
  text-transform: uppercase;
}

.event-kicker {
  margin: 0 0 10px;
  color: var(--flame-gold);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(34px, 10vw, 72px);
  line-height: 1.06;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.hero-note {
  max-width: 660px;
  margin-bottom: 22px;
  color: rgba(247, 250, 255, 0.82);
  font-size: 16px;
  line-height: 1.8;
}

.redeem-panel,
.event-pass {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.redeem-panel {
  border: 1px solid rgba(244, 190, 47, 0.38);
  border-radius: 8px;
  padding: 18px;
  backdrop-filter: blur(18px) saturate(1.08);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.pass-chip {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--night-navy);
  background: var(--visakha-gold);
  font-size: 13px;
}

.panel-header h2,
.result-header h2 {
  margin-bottom: 4px;
  font-size: 22px;
  line-height: 1.28;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--ink);
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--ticket-silver);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: 0;
}

.field input:focus {
  border-color: var(--visakha-blue);
  box-shadow: 0 0 0 4px rgba(244, 190, 47, 0.24);
}

.form-message {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin-bottom: 12px;
  color: var(--match-red);
  font-size: 14px;
  line-height: 1.5;
}

.form-message.is-ok {
  color: var(--pitch-green);
}

.form-message.is-loading::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(17, 113, 66, 0.22);
  border-top-color: var(--pitch-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.primary-cta,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 8px;
  padding: 0 18px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.primary-cta {
  color: var(--floodlight-white);
  background: linear-gradient(135deg, var(--visakha-blue), var(--crest-blue) 48%, #083058);
  box-shadow: 0 16px 34px rgba(3, 18, 38, 0.3);
  border: 1px solid rgba(244, 190, 47, 0.36);
}

.primary-cta:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  color: var(--visakha-blue);
  border: 1px solid rgba(244, 190, 47, 0.5);
  background: rgba(247, 250, 255, 0.78);
}

.submit-button,
.result-actions .primary-cta,
.result-actions .secondary-button {
  width: 100%;
}

.desktop-only {
  display: none;
}

.result-section {
  display: grid;
  gap: 16px;
  padding: 12px 0 26px;
}

.result-section[hidden] {
  display: none;
}

.result-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.result-header .secondary-button {
  min-height: 44px;
  padding-inline: 12px;
  white-space: nowrap;
}

.event-pass {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(217, 226, 242, 0.8);
}

.pass-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--floodlight-white);
  background: linear-gradient(90deg, var(--visakha-blue), var(--crest-blue));
  font-size: 13px;
}

.pass-main {
  display: grid;
  gap: 18px;
  padding: 22px 18px 18px;
}

.pass-label {
  margin-bottom: 4px;
  color: var(--crest-blue);
  font-size: 13px;
}

.pass-main h3 {
  margin-bottom: 8px;
  font-size: clamp(26px, 8vw, 38px);
  line-height: 1.12;
}

.pass-event {
  margin-bottom: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.qr-wrap {
  justify-self: center;
  display: grid;
  place-items: center;
  width: min(70vw, 230px);
  aspect-ratio: 1;
  border: 10px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ticket-silver);
}

.qr-wrap canvas,
.qr-wrap img {
  width: 100%;
  height: 100%;
}

.pass-meta {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(244, 190, 47, 0.22), rgba(217, 226, 242, 0.78));
  font-size: 14px;
}

.pass-meta span {
  overflow-wrap: anywhere;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.sticky-action {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(3, 18, 38, 0.94) 28%);
}

.sticky-action .primary-cta {
  width: min(100%, 520px);
  margin: 0 auto;
}

body.has-result .sticky-action,
body.form-visible .sticky-action {
  display: none;
}

body.has-result .hero {
  display: none;
}

.status-dialog {
  width: min(calc(100vw - 32px), 390px);
  border: 1px solid rgba(247, 250, 255, 0.68);
  border-radius: 8px;
  padding: 22px 18px 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 250, 255, 0.98), rgba(217, 226, 242, 0.98)),
    var(--floodlight-white);
  box-shadow: 0 28px 80px rgba(7, 20, 46, 0.42);
}

.status-dialog::backdrop {
  background: rgba(7, 20, 46, 0.72);
  backdrop-filter: blur(8px);
}

.status-dialog[open] {
  display: grid;
  gap: 12px;
}

.dialog-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  color: var(--floodlight-white);
  background: rgba(6, 47, 99, 0.08);
}

.dialog-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.status-dialog h2 {
  margin: 4px 0 0;
  color: var(--visakha-blue);
  font-size: 26px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.status-dialog p {
  margin-bottom: 4px;
  color: var(--muted);
  line-height: 1.65;
}

.status-dialog .primary-cta {
  width: 100%;
  margin-top: 4px;
}

:focus-visible {
  outline: 3px solid rgba(247, 250, 255, 0.92);
  outline-offset: 3px;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 24px 28px 70px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
    align-items: center;
    min-height: calc(100vh - 120px);
  }

  .redeem-panel {
    padding: 24px;
  }

  .desktop-only {
    display: inline-flex;
    width: fit-content;
  }

  .sticky-action {
    display: none;
  }

  .result-section {
    width: min(760px, 100%);
    margin: 0 auto;
  }

  .pass-main {
    grid-template-columns: 1fr 230px;
    align-items: center;
  }

  .pass-meta {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  h1 {
    font-size: clamp(30px, 8.8vw, 40px);
    line-height: 1.16;
  }

  .hero-copy {
    min-height: 218px;
  }
}

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