@font-face { font-family: 'HB Nunito'; src: url('../resources/fonts/nunito.woff2') format('woff2'); font-weight: 400 800; font-display: block; }

:root {
  --ink: #eef3f1;
  --glow: #2ec4a6;
  --ground: #121718;
  --ground-alpha: 1;

  /* task colour by value, worst to best */
  --t-ember: #e5484d;
  --t-rust: #f2774b;
  --t-amber: #f5a524;
  --t-sand: #e3cf6a;
  --t-moss: #4cc38a;
  --t-sea: #3eb6d8;
  --t-deep: #5b8cff;

  --pad: 28px;
  --txt: 30px;
  --meta: 20px;
  --big: 92px;
  --tick: 46px;
  --line: color-mix(in srgb, var(--ink) 9%, transparent);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: transparent; }
body { color: var(--ink); font: 600 var(--txt)/1.22 'HB Nunito', 'Segoe UI', system-ui, sans-serif; -webkit-font-smoothing: antialiased; user-select: none; }
[hidden] { display: none !important; }

.hb { position: relative; width: 100%; height: 100%; overflow: hidden; }
.hb-ground { position: absolute; inset: 0; background: var(--ground); opacity: var(--ground-alpha); }
.hb-frame { position: absolute; inset: 0; display: flex; gap: 34px; padding: 26px 30px 52px; min-width: 0; min-height: 0; }
.hb:not([data-state="content"]) .hb-frame { visibility: hidden; }

