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

:root {
  --bg:       #f2f1ec;
  --surface:  #ffffff;
  --surface2: #ebebeb;
  --border:   rgba(0,0,0,0.08);
  --text:     #111111;
  --muted:    #888888;
  --green:    #1a9e5c;
  --green-l:  #22c069;
  --green-bg: #e8f7ef;
  --red:      #e03131;
  --gold:     #e8a800;
  --radius:   18px;
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ──────────────────────────────────────────────── */
.screen { display: none; width: 100%; height: 100dvh; flex-direction: column; overflow: hidden; }
.screen.active { display: flex; }

/* ── Logo ─────────────────────────────────────────────────── */
.logo-big  { font-size: 36px; font-weight: 900; letter-spacing: -1.5px; color: var(--text); }
.logo-big span, .logo-small span { color: var(--green); }
.logo-small { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; color: var(--text); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 16px;
  background: var(--text); color: white;
  border: none; border-radius: 50px;
  font-size: 16px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; margin-bottom: 10px;
  letter-spacing: 0.2px;
}
.btn-primary:active { opacity: 0.85; }
.btn-green {
  display: block; width: 100%; padding: 16px;
  background: var(--green); color: white;
  border: none; border-radius: 50px;
  font-size: 16px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; margin-bottom: 10px;
}
.btn-green:active { opacity: 0.85; }
.btn-outline {
  display: block; width: 100%; padding: 15px;
  background: transparent; color: var(--text);
  border: 2px solid var(--border); border-radius: 50px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: background 0.15s; margin-bottom: 10px;
}
.btn-outline:active { background: var(--surface2); }
.btn-ghost {
  display: block; width: 100%; padding: 12px;
  background: transparent; color: var(--muted);
  border: none; font-size: 14px; cursor: pointer;
}
.btn-full   { width: 100%; }
.btn-margin { margin: 0 16px 16px; width: calc(100% - 32px); }

/* ── Inputs ───────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface2);
  border: 2px solid transparent; border-radius: 14px;
  color: var(--text); font-size: 15px;
  outline: none; transition: border-color 0.15s;
}
input:focus { border-color: var(--green); background: var(--surface); }
input::placeholder { color: var(--muted); }

.form-error { color: var(--red); font-size: 13px; margin: -4px 0 8px; min-height: 18px; }

/* ── Top bar ──────────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px; flex-shrink: 0;
}
.top-title { font-size: 17px; font-weight: 800; }
.icon-btn {
  background: var(--surface); border: none; color: var(--text);
  font-size: 18px; cursor: pointer; padding: 8px 10px;
  border-radius: 12px; transition: background 0.15s;
  line-height: 1;
}
.icon-btn:active { background: var(--surface2); }

.or-divider { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 0 10px; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: absolute; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface); border-radius: 28px 28px 0 0;
  padding: 28px 20px 44px; width: 100%; max-width: 480px;
}
.modal-title { font-size: 20px; font-weight: 900; margin-bottom: 18px; }
.code-display {
  font-family: monospace; font-size: 36px; font-weight: 900;
  letter-spacing: 10px; color: var(--green);
  text-align: center; padding: 20px;
  background: var(--green-bg); border-radius: 16px; margin-bottom: 16px;
}

/* Google OAuth button */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 16px;
  background: white; color: #3c4043;
  border: 1.5px solid #dadce0; border-radius: 50px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.15s, background 0.15s;
  margin-bottom: 4px;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); background: #f8f9fa; }
.btn-google:active { background: #f1f3f4; }

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0; color: var(--muted); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
#screen-auth { justify-content: center; align-items: center; background: var(--bg); }
.auth-wrap { width: 100%; max-width: 380px; padding: 0 24px; }
.auth-sub  { font-size: 14px; color: var(--muted); margin: 6px 0 32px; }
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--surface2); border-radius: 14px; padding: 4px;
}
.auth-tab {
  flex: 1; padding: 11px; background: none; border: none;
  color: var(--muted); font-size: 14px; font-weight: 700;
  cursor: pointer; border-radius: 11px; transition: all 0.15s;
}
.auth-tab.active { background: var(--surface); color: var(--text); }


