/* Weekly recap screen (T-015 / R-012) - design/v3/parts/WeeklyRecap.html.

   Screen-local rules only: every colour, radius, font and control class comes
   from web/css/tokens.css + web/css/components.css (.card/.btn/.iconbtn/.art/
   .eyebrow/.num/.display/.tiny/.small/.muted/.good/.bad/.skeleton). Nothing here
   redefines a token or a component class.

   The recap card is a single bordered block with three bands - a GOLD header, a
   hairline 2x2 stat grid and a lower detail block - because the whole card is
   also what the canvas export redraws at 1080x1350: keeping it one visual object
   is what makes the exported PNG recognisably the same thing the screen shows.

   Type floor (R-002/R-005): 11px ONLY on the uppercase .eyebrow labels; every
   other line is .small (12px) or larger, which is why this screen uses .small
   and not .tiny for the sub-lines the artboard draws at 11px. Every figure is
   tabular (.num/.display/.tnum). */

#tab-recap .screen-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- week picker ---------- */

.recap-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recap-picker .iconbtn:disabled {
  opacity: .4;
  cursor: default;
}

.recap-week {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.recap-week-label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.recap-week-sub { letter-spacing: .04em; }

/* ---------- the card ---------- */

.recap-card {
  border: 1px solid var(--line-2);
  border-radius: 20px;
  overflow: hidden;
  background: var(--s1);
  display: flex;
  flex-direction: column;
}

/* The loading and error states have no gold band, so the card itself supplies
   the padding those two need (the empty-WEEK state keeps the gold band and
   renders its message inside .recap-lower, which is padded already). */
.recap-card.recap-plain { padding: 16px; }

.recap-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recap-skel-a { height: 22px; width: 60%; }
.recap-skel-b { height: 14px; width: 85%; }

/* ---------- gold header ---------- */

.recap-head {
  background: var(--gold);
  color: var(--gold-ink);
  padding: 18px 20px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.recap-head-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* .eyebrow is ink-3 by default; on gold it has to be dark to stay legible. */
.recap-head-eyebrow { color: rgba(26, 18, 0, .72); }

.recap-head-name {
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* F4-01: the demo cue on the card itself. The gold header is a dark-on-light
   surface, so the badge is drawn in the card's own ink rather than --bad on
   gold, which is where that pair fails contrast. */
.recap-demo {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(26, 18, 0, .82);
  color: var(--gold);
}

/* The player's own tag beside the name - lighter than the name, same line. */
.recap-head-tag { font-weight: 700; color: rgba(26, 18, 0, .6); }

.recap-net {
  font-size: 52px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.recap-head-sub {
  color: rgba(26, 18, 0, .78);
  font-weight: 700;
}

.recap-head-art {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  padding-bottom: 4px;
}

/* ---------- 2x2 stat grid ---------- */
/* 1px gap over a --line background = hairline rules without extra elements. */

.recap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.recap-stat {
  background: var(--s1);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.recap-stat-value { font-size: 26px; }

/* Sub-line under a figure: the delta arrow sits inline with its text. */
.recap-sub {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  line-height: 1.3;
}

/* ---------- lower block ---------- */

.recap-lower {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

.recap-deck {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recap-deck-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.recap-deck-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
}

.recap-deck-pct { font-size: 20px; }

/* The low-sample affordance: muted + italic, exactly like the Decks screen. */
.recap-low {
  color: var(--ink-3);
  font-style: italic;
}

.recap-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recap-pair-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Decorative badge, NOT a control - it deliberately does not use .iconbtn, whose
   44px box is a hit-target promise this static <span> does not keep. */
.recap-pair-icon {
  width: 28px;
  height: 34px;
  border-radius: 6px;
  background: var(--s2);
  border: 1px solid var(--line);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.recap-pair-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.recap-pair-value {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The sub-line of a pair cell ("+375 Trophy Road · 12 games", "won 3 of 7 ·
   43%") lives in a half-width grid column that is ~150px wide on a small
   phone. `.recap-sub` is an inline-flex, whose anonymous text item cannot be
   ellipsized, so these two clip to `block` first and then behave like
   `.recap-pair-value` above.

   This matters more since E1-02: the Best-day figure now carries its UNIT next
   to the number, which made the string longer. Overflowing the card would put
   that unit off-screen - which is the very failure the fix exists to remove -
   and ellipsis trims from the END, so the number and its unit are what survive
   a narrow screen; only the trailing games count is dropped. */
.recap-pair-meta .recap-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recap-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.recap-foot-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------- actions ---------- */

.recap-actions { display: flex; gap: 10px; }
.recap-action { flex: 1; min-width: 0; }
.recap-action-wide { flex: 1.3; }
.recap-action:disabled { opacity: .55; cursor: default; }

.recap-note { text-align: center; }

/* ---------- toast ---------- */

.recap-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  z-index: 150;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--s3);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  text-align: center;
}

.recap-toast-ok { border-color: var(--good); }
.recap-toast-bad { border-color: var(--bad); }

/* ---------- >=768: the card stops stretching ---------- */

@media (min-width: 768px) {
  .recap-card,
  .recap-picker,
  .recap-actions,
  .recap-note { max-width: 620px; width: 100%; }

  #tab-recap .screen-body { align-items: stretch; }

  .recap-net { font-size: 56px; }
}

@media (min-width: 1024px) {
  .recap-toast { bottom: 24px; }
}
