/* === Gain Games PWA shared styles ========================================
 * Mobile-first. Same brand tokens as the public landing page so the app
 * doesn't feel like a separate product.
 * ========================================================================= */

:root {
  --blue: #0082cd;
  --blue-deep: #006da9;
  --clay: #fa854f;
  --clay-soft: #ffd6c2;
  --ink: #02131b;
  --ink-soft: #2a3a44;
  --fg-2: #52606b;
  --bone: #fbfdfe;
  --bone-soft: #eef2f5;
  --paper: #ffffff;
  --line: rgba(2, 19, 27, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  /* iOS safe-area: header absorbs the top inset itself (it extends up
     under the status bar / Dynamic Island as a frosted-glass panel),
     so body's top padding stays at 0. Bottom inset still shifts
     content above the home indicator. */
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--blue-deep); }
button { font: inherit; }

/* === Top bar ============================================================ */
.app-top {
  /* Frosted glass over translucent brand blue. As body content scrolls
     under the sticky header, it gets softly blurred — system-y iOS
     pattern. In a real PWA install (standalone mode), iOS paints the
     status bar background from `theme-color`, so the system clock /
     signal sit on a solid blue strip that flows seamlessly into our
     glass header below. In a browser tab, iOS overlays its status bar
     on top of our translucent glass — still readable, no hard edge. */
  background: rgba(0, 130, 205, 0.82);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  color: #fff;
  /* Header extends up under the safe area; visible content sits below
     iOS's status bar zone via padding-top. Right padding still clears
     the clay slash. */
  padding: calc(env(safe-area-inset-top) + 14px) 110px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.app-top::after {
  content: "";
  position: absolute;
  /* Anchored to the FULL height of the header, including the part that
     extends up under the iOS safe area — keeps the orange slash flush
     with the blue band all the way to the top of the screen. */
  top: 0;
  bottom: 0;
  right: 0;
  width: 110px;
  background: var(--clay);
  clip-path: polygon(40px 0, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(40px 0, 100% 0, 100% 100%, 0 100%);
  pointer-events: none;
  z-index: 0;
}
.app-top > * { position: relative; z-index: 1; }
.app-top img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.app-top .title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.app-top .right {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.85;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Home variant: email goes UNDER the title in a vertical lockup so a
   long address can't ever overflow into the clay slash. */
.app-top .lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.app-top .lockup .title { line-height: 1.15; }
.app-top .lockup .right {
  margin-left: 0;
  font-size: 11px;
  opacity: 0.78;
  max-width: 100%;
}

/* === Main wrap ========================================================== */
.app-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 18px 64px;
}

.app-h1 {
  font-family: "Anton", "DM Sans", sans-serif;
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  line-height: 0.98;
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.app-h1 em {
  font-style: italic;
  color: var(--clay);
  font-weight: 400;
}
.app-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 6px;
}
.app-eyebrow::before {
  content: "";
  width: 22px;
  height: 3px;
  background: var(--blue);
}

/* === Card ============================================================== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(2, 19, 27, 0.05);
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}
.card p { margin: 0 0 8px; color: var(--ink-soft); line-height: 1.5; }
.card p:last-child { margin-bottom: 0; }

/* === Buttons + inputs =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--blue-deep);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px; /* iOS hit target */
}
.btn.is-clay { background: var(--clay); }
.btn.is-ghost {
  background: transparent;
  color: var(--blue-deep);
  border: 1px solid var(--blue-deep);
}
.btn.is-danger {
  background: transparent;
  color: #b03a2e;
  border: 1px solid rgba(176, 58, 46, 0.4);
}
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.input,
.textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* iOS no-zoom */
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.input:focus,
.textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  border-color: transparent;
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 6px;
}

.callout {
  background: var(--bone-soft);
  border-left: 3px solid var(--clay);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 12px 0;
}
.callout.is-error { border-left-color: #b03a2e; color: #b03a2e; background: #fdecea; }
.callout.is-ok { border-left-color: #2e7d32; color: #1f5d23; background: #e9f5ec; }

/* === Lists ============================================================== */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--paper);
}
.list .meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.list .pri { font-weight: 700; }
.list .sec { font-size: 12px; color: var(--fg-2); }
/* Mobile allowlist rows: 3 columns (name+email | timestamp | Remove) get
   crushed on narrow phones — name overflows, timestamp wraps "26m / ago",
   Remove button overlaps the header's clay slash. Stack vertically. */
@media (max-width: 560px) {
  .list li {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .list li > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }
  .list li > div:first-child .pri {
    word-break: break-word;
  }
  .list .meta {
    flex: 1 1 100%;
    margin-left: 0;
    margin-top: 8px;
    justify-content: space-between;
    align-items: center;
  }
  .list .meta > span { white-space: nowrap; }
  .list .meta .btn { margin-left: auto; }
}

/* === Pill =============================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bone-soft);
  color: var(--ink-soft);
}
.pill.is-fresh { background: rgba(250, 133, 79, 0.16); color: var(--clay); }
.pill.is-stale { background: rgba(2, 19, 27, 0.08); color: var(--fg-2); }

/* === Hero spacing ======================================================= */
.hero { padding: 6px 0 18px; }
.hero .app-h1 { margin-bottom: 0; }