/* ── Home screen ─────────────────────────────────────────── */
#screen-home {
  background: #00B894;
}

.home-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px; flex-shrink: 0;
}
.home-top-bar .logo-small { color: white; }
.home-top-bar .logo-small span { color: #FDCB6E; }

/* Settings gear button — clean circle */
.home-settings-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.home-settings-btn:active { background: rgba(255,255,255,0.35); }

.home-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 16px 0;
}

/* Group card — white card on green bg */
.gc {
  background: #ffffff; border-radius: 24px;
  margin-bottom: 16px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  cursor: pointer; transition: transform 0.15s;
  border: none;
}
.gc:active { transform: scale(0.975); }

.gc-banner {
  position: relative; height: 130px; overflow: hidden;
  background: #3B1F8C;  /* fallback — overridden inline per card */
}
.gc-banner-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 75% -20%, rgba(255,255,255,0.25) 0%, transparent 50%),
    radial-gradient(circle at 110% 80%, rgba(253,203,110,0.35) 0%, transparent 40%),
    radial-gradient(circle at -10% 60%, rgba(255,255,255,0.1) 0%, transparent 40%);
}
/* Decorative blob */
.gc-banner::after {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(253,203,110,0.35);
  pointer-events: none;
}
.gc-banner-top {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 12px 16px 16px; height: 100%;
}
.gc-avatars { display: flex; align-items: center; }
.gc-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
  border: 3px solid rgba(255,255,255,0.45);
  margin-right: -14px; flex-shrink: 0; position: relative;
}
.gc-avatar.played-av { border-color: #FDCB6E; }
.gc-countdown {
  background: rgba(0,0,0,0.3); color: white;
  font-size: 12px; font-weight: 700; padding: 5px 11px;
  border-radius: 50px; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2); white-space: nowrap;
}
.gc-body {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 16px;
}
.gc-left { min-width: 0; flex: 1; }
.gc-name {
  font-size: 20px; font-weight: 900; color: #111;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gc-zone  { font-size: 13px; color: #00B894; font-weight: 700; margin-top: 3px; }
.gc-meta  { font-size: 12px; color: #999; margin-top: 2px; }
.gc-right {
  flex-shrink: 0; margin-left: 12px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.gc-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 50px;
  font-size: 13px; font-weight: 800; white-space: nowrap;
  background: #2d3436; color: white;
}
.gc-badge-score   { background: #00B894; color: white; }
.gc-badge-pending { background: #2d3436; color: #FDCB6E; }

/* Suggest / join card — dashed white on green */
.suggest-card {
  display: flex; align-items: center; gap: 14px;
  border: 2.5px dashed rgba(255,255,255,0.4); border-radius: 20px;
  padding: 16px; margin-bottom: 16px; cursor: pointer;
  transition: background 0.15s;
}
.suggest-card:active { background: rgba(255,255,255,0.1); }
.suggest-icon  { font-size: 26px; flex-shrink: 0; }
.suggest-title { font-size: 15px; font-weight: 800; color: white; }
.suggest-sub   { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 2px; }

/* Home bottom */
.home-bottom {
  padding: 10px 16px 32px; flex-shrink: 0;
  background: #00B894;
}

/* Amber create button — 3D shadow */
.btn-home-create {
  display: block; width: 100%; padding: 18px;
  background: #FDCB6E;
  color: #111;
  border: none; border-radius: 50px;
  font-size: 18px; font-weight: 900; cursor: pointer;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 0 #e0a84e, 0 8px 20px rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative; top: 0;
}
.btn-home-create:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #e0a84e, 0 4px 10px rgba(0,0,0,0.15);
}

.or-divider { text-align: center; color: rgba(255,255,255,0.75); font-size: 13px; margin-top: 10px; }
.link-btn {
  color: #FDCB6E; font-weight: 700; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

/* ── Avatars ──────────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid var(--bg); margin-right: -10px; flex-shrink: 0;
  color: white; text-transform: uppercase;
}
.avatar-lg { width: 46px; height: 46px; font-size: 15px; margin-right: -12px; }
.avatar-sm { width: 32px; height: 32px; font-size: 11px; margin-right: -8px; }
.avatar-xs { width: 26px; height: 26px; font-size: 10px; margin-right: -6px; }

.av-a{background:#e74c3c}.av-b{background:#e67e22}.av-c{background:#d4a017}
.av-d{background:#27ae60}.av-e{background:#1abc9c}.av-f{background:#2980b9}
.av-g{background:#8e44ad}.av-h{background:#c0392b}.av-i{background:#16a085}
.av-j{background:#d35400}.av-k{background:#7f8c8d}.av-l{background:#2ecc71}
.av-m{background:#f39c12}.av-n{background:#6d4c41}.av-o{background:#7b1fa2}
.av-p{background:#1976d2}.av-q{background:#00796b}.av-r{background:#c62828}
.av-s{background:#512da8}.av-t{background:#283593}.av-u{background:#0277bd}
.av-v{background:#388e3c}.av-w{background:#ad1457}.av-x{background:#4527a0}
.av-y{background:#00838f}.av-z{background:#558b2f}

/* ── Group screen ─────────────────────────────────────────── */
#screen-group {
  background: #f4f3ef;
  overflow: hidden;
}

/* Top bar */
.grp-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px; flex-shrink: 0;
}
.grp-icon-btn {
  width: 38px; height: 38px; border: none; background: rgba(0,0,0,0.06);
  cursor: pointer; color: #333;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; transition: background 0.15s;
  flex-shrink: 0;
}
.grp-icon-btn:active { background: rgba(0,0,0,0.12); }

/* Members pill — rounded container with overlapping avatars */
#members-pill {
  background: white; border-radius: 50px; padding: 5px 12px;
  display: flex; align-items: center; gap: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}


/* Score card — tappable pill tight around content */
.grp-score-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  background: white; border-radius: 50px;
  padding: 8px 22px; cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  border: 1.5px solid rgba(0,0,0,0.06);
  transition: transform 0.12s;
}
.grp-score-card:active { transform: scale(0.95); }
.grp-my-score {
  display: flex; align-items: center; gap: 6px;
  font-size: 17px; font-weight: 900; color: #111;
}
.grp-score-gem   { font-size: 16px; }
.grp-divider     { color: #ccc; font-weight: 400; margin: 0 2px; }
.grp-score-trophy{ font-size: 16px; }
.grp-season-label {
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.2px;
}

/* ── Season screen ────────────────────────────────────────── */
#screen-season { background: #f4f3ef; overflow-y: auto; }

.season-header {
  background: #2d3436; padding: 16px 20px 28px;
  display: flex; flex-direction: column; align-items: center;
  border-radius: 0 0 28px 28px;
}
.season-header-center {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
}
.season-laurels { font-size: 32px; margin-bottom: 2px; }
.season-title   { font-size: 28px; font-weight: 900; color: white; letter-spacing: -0.5px; }
.season-subtitle { font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.6); margin-bottom: 6px; }
.season-date-pill {
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8);
  font-size: 13px; font-weight: 700; padding: 5px 16px;
  border-radius: 50px; display: inline-flex; align-items: center; gap: 6px;
}
.season-body { padding: 20px 16px 32px; }

