:root {
  --green-dark:  #136747;
  --green:       #1e9462;
  --green-light: #e8f5ef;
  --green-mid:   #c8e8d8;
  --gold:        #c9960c;
  --gold-light:  #fef9ec;
  --white:       #ffffff;
  --bg:          #f2f6f4;
  --card:        #ffffff;
  --text:        #0d1f16;
  --text-mid:    #2e5040;
  --text-soft:   #6b8c7b;
  --border:      #d4e6da;
  --red:         #b91c1c;
  --red-light:   #fef2f2;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(19,103,71,0.07);
  --shadow-lg:   0 8px 32px rgba(19,103,71,0.16);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── SPLASH ── */
.splash {
  min-height: 100vh;
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #072b1c 0%, #0d4530 35%, #136747 68%, #1c8a5a 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 24px 48px;
  color: white;
}
/* Diagonal fairway mowing stripe pattern */
.splash::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0, transparent 22px,
    rgba(255,255,255,0.025) 22px, rgba(255,255,255,0.025) 44px
  );
  pointer-events: none; z-index: 0;
}
/* Blurred glow orbs */
.splash-glow {
  position: absolute; border-radius: 50%;
  pointer-events: none; filter: blur(80px); z-index: 0;
}
.splash-glow-1 {
  width: 340px; height: 340px;
  background: rgba(26,122,82,0.5);
  top: -100px; right: -90px;
}
.splash-glow-2 {
  width: 240px; height: 240px;
  background: rgba(201,150,12,0.14);
  bottom: 28%; left: -80px;
}
.splash-hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 64px 0 32px; text-align: center; width: 100%;
}
.splash-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.11);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 20px; padding: 5px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: rgba(255,255,255,0.82);
  margin-bottom: 28px; backdrop-filter: blur(8px);
}
.splash-logo {
  animation: floatBall 2.5s ease-in-out infinite;
  width: 88px; height: 88px; border-radius: 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.14);
}
.splash-logo svg { display: block; }
.splash h1 {
  font-size: 42px; font-weight: 900; letter-spacing: -1.5px;
  line-height: 1; text-shadow: 0 2px 20px rgba(0,0,0,0.22); margin: 0;
}
.splash-tagline {
  font-size: 15px; color: rgba(255,255,255,0.62);
  margin-top: 10px; font-weight: 400; letter-spacing: 0.2px;
}
.splash-sub-tagline {
  font-size: 12px; color: rgba(255,255,255,0.38);
  margin-top: 6px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── AUTH FORMS ── */
.auth-tabs { display: flex; gap: 4px; margin-bottom: 24px; background: rgba(0,0,0,0.08); padding: 4px; border-radius: var(--radius-sm); }
.auth-tab {
  flex: 1; padding: 10px; border: none; background: transparent;
  border-radius: 7px; font-size: 15px; font-weight: 600; cursor: pointer;
  color: rgba(255,255,255,0.7); transition: background 0.15s, color 0.15s;
}
.auth-tab.active { background: white; color: var(--green-dark); box-shadow: 0 1px 6px rgba(0,0,0,0.12); }

.auth-box {
  background: rgba(255,255,255,0.12); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 380px; margin-top: 28px;
}
.auth-box .field label { color: rgba(255,255,255,0.9); }
.auth-box .field input {
  background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.25);
  color: white;
}
.auth-box .field input::placeholder { color: rgba(255,255,255,0.5); }
.auth-box .field input:focus { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.2); }
.auth-box details summary { color: rgba(255,255,255,0.65); }
.terms-note {
  font-size: 11px; color: rgba(255,255,255,0.45);
  text-align: center; margin-top: 14px; line-height: 1.5;
}
.terms-note a { color: rgba(255,255,255,0.65); text-decoration: underline; }
.terms-note a:hover { color: rgba(255,255,255,0.9); }

