/* GamesGarden platform UI (name sheet, leaderboard sheet, profile, chip, result moment).
   Design-system tokens and components only (garden.css). Loaded by gg.js itself. Prefix: ggp-. */

/* ---------- sheets ---------- */
.ggp-modal { z-index: 85; }
.ggp-sheet { width: min(440px, 100%); padding: 26px 22px 22px; }
.ggp-close { position: absolute; top: 12px; right: 12px; z-index: 2; box-shadow: var(--gg-shadow-sm); }
.ggp-close svg { width: 18px; height: 18px; }
.ggp-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ggp-body > * { min-width: 0; }
.ggp-badge { width: 64px; height: 64px; margin: 0 auto 2px; }
.ggp-badge svg { width: 100%; height: 100%; display: block; }
.ggp-title { font-size: var(--gg-text-2xl); padding-inline: 36px; overflow-wrap: anywhere; }
.ggp-eyebrow { margin-bottom: -6px; }
.ggp-lede { color: var(--gg-ink-2); font-size: var(--gg-text-md); line-height: 1.45; margin: 0; }
.ggp-muted { color: var(--gg-ink-3); font-size: var(--gg-text-sm); margin: 0; }
.ggp-fine { color: var(--gg-ink-3); font-size: var(--gg-text-xs); margin: 0; }
.ggp-fine a { font-weight: 700; }
.ggp-alt { display: flex; justify-content: center; margin-top: -4px; }

/* ---------- form ---------- */
.ggp-form { display: grid; gap: 8px; text-align: left; margin-top: 4px; }
.ggp-label { font-weight: 700; font-size: var(--gg-text-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--gg-ink-3); }
.ggp-input {
  width: 100%; min-height: 54px; padding: 12px 16px; border: var(--gg-border); border-radius: var(--gg-r-md);
  background: var(--gg-cream); color: var(--gg-ink); font: 700 var(--gg-text-lg) / 1.2 var(--gg-font-body);
  box-shadow: inset 0 2px 0 var(--gg-line); outline: none;
  transition: box-shadow var(--gg-dur-sm) ease, background-color var(--gg-dur-sm) ease;
}
.ggp-input::placeholder { color: var(--gg-ink-3); font-weight: 600; opacity: .8; }
.ggp-input:focus { background: var(--gg-paper); box-shadow: 0 0 0 4px var(--gg-lime); }
.ggp-input--key { font-family: var(--gg-font-display); letter-spacing: .08em; text-transform: uppercase; }
.ggp-hint { margin: 0 0 6px; font-size: var(--gg-text-sm); color: var(--gg-ink-3); min-height: 1.5em; }
.ggp-hint[data-state="error"] { color: var(--gg-ink); font-weight: 700; }
.ggp-hint[data-state="wait"] { color: var(--gg-ink-2); font-weight: 700; }
.ggp-hint[data-state="wait"]::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--gg-butter); border: 2px solid var(--gg-ink); vertical-align: -1px; }
.ggp-hint[data-state="error"]::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--gg-pink); border: 2px solid var(--gg-ink); vertical-align: -1px; }

/* ---------- garden key ---------- */
.ggp-key {
  font-family: var(--gg-font-display); font-weight: 800; font-size: clamp(20px, 6.2vw, 28px); letter-spacing: .05em; line-height: 1;
  padding: 16px 12px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-butter-100);
  user-select: all; -webkit-user-select: all; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ggp-key--hidden { color: var(--gg-ink-3); letter-spacing: .1em; user-select: none; -webkit-user-select: none; background: var(--gg-sand); }
