/* ---------- Daily reward (public/js/daily.js, src/daily.js) ----------
   The home card (.dash-daily, in the right column next to lesson + topic of the day) like the other home cards: a head
   (gift, title, "View all"), seven pips for the days of the running cycle – collected with a check, missed dashed and
   struck through, today in the accent ring, the days to come muted, day 7 in gold –, the member note and today's
   "Claim" or the countdown to the next one. A wide card (tablets: the home page in one column) puts pips, note and
   button in one row. "View all" opens the popup (.modal-daily): the seven days as flat tiles in four columns, day 7
   twice as wide with the amphora (three columns on a very small phone). The gold dot after the name in the logo while
   today's reward waits; the guest line on the start page. Everything that moves stops with prefers-reduced-motion. */
.dash-daily { display: flex; flex-direction: column; container: dyc / inline-size; }
.dash-daily[hidden] { display: none; }
.dy-card { flex: 1; display: flex; flex-direction: column; }
.dash-daily .card-head h3 .ico, .dy-dlg h2 .ico { width: 20px; height: 20px; color: var(--gold); }
.dy-open { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; border-radius: 6px; }
.dy-open:hover { color: #fff; }
/* a card stretched to the height of lesson + topic: pips, note and action stay together in the middle */
.dy-cbody { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 16px 24px 18px; }
/* a very small phone: a long title ("Ricompensa del giorno") still fits next to "View all" */
@media (max-width: 400px) {
  .dash-daily .card-head { padding: 16px 18px; }
  .dash-daily .card-head h3 { font-size: 16px; }
  .dy-cbody { padding-inline: 18px; }
}

/* the pips: one per day of the cycle */
.dy-pips { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; gap: 6px; cursor: pointer; }
.dy-mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.dy-mark b { font-weight: 800; }
.dy-mark .ico { width: 16px; height: 16px; }
.dy-pip.claimed .dy-mark { background: rgba(53, 194, 165, .16); color: var(--ok); }
.dy-pip.missed .dy-mark { background: none; border: 1px dashed var(--surface-3); color: var(--faint); }
.dy-pip.missed .dy-mark b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.dy-pip.upcoming .dy-mark { color: var(--muted); }
.dy-pip.dy-big:not(.claimed) .dy-mark { background: rgba(244, 183, 64, .14); color: var(--gold); }
.dy-pip.dy-big.missed .dy-mark { background: none; color: var(--faint); }
.dy-pip.today .dy-mark { background: var(--accent-soft); color: #fff; box-shadow: inset 0 0 0 2px var(--accent-hi); }
.dy-pip.dy-big.today .dy-mark { color: var(--gold); }

/* the member note and the action */
.dy-note { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.dy-hint { color: var(--muted); font-weight: 600; }
a.dy-hint:hover, a.dy-hint:focus-visible { color: #fff; }
.dy-x2 { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 700; }
.dy-x2 .ico { width: 15px; height: 15px; color: var(--gold); }
.dy-claim { gap: 8px; }
.dy-btn-amt { display: inline-flex; align-items: center; gap: 4px; }
.dy-btn-amt .ico { width: 18px; height: 18px; }
/* the amount on the violet button: white, not the gold of the balances */
.dy-claim .dr-n { background: none; -webkit-text-fill-color: currentColor; color: inherit; }
.dy-claim.dy-busy { cursor: progress; opacity: .8; }
.dy-claim.dy-got { animation: dyPop .45s ease-out; }
.dy-next { display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.dy-next .ico { width: 16px; height: 16px; }
.dy-next b { color: #fff; font-weight: 800; font-variant-numeric: tabular-nums; }
.dy-next:focus { outline: none; }
.dy-next:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* while the first state loads: the card at its size, in grey */
.dy-skel { cursor: default; }
.dy-skel .dy-pips { cursor: default; }
.dy-skel .dy-mark { background: var(--surface-2); }
.dy-skel-line { display: block; width: 46%; height: 10px; margin: 3px 0 4px; border-radius: 99px; background: var(--surface-2); }
.dy-skel-btn { display: block; height: 36px; border-radius: var(--r-sm); background: var(--surface-2); }

/* a wide card (tablets): pips with the note under them, the action beside */
@container dyc (min-width: 560px) {
  .dy-cbody { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, 240px); align-items: center; gap: 8px 24px; padding: 18px 24px; }
  .dy-pips { grid-column: 1; grid-row: 1; justify-content: flex-start; gap: 10px; }
  .dy-note { grid-column: 1; grid-row: 2; margin: 0; }
  .dy-cact { grid-column: 3; grid-row: 1 / span 2; }
}

/* ---------- the popup: the whole week ---------- */
.modal-daily .dy-dlg { gap: 16px; container: dyd / inline-size; }
.dy-dlg h2 { display: flex; align-items: center; gap: 10px; }
.dy-sub { margin-top: -6px; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.dy-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dy-day { display: flex; min-width: 0; }
.dy-in { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 96px; padding: 10px 4px; border-radius: 10px; background: var(--surface-2); }
.dy-n { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.dy-art { position: relative; height: 30px; display: grid; place-items: center; }
.dy-coins { display: inline-flex; align-items: flex-end; justify-content: center; }
.dy-coins .dr-ico { width: 24px; height: 24px; }
.dy-coins.n2 .dr-ico + .dr-ico { margin-inline-start: -11px; margin-bottom: 5px; }
.dy-coins.n3 .dr-ico + .dr-ico { margin-inline-start: -13px; }
.dy-coins.n3 .dr-ico:nth-child(2) { margin-bottom: 6px; }
.dy-amt { font-size: 17px; line-height: 1.1; }
.dy-amt .dr-n { font-size: inherit; }
/* collected: a check on the coins, like a stamp */
.dy-check { position: absolute; bottom: -3px; inset-inline-end: -11px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #062a22; box-shadow: 0 0 0 2px var(--surface-2); }
.dy-check .ico { width: 11px; height: 11px; }
.dy-big .dy-check { bottom: 0; inset-inline-end: -6px; width: 20px; height: 20px; }
.dy-day.claimed .dy-art > :not(.dy-check), .dy-day.claimed .dy-amt { opacity: .7; }
/* missed: gone for good */
.dy-day.missed .dy-in { background: none; border: 1px dashed var(--surface-3); }
.dy-day.missed .dy-n { color: var(--faint); }
.dy-day.missed .dy-art { filter: grayscale(1); opacity: .3; }
.dy-day.missed .dy-amt .dr-n { background: none; -webkit-text-fill-color: currentColor; color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
/* to come: muted – the coins, not the label (it stays readable) */
.dy-day.upcoming .dy-in { background: rgba(255, 255, 255, .025); box-shadow: inset 0 0 0 1px var(--surface-2); }
.dy-day.upcoming .dy-art { opacity: .45; }
.dy-day.upcoming .dy-amt { opacity: .75; }
/* today: the accent ring */
.dy-day.today .dy-in { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent-hi); }
.dy-day.today .dy-n { color: #fff; }
/* day 7: twice as wide, the amphora next to its amount */
.dy-day.dy-big { grid-column: span 2; }
.dy-big .dy-in { flex-direction: row; gap: 12px; box-shadow: inset 0 0 0 1px rgba(244, 183, 64, .3); }
.dy-big .dy-art { height: auto; }
.dy-amph { width: 46px; height: 53px; display: block; }
.dy-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.dy-big .dy-n { color: var(--gold); }
.dy-big .dy-amt { font-size: 22px; }
.dy-day.dy-big.upcoming .dy-in { box-shadow: inset 0 0 0 1px rgba(244, 183, 64, .3); }
.dy-day.dy-big.upcoming .dy-art { opacity: .75; }
.dy-day.dy-big.missed .dy-in { box-shadow: none; }
.dy-day.dy-big.missed .dy-n { color: var(--faint); }
.dy-day.dy-big.today .dy-in { box-shadow: inset 0 0 0 2px var(--accent-hi); }
.dy-act .btn { height: 48px; font-size: 16px; }
.dy-act .dy-next { height: 48px; font-size: 14.5px; }
.dy-dlg .dy-note { margin-top: 0; text-align: center; font-size: 13px; }
/* a very small phone: three columns, day 7 across the last row */
@container dyd (max-width: 290px) {
  .dy-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dy-day.dy-big { grid-column: span 3; }
}
@container dyd (max-width: 330px) {
  .dy-n { font-size: 10px; letter-spacing: .03em; }
  .dy-in { min-height: 88px; padding-inline: 2px; }
}
@media (max-width: 420px) {
  .modal-daily .dlg { padding: 26px 18px 20px; }
}

/* the day just collected: the check lands like a stamp */
.dy-stamp .dy-check, .dy-pip.dy-stamp .dy-mark .ico { animation: dyStamp .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes dyStamp { 0% { transform: scale(2.2); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1); } }
@keyframes dyPop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
/* the coins on their way to the balance */
.dy-fly { position: fixed; z-index: 300; width: 22px; height: 22px; pointer-events: none; }
.dy-fly .dr-ico { width: 22px; height: 22px; display: block; }

/* the gold dot on the home links while today's reward waits: after the name, apart from the logo's gold bubble */
.side-logo > span { position: relative; }
.side-logo.dy-dot > span::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg-side); top: -2px; inset-inline-end: -16px; animation: dyDot 2.4s ease-in-out infinite; }
@keyframes dyDot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* the start page for guests: one line about the daily reward */
.dy-guest { display: flex; align-items: center; gap: 10px; margin-top: 16px; max-width: 380px; padding: 9px 14px 9px 10px; border-radius: 12px; background: rgba(244, 183, 64, .08); box-shadow: inset 0 0 0 1px rgba(244, 183, 64, .22); color: var(--muted); font-size: 14px; line-height: 1.35; text-decoration: none; }
.dy-guest > .ico { flex: none; width: 22px; height: 22px; color: var(--gold); }
.dy-guest b { color: #ffd668; }
.dy-nb { white-space: nowrap; }
.dy-guest .dy-guest-go { margin-inline-start: auto; flex: none; display: inline-flex; align-items: center; gap: 2px; color: #fff; font-weight: 800; white-space: nowrap; }
.dy-guest .dy-guest-go .ico { width: 16px; height: 16px; }
.dy-guest:hover { background: rgba(244, 183, 64, .13); }
.dy-guest:hover .dy-guest-go { color: #ffd668; }

@media (prefers-reduced-motion: reduce) {
  .dy-claim.dy-got, .dy-stamp .dy-check, .dy-pip.dy-stamp .dy-mark .ico, .side-logo.dy-dot > span::after { animation: none; }
}
