:root {
  --orange: #ff6b35;
  --orange-dark: #e85a2a;
  --navy: #1b2a4a;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e3e6ee;
  --text: #1b2333;
  --muted: #6b7280;
  --green: #1a9c5b;
  --red: #d64545;
  --yellow: #b7791f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 25, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  background: linear-gradient(135deg, var(--navy), #2b3f6b);
  color: #fff;
  padding: 28px 20px 60px;
  text-align: center;
}
.topbar h1 { margin: 0 0 6px; font-size: 1.6rem; }
.topbar p { margin: 2px 0; opacity: 0.85; font-size: 0.92rem; }

.wrap {
  max-width: 760px;
  margin: -40px auto 60px;
  padding: 0 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.races { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.race-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s;
}
.race-option:hover { border-color: #ffbfa1; }
.race-option.selected { border-color: var(--orange); background: #fff4ee; }
.race-option input { position: absolute; opacity: 0; }
.race-option .name { font-weight: 600; margin-bottom: 4px; }
.race-option .price { color: var(--orange-dark); font-weight: 700; font-size: 1.05rem; }
.race-option .remain { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.race-option.full { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--orange);
  color: #fff;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--orange-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 14px; font-size: 0.82rem; }

.qr-box { text-align: center; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; background: #fafbff; }
.qr-box img { width: 220px; height: 220px; }
.qr-amount { font-size: 1.4rem; font-weight: 700; color: var(--orange-dark); margin: 6px 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.pending_payment { background: #fff4d6; color: var(--yellow); }
.badge.paid { background: #e2f6ea; color: var(--green); }
.badge.rejected { background: #fbe4e4; color: var(--red); }
.badge.cancelled { background: #eee; color: var(--muted); }

.msg { padding: 10px 14px; border-radius: 8px; font-size: 0.88rem; margin-top: 10px; }
.msg.error { background: #fbe4e4; color: var(--red); }
.msg.ok { background: #e2f6ea; color: var(--green); }

.hidden { display: none !important; }

.success-box { text-align: center; padding: 10px; }
.success-box .big-id { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin: 10px 0; letter-spacing: .5px; }

.footer-link { text-align: center; margin-top: 8px; }
.footer-link a { color: var(--navy); font-size: 0.85rem; }

.status-result { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-top: 12px; }
