/* โทนเวที: พื้นมืดอมม่วง แสงไฟทังสเตนสีอำพันส่องลงที่ชื่อ เป็นจุดเด่นจุดเดียวของหน้า */
:root {
  --stage: #16111d;
  --riser: #211a2b;
  --riser-hi: #2c2338;
  --line: #3a2f48;
  --chalk: #f4ece1;
  --dust: #a99db6;
  --tungsten: #ffb648;
  --tungsten-ink: #1d1407;
  --gel: #ff6f91;
  --cue: #7ad9a7;
  --warn: #ff9a85;
  --font-display: 'Mitr', 'Anuphan', system-ui, sans-serif;
  --font-body: 'Anuphan', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--stage);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--stage);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--tungsten);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- spotlight ---------- */
/* กล่องนอกตัดขอบไม่ให้แสงทำหน้ากว้างเกินจอ (มือถือไม่สน overflow-x ของ body) */
.beam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 560px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.beam::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: min(150vw, 920px);
  height: 100%;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse 50% 100% at 50% 0%,
    rgba(255, 182, 72, 0.42) 0%,
    rgba(255, 182, 72, 0.16) 45%,
    rgba(255, 182, 72, 0) 100%
  );
  clip-path: polygon(41% 0, 59% 0, 100% 100%, 0 100%);
}

body.ready .beam {
  animation: lamp-on 1.4s ease-out 0.1s forwards;
}

@keyframes lamp-on {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 0.8;
  }
  42% {
    opacity: 0.3;
  }
  58% {
    opacity: 0.9;
  }
  100% {
    opacity: 1;
  }
}

/* ---------- header ---------- */
.marquee {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 20px 28px;
  text-align: center;
}

.lang {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(33, 26, 43, 0.85);
  border: 1px solid var(--line);
}

.lang button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dust);
  font-size: 0.85rem;
  font-weight: 500;
}

.lang button[aria-pressed='true'] {
  background: var(--riser-hi);
  color: var(--chalk);
}

.avatar {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 182, 72, 0.7);
  box-shadow: 0 0 0 7px rgba(255, 182, 72, 0.08), 0 12px 40px rgba(255, 182, 72, 0.18);
}

.name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.005em;
  text-shadow: 0 0 28px rgba(255, 182, 72, 0.35);
  overflow-wrap: anywhere;
}

.bio {
  max-width: 34ch;
  margin: 10px auto 0;
  color: var(--dust);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  font-size: 0.95rem;
  color: var(--chalk);
}

.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cue);
  box-shadow: 0 0 10px var(--cue);
}

body.closed .dot {
  background: var(--dust);
  box-shadow: none;
}

body.closed .status {
  color: var(--dust);
}

.tip-btn {
  display: block;
  min-height: 46px;
  margin: 20px auto 0;
  padding: 0 26px;
  border: 1.5px solid var(--tungsten);
  border-radius: 999px;
  background: transparent;
  color: var(--tungsten);
  font-weight: 600;
}

.tip-btn:active {
  background: rgba(255, 182, 72, 0.12);
}

/* ---------- song list ---------- */
.set {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 140px;
}

.finder {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 0 6px;
}

.finder.stuck {
  background: var(--stage);
  box-shadow: 0 0 0 100vmax var(--stage), 0 1px 0 100vmax var(--line);
  clip-path: inset(0 -100vmax -1px);
}

#search {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--riser)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a99db6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat 15px center;
  font-size: 16px;
}

#search::placeholder {
  color: var(--dust);
}

.chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 10px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--riser);
  color: var(--dust);
  font-size: 0.92rem;
}

.chip[aria-pressed='true'] {
  border-color: var(--tungsten);
  background: rgba(255, 182, 72, 0.13);
  color: var(--tungsten);
}

.block h2 {
  margin: 26px 0 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--dust);
}

.setlist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.song {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 13px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}

.song:active {
  background: rgba(244, 236, 225, 0.04);
}

.song-title {
  font-weight: 600;
  font-size: 1.06rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.song-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  grid-column: 1;
  font-size: 0.85rem;
  color: var(--dust);
}

.song-meta:empty {
  display: none;
}

.hit {
  color: var(--gel);
}

.hit::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--gel);
  vertical-align: 2px;
}

.ask {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 6px 14px;
  border: 1.5px solid rgba(255, 182, 72, 0.55);
  border-radius: 999px;
  color: var(--tungsten);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

body.closed .ask {
  visibility: hidden;
}

.empty,
.load-error {
  margin: 40px 0;
  color: var(--dust);
  text-align: center;
}

.load-error .btn-outline {
  margin-top: 12px;
}

/* ---------- buttons ---------- */
.btn-primary {
  display: block;
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  background: var(--tungsten);
  color: var(--tungsten-ink);
  font-weight: 600;
  font-size: 1.05rem;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-outline {
  min-height: 46px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--chalk);
  font-weight: 500;
}

.btn-outline:disabled {
  opacity: 0.45;
}

.btn-text {
  display: block;
  min-height: 44px;
  margin: 6px auto 0;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--dust);
}