/* === Podium card — leaderboard preview, tappable ======================== */
.podium-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #fff 0%, #fbfaf5 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 10px 28px rgba(2, 19, 27, 0.06);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 200ms ease;
}
.podium-card:active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(2, 19, 27, 0.08);
}
.podium-card::after {
  /* Tiny clay accent strip in the top-right, echoes the brand slash */
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 74px; height: 6px;
  background: var(--clay);
  border-bottom-left-radius: 12px;
}
.podium-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 14px;
}
.podium-eyebrow .day {
  color: var(--fg-2);
  letter-spacing: 0.18em;
  font-size: 10px;
}

/* Empty state — pre-launch hero */
.podium-empty {
  padding: 8px 0 6px;
}
.podium-empty .headline {
  font-family: "Anton", "DM Sans", sans-serif;
  font-size: clamp(1.6rem, 5.4vw, 2.05rem);
  line-height: 1;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.podium-empty .headline em {
  font-style: italic;
  color: var(--clay);
  font-weight: 400;
}
.podium-empty .sub {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.4;
  margin: 0;
}

/* Live state — top 3 list */
.podium-list { display: flex; flex-direction: column; gap: 8px; }
.podium-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.podium-row:last-child { border-bottom: 0; }
.podium-row .rank {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: rgba(2, 19, 27, 0.06);
  color: var(--ink);
}
.podium-row.is-first .rank {
  background: var(--clay);
  color: #fff;
  box-shadow: 0 4px 12px rgba(250, 133, 79, 0.35);
}
.podium-row.is-second .rank {
  background: var(--blue);
  color: #fff;
}
.podium-row .team-name {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-row .pts {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.podium-row .pts .unit {
  font-size: 11px;
  color: var(--fg-2);
  font-weight: 600;
  margin-left: 3px;
}

.podium-cta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.02em;
}
.podium-cta .arrow { font-size: 18px; line-height: 1; }

/* === Action list — iOS-style tappable rows ============================== */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 14px rgba(2, 19, 27, 0.04);
  transition: transform 120ms ease, box-shadow 200ms ease;
}
.action-row:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(2, 19, 27, 0.06);
}
.action-row .action-content { flex: 1; min-width: 0; }
.action-row .action-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 2px;
}
.action-row .action-subtitle {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.35;
}
.action-row .action-arrow {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--fg-2);
  margin-left: 6px;
}

/* === Tucked sections — collapsible <details> ============================ */
.tuck {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(2, 19, 27, 0.04);
}
.tuck[open] { box-shadow: 0 8px 22px rgba(2, 19, 27, 0.06); }
.tuck > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.tuck > summary::-webkit-details-marker { display: none; }
.tuck > summary::marker { display: none; }
.tuck-state {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: 0.04em;
}
.tuck-caret {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg-2);
  transition: transform 200ms ease;
  display: inline-block;
  width: 14px;
  text-align: center;
  margin-left: auto;
}
/* When a tuck has both a state label AND a caret (e.g. Notifications),
   `.tuck-state` already takes the margin-left:auto so the caret is just
   the trailing element. The rule above also lets a caret-only summary
   (e.g. "Run into a snag?") right-align the caret without extra markup. */
.tuck-state ~ .tuck-caret { margin-left: 0; }

/* Nudge state — applied to the Notifications tuck when push is supported
   but the user hasn't subscribed yet. Pulsing clay dot before the state
   pill + clay-tinted text + soft halo on the card itself, so it gently
   pulls the eye without screaming. Auto-removes when the user opens the
   tuck (or once they subscribe). */
.tuck.is-nudge {
  border-color: rgba(250, 133, 79, 0.45);
  box-shadow: 0 0 0 1px rgba(250, 133, 79, 0.18), 0 8px 22px rgba(2, 19, 27, 0.06);
  animation: tuck-nudge-halo 2.4s ease-in-out infinite;
}
@keyframes tuck-nudge-halo {
  0%, 100% { box-shadow: 0 0 0 1px rgba(250, 133, 79, 0.18), 0 8px 22px rgba(2, 19, 27, 0.06); }
  50%      { box-shadow: 0 0 0 3px rgba(250, 133, 79, 0.22), 0 10px 26px rgba(2, 19, 27, 0.08); }
}
.tuck.is-nudge .tuck-state {
  color: var(--clay);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tuck.is-nudge .tuck-state::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clay);
  animation: tuck-nudge-dot 1.4s ease-in-out infinite;
}
@keyframes tuck-nudge-dot {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.45); opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .tuck.is-nudge,
  .tuck.is-nudge .tuck-state::before { animation: none; }
}
.tuck[open] .tuck-caret { transform: rotate(90deg); }
.tuck-body {
  padding: 6px 18px 18px;
  border-top: 1px solid var(--line);
}
.tuck-body p:first-child { margin-top: 12px; }

/* === Footer nav (placeholder until tab bar exists) ====================== */
.app-foot {
  text-align: center;
  font-size: 12px;
  color: var(--fg-2);
  padding: 24px 0;
}
