:root {
  --navy: #1a2040;
  --navy2: #232c52;
  --yellow: #ffd166;
  --white: #ffffff;
  --muted: #aab4d2;
  --ink: #f4f6ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--navy);
  color: var(--ink);
  min-height: 100vh;
}

.app { max-width: 560px; margin: 0 auto; padding-bottom: 110px; }

.topbar {
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.share-btn {
  padding: 10px 18px;
  background: rgba(255,209,102,0.12); color: var(--yellow);
  border: 1px solid rgba(255,209,102,0.5); border-radius: 999px;
  font-size: 14px; font-weight: 800; cursor: pointer;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--yellow); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}

.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 13px; }

.install-banner {
  margin: 12px 20px 0; padding: 10px 14px;
  background: var(--navy2); border: 1px solid rgba(255,209,102,0.35);
  border-radius: 10px; font-size: 13px; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.install-banner button {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}

main { padding: 4px 0 12px; }

.tab { display: none; }
.tab.active { display: block; }

.game-card {
  margin: 16px 20px 0; padding: 22px 20px;
  background: var(--navy2); border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.07);
}
.game-card.center { text-align: center; }

.eyebrow {
  color: var(--yellow); font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.eyebrow.pad { padding: 18px 20px 0; }

h1 { font-size: 30px; margin: 10px 0 6px; line-height: 1.15; }
h2 { font-size: 16px; margin: 20px 0 8px; color: var(--yellow); }

.tagline { color: var(--muted); font-size: 15px; margin: 0 0 4px; line-height: 1.45; }

.steps { margin: 0; padding-left: 20px; }
.steps li { margin: 10px 0; line-height: 1.55; font-size: 15px; }

.win-box {
  margin-top: 20px; padding: 14px 16px;
  background: rgba(255,209,102,0.1);
  border-left: 4px solid var(--yellow);
  border-radius: 0 10px 10px 0;
}
.win-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--yellow); margin-bottom: 6px; }
.win-box p { margin: 0; font-size: 14px; line-height: 1.5; }

.done-btn {
  width: 100%; margin-top: 20px; padding: 16px;
  background: var(--yellow); color: var(--navy);
  border: none; border-radius: 14px;
  font-size: 18px; font-weight: 800; cursor: pointer;
}
.done-btn.done { background: #2f9e6e; color: #fff; }

.streak-line { text-align: center; margin-top: 14px; color: var(--muted); font-size: 14px; }
.streak-line strong { color: var(--yellow); }

.share-nudge {
  margin-top: 16px; padding: 14px 16px;
  background: rgba(255,209,102,0.1);
  border: 1px solid rgba(255,209,102,0.35);
  border-radius: 12px; text-align: center;
}
.share-nudge p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.share-win-btn {
  width: 100%; padding: 13px;
  background: var(--yellow); color: var(--navy);
  border: none; border-radius: 12px;
  font-size: 16px; font-weight: 800; cursor: pointer;
}

.streak-big { font-size: 96px; font-weight: 800; color: var(--yellow); line-height: 1; margin-top: 8px; }
.streak-word { font-size: 18px; margin-top: 4px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }

.week-dots { display: flex; justify-content: center; gap: 8px; margin: 18px 0 6px; }
.dot {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted);
}
.dot.hit { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 800; }
.dot.today { border-color: var(--yellow); }

.total-line { margin-top: 14px; color: var(--muted); font-size: 14px; }
.total-line strong { color: var(--ink); }

.level-badge {
  margin-top: 14px; padding: 12px 16px;
  background: rgba(255,209,102,0.1);
  border: 1px solid rgba(255,209,102,0.35);
  border-radius: 12px;
}
.level-name { color: var(--yellow); font-weight: 800; font-size: 18px; }
.level-next { color: var(--muted); font-size: 13px; margin-top: 4px; }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-piece { position: absolute; top: -14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(112vh) rotate(720deg); opacity: 0.85; } }

.lib-card {
  margin: 12px 20px 0; background: var(--navy2);
  border-radius: 14px; border: 1px solid rgba(255,255,255,0.07);
  overflow: hidden;
}
.lib-head {
  width: 100%; padding: 16px; background: none; border: none;
  color: var(--ink); text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.lib-head .t { font-weight: 700; font-size: 16px; }
.lib-head .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lib-head .chev { color: var(--yellow); font-size: 18px; }
.lib-body { display: none; padding: 0 16px 16px; }
.lib-card.open .lib-body { display: block; }
.lib-body p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.lib-body ol { padding-left: 20px; margin: 8px 0; }
.lib-body li { font-size: 14px; line-height: 1.55; margin: 6px 0; }
.lib-week {
  margin: 22px 24px 2px; font-size: 12px; font-weight: 800;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}

.community { text-align: center; padding: 26px 20px 10px; }
.community p { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.wa-btn {
  display: inline-block; padding: 14px 22px;
  background: #25d366; color: #062b16; font-weight: 800;
  border-radius: 999px; text-decoration: none; font-size: 15px;
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: #12172e;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1; padding: 16px 0; background: none; border: none;
  color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer;
}
.tab-btn.active { color: var(--yellow); }

.lead-card {
  margin: 16px 20px 40px; padding: 22px 20px;
  background: linear-gradient(160deg, #2a3358, #232c52);
  border-radius: 18px;
  border: 1px solid rgba(255,209,102,0.35);
}
.lead-title { font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.lead-sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.lead-form input {
  width: 100%; margin-bottom: 10px; padding: 14px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.15);
  background: #12172e; color: var(--ink); font-size: 16px;
}
.lead-form input:focus { outline: none; border-color: var(--yellow); }
.lead-btn {
  width: 100%; padding: 15px;
  background: var(--yellow); color: var(--navy);
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 800; cursor: pointer;
}
.lead-btn:disabled { opacity: 0.6; }
.lead-skip {
  width: 100%; margin-top: 8px; padding: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer;
}
.lead-msg { margin-top: 10px; font-size: 14px; color: var(--yellow); line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(10px);
  background: #0d1226; color: var(--ink);
  border: 1px solid rgba(255,209,102,0.5); border-radius: 12px;
  padding: 12px 18px; font-size: 14px; max-width: 86%;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; z-index: 50; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Leaderboard */
.lb-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--navy2); border-radius: 14px;
  padding: 12px 14px; margin: 8px 0;
}
.lb-row.lb-mine { border: 1px solid var(--yellow); }
.lb-rank { font-size: 18px; width: 30px; text-align: center; color: var(--yellow); font-weight: 700; }
.lb-nick { flex: 1; font-weight: 700; font-size: 15px; }
.lb-stat { color: var(--muted); font-size: 13px; text-align: right; }
.lb-member {
  background: rgba(255,209,102,0.12); color: var(--yellow);
  border-radius: 14px; padding: 12px 14px; margin: 8px 0; font-size: 14px;
}
.lb-join-row { display: flex; gap: 8px; margin: 12px 0 4px; }
#lb-nick {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 15px;
  background: var(--navy); border: 1px solid rgba(255,209,102,0.35); color: var(--ink);
}
.btn-primary {
  background: var(--yellow); color: var(--navy); border: none;
  border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700;
}
.btn-primary:disabled { opacity: 0.6; }