/* ---- hero: the day, the tally, the bars ---- */
.hb-hero { display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 0 0 auto; }
.hb-day { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--meta); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--glow); }
.hb-rest { color: var(--ink); opacity: 0.6; letter-spacing: 0.04em; text-transform: none; font-weight: 700; }
.hb-tally { display: flex; align-items: baseline; gap: 16px; margin-top: 8px; }
.hb-tally b { font-size: var(--big); font-weight: 800; line-height: 0.92; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hb-tally span { font-size: 26px; font-weight: 700; opacity: 0.72; }
.hb-stats { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.hb-bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: var(--meta); }
.hb-bar-name { font-weight: 800; opacity: 0.7; letter-spacing: 0.06em; }
.hb-track { height: 12px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 6px; }
.is-hp .hb-fill { background: #ef5a5a; }
.is-xp .hb-fill { background: #f2b33d; }
.is-mp .hb-fill { background: #4f9cf9; }
.hb-bar-num { font-variant-numeric: tabular-nums; opacity: 0.75; min-width: 92px; text-align: right; }
.hb-level { font-size: var(--meta); font-weight: 700; opacity: 0.7; white-space: pre; }

/* ---- lists ---- */
.hb-lists { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; }
.hb-sec { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.hb-sec[data-off="1"] { display: none; }
.hb-sec h2 { display: flex; align-items: baseline; white-space: nowrap; margin: 0 0 4px; font-size: var(--meta); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.6; flex: 0 0 auto; }
.hb-sec h2 em { font-style: normal; letter-spacing: 0.02em; text-transform: none; margin-left: 10px; opacity: 0.85; }
.hb-sec h2 em.is-clear { color: var(--glow); opacity: 1; }
.hb-sec ul { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; overflow: hidden; }

.hb-row { display: flex; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.hb-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.hb-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-meta { display: flex; gap: 14px; font-size: var(--meta); font-weight: 600; opacity: 0.62; white-space: nowrap; overflow: hidden; }
.hb-undo { color: var(--glow); opacity: 1; font-weight: 800; }
.hb-row.is-waiting .hb-meta { opacity: 1; }
.hb-due.is-late { color: var(--t-rust); }

.hb-tick, .hb-step {
  flex: 0 0 auto; width: var(--tick); height: var(--tick); padding: 0; cursor: pointer; position: relative;
  border: 3px solid var(--tint, var(--t-sand)); background: color-mix(in srgb, var(--tint, var(--t-sand)) 16%, transparent); color: var(--ink);
}
.hb-tick { border-radius: 12px; }
.hb-step { border-radius: 50%; font: 800 34px/1 'HB Nunito', system-ui, sans-serif; display: flex; align-items: center; justify-content: center; }
.hb-tick:disabled, .hb-step:disabled { cursor: default; opacity: 0.55; }
.is-done .hb-tick { background: var(--tint, var(--t-sand)); }
.is-done .hb-tick::after {
  content: ''; position: absolute; left: 50%; top: 45%; width: 11px; height: 21px; transform: translate(-50%, -50%) rotate(45deg);
  border: solid var(--ground); border-width: 0 5px 5px 0;
}
.is-done .hb-text { opacity: 0.45; text-decoration: line-through; text-decoration-thickness: 2px; }
.is-waiting .hb-tick, .is-waiting .hb-step { outline: 4px solid var(--glow); outline-offset: -4px; animation: hb-wait 1s ease-in-out infinite alternate; }
@keyframes hb-wait { from { outline-color: var(--glow); } to { outline-color: transparent; } }

.t-ember { --tint: var(--t-ember); } .t-rust { --tint: var(--t-rust); } .t-amber { --tint: var(--t-amber); }
.t-sand { --tint: var(--t-sand); } .t-moss { --tint: var(--t-moss); } .t-sea { --tint: var(--t-sea); } .t-deep { --tint: var(--t-deep); }

.hb-empty { font-size: 26px; opacity: 0.6; padding: 10px 0; }
.hb-sec h2 .hb-more { margin-left: auto; padding-left: 16px; letter-spacing: 0.04em; text-transform: none; }
.hb-step-gap { flex: 0 0 auto; width: var(--tick); height: var(--tick); }
.hb-sub { padding: 5px 0 5px 62px; gap: 14px; border-bottom: 0; }
.hb-sub .hb-tick { --tick: 34px; border-width: 3px; border-radius: 9px; }
.hb-sub .hb-text { font-size: 25px; font-weight: 600; }
.hb-sub.is-done .hb-tick::after { width: 8px; height: 16px; border-width: 0 4px 4px 0; }
.is-cut { display: none !important; }

/* ---- layouts ---- */
/* small slots: the tally beside the open Dailies, nothing else */
[data-layout="compact"] .hb-frame { flex-direction: row; gap: 30px; }
[data-layout="compact"] .hb-hero { width: 230px; }
[data-layout="compact"] .hb-tally { flex-direction: column; align-items: flex-start; gap: 4px; }
[data-layout="compact"] .hb-stats, [data-layout="compact"] #sec-habits, [data-layout="compact"] #sec-todos, [data-layout="compact"] .hb-rest { display: none !important; }
[data-layout="compact"] .hb-lists { display: flex; flex-direction: column; }
[data-layout="compact"] #sec-dailies { flex: 1 1 auto; }

/* medium and tall slots: hero on top, lists stacked */
[data-layout="stack"] .hb-frame { flex-direction: column; gap: 22px; }
[data-layout="stack"] .hb-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); grid-template-areas: "day stats" "tally stats"; column-gap: 30px; align-items: start; }
[data-layout="stack"] .hb-day { grid-area: day; }
[data-layout="stack"] .hb-tally { grid-area: tally; }
[data-layout="stack"] .hb-stats { grid-area: stats; }
[data-layout="stack"] .hb-tally { flex-wrap: wrap; }
[data-layout="stack"] .hb-lists { display: flex; flex-direction: column; gap: 18px; }
[data-layout="stack"] .hb-sec { flex: 0 0 auto; }

/* wide slots: hero column, then two or three list columns */
[data-layout="cols2"] .hb-hero, [data-layout="cols3"] .hb-hero { width: 380px; }
[data-layout="cols2"] .hb-stats, [data-layout="cols3"] .hb-stats { margin-top: auto; }
[data-layout="cols2"] .hb-tally, [data-layout="cols3"] .hb-tally { flex-direction: column; align-items: flex-start; gap: 6px; }
[data-layout="cols2"] .hb-lists { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); column-gap: 44px; row-gap: 18px; }
[data-layout="cols2"] #sec-dailies { grid-column: 1; grid-row: 1 / span 2; }
[data-layout="cols2"] #sec-habits { grid-column: 2; grid-row: 1; }
[data-layout="cols2"] #sec-todos { grid-column: 2; grid-row: 2; }
[data-layout="cols2"] .no-todos #sec-habits, [data-layout="cols2"] .no-habits #sec-todos { grid-row: 1 / span 2; }
[data-layout="cols2"] .no-habits.no-todos #sec-dailies { grid-column: 1 / -1; }
[data-layout="cols3"] .hb-lists { display: flex; gap: 48px; }
[data-layout="cols3"] .hb-sec { flex: 1 1 0; }
[data-layout="cols3"] #sec-dailies { flex-grow: 1.25; }

/* ---- foot and state card ---- */
.hb-foot { position: absolute; right: 30px; bottom: 14px; font-size: 18px; font-weight: 700; opacity: 0.5; white-space: nowrap; }
.hb-foot.is-warn { color: var(--t-amber); opacity: 1; }
.hb-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1100px, calc(100% - 80px));
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.hb-card b { font-size: 36px; font-weight: 800; color: var(--glow); }
.hb-card span { font-size: 24px; font-weight: 600; opacity: 0.78; line-height: 1.3; }