/* ── HEADER ── */
.app-header {
  background: var(--green-dark); color: white;
  padding: 0 16px; display: flex; align-items: center; gap: 10px;
  height: 56px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}
.header-back {
  background: none; border: none; color: rgba(255,255,255,0.9); font-size: 22px;
  cursor: pointer; line-height: 1; padding: 6px; flex-shrink: 0;
  display: flex; align-items: center; margin-left: -6px;
  border-radius: 8px; transition: background 0.1s;
}
.header-back:active { background: rgba(255,255,255,0.15); }
.header-title { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -0.1px; }
.header-logo  { display: flex; align-items: center; }

/* ── CONTENT ── */
.content { flex: 1; padding: 16px; padding-bottom: 90px; overflow-y: auto; }
.content-full { flex: 1; padding-bottom: 90px; overflow-y: auto; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; background: white;
  border-top: 1px solid var(--border); display: flex;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06); z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px 10px; border: none; background: none; cursor: pointer;
  color: var(--text-soft); font-size: 10px; font-weight: 600; letter-spacing: 0.2px;
  transition: color 0.15s; text-decoration: none; gap: 4px;
  position: relative;
}
.nav-item::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 2.5px; background: var(--green-dark); border-radius: 0 0 3px 3px;
  transition: width 0.2s ease;
}
.nav-item.active { color: var(--green-dark); }
.nav-item.active::before { width: 28px; }
.nav-icon { display: flex; align-items: center; justify-content: center; line-height: 1; }

/* ── CARDS ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card-row {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}

/* ── SEASON CARD ── */
.season-card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 12px; cursor: pointer;
  border: 1.5px solid transparent; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.season-card:active { border-color: var(--green-mid); box-shadow: var(--shadow-lg); transform: scale(0.99); }
.season-course { font-size: 12px; color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; display: flex; align-items: center; gap: 5px; }
.season-name   { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 4px; }
.season-meta   { font-size: 13px; color: var(--text-soft); margin-top: 8px; }

/* ── PROGRESS ── */
.progress-wrap { background: var(--green-mid); border-radius: 99px; height: 8px; overflow: hidden; margin: 8px 0; }
.progress-bar  { background: linear-gradient(90deg, var(--green-dark), var(--green)); height: 100%; border-radius: 99px; transition: width 0.6s ease; min-width: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin-top: 4px; font-weight: 500; }

/* ── DASHBOARD GRID ── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dash-tile {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 12px 16px; text-align: center; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s; text-decoration: none; display: block;
}
.dash-tile:active { transform: scale(0.96); box-shadow: var(--shadow-lg); }
.dash-icon-wrap {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-light); color: var(--green-dark);
}
.dash-label { font-size: 13px; font-weight: 700; color: var(--text-mid); }

/* ── LADDER ITEMS ── */
.ladder-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; background: white;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.1s;
}
.ladder-item:last-child { border-bottom: none; }
.ladder-item:active { background: var(--green-light); }
.ladder-item.completed { opacity: 0.65; }
.ladder-item.prize-row {
  background: var(--gold-light); cursor: default;
  border-left: 3px solid var(--gold);
}