.season-rank-row {
  display: flex; align-items: center; gap: 12px;
  background: #2d3436; border-radius: 20px;
  padding: 14px 16px; margin-bottom: 10px;
  border: 2px solid transparent;
}
.season-rank-row.me     { border-color: #f39c12; }
.season-rank-row.rank-2 { border-color: #00B894; }
.season-rank-row.rank-3 { border-color: #6c5ce7; }
.season-rank-num { font-size: 13px; font-weight: 800; color: rgba(255,255,255,0.6); min-width: 24px; }
.season-rank-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: white; overflow: hidden;
}
.season-rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.season-rank-info { flex: 1; min-width: 0; }
.season-rank-name {
  font-size: 16px; font-weight: 900; color: white;
  display: flex; align-items: center; gap: 6px;
}
.season-rank-meta { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.season-rank-pts  { font-size: 18px; font-weight: 900; color: #f6c90e; flex-shrink: 0; }

/* HOY label */
.grp-hoy-label {
  text-align: center; font-size: 28px; font-weight: 900;
  color: #111; letter-spacing: -0.5px;
  padding: 4px 0 8px; flex-shrink: 0;
}

/* Fixed top area — score, HOY, banner stay put while chat scrolls */
.grp-fixed-top { flex-shrink: 0; }

/* Scrollable content */
.grp-scroll {
  flex: 1; overflow-y: auto;
  padding: 0 16px 0;
  display: flex; flex-direction: column; gap: 14px;
}

/* Challenge banner — big teal card like reference */
#challenge-banner {
  border-radius: 22px; overflow: hidden;
  cursor: pointer; flex-shrink: 0;
  height: 200px; position: relative;
  background: linear-gradient(150deg,#3B1F8C 0%,#6C3FC4 55%,#A78BFA 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: none; transition: transform 0.15s;
}
#challenge-banner:active { transform: scale(0.98); }
#challenge-banner.played { cursor: default; }

#banner-illustration-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.banner-big-emoji {
  font-size: 80px;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.25));
}

.banner-bottom-pill {
  width: 100%; padding: 0 16px 18px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.banner-cta-pill {
  background: white; color: #6C3FC4;
  padding: 8px 18px; border-radius: 50px;
  font-size: 14px; font-weight: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.banner-cta-pill.done {
  background: rgba(255,255,255,0.2); color: white; box-shadow: none;
}
.banner-badge {
  position: absolute; top: 12px;
  background: rgba(0,0,0,0.3); color: white;
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 50px; backdrop-filter: blur(4px);
}
.banner-badge-left  { left: 14px; }
.banner-badge-right { right: 14px; }

/* Podium — top 3 today */
#podium-row {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 16px; padding: 4px 0;
}
.podium-player {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.podium-crown { font-size: 20px; }
.podium-avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white; border: 3px solid white;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.podium-avatar.p1 { width: 64px; height: 64px; font-size: 20px; }
.podium-avatar.p2 { width: 52px; height: 52px; font-size: 16px; }
.podium-avatar.p3 { width: 52px; height: 52px; font-size: 16px; }
.podium-name { font-size: 12px; font-weight: 700; color: #333; max-width: 70px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-pts  { font-size: 13px; font-weight: 900; color: #111; }
.podium-pts.p1 { font-size: 15px; }

/* Best player banner */
#best-player-row {
  background: white; border-radius: 16px; padding: 14px 16px;
  display: none;
}
#best-player-row.show { display: block; }
.best-inner {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.best-laurels { font-size: 13px; color: #888; }
.best-name { font-size: 20px; font-weight: 900; color: #111; }
.best-pts  { font-size: 14px; color: #888; }

/* Tabs pill — dark pill like reference */
.grp-tabs-pill {
  display: flex; background: #2d3436; border-radius: 50px;
  padding: 4px; gap: 4px;
}
.grp-tab {
  flex: 1; padding: 11px 0; border: none; border-radius: 50px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: transparent; color: rgba(255,255,255,0.5);
  transition: all 0.15s;
}
.grp-tab.active { background: #111; color: white; }

/* ── Score section ────────────────────────────────────────── */
.score-tabs {
  display: flex; gap: 8px; padding: 4px 0 8px; flex-shrink: 0;
}
.score-tab {
  padding: 8px 18px; background: var(--surface2);
  border: none; border-radius: 50px;
  color: var(--muted); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.score-tab.active { background: var(--text); color: white; }
/* ── Score cards — reference style ───────────────────────── */
#scores-list { padding: 4px 0 24px; display: flex; flex-direction: column; gap: 10px; }

.sr-card {
  display: flex; align-items: center; gap: 0;
  border-radius: 18px; overflow: visible;
  position: relative; padding: 0;
  min-height: 76px;
  transition: transform 0.12s;
}
.sr-card:active { transform: scale(0.98); }

/* Separator line after rank 3 */
.score-separator {
  margin-bottom: 6px;
}
.score-separator::after {
  content: ''; display: block;
  position: absolute; bottom: -10px; left: 0; right: 0;
  height: 1px; background: rgba(0,0,0,0.08);
}

.sr-rank {
  width: 56px; flex-shrink: 0;
  font-size: 18px; font-weight: 900; color: rgba(255,255,255,0.9);
  text-align: center; letter-spacing: -0.5px;
  padding-left: 4px;
}

.sr-avatar-wrap {
  flex-shrink: 0; margin: -8px 0 -8px -8px;
}
.sr-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: white;
  border: 3px solid rgba(255,255,255,0.4);
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.sr-info {
  flex: 1; padding: 14px 10px 14px 14px; min-width: 0;
}
.sr-pts {
  font-size: 16px; font-weight: 900; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-name {
  font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.8);
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-dist {
  font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 1px;
}

.sr-badges {
  flex-shrink: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
}
.sr-pts-badge {
  background: rgba(0,0,0,0.25); color: white;
  font-size: 12px; font-weight: 800; padding: 4px 10px;
  border-radius: 50px; white-space: nowrap;
}

/* Old score-row kept for compatibility but hidden */
.score-row { display: none; }

/* ── Chat ─────────────────────────────────────────────────── */
#chat-messages {
  padding: 4px 0 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-bubble {
  background: white; border-radius: 0 14px 14px 14px;
  padding: 9px 12px; max-width: 78%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chat-author { font-size: 12px; color: #00B894; font-weight: 800; margin-bottom: 2px; }
.chat-text   { font-size: 14px; line-height: 1.4; color: #111; }
.chat-time   { font-size: 11px; color: #999; margin-top: 2px; }

/* Score msg in chat — record gets gold */
.chat-score-msg {
  background: #f0f9f5; border: 1px solid rgba(0,184,148,0.2);
  border-radius: 12px; padding: 10px 14px;
  font-size: 13px; color: #00B894; text-align: center; font-weight: 600;
}
.chat-score-msg.record {
  background: #fffbeb; border-color: #fcd34d; color: #92400e;
}

.chat-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 0; color: #aaa; font-size: 14px; gap: 6px;
}
.chat-empty-icon { font-size: 36px; opacity: 0.4; }

/* Fixed chat input */
#chat-input-row {
  display: flex; gap: 10px; padding: 10px 16px 20px;
  border-top: 1px solid rgba(0,0,0,0.06); flex-shrink: 0;
  background: #f4f3ef;
}
#chat-input {
  flex: 1; margin-bottom: 0; border-radius: 50px;
  padding: 12px 18px; background: white;
  border: 1.5px solid rgba(0,0,0,0.08);
}
.btn-send {
  width: 46px; height: 46px; background: #00B894; color: white;
  border: none; border-radius: 50%; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,184,148,0.35);
}

/* ── Game screen ──────────────────────────────────────────── */
#screen-game { position: relative; overflow: hidden; background: #000; }
#sv-pano {
  position: absolute; inset: 0;
  touch-action: none;          /* prevent browser scroll from stealing touch events */
  -webkit-user-select: none;
  user-select: none;
}
/* Prevent entire game screen from scrolling while playing */
#screen-game {
  overflow: hidden;
  touch-action: none;
}
#screen-game #map-panel {
  touch-action: none;
}

#hud-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 36px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
  pointer-events: none;
}
.logo-small-white { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; color: white; }
.logo-small-white span { color: #4ade80; }
#score-badge {
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px; padding: 6px 14px;
  font-size: 13px; font-weight: 700; color: #4ade80;
}

/* Map panel */
#map-panel {
  position: absolute; z-index: 20;
  top: 70px; left: 12px;          /* top-left, below HUD */
  bottom: auto; right: auto;
  border-radius: 18px; overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
  background: #e8f5e9;
  width: 200px; height: 160px; opacity: 0.5;
  transition: width 0.25s ease, height 0.25s ease, opacity 0.2s ease;
}
#map-panel:hover, #map-panel.expanded {
  width: min(92vw, 380px); height: min(55vh, 380px);
  opacity: 1; border-color: rgba(255,255,255,0.4);
}
#map-canvas { width: 100%; height: 100%; cursor: crosshair; }
#map-tip {
  position: absolute; bottom: 44px; left: 0; right: 0;
  text-align: center; font-size: 11px; color: rgba(0,0,0,0.7);
  pointer-events: none; text-shadow: 0 1px 2px rgba(255,255,255,0.8);
  font-weight: 600;
}
#map-panel:not(:hover):not(.expanded) #map-tip { display: none; }
#map-tip.hidden { opacity: 0; }
#confirm-btn {
  position: absolute; bottom: 0; left: 0; right: 0; height: 42px;
  background: #1a9e5c; color: white; border: none;
  font-size: 14px; font-weight: 800; cursor: pointer; display: none;
  letter-spacing: 0.3px;
}
#map-panel:hover #confirm-btn, #map-panel.expanded #confirm-btn { display: block; }
#confirm-btn:disabled { background: #ccc; color: #999; cursor: default; }
#expand-btn {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; background: rgba(255,255,255,0.85);
  border: none; border-radius: 8px; cursor: pointer;
  color: #333; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  /* always visible so user can minimize */
  z-index: 5;
}
#expand-btn::before { content: '⤢'; }
#map-panel.expanded #expand-btn::before { content: '−'; font-size: 20px; font-weight: 900; line-height: 1; }

/* ── Mobile map panel ─────────────────────────────────────── */
/* On touch devices: hover doesn't work, only .expanded class matters */
@media (hover: none) {
  #map-panel {
    top: 70px; left: 12px;
    bottom: auto; right: auto;
    width: 160px;
    height: 130px;
    opacity: 0.55;
  }
  #map-panel:hover {
    width: 160px; height: 130px;
    opacity: 0.55;
    border-color: rgba(255,255,255,0.2);
  }
  #map-panel:hover #confirm-btn { display: none; }
  #map-panel:not(.expanded) #map-tip { display: none; }
  #map-panel.expanded {
    width: min(92vw, 340px);
    height: min(52vh, 340px);
    opacity: 1;
    border-color: rgba(255,255,255,0.4);
  }
  #map-panel.expanded #confirm-btn { display: block; }
  #map-panel.expanded #map-tip.hidden { opacity: 0; }
}
#screen-result { overflow-y: auto; background: var(--bg); }
#result-header {
  padding: 22px 20px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#res-title  { font-size: 24px; font-weight: 900; }
