/* ============================================================================
   DAILY GAMES LAB — run.css  ("Today's Games" 5-game runner)
   Styles for: home screen, weekly-difficulty ramp, per-challenge chrome,
   between-game score reveal, transitions, final scorecard.
   Built on base.css tokens. Mobile-first. No pinch/zoom assumptions.
   ============================================================================ */

/* ---- home screen ---- */
.home {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: 8px;
}

.home-hero {
  text-align: center;
  padding: 6px 0 2px;
}

.home-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 12px;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 9vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 12px;
}

.home-sub {
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto;
}

/* ---- weekly difficulty ramp (home + compact in chrome) ---- */
.ramp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 16px auto 0;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.ramp-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.ramp-label b {
  color: var(--ink);
  font-weight: 700;
}

.ramp-pips {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.ramp-pip {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--line);
  transition: background 0.3s var(--ease), transform 0.3s var(--ease-snap);
}

.ramp-pip.on {
  background: var(--accent);
}

.ramp-pip.now {
  transform: scale(1.18);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* compact ramp lives inside the run chrome header */
.ramp.compact {
  margin: 0;
  padding: 4px 8px;
  gap: 7px;
  background: transparent;
  border-color: transparent;
}

.ramp.compact .ramp-pip {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.ramp.compact .ramp-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

/* ---- CTA ---- */
.home-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.home-cta .btn-primary {
  font-size: 1.12rem;
  padding: 18px 36px;
  letter-spacing: -0.01em;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: color-mix(in oklab, var(--warn) 16%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--warn) 36%, var(--line));
  border-radius: var(--r-pill);
  padding: 7px 14px;
}

.streak-chip .flame { font-size: 0.95rem; line-height: 1; }
.streak-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.home-best {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* ---- completed-today state ---- */
.done-today {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.done-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 20px;
}

.done-today-badge .check { color: var(--good); font-size: 1.2rem; }

.countdown {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}
.countdown b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---- challenge teaser list ---- */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.challenge-list-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  padding: 0 4px;
  margin-bottom: 4px;
}

.challenge-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease-snap);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.challenge-item:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.challenge-item:active { transform: scale(0.98); }

.challenge-item-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  width: 16px;
  flex-shrink: 0;
}

.challenge-item-emoji {
  font-size: 1.4rem;
  line-height: 1;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.challenge-item-info { flex: 1; min-width: 0; }
.challenge-item-name { font-weight: 600; font-size: 0.95rem; color: var(--ink-dim); }
.challenge-item-blurb {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.challenge-item-action {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.6;
  flex-shrink: 0;
}

/* ---- per-challenge chrome ---- */
.run-chrome { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

.run-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.run-progress-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

.run-challenge-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.run-challenge-emoji { font-size: 1.6rem; line-height: 1; }
.run-challenge-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.run-challenge-header .ramp { margin-left: auto; }

/* ---- progress dots (for the run) ---- */
.run-dots { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.run-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
  transition: background 0.3s, transform 0.3s var(--ease-snap);
}
.run-dot.active { background: var(--accent); transform: scale(1.3); }
.run-dot.done { background: var(--accent); opacity: 0.35; }
.run-dot.failed { background: var(--bad); opacity: 0.45; }

/* ---- challenge host container ---- */
.challenge-host {
  min-height: 220px;
  animation: challengeIn 0.35s var(--ease) both;
}
@keyframes challengeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---- between-game score reveal (interstitial) ---- */
.reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px;
  text-align: center;
  animation: pop 0.4s var(--ease-snap) both;
}
.reveal-cell { font-size: 4.2rem; line-height: 1; }
.reveal-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-dim);
}
.reveal-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.reveal-detail {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

/* ---- transition overlay ---- */
.run-transition {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.run-transition.show { opacity: 1; pointer-events: auto; }

/* ---- solo play done bar ---- */
.solo-done-bar {
  margin-top: 22px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  animation: fadeUp 0.4s var(--ease) both;
}
.solo-done-info { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-dim); }
.solo-done-cell { font-size: 1.4rem; line-height: 1; }
.solo-done-score { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
.solo-done-actions { display: flex; gap: 8px; flex-shrink: 0; }
.solo-done-actions .btn { padding: 9px 14px; font-size: 0.85rem; }

/* ---- error / skip card ---- */
.run-error-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: center;
}
.run-error-card p { color: var(--ink-dim); font-size: 0.9rem; margin-bottom: 14px; }

/* ---- scorecard ---- */
.scard {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  animation: fadeUp 0.45s var(--ease) both;
}
.scard.scard-best {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn), 0 18px 50px -24px color-mix(in oklab, var(--warn) 55%, transparent);
}

