:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-muted: #57534e;
  --gold: #b4832c;
  --gold-soft: #f5ebd6;
  --border: #e7e0d6;
  --ok-bg: #ecfdf5;
  --ok-ink: #065f46;
  --danger-bg: #fef2f2;
  --danger-ink: #991b1b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Sarabun", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ink);
  color: #faf7f2;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.subtitle {
  font-size: 12px;
  color: #d6c7ad;
  letter-spacing: 0.08em;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 8px 24px rgba(28, 25, 23, 0.06);
}

.status-panel {
  text-align: center;
  padding: 36px 22px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 6px;
}

h1 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.3;
}

h2 {
  margin: 12px 0 10px;
  font-size: 17px;
}

h3 {
  margin: 4px 0 6px;
  font-size: 16px;
}

.help {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--ink-muted);
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.member-card {
  background: linear-gradient(145deg, #26221f 0%, #171412 100%);
  color: #faf7f2;
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 14px 32px rgba(28, 25, 23, 0.22);
}

.member-card .eyebrow {
  color: #e2c17f;
}

.member-card h1 {
  color: #ffffff;
  font-size: 23px;
  margin-bottom: 0;
}

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

.tier-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(226, 193, 127, 0.18);
  border: 1px solid rgba(226, 193, 127, 0.55);
  color: #f3dba4;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.member-id-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: #d6ccc2;
  gap: 8px;
}

.member-id-line strong {
  color: #ffffff;
  font-size: 13px;
  word-break: break-all;
  text-align: right;
}

.points-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.point-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}

.point-primary {
  background: rgba(180, 131, 44, 0.22);
  border-color: rgba(226, 193, 127, 0.5);
}

.point-label {
  display: block;
  font-size: 12px;
  color: #e7dfd5;
  margin-bottom: 4px;
}

.point-value {
  display: block;
  font-size: 30px;
  line-height: 1.1;
  color: #ffffff;
}

.point-unit {
  font-size: 12px;
  color: #d6c7ad;
}

.progress-wrap {
  margin-top: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d6ccc2;
  margin-bottom: 8px;
}

.progress-header strong {
  color: #f3dba4;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #b4832c, #f3dba4);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.info-panel {
  margin-top: 12px;
}

.status-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-ink);
  font-size: 13px;
  font-weight: 600;
}

.benefit-list {
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

.benefit-list li {
  margin-bottom: 8px;
}

.fallback-cards {
  display: grid;
  gap: 12px;
  margin: 16px 0 20px;
}

.fallback-item {
  border: 1px solid var(--border);
  background: #fcfaf7;
  border-radius: 14px;
  padding: 14px 16px;
}

.fallback-item p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.fallback-step {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
  padding: 12px 18px;
}

.button-primary {
  background: var(--ink);
  color: #ffffff;
}

.button-quiet {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 14px;
}

.button-large {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
}

.message {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  background: var(--gold-soft);
  color: var(--ink);
}

.message-error {
  background: var(--danger-bg);
  color: var(--danger-ink);
}
