/* Daily habits (design: Claude Design "Daily Habits"): one streak, freezes and three daily quests.
   The streak's card on Today (habits/_card), its pill in the menu, the top bar and the account menu, the streak
   details (a dialog; a bottom sheet on a phone) and the class roster's day. Colors are the language's theme. */

/* ---------- Today: the plan with the card beside it (under it on a phone) ---------- */
.today__habits { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) {
  .today__habits { grid-template-columns: minmax(0, 1.12fr) minmax(330px, 1fr); }
}

/* ---------- The card ---------- */
.habits { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; border-radius: 22px; }
.habits__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.habits__streak { display: flex; align-items: center; gap: 12px; min-width: 0; }
.habits__flame {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--sand); color: var(--text-muted);
}
.habits__flame .icon { width: 28px; height: 28px; }
.habits.is-kept .habits__flame { background: var(--peach); color: var(--ink); }
.habits.is-kept .habits__flame .icon { fill: var(--peach); }
.habits__count { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.habits__title { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-weight: 400; }
.habits__num { font-family: var(--font-serif); font-size: 46px; line-height: 1; }
.habits__num--none { font-size: 34px; }
.habits__num-label { font-size: 15px; font-weight: 700; }
.habits__state { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.habits__state.is-kept { color: var(--green); }

.habits__freezes {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  padding-inline-start: 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--sand); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.habits__freezes:hover { background: var(--sand-hover); text-decoration: none; color: var(--ink); }
.habits__shield { display: inline-flex; color: var(--text-muted); }
.habits__shield .icon { width: 20px; height: 20px; }
.habits__freezes.has-freezes .habits__shield { color: var(--clay); }
.habits__freezes.has-freezes .habits__shield .icon { fill: var(--clay-soft); }

/* One line of news: all done, a freeze earned or used, a streak ended, the first day. */
.habits__banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--sand); }
.habits__banner-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; background: var(--card); color: var(--ink);
}
.habits__banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; line-height: 1.45; }
.habits__banner-text strong { font-size: 15px; line-height: 1.35; }
.habits__banner--all { background: var(--green-soft); }
.habits__banner--all .habits__banner-icon { background: var(--green); color: var(--text-on-accent); }
.habits__banner--earned { background: var(--mark); }
.habits__banner--earned .habits__banner-icon,
.habits__banner--used .habits__banner-icon { background: var(--clay); color: var(--text-on-accent); }
.habits__banner--used { background: var(--clay-soft); }

/* The quests. */
.habits__quests { display: flex; flex-direction: column; gap: 4px; }
.habits__quests-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.habits__quests-title { margin: 0; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); font-weight: 800; }
.habits__quests-done { font-size: 13px; font-weight: 700; }
.habits__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.habits__quest { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.habits__mark {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line-strong); color: var(--text-on-accent);
}
.habits__quest.is-done .habits__mark { background: var(--green); border: 2px solid var(--green); }
.habits__quest-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.habits__quest-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.habits__quest.is-done .habits__quest-title { font-weight: 500; color: var(--text-muted); }
.habits__quest-progress { display: flex; align-items: center; gap: 8px; }
.habits__bar { flex: 1; max-width: 180px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.habits__bar > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.habits__quest-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.habits__start {
  flex-shrink: 0; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer;
}
.habits__start:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.habits__start-form { flex-shrink: 0; margin: 0; }

/* Toward the next freeze, the minutes goal, the details. */
.habits__foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 12px;
}
.habits__toward { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.4; min-width: 0; }
.habits__dots { display: flex; gap: 4px; flex-shrink: 0; }
.habits__dots > span { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line-strong); }
.habits__dots > .is-on { background: var(--clay); border-color: var(--clay); }
.habits__meta { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 13px; }
.habits__minutes { color: var(--text-muted); }
.habits__change { color: var(--text-muted); text-decoration: underline; }
.habits__details { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ink); text-decoration: underline; }