.ggp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- leaderboard ---------- */
.ggp-boardsheet { width: min(480px, 100%); }
.ggp-tabs { justify-self: center; width: 100%; }
.ggp-tabs button { padding-inline: 8px; }
.ggp-sub { margin: -2px 0 0; font-size: var(--gg-text-sm); color: var(--gg-ink-3); }
.ggp-list { text-align: left; min-height: 120px; }
.ggp-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ggp-row {
  display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 10px; min-height: 48px;
  padding: 6px 14px 6px 6px; border: 2px solid var(--gg-line); border-radius: var(--gg-r-md); background: var(--gg-paper);
  animation: gg-rise var(--gg-dur-lg) var(--gg-ease-out) both;
}
.ggp-row:nth-child(2) { animation-delay: calc(30ms * var(--gg-time)); }
.ggp-row:nth-child(3) { animation-delay: calc(60ms * var(--gg-time)); }
.ggp-row:nth-child(n+4) { animation-delay: calc(90ms * var(--gg-time)); }
.ggp-rank {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  font-family: var(--gg-font-display); font-weight: 800; font-size: var(--gg-text-md); color: var(--gg-ink-2); background: var(--gg-sand);
}
.ggp-row.is-top .ggp-rank { color: var(--gg-ink); border: 2px solid var(--gg-ink); box-shadow: var(--gg-shadow-sm); }
.ggp-row.is-top1 .ggp-rank { background: var(--gg-butter); }
.ggp-row.is-top2 .ggp-rank, .ggp-row.is-top3 .ggp-rank { background: var(--gg-butter-100); }
.ggp-name { min-width: 0; font-weight: 700; font-size: var(--gg-text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ggp-name small { margin-left: 6px; padding: 2px 8px; border-radius: var(--gg-r-pill); background: var(--gg-ink); color: var(--gg-cream); font-size: var(--gg-text-xs); font-weight: 700; vertical-align: 2px; }
.ggp-best { font-size: var(--gg-text-xs); font-weight: 700; color: var(--gg-ink-3); white-space: nowrap; }
.ggp-pts { font-family: var(--gg-font-display); font-weight: 800; font-size: var(--gg-text-lg); font-variant-numeric: tabular-nums; }
.ggp-row.is-you { border-color: var(--gg-ink); background: var(--gg-lime-100); box-shadow: var(--gg-shadow-sm); }
.ggp-gap { text-align: center; color: var(--gg-ink-3); font-weight: 800; letter-spacing: .3em; line-height: 1; padding: 2px 0 6px; }
.ggp-rows--loading .ggp-row { border-style: dashed; animation: none; }
.ggp-rows--loading .ggp-rank, .ggp-rows--loading .ggp-name, .ggp-rows--loading .ggp-pts { background: var(--gg-sand); border-radius: var(--gg-r-pill); height: 14px; }
.ggp-rows--loading .ggp-rank { width: 36px; height: 36px; border-radius: 50%; }
.ggp-rows--loading .ggp-name { width: 60%; }
.ggp-rows--loading .ggp-pts { width: 28px; }
.ggp-empty { display: grid; place-items: center; min-height: 140px; padding: 16px; border: 2px dashed var(--gg-line); border-radius: var(--gg-r-md); text-align: center; color: var(--gg-ink-2); }
.ggp-empty p { margin: 0; max-width: 28ch; }
.ggp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.ggp-foot .gg-btn svg { width: 18px; height: 18px; }
.ggp-cta { margin: 0; font-weight: 700; font-size: var(--gg-text-sm); }
.ggp-sheet .ggp-list { max-height: min(52dvh, 460px); overflow: auto; padding: 2px 4px 6px 2px; margin: 0 -4px 0 -2px; }

/* ---------- profile ---------- */
.ggp-title--name { font-size: var(--gg-text-3xl); }
.ggp-rename-btn { justify-self: center; margin-top: -8px; }
.ggp-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ggp-totals > div { padding: 10px 8px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-cream); }
.ggp-totals > div:first-child { background: var(--gg-butter-100); }
.ggp-totals b { display: block; font-family: var(--gg-font-display); font-weight: 800; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ggp-totals span { font-size: var(--gg-text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gg-ink-3); }
.ggp-games { list-style: none; margin: 0; padding: 0; text-align: left; border-top: 2px solid var(--gg-line); }
.ggp-games li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 10px 2px; border-bottom: 2px solid var(--gg-line); font-size: var(--gg-text-sm); }
.ggp-games li span:first-child { font-weight: 700; font-size: var(--gg-text-md); }
.ggp-games li span:nth-child(2) { color: var(--gg-ink-3); }
.ggp-games b { font-family: var(--gg-font-display); font-weight: 800; }
.ggp-games .ggp-time { grid-column: 1 / -1; margin-top: -6px; font-size: var(--gg-text-xs); font-weight: 600; color: var(--gg-ink-3); }
.ggp-name .ggp-time { display: block; font-size: var(--gg-text-xs); font-weight: 600; color: var(--gg-ink-3); }
.ggp-playweek { margin: -4px 0 10px; font-size: var(--gg-text-xs); }
.ggp-keybox { display: grid; gap: 8px; padding: 14px; border: 2px dashed var(--gg-line); border-radius: var(--gg-r-md); }
.ggp-keybox h3 { font-size: var(--gg-text-lg); }
.ggp-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
.ggp-danger { display: grid; justify-items: center; gap: 4px; padding-top: 8px; border-top: 2px solid var(--gg-line); }
.ggp-danger .gg-btn { color: var(--gg-ink-3); }
.ggp-danger .gg-btn.is-armed { color: var(--gg-ink); background: var(--gg-pink-100); text-decoration-color: var(--gg-pink); }

/* ---------- app-bar chip + trophy ---------- */
.ggp-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: min(46vw, 260px); padding: 6px 14px 6px 10px;
  border: var(--gg-border); border-radius: var(--gg-r-pill); background: var(--gg-paper); box-shadow: var(--gg-shadow-sm);
  font-weight: 700; font-size: var(--gg-text-sm); cursor: pointer; white-space: nowrap;
  transition: transform var(--gg-dur-xs) ease, box-shadow var(--gg-dur-xs) ease;
}
.ggp-chip:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--gg-ink); }
.ggp-chip svg { width: 20px; height: 20px; flex: none; }
.ggp-chip__dot {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gg-lime); border: 2px solid var(--gg-ink);
  font-family: var(--gg-font-display); font-weight: 800; font-size: var(--gg-text-sm); line-height: 1; text-transform: uppercase;
}
.ggp-chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ggp-chip__pts { flex: none; padding-left: 8px; border-left: 2px solid var(--gg-line); font-family: var(--gg-font-display); font-weight: 800; }
.ggp-chip.is-anon { background: var(--gg-lime); }
.ggp-trophy svg { width: 22px; height: 22px; }
/* seeds: a small dot for unread garden replies (on the chip, and on "My seeds" in the profile) */
.ggp-chip { position: relative; }
.ggp-new { display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: var(--gg-r-pill); background: var(--gg-pink); border: 2px solid var(--gg-ink); vertical-align: 1px; flex: none; }
.ggp-chip__new { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; margin: 0; }
.ggp-chip__short { display: none; }
/* phones: the app bar is tight, so the chip shrinks to the initial + points ("Name" when there is no player yet) */
@media (max-width: 560px) {
  .ggp-chip { padding: 6px 12px 6px 6px; gap: 6px; }
  .ggp-chip__name, .ggp-chip__unit { display: none; }
  .ggp-chip__pts { padding-left: 0; border-left: 0; }
  .ggp-chip.is-anon { padding-left: 10px; }
  .ggp-chip.is-anon .ggp-chip__short { display: inline; }
}

/* ---------- result-screen moment ---------- */
.ggp-moment {
  display: grid; gap: 8px; justify-items: center; margin: 0 0 16px; padding: 12px 14px;
  border: 2px dashed var(--gg-line); border-radius: var(--gg-r-md); background: var(--gg-cream);
  animation: gg-rise var(--gg-dur-lg) var(--gg-ease-out) both;
}
.ggp-moment[hidden] { display: none; }
.ggp-moment[data-state="done"] { border-style: solid; border-color: var(--gg-ink); background: var(--gg-lime-100); }
.ggp-moment__line { margin: 0; font-weight: 700; font-size: var(--gg-text-sm); color: var(--gg-ink-2); }
.ggp-moment__line--wait { color: var(--gg-ink-3); }
.ggp-moment__pts { margin: 0; font-weight: 700; font-size: var(--gg-text-md); }
.ggp-moment__pts b { display: inline-block; font-family: var(--gg-font-display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ggp-moment__row { display: flex; align-items: center; justify-content: center; gap: 10px 12px; flex-wrap: wrap; }
.ggp-moment__rank { font-weight: 700; font-size: var(--gg-text-sm); }
.ggp-moment__btn svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) { .ggp-row, .ggp-moment { animation: none; } }