.item-check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
  border: 2px solid var(--border); background: white; color: transparent;
}
.item-check.done    { background: var(--green-dark); border-color: var(--green-dark); color: white; }
.item-check.pending { background: #fffbeb; border-color: #f59e0b; color: #b45309; }
.item-check.prize   { background: var(--gold); border-color: var(--gold); color: white; border-radius: 6px; }

.item-body  { flex: 1; min-width: 0; }
.item-name  { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; }
.item-sub   { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.item-arrow { color: var(--border); display: flex; align-items: center; margin-top: 2px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.badge-self   { background: var(--green-light); color: var(--green-dark); }
.badge-peer   { background: #f0ebfc; color: #6d28d9; }
.badge-admin  { background: #fff7ed; color: #c2410c; }
.badge-done   { background: var(--green-light); color: var(--green-dark); }
.badge-pending { background: #fffbeb; color: #92400e; }
.badge-rejected { background: var(--red-light); color: var(--red); }
.badge-locked  { background: #f3f4f6; color: #6b7280; }
.badge-gold    { background: var(--gold-light); color: #78350f; border: 1px solid #fcd34d; }

/* ── CHALLENGE DETAIL ── */
.challenge-detail { padding: 24px; }
.challenge-detail h2 { font-size: 22px; font-weight: 800; line-height: 1.3; margin-bottom: 12px; }
.challenge-detail .desc { font-size: 15px; color: var(--text-mid); line-height: 1.6; margin-bottom: 20px; }
.verify-note {
  background: var(--green-light); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 14px; color: var(--green-dark);
  margin-bottom: 20px; display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--green-mid);
}
.verify-note .icon { display: flex; align-items: center; flex-shrink: 0; margin-top: 1px; }

/* ── PEER OVERLAY ── */
.peer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 80;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.peer-sheet {
  background: white; border-radius: 24px 24px 0 0; padding: 28px 24px 40px;
  animation: slideUp 0.3s ease;
}
.peer-sheet-icon { display: flex; justify-content: center; margin-bottom: 16px; }
.peer-sheet h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; text-align: center; }
.peer-sheet p  { font-size: 14px; color: var(--text-soft); text-align: center; margin-bottom: 20px; }

/* ── PRIZES ── */
.prize-card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
  border: 1.5px solid var(--border);
}
.prize-card.prize-unlocked { border-color: var(--gold); }
.prize-card.prize-awarded  { border-color: var(--gold); background: var(--gold-light); }
.prize-header { padding: 18px 16px; display: flex; gap: 14px; align-items: flex-start; }
.prize-icon-wrap { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.prize-icon-wrap.awarded  { background: var(--gold); color: white; }
.prize-icon-wrap.unlocked { background: var(--green-light); color: var(--green-dark); }
.prize-icon-wrap.locked   { background: #f3f4f6; color: #9ca3af; }
.prize-name   { font-size: 16px; font-weight: 700; color: var(--text); }
.prize-sub    { font-size: 13px; color: var(--text-soft); margin-top: 3px; }
.prize-locked-card { opacity: 0.7; }

/* ── LEADERBOARD ── */
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: white; border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: var(--green-light); }
.lb-rank { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; background: var(--bg); color: var(--text-soft); }
.lb-rank.gold   { background: #f59e0b; color: white; }
.lb-rank.silver { background: #94a3b8; color: white; }
.lb-rank.bronze { background: #b45309; color: white; }
.lb-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--green-mid); display: flex; align-items: center; justify-content: center; color: var(--green-dark); font-weight: 700; font-size: 13px; }
.lb-name   { flex: 1; font-size: 15px; font-weight: 500; }
.lb-name.me-name { font-weight: 700; color: var(--green-dark); }
.lb-me-tag { font-size: 11px; color: var(--green); font-weight: 600; margin-left: 4px; }
.lb-score  { display: flex; align-items: center; gap: 4px; }
.lb-count  { font-size: 15px; font-weight: 800; color: var(--green-dark); }
.lb-count-label { font-size: 11px; color: var(--text-soft); font-weight: 500; }

/* ── FORMS ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px; color: var(--text);
  background: white; transition: border-color 0.15s; outline: none;
  -webkit-appearance: none;
}
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,148,98,0.1); }
.field input::placeholder { color: #b0c4b8; }

/* ── BUTTONS ── */
.btn {
  display: block; width: 100%; padding: 15px; border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary   { background: var(--green-dark); color: white; }
.btn-primary:hover { background: var(--green); }
.btn-secondary { background: var(--green-light); color: var(--green-dark); }
.btn-gold      { background: var(--gold); color: white; }
.btn-outline   { background: transparent; color: white; border: 2px solid rgba(255,255,255,0.7); }
.btn-ghost     { background: none; color: var(--text-soft); font-size: 14px; padding: 10px; }
.btn-sm        { padding: 11px 20px; font-size: 14px; width: auto; display: inline-block; border-radius: var(--radius-sm); }
.btn:disabled  { opacity: 0.45; cursor: not-allowed; }

/* ── LOADING / ERROR ── */
.loading-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; color: var(--text-soft); padding: 40px;
}
.spinner {
  width: 32px; height: 32px; border: 2.5px solid var(--green-mid);
  border-top-color: var(--green-dark); border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.golf-spinner {
  color: var(--green-dark); opacity: 0.75;
  animation: bounceCelebrate 0.55s ease-in-out infinite alternate;
}
.error-box {
  background: var(--red-light); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--red); font-size: 14px;
  margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px;
  border: 1px solid #fecaca;
}
.empty-state {
  text-align: center; padding: 52px 24px; color: var(--text-soft);
}
.empty-state .icon { display: flex; justify-content: center; margin-bottom: 14px; opacity: 0.45; }
.empty-state p { font-size: 15px; line-height: 1.6; }

/* ── NEXT PRIZE BANNER ── */
.next-prize {
  background: var(--gold-light); border-radius: var(--radius); padding: 16px;
  border: 1.5px solid #fcd34d; display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
}
.next-prize-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--gold); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: white; }
.next-prize-label { font-size: 10px; text-transform: uppercase; font-weight: 700; color: #92400e; letter-spacing: 0.6px; }
.next-prize-name  { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 2px; }
.next-prize-sub   { font-size: 12px; color: #78350f; margin-top: 2px; }

/* ── CELEBRATION ── */
.celebration {
  position: fixed; inset: 0; background: linear-gradient(155deg, var(--green-dark), #1a7a52);
  z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px;
  animation: fadeIn 0.35s ease;
}
.celebration-ball { animation: bounceCelebrate 0.6s ease-in-out infinite alternate; }
.celebration h2 { color: white; font-size: 30px; font-weight: 900; margin: 24px 0 8px; text-align: center; letter-spacing: -0.5px; }
.celebration p  { color: rgba(255,255,255,0.85); font-size: 17px; text-align: center; }
.celebration .stars { font-size: 36px; letter-spacing: 8px; margin: 16px 0; animation: pulse 1s ease infinite; }
.confetti-dot {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: confettiFall 1.5s ease-in forwards;
}

/* ── SECTION HEADERS ── */
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-soft); margin: 20px 0 10px; }

/* ── STATUS DOT ── */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-active { background: #22c55e; }

/* ── PROFILE ── */
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--green-dark); display: flex; align-items: center; justify-content: center; color: white; }
.profile-avatar-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; display: block; }
.profile-avatar-wrap { position: relative; width: 80px; height: 80px; margin: 0 auto 8px; display: block; cursor: pointer; }
.profile-avatar-badge { position: absolute; bottom: 0; right: 0; width: 24px; height: 24px; background: var(--green-dark); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2.5px solid white; pointer-events: none; }
.profile-stat-row { display: flex; gap: 10px; margin-bottom: 4px; }
.profile-stat { flex: 1; background: var(--green-light); border-radius: 12px; padding: 12px; text-align: center; }
.profile-stat-num { font-size: 20px; font-weight: 800; color: var(--green-dark); }
.profile-stat-label { font-size: 11px; color: var(--text-soft); font-weight: 600; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── ANIMATIONS ── */
@keyframes floatBall    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes bounceCelebrate { from { transform: translateY(0) rotate(-5deg) scale(1); } to { transform: translateY(-20px) rotate(5deg) scale(1.05); } }
@keyframes spin         { to { transform: rotate(360deg); } }
@keyframes fadeIn       { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp      { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse        { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes confettiFall { to { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* ── UTILS ── */
.hidden     { display: none !important; }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