/* Motion: the ticks settle when all three are done; the shield glints once for a freeze earned. */
@keyframes habits-tick { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes habits-glint {
  0% { filter: brightness(1); transform: rotate(0); }
  50% { filter: brightness(1.5); transform: rotate(-8deg); }
  100% { filter: brightness(1); transform: rotate(0); }
}
.habits:has(.habits__banner--all) .habits__quest.is-done .habits__mark svg { animation: habits-tick .28s ease-out both; }
.habits__freezes.is-earned .habits__shield { animation: habits-glint .3s ease-out .2s both; }
@media (prefers-reduced-motion: reduce) {
  .habits .habits__mark svg, .habits__freezes .habits__shield { animation: none !important; }
}

@media (max-width: 640px) {
  .habits { padding: 16px; gap: 14px; }
  .habits__num { font-size: 40px; }
}

/* ---------- The pill in the menu ---------- */
.streak-pill {
  display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--ink-raised); border: 1px solid var(--ink-line); color: var(--text-on-dark); text-decoration: none;
}
.streak-pill:hover { border-color: var(--ink-line-strong); text-decoration: none; color: var(--text-on-dark); }
.streak-pill__top { display: flex; align-items: center; gap: 10px; }
.streak-pill__flame {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .1);
}
.streak-pill.is-kept .streak-pill__flame { background: var(--peach); color: var(--ink); }
.streak-pill.is-kept .streak-pill__flame .icon { fill: var(--peach); }
.streak-pill__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.streak-pill__days { font-size: 12px; font-weight: 600; }
.streak-pill__n { font-size: 17px; font-weight: 800; }
.streak-pill__state { font-size: 11px; line-height: 1.3; color: var(--text-on-dark-muted); }
.streak-pill__freezes { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--peach); }
.streak-pill__freezes .icon { width: 15px; height: 15px; }
.streak-pill__goal { display: flex; align-items: center; gap: 8px; }
.streak-pill__bar { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.streak-pill__bar > span { display: block; height: 100%; background: var(--green-bright); }
.streak-pill__min { font-size: 11px; color: var(--text-on-dark-muted); white-space: nowrap; }

/* Collapsed sidebar: the flame and the days. */
.streak-mini {
  display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
  color: var(--peach); font-family: var(--font-serif); font-size: 22px; text-decoration: none;
}
.streak-mini > span { display: inline-flex; align-items: center; gap: 2px; }
.streak-mini .icon { width: 16px; height: 16px; }
.streak-mini.is-kept .icon { fill: var(--peach); }
.streak-mini:hover { text-decoration: none; color: var(--peach); }

/* The phone's top bar. */
.topbar-streak {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--ink-line-strong); background: var(--ink-raised);
  color: var(--text-on-dark); font-size: 15px; font-weight: 700; text-decoration: none;
}
.topbar-streak:hover { color: var(--text-on-dark); text-decoration: none; }
.topbar-streak .icon { width: 16px; height: 16px; }
.topbar-streak.is-kept .icon { color: var(--peach); fill: var(--peach); }
.topbar-streak__mark { font-size: 12px; color: var(--text-on-dark-muted); }
.topbar-streak.is-kept .topbar-streak__mark { color: var(--green-bright); }
.topbar-streak.is-frozen .topbar-streak__mark { color: var(--peach); }

/* The account menu's row. */
.account-menu__streak {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--sand); color: var(--ink); text-decoration: none;
}
.account-menu__streak:hover { background: var(--sand-hover); color: var(--ink); text-decoration: none; }
.account-menu__streak-flame { display: inline-flex; color: var(--clay); }
.account-menu__streak-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.account-menu__streak-text strong { font-size: 13px; }
.account-menu__streak-text span { font-size: 12px; color: var(--text-muted); }
.account-menu__streak-go { color: var(--text-muted); }
html[dir="rtl"] .account-menu__streak-go { transform: scaleX(-1); }

