:root {
  --bg: #e8ecef;
  --bg-deep: #dfe5ea;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --ink: #12151a;
  --muted: #5c6570;
  --line: rgba(18, 21, 26, 0.08);
  --line-strong: rgba(18, 21, 26, 0.14);
  --accent: #0f7a6c;
  --accent-soft: rgba(15, 122, 108, 0.1);
  --accent-ink: #ffffff;
  --ok: #1f8a5b;
  --warn: #a66b1f;
  --font-display: "Syne", sans-serif;
  --font-body: "Onest", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --topbar-h: 54px;
  --dock-h: 70px;
  --next-h: 56px;
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 48px;
  --max: 430px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-soft: 0 10px 28px rgba(18, 21, 26, 0.06);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body.sheet-open { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* —— Atmosphere: cool athletic plane, no glow orbs —— */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(165deg, #f3f6f8 0%, #e6ebef 42%, #dde4ea 100%);
}

.atmosphere__mesh {
  position: absolute;
  inset: 0;
  opacity: 0.9;
  background:
    radial-gradient(ellipse 90% 55% at 12% -8%, rgba(15, 122, 108, 0.12), transparent 58%),
    radial-gradient(ellipse 70% 50% at 100% 8%, rgba(70, 110, 150, 0.1), transparent 55%),
    repeating-linear-gradient(
      -18deg,
      transparent 0,
      transparent 11px,
      rgba(18, 21, 26, 0.015) 11px,
      rgba(18, 21, 26, 0.015) 12px
    );
}

.atmosphere__glow {
  display: none;
}

.atmosphere__vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 55%, rgba(214, 222, 230, 0.55) 100%);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(0.985); }
}

/* —— Login (brand-first) —— */
.login {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: calc(var(--safe-top) + 2.5rem) 1.5rem calc(var(--safe-bot) + 2.25rem);
}

.login__stage {
  width: min(100%, var(--max));
  animation: rise 0.65s var(--ease) both;
}

.login__kicker {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.login__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.1rem, 14vw, 4.2rem);
  letter-spacing: -0.01em;
  line-height: 0.92;
  color: var(--ink);
  max-width: 100%;
}

.login__lead {
  margin: 1.05rem 0 0;
  max-width: 17rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
}

.login__cta {
  margin-top: 2.1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  max-width: 20rem;
}

.login__google {
  min-height: 48px;
  display: flex;
  align-items: center;
}

.login__google > div {
  width: 100% !important;
}

.login__status {
  margin: 1rem 0 0;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.84rem;
}

/* —— App shell —— */
.app {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + var(--topbar-h) + 0.35rem)
    1.15rem
    calc(var(--safe-bot) + var(--dock-h) + 1.1rem);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), padding-bottom 0.2s ease;
}

.app.has-next {
  padding-bottom: calc(var(--safe-bot) + var(--dock-h) + var(--next-h) + 1.25rem);
}

.app.is-ready {
  opacity: 1;
  transform: none;
}

.app[hidden],
.login[hidden],
.view[hidden],
.dock[hidden] {
  display: none !important;
}