#res-coords { font-size: 13px; color: var(--muted); margin-top: 4px; font-family: monospace; }
#result-map { width: 100%; height: 260px; background: #e8f5e9; flex-shrink: 0; }
#result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
.stat-card { background: var(--surface); border-radius: 16px; padding: 16px; text-align: center; border: 1.5px solid var(--border); }
.stat-card.highlight { background: var(--green-bg); border-color: rgba(26,158,92,0.2); }
.stat-val { font-size: 26px; font-weight: 900; color: var(--green); }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }

/* ── Season end modal ─────────────────────────────────────── */
.season-result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px; margin-bottom: 8px;
}
.season-result-row.rank-1 { background: linear-gradient(135deg,#f6d365,#fda085); }
.season-result-row.rank-2 { background: linear-gradient(135deg,#d7d7d7,#aaa); }
.season-result-row.rank-3 { background: linear-gradient(135deg,#f0a500,#c67c00); }
.season-result-row.rank-other { background: var(--surface2); }
.season-medal { font-size: 28px; flex-shrink: 0; }
.season-av-wrap { position: relative; flex-shrink: 0; }
.season-pts { font-size: 16px; font-weight: 900; margin-left: auto; white-space: nowrap; }

/* ── Gold medal badge on avatar ───────────────────────────── */
.av-medal-wrap { position: relative; display: inline-flex; }
.av-medal-badge {
  position: absolute; top: -4px; right: -4px;
  background: #f6d365; color: #7a4f00;
  font-size: 9px; font-weight: 900;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1;
}

/* Season info row — below score/rank */
.grp-season-info {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; padding: 0 0 4px; flex-shrink: 0;
}
.grp-season-pill {
  background: #2d3436; color: white;
  font-size: 12px; font-weight: 800; padding: 5px 12px;
  border-radius: 50px;
}
.grp-season-days {
  font-size: 13px; font-weight: 600; color: var(--muted);
}

/* Days left badge in banner */
.banner-days-left {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.3); color: rgba(255,255,255,0.85);
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 50px; white-space: nowrap;
}

/* ── Members screen ───────────────────────────────────────── */
#screen-members { background: #f4f3ef; overflow-y: auto; }

.mbr-header {
  background: #6c5ce7;
  padding: 16px 20px 32px;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  border-radius: 0 0 32px 32px;
}
.mbr-topbar {
  width: 100%; display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}
.mbr-back-btn {
  width: 38px; height: 38px; border: none; background: rgba(255,255,255,0.15);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mbr-action-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); color: white;
  border: none; border-radius: 50px; padding: 8px 16px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.mbr-icon-btn {
  width: 38px; height: 38px; border: none;
  background: rgba(255,255,255,0.15); border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.mbr-avatars {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.mbr-big-av {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: white;
  border: 3px solid rgba(255,255,255,0.5);
  margin-right: -14px; flex-shrink: 0; overflow: hidden;
}
.mbr-big-av img { width: 100%; height: 100%; object-fit: cover; }

.mbr-played-count {
  color: rgba(255,255,255,0.8); font-size: 14px; font-weight: 600;
  margin: 10px 0 14px;
}
.mbr-name-pill {
  background: white; color: #111;
  font-size: 17px; font-weight: 900;
  padding: 12px 28px; border-radius: 50px;
  margin-bottom: 12px; max-width: 90%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mbr-edit-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.2); color: white;
  border: none; border-radius: 50px; padding: 12px 24px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  width: 100%; justify-content: center; max-width: 300px;
}

.mbr-body { padding: 20px 16px 32px; }
.mbr-count-label {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin-bottom: 12px;
}

/* Member row */
.mbr-row {
  display: flex; align-items: center; gap: 14px;
  background: #2d3436; border-radius: 18px;
  padding: 14px 16px; margin-bottom: 10px;
  color: white;
}
.mbr-row-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: white;
  flex-shrink: 0; overflow: hidden;
}
.mbr-row-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mbr-row-info { flex: 1; min-width: 0; }
.mbr-row-name {
  font-size: 16px; font-weight: 900;
  display: flex; align-items: center; gap: 6px;
}
.mbr-badge {
  font-size: 10px; font-weight: 800; padding: 2px 8px;
  border-radius: 50px; white-space: nowrap;
}
.mbr-badge-admin { background: rgba(108,92,231,0.7); color: white; }
.mbr-badge-you   { background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); }
.mbr-row-meta { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 3px; }
.mbr-row-score {
  font-size: 24px; flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
#screen-settings { background: var(--bg); }
.settings-wrap { padding: 20px 16px; }

.profile-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 0 20px; gap: 6px;
}
.profile-avatar-wrap { position: relative; margin-bottom: 4px; }
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: white;
  overflow: hidden; background: #00B894;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-edit-btn {
  position: absolute; bottom: 2px; right: 2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #2d3436; border: 2.5px solid white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.profile-edit-btn:hover { background: #111; }
.profile-name  { font-size: 20px; font-weight: 900; color: var(--text); }
.profile-email { font-size: 13px; color: var(--muted); }

.settings-row {
  background: var(--surface); border-radius: 18px;
  border: 1.5px solid var(--border); overflow: hidden;
}
.settings-label {
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 12px 16px 6px;
}
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}

/* Banner zone pill — centered below emoji */
.banner-zone-pill {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.22); color: white;
  font-size: 13px; font-weight: 800; padding: 6px 16px;
  border-radius: 50px; backdrop-filter: blur(4px);
  letter-spacing: 0.2px; align-self: center;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Game HUD ─────────────────────────────────────────────── */
#game-stats { display: flex; gap: 8px; align-items: center; }
.game-badge {
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px; padding: 6px 12px;
  font-size: 13px; font-weight: 700; color: white;
  transition: background 0.3s, color 0.3s;
}
.game-badge.warning { background: rgba(220,100,30,0.85); border-color: rgba(255,160,80,0.5); }
.game-badge.danger  { background: rgba(200,30,30,0.85);  border-color: rgba(255,80,80,0.5); animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { opacity:1; } to { opacity:0.6; } }

/* ── Ad screen ────────────────────────────────────────────── */
#screen-ad {
  background: var(--bg);
  justify-content: center; align-items: center;
}
.ad-wrap {
  width: 100%; max-width: 360px; padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.ad-title    { font-size: 20px; font-weight: 900; text-align: center; }
.ad-subtitle { font-size: 14px; color: var(--muted); text-align: center; margin-top: -12px; }

.ad-countdown-wrap { display: flex; justify-content: center; }
.ad-ring { position: relative; width: 80px; height: 80px; }
.ad-ring svg { transform: rotate(-90deg); }
.ad-ring-bg   { fill: none; stroke: var(--surface2); stroke-width: 6; }
.ad-ring-fill {
  fill: none; stroke: var(--green); stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.ad-ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: var(--green);
}

.ad-slot { width: 320px; min-height: 100px; position: relative; }
.ad-placeholder {
  width: 100%; min-height: 100px; background: var(--surface2);
  border-radius: 12px; border: 2px dashed var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px;
}
.adsbygoogle { border-radius: 12px; overflow: hidden; }

.ad-skip-btn {
  width: 100%; padding: 15px; background: var(--green); color: white;
  border: none; border-radius: 50px; font-size: 16px; font-weight: 800;
  cursor: pointer; transition: opacity 0.2s;
}
.ad-skip-btn:disabled { background: var(--surface2); color: var(--muted); cursor: default; }

/* ── Result breakdown ─────────────────────────────────────── */
#result-breakdown {
  margin: 0 16px 8px; background: var(--surface);
  border-radius: 16px; border: 1.5px solid var(--border);
  overflow: hidden;
}
.breakdown-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-icon { font-size: 18px; width: 24px; text-align: center; }
.breakdown-label { flex: 1; font-size: 14px; color: var(--muted); font-weight: 500; }
.breakdown-val { font-size: 15px; font-weight: 800; color: var(--green); }

/* ── Tutorial modal ───────────────────────────────────────── */
.tutorial-zone {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-bg); color: var(--green);
  font-size: 13px; font-weight: 800; padding: 6px 14px;
  border-radius: 50px; margin-bottom: 14px;
  border: 1.5px solid rgba(26,158,92,0.25);
}
.tut-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; line-height: 1.5; color: var(--muted);
}
.tut-row:last-of-type { border-bottom: none; }
.tut-row b { color: var(--text); }
.tut-icon { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; }