.btn-small {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--tungsten);
  color: var(--tungsten-ink);
  font-weight: 600;
}

/* ---------- sheet ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(9, 6, 13, 0.62);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.backdrop.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-width: 560px;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: var(--riser);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-head {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -10px -20px 0;
  padding: 14px 12px 10px 20px;
  background: var(--riser);
}

.steps {
  display: flex;
  flex: 1;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--dust);
}

.steps li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.steps .num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.75rem;
}

.steps .current {
  color: var(--chalk);
}

.steps .current .num {
  border-color: var(--tungsten);
  background: var(--tungsten);
  color: var(--tungsten-ink);
  font-weight: 600;
}

.steps .done .num {
  border-color: var(--tungsten);
  color: var(--tungsten);
}

.close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: var(--riser-hi);
  color: var(--chalk);
}

.sheet-title {
  margin: 14px 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.sheet-title:focus,
.pay-amount:focus {
  outline: none;
}

.sheet-sub {
  margin: 0 0 8px;
  color: var(--dust);
}

/* form */
.field {
  margin-top: 16px;
}

.field label,
.amount legend {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 500;
}

.optional {
  color: var(--dust);
  font-weight: 400;
}

.field input,
.field textarea,
.other-amount input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--stage);
  font-size: 16px;
}

.field textarea {
  resize: vertical;
  min-height: 76px;
}

.field input::placeholder,
.field textarea::placeholder,
.other-amount input::placeholder {
  color: #7d7189;
}

.amount {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.amount-chip {
  min-height: 54px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--stage);
  font-weight: 600;
  font-size: 1.05rem;
}

.amount-chip[aria-pressed='true'] {
  border-color: var(--tungsten);
  background: rgba(255, 182, 72, 0.12);
  color: var(--tungsten);
}

.other-amount {
  margin-top: 10px;
}

.form-error {
  min-height: 0;
  margin: 12px 0 0;
  color: var(--warn);
  font-size: 0.95rem;
}

.form-error:empty {
  margin: 0;
}

/* pay */
.pay {
  text-align: center;
}

.pay-amount {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1.15;
  color: var(--tungsten);
}

.qr-frame {
  display: grid;
  place-items: center;
  width: min(100%, 320px);
  aspect-ratio: 800 / 970;
  margin: 14px auto 0;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
}

.qr-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-touch-callout: default;
}

.qr-wait {
  color: #5b4e68;
}

.pay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.pp-line {
  margin: 10px 0 0;
  color: var(--dust);
  font-size: 0.92rem;
}

.howto {
  margin: 18px 0 0;
  padding: 14px 16px 14px 36px;
  border-radius: 14px;
  background: var(--stage);
  text-align: left;
  color: var(--chalk);
  font-size: 0.95rem;
}

.howto li + li {
  margin-top: 6px;
}

.howto li::marker {
  color: var(--tungsten);
  font-weight: 600;
}

/* slip */
.slip-summary {
  margin: 0 0 2px;
  color: var(--tungsten);
  font-weight: 600;
}

.slip-pick {
  display: grid;
  place-items: center;
  min-height: 96px;
  margin-top: 16px;
  border: 1.5px dashed rgba(255, 182, 72, 0.6);
  border-radius: 16px;
  background: var(--stage);
  color: var(--tungsten);
  font-weight: 600;
  cursor: pointer;
}

#f-slip:focus-visible + .slip-pick {
  outline: 2px solid var(--tungsten);
  outline-offset: 2px;
}

.slip-preview {
  display: block;
  max-width: 100%;
  max-height: 46dvh;
  margin: 14px auto 0;
  border-radius: 12px;
}

.slip-status {
  margin: 10px 0 0;
  color: var(--dust);
  text-align: center;
}

.slip-status:empty {
  margin: 0;
}

/* done */
.done {
  padding: 18px 0 4px;
  text-align: center;
}

.done-mark {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 8px auto 0;
  border-radius: 50%;
  background: rgba(255, 182, 72, 0.14);
  box-shadow: 0 0 40px rgba(255, 182, 72, 0.25);
}

.done-mark::after {
  content: '';
  position: absolute;
  left: 26px;
  top: 16px;
  width: 16px;
  height: 30px;
  border: solid var(--tungsten);
  border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}

/* resume + toast */
.resume {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 536px;
  margin: 0 auto;
  padding: 10px 10px 10px 16px;
  border: 1px solid rgba(255, 182, 72, 0.5);
  border-radius: 16px;
  background: var(--riser-hi);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.resume p {
  flex: 1;
  margin: 0;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.resume-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.resume .btn-text {
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--chalk);
  color: var(--stage);
  font-weight: 500;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 640px) {
  .sheet {
    bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.ready .beam {
    animation: none;
    opacity: 1;
  }

  .sheet,
  .backdrop,
  .toast {
    transition: none;
  }
}