/* —— Top bar —— */
.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--max));
  height: calc(var(--safe-top) + var(--topbar-h));
  padding: var(--safe-top) 1.15rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  background: linear-gradient(180deg, rgba(232, 236, 239, 0.94) 40%, rgba(232, 236, 239, 0.55) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand--btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.brand__mark {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 3px;
  background: var(--accent);
  transform: rotate(14deg);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.btn-text {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  padding: 0.4rem 0;
}

.eyebrow {
  margin: 0 0 0.28rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.btn--block { width: 100%; }

/* —— Sets —— */
.sets-head {
  padding: 0.15rem 0 1.1rem;
  animation: rise 0.5s var(--ease) both;
}

.sets-head__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sets-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.sets-head__clock {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sets-head__clock time:first-child {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: capitalize;
}

.sets-head__clock time:last-child {
  display: block;
  margin-top: 0.12rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.sets-head__sub {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.catalog-filters {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
}

.filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.1rem;
}

.filter-row::-webkit-scrollbar { display: none; }
.filter-row[hidden] { display: none !important; }

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: rgba(15, 122, 108, 0.35);
  color: var(--accent);
}

.chip--tag.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip:active { transform: scale(0.97); }

.sets-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sets-empty {
  margin: 2rem 0;
  text-align: center;
  color: var(--muted);
}

.set-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1.05rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, transform 0.15s var(--ease), box-shadow 0.2s ease;
  animation: rise 0.4s var(--ease) both;
}

.set-card:nth-child(2) { animation-delay: 0.04s; }
.set-card:nth-child(3) { animation-delay: 0.08s; }

.set-card:active { transform: scale(0.985); }
.set-card:hover,
.set-card:focus-visible {
  border-color: rgba(15, 122, 108, 0.38);
  box-shadow: 0 12px 30px rgba(18, 21, 26, 0.08);
  outline: none;
}

.set-card__path {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.35;
}

.set-card__sep {
  display: inline-block;
  margin: 0 0.28rem;
  opacity: 0.55;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

.set-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.set-card__tag {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--muted);
  padding: 0.12rem 0.45rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.set-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.set-card__load {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  margin-top: 0.1rem;
}

.set-card__kg {
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.set-card__dur {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.set-card__meta {
  font-size: 0.76rem;
  font-weight: 500;
  color: #6b7380;
  line-height: 1.3;
}

/* Guest name sheet */
.name-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.name-sheet[hidden] { display: none !important; }

.name-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 26, 0.4);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.name-sheet__panel {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max));
  margin: 0;
  padding: 1.15rem 1.2rem calc(var(--safe-bot) + 1.25rem);
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(18, 21, 26, 0.12);
  transform: translateY(108%);
  transition: transform 0.32s var(--ease);
}

.name-sheet.is-open .name-sheet__backdrop { opacity: 1; }
.name-sheet.is-open .name-sheet__panel { transform: translateY(0); }

.name-sheet__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.name-sheet__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.name-sheet__lead {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.name-sheet__field { margin: 1.1rem 0 0.85rem; }

.name-sheet__cancel {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  text-align: center;
  color: var(--muted);
}

/* —— Workout session —— */
.session-head {
  padding: 0.1rem 0 0.8rem;
  animation: rise 0.45s var(--ease) both;
}

.link-back {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0;
  margin: 0 0 0.8rem;
  cursor: pointer;
}

.link-back::before {
  content: "‹ ";
  font-size: 1.15em;
}

.session-head__now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}

.session-head__date {
  margin: 0;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 550;
  text-transform: capitalize;
  font-variant-numeric: tabular-nums;
}

.session-head__time {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.session-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 7vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.session-head__sub {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.session-head__hint {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--warn);
}

.session-head__hint:empty,
.session-head__hint[hidden] { display: none; }

.session-head__bar { margin-top: 0.95rem; }

.session-head__free {
  margin: 0.5rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.progress__track {
  height: 3px;
  border-radius: 4px;
  background: rgba(18, 21, 26, 0.08);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b6358, var(--accent));
  transition: width 0.35s var(--ease);
}

.progress__text {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.notes-fold {
  margin: 0.1rem 0 1.25rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.notes-fold summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.notes-fold summary::-webkit-details-marker { display: none; }
.notes-fold[open] summary { color: var(--accent); }

.notes-fold p {
  margin: 0 0 0.9rem;
  color: #3d4550;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* —— Blocks / exercises —— */
.blocks {
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
}

.block__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.block__eyebrow {
  margin: 0 0 0.12rem;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.block__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.block__time {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.block__list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ex-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ex-card.is-focused {
  border-color: rgba(15, 122, 108, 0.4);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-soft);
}

.ex-card.is-complete { border-color: rgba(31, 138, 91, 0.35); }
.ex-card.is-complete .ex-card__name { color: var(--ok); }
.ex-card.is-pulse { animation: pulseSoft 0.4s var(--ease); }

.ex-card--linked { border-left: 3px solid var(--accent); }

.ex-card__main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  width: 100%;
  padding: 0.95rem 1rem 0.45rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ex-card__main:active { opacity: 0.88; }

.ex-card__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.18rem;
}

.ex-card__name {
  display: block;
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.25;
}

.ex-card__detail {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.ex-card__short {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.84rem;
  color: #6a727d;
  line-height: 1.35;
}

.ex-card__badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.ex-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.12rem;
}

.ex-card__load {
  color: var(--ink);
  font-weight: 650;
}

.ex-card__actions { padding: 0 0.85rem 0.9rem; }

.set-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.set-dot {
  width: var(--tap);
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.set-dot span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
}

.set-dot.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.set-dot:active { transform: scale(0.94); }

.set-dots--xl .set-dot {
  width: 56px;
  height: 56px;
  border-radius: 15px;
}

/* —— Dock / tabbar —— */
.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--max));
  z-index: 45;
  padding: 0 0.85rem calc(var(--safe-bot) + 0.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

.dock > * { pointer-events: auto; }

.dock__next[hidden] { display: none !important; }

.dock__next {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: var(--next-h);
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(15, 122, 108, 0.28);
  transition: transform 0.15s ease;
}

.dock__next:active { transform: scale(0.98); }

.dock__next-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
}

.dock__next-detail {
  font-size: 0.74rem;
  opacity: 0.85;
  margin-top: 0.04rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(18, 21, 26, 0.08);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.tabbar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tabbar__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.tabbar__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tabbar__glyph {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1.5px solid currentColor;
}

.tabbar__glyph--dot {
  border-radius: 50%;
  background: currentColor;
  border: 0;
  width: 7px;
  height: 7px;
}

.tabbar__glyph--list {
  width: 12px;
  height: 2px;
  border: 0;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 -4px 0 currentColor, 0 4px 0 currentColor;
}

/* —— History —— */
.history-head { padding: 0.15rem 0 1rem; }

.history-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.history-head__sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.history-empty {
  padding: 2.4rem 0.5rem;
  text-align: center;
}

.history-empty__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.history-empty__sub {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.history-day__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.history-day__date {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: capitalize;
}

.history-day__count {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.history-day__ring {
  --p: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--bg) 58%, transparent 59%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(18, 21, 26, 0.08) 0);
  font-size: 0.66rem;
  font-weight: 700;
}

.history-day__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.history-item {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem 0.75rem 0;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.history-item__bar {
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(
    180deg,
    var(--accent) 0%,
    var(--accent) var(--fill, 0%),
    rgba(18, 21, 26, 0.08) var(--fill, 0%)
  );
}

.history-item__name {
  margin: 0;
  font-weight: 650;
  font-size: 0.94rem;
}

.history-item__meta {
  margin: 0.18rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.history-item__dots {
  display: flex;
  gap: 0.26rem;
  margin-top: 0.4rem;
}

.history-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(18, 21, 26, 0.12);
}

.history-item__dot.is-on { background: var(--accent); }

/* —— Sheet —— */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] { display: none !important; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 26, 0.38);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet__panel {
  position: relative;
  width: min(100%, var(--max));
  max-height: min(90dvh, 740px);
  overflow: auto;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 0.4rem 1.15rem calc(var(--safe-bot) + 1.3rem);
  transform: translateY(110%);
  transition: transform 0.38s var(--ease);
  z-index: 1;
  box-shadow: 0 -12px 40px rgba(18, 21, 26, 0.12);
}

.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: translateY(0); }

.sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: rgba(18, 21, 26, 0.16);
  margin: 0.35rem auto 0.85rem;
}

.sheet__eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.sheet__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  padding-right: 2.2rem;
}

.sheet__detail {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sheet__full {
  margin: 0.95rem 0 0;
  color: #3d4550;
  font-size: 0.94rem;
  line-height: 1.55;
}

.sheet__cue {
  margin: 0.6rem 0 0;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 550;
}

.sheet__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1.1rem 0 0.85rem;
}

.sheet__fields .field:last-child { grid-column: 1 / -1; }
.sheet__sets { margin-bottom: 0.95rem; }

.sheet__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  position: relative;
}

.field__label {
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__input {
  width: 100%;
  min-height: 50px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
}

.field__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.field__unit {
  position: absolute;
  right: 0.75rem;
  bottom: 0.9rem;
  font-size: 0.74rem;
  color: var(--muted);
  pointer-events: none;
}

.field:has(.field__unit) .field__input { padding-right: 2.5rem; }

.boot-status {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bot) + 7.5rem);
  transform: translateX(-50%);
  margin: 0;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--muted);
  z-index: 30;
}

.boot-status:empty { display: none; }

@media (min-width: 720px) {
  :root { --max: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .app { opacity: 1; transform: none; }
  .sheet__panel { transform: none; }
}