/* Banner zone pill */
.banner-zone-pill {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.15); color: white;
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 50px; margin-bottom: 10px;
  backdrop-filter: blur(4px);
}
.banner-zone-pill.hard { background: rgba(255,80,0,0.3); }

/* ── Toggle switch ────────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.toggle { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 28px;
  background: var(--surface2); cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 22px; height: 22px; border-radius: 50%;
  left: 3px; top: 3px;
  background: white; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.zone-header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: var(--surface2); margin-bottom: 6px;
  font-size: 14px; font-weight: 700; color: var(--text);
  transition: background 0.12s;
}
.zone-header-row:hover { background: #e0ede6; }
.zone-barrio { margin-left: 12px; width: calc(100% - 12px); }

/* ── Zone picker ──────────────────────────────────────────── */
.zone-group-label {
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 8px 2px 4px;
}
.zone-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid transparent; background: var(--surface2);
  margin-bottom: 6px; transition: all 0.12s;
  font-size: 14px; font-weight: 600;
}
.zone-option:hover { background: var(--green-bg); border-color: rgba(26,158,92,0.3); }
.zone-option.selected {
  background: var(--green-bg); border-color: var(--green);
  color: var(--green);
}
.zone-option.selected::after { content: '✓'; margin-left: auto; font-weight: 900; }

/* Zone badge in group card */
.zone-badge {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}

/* Google Maps */
.gm-style-cc, a[href*="maps.google.com/maps"] { display: none !important; }