/* ---------- Streak details: a dialog, a bottom sheet on a phone ---------- */
.streak-sheet {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(620px, calc(100% - 32px)); max-width: none; max-height: calc(100vh - 32px); overflow: visible;
}
.streak-sheet::backdrop { background: rgba(0, 0, 0, .42); }
.streak-sheet__panel {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 24px 26px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-float);
}
.streak-sheet__grab { display: none; }
.streak-page { max-width: 680px; }

.streak-details { display: flex; flex-direction: column; gap: 16px; }
.streak-details__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.streak-details__title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 34px; line-height: 1.1; }
.streak-details__close {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--sand); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.streak-details__close:hover { background: var(--sand-hover); color: var(--ink); }
.streak-details__stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.streak-details__stats > div { display: flex; flex-direction: column-reverse; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--sand); }
.streak-details__stats dt { font-size: 12px; color: var(--text-muted); }
.streak-details__stats dd { margin: 0; font-family: var(--font-serif); font-size: 30px; line-height: 1.1; }
.streak-details__toward { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.streak-details__month { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.streak-details__month-name { margin: 0; font-size: 16px; font-weight: 700; }
.streak-details__nav {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; font-size: 16px;
}
.streak-details__nav:hover { background: var(--sand); color: var(--ink); text-decoration: none; }
.streak-details__nav.is-off { opacity: .4; }

.streak-cal { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 6px 6px; margin: -6px 0; }
.streak-cal th { font-size: 12px; font-weight: 700; color: var(--text-muted); padding-bottom: 2px; text-align: center; }
.streak-cal abbr { text-decoration: none; }
.streak-cal td { padding: 0; }
.streak-cal__day {
  height: 52px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; color: var(--ink); font-size: 13px; font-weight: 600; box-sizing: border-box;
}
.streak-cal__mark { font-size: 10px; line-height: 1; min-height: 10px; }
.streak-cal__day.is-kept { background: var(--green); color: var(--text-on-accent); }
.streak-cal__day.is-frozen { background: var(--clay-soft); border: 1.5px solid var(--clay); }
.streak-cal__day.is-missed { border: 1.5px dashed var(--line-strong); color: var(--text-muted); }
.streak-cal__day.is-today { border: 2.5px solid var(--ink); background: var(--card); font-weight: 800; }
.streak-cal__day.is-kept.is-today { background: var(--green); }
.streak-cal__day.is-future { color: var(--text-muted); opacity: .6; font-weight: 500; }
.streak-cal__day.is-none { color: var(--text-muted); font-weight: 500; }
.streak-details__legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.streak-details__legend li { display: inline-flex; align-items: center; gap: 6px; }
.streak-cal__day.is-legend { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }
.streak-cal__day.is-legend.is-today { border-width: 2px; }
.streak-details__how { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--sand); font-size: 13px; line-height: 1.55; }

@media (max-width: 640px) {
  .streak-sheet {
    width: 100%; max-height: 92vh; margin: auto 0 0; inset-inline: 0;
  }
  .streak-sheet__panel { border-radius: 28px 28px 0 0; padding: 10px 16px 24px; max-height: 92vh; border-bottom: 0; }
  .streak-sheet__grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 10px; }
  .streak-details__title { font-size: 28px; }
  .streak-details__stats { grid-template-columns: 1fr 1fr; }
  .streak-cal { border-spacing: 4px 4px; margin: -4px 0; }
  .streak-cal__day { height: 46px; }
}

/* ---------- The class roster: each student's day ---------- */
.roster-streak { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.roster-streak__mark {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
  border: 1.5px dashed var(--line-strong); color: var(--text-muted);
}
.roster-streak.is-kept { color: var(--green-deep); }
.roster-streak.is-kept .roster-streak__mark { background: var(--green); border: 1.5px solid var(--green); color: var(--text-on-accent); }
.roster-streak.is-frozen .roster-streak__mark { background: var(--clay-soft); border: 1.5px solid var(--clay); color: var(--ink); }
.roster-streak.is-new { color: var(--text-muted); font-weight: 500; }
.teach__quests, .teach__minutes { white-space: nowrap; }
.teach__roster-note { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