/* header */
.scard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scard-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.scard-avatar {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.5rem;
  background: color-mix(in oklab, var(--accent) 22%, var(--surface-2));
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
}
.scard-idtext { min-width: 0; }
.scard-name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--ink); line-height: 1.1; }
.scard-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 10px;
}
.scard-ptswrap { text-align: right; flex: none; }
.scard-pts {
  font-family: var(--font-mono); font-weight: 800; font-size: 1.05rem;
  color: color-mix(in oklab, var(--accent) 78%, white);
  background: color-mix(in oklab, var(--accent) 20%, var(--surface-2));
  border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  border-radius: var(--r-lg); padding: 8px 14px; display: inline-block; white-space: nowrap;
}
.scard-time { font-family: var(--font-mono); font-size: 0.66rem; color: var(--ink-faint); margin-top: 6px; letter-spacing: 0.04em; }

/* per-game tile grid */
.scard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scard-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 80px; padding: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  animation: fadeUp 0.4s var(--ease) both;
}
.scard-tile.is-skip { opacity: 0.5; }
.scard-tile-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.scard-tile-emoji { font-size: 1.05rem; flex: none; line-height: 1; }
.scard-tile-name {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scard-tile-score {
  text-align: center;
  font-family: var(--font-mono); font-weight: 800; font-size: 1.55rem; line-height: 1;
  color: var(--warn); font-variant-numeric: tabular-nums;
  background: color-mix(in oklab, var(--bg) 55%, #000);
  border-radius: 10px; padding: 9px 6px;
}

/* footer + actions */
.scard-foot { text-align: center; margin-top: 2px; }
.scard-grade { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: var(--accent); }
.scard-pb { color: var(--good); font-size: 0.9rem; }
.scard-bestnote { color: var(--ink-faint); font-size: 0.85rem; font-weight: 600; }
.scard-streak { font-size: 0.8rem; color: var(--ink-dim); margin-top: 5px; }

.scard-actions { display: flex; gap: 10px; margin-top: 2px; }
.scard-actions .btn { flex: 1; }
@media (max-width: 400px) { .scard-actions { flex-direction: column; } }

/* ---- kids corner (link to toddler page) ---- */
.home-kids {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  margin-top: -8px;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(120deg,
    color-mix(in oklab, #ff8fab 22%, var(--surface)),
    color-mix(in oklab, #7cd4ff 22%, var(--surface)));
  border: 1px solid color-mix(in oklab, #ff8fab 32%, var(--line));
  transition: transform 0.12s var(--ease-snap), border-color 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.home-kids:hover {
  border-color: color-mix(in oklab, #ff8fab 55%, var(--line));
  box-shadow: 0 6px 22px color-mix(in oklab, #ff8fab 20%, transparent);
}
.home-kids:active { transform: scale(0.985); }
.home-kids-emoji { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.home-kids-info { flex: 1; min-width: 0; }
.home-kids-title { font-family: var(--font-display); font-weight: 800; font-size: 1rem; letter-spacing: -0.01em; }
.home-kids-sub { font-size: 0.78rem; color: var(--ink-dim); margin-top: 2px; }
.home-kids-action { font-size: 1.4rem; color: color-mix(in oklab, #ff5d8f 70%, var(--ink)); flex-shrink: 0; }
