:root {
  --font-display: "Rubik", Arial, sans-serif;
  --font-body: "Rubik", Arial, sans-serif;
  --font-accent: "PT Serif", Georgia, serif;
  --font-hero: "Rubik", Arial, sans-serif;

  /* Новая палитра */
  --color-lime: #DFFF00;
  --color-lime-hover: #C8E600;
  --color-lime-soft: #F1FFC2;
  --color-background: #F7F8F5;
  --color-surface: #FFFFFF;
  --color-border: #D9DDD7;
  --color-text-secondary: #646861;
  --color-text-primary: #161816;
  --color-black: #000000;
  --color-on-lime: #161816;

  /* Системные статусы (только ошибки / предупреждения / успех) */
  --color-success: #1F7A3A;
  --color-success-bg: #E5F6EA;
  --color-warning: #8A6A00;
  --color-warning-bg: #FFF4C2;
  --color-danger: #B42318;
  --color-danger-bg: #FCEBEA;
  --color-danger-text: #FFFFFF;

  /* Семантические алиасы — единый источник для всего CSS */
  --bg: var(--color-background);
  --bg-2: var(--color-background);
  --ink: var(--color-text-primary);
  --text: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --surface: var(--color-surface);
  --primary: var(--color-lime);
  --primary-soft: var(--color-lime-soft);
  --accent: var(--color-lime);
  --accent-soft: var(--color-lime-soft);
  --border: var(--color-border);
  --shadow: 0 14px 36px rgba(22, 24, 22, 0.08);
  --danger: var(--color-danger);
  --yellow: var(--color-warning);
  --yellow-bg: var(--color-warning-bg);
  --red-bg: var(--color-danger-bg);
  --radius: 22px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--color-lime) 55%, transparent);
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --pad-card: 24px;
  --gap-cards: 22px;
  --gap-controls: 12px;
  --gap-buttons: 16px;
  --stack-blocks: 28px;
  --illust-max: 42rem;
  --illust-height: 220px;
}

[data-theme="dark"] {
  --color-lime: #DFFF00;
  --color-lime-hover: #C8E600;
  --color-lime-soft: #2C3414;
  --color-background: #121412;
  --color-surface: #1C1E1C;
  --color-border: #3A3D3A;
  --color-text-secondary: #9A9E9A;
  --color-text-primary: #F2F4F2;
  --color-black: #000000;
  --color-on-lime: #161816;
  --color-success: #6FCF97;
  --color-success-bg: #1A2E22;
  --color-warning: #E8C984;
  --color-warning-bg: #3A3018;
  --color-danger: #F0B4B0;
  --color-danger-bg: #3A221F;
  --color-danger-text: #161816;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --focus: 0 0 0 3px color-mix(in srgb, var(--color-lime) 45%, transparent);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  background:
    radial-gradient(720px 380px at 100% -8%, color-mix(in srgb, var(--color-lime-soft) 70%, transparent), transparent 58%),
    var(--color-background);
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 8;
  opacity: 0.08;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

[data-theme="dark"] .grain {
  mix-blend-mode: overlay;
  opacity: 0.16;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-text-primary);
  text-decoration-color: color-mix(in srgb, var(--color-lime) 70%, var(--color-border));
}

a:hover {
  color: var(--color-black);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 60;
}

.skip-link:focus {
  left: 8px;
}

.kicker {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
  font-weight: 600;
  line-height: 1.45;
}

.demo-banner,
.demo-tag {
  background: var(--color-lime-soft);
  color: var(--color-text-primary);
  text-align: center;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
}

.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 10px 16px;
}

.demo-banner[hidden] {
  display: none !important;
}

.demo-banner p {
  margin: 0;
}

.demo-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.demo-cta {
  margin-top: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 32px;
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px 20px;
}

.logo {
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  flex-shrink: 0;
  justify-self: start;
}

.logo span {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}

.app-nav {
  display: flex;
  gap: 2px 6px;
  flex-wrap: wrap;
  margin: 0;
  justify-content: center;
}

.app-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}

.app-nav[hidden],
.app-nav a[hidden],
.admin-more-link[hidden],
#hero-register-btn[hidden],
#hero-primary-btn[hidden],
#home-close[hidden],
#home-register-wrap[hidden],
#hero-program-btn[hidden],
#hero-demo-btn[hidden],
.theme-icon[hidden] {
  display: none !important;
}

.app-nav a.is-active,
.app-nav a:hover {
  color: var(--color-text-primary);
  background: var(--color-lime-soft);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-self: end;
}

.account-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-cluster:empty {
  display: none;
}

.account-menu {
  position: relative;
}

.account-name {
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}

.account-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-name:hover,
.account-name.is-open,
.account-name.is-active {
  background: var(--color-lime-soft);
}

.account-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.account-name.is-open .account-caret {
  transform: rotate(180deg);
}

.account-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 232px;
  padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-menu-panel[hidden] {
  display: none !important;
}

.account-menu-panel a,
.account-menu-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: var(--color-text-primary);
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 40px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.account-menu-panel a:hover,
.account-menu-panel button:hover {
  background: var(--color-lime-soft);
}

.account-menu-panel button[data-action="logout"] {
  color: var(--color-danger);
  margin-top: 4px;
}

.account-cluster .btn-small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 14px;
}

.site-notice {
  background: var(--color-warning-bg);
  color: var(--color-text-primary);
  text-align: center;
  padding: 8px 14px;
  font-size: 14px;
}

.auth-card {
  max-width: 560px;
}

.auth-switch {
  margin-top: 18px;
}

.form-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.account-settings {
  margin-top: var(--stack-blocks);
}

.admin-search {
  display: grid;
  gap: 8px;
  font-weight: 600;
  margin: 8px 0 0;
}

.admin-search input {
  font-weight: 400;
  width: 100%;
  max-width: 28rem;
}

.admin-table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  vertical-align: top;
}

.admin-table th {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-user-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.admin-user-open:hover,
.admin-user-open:focus-visible {
  background: var(--color-lime-soft);
  border-color: var(--ink);
}

.admin-user-row.is-selected .admin-user-open {
  border-color: var(--ink);
  background: var(--primary-soft);
}

.safety-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2, var(--color-lime-soft));
  font-size: 13px;
}

.safety-chip.is-green {
  background: #e4f3e6;
  color: #1d5c2a;
}

.safety-chip.is-yellow {
  background: #f8efc8;
  color: #6a5208;
}

.safety-chip.is-red {
  background: #f8d9d4;
  color: #8a2b22;
}

.article-edit {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

#admin-user-detail {
  margin-top: 8px;
}

#theme-toggle.icon-btn {
  flex-shrink: 0;
  gap: 8px;
  padding-left: 14px;
  padding-right: 16px;
  background: #161816;
  color: #f7f8f5;
  border: 1px solid #161816;
  box-shadow: none;
}

#theme-toggle.icon-btn:hover {
  background: #000;
  color: #fff;
  border-color: #000;
}

html[data-theme="dark"] #theme-toggle.icon-btn {
  background: #dfff00;
  color: #161816;
  border-color: #dfff00;
}

html[data-theme="dark"] #theme-toggle.icon-btn:hover {
  background: #c8e600;
  color: #161816;
  border-color: #c8e600;
}

.theme-icon {
  display: block;
  flex-shrink: 0;
}

.page-hero {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-bottom: 24px;
}

.page-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--color-lime-soft);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 700;
}

.page-progress {
  width: min(320px, 100%);
  height: 10px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.page-progress > span {
  display: block;
  height: 100%;
  background: var(--color-lime);
  border-radius: inherit;
}

.material-featured {
  border-color: color-mix(in srgb, var(--color-lime) 55%, var(--color-border));
  background: color-mix(in srgb, var(--color-lime-soft) 70%, var(--color-surface));
}

#view-templates {
  display: none !important;
}

.icon-btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  background: var(--color-lime);
  color: var(--color-on-lime);
  transition:
    transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.22s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.btn:hover {
  background: var(--color-lime-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(22, 24, 22, 0.12);
}

.btn:active,
.icon-btn:active {
  transform: scale(0.96) translateY(0);
  box-shadow: 0 4px 12px rgba(22, 24, 22, 0.1);
}

.btn:focus-visible,
.icon-btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn:disabled,
.icon-btn:disabled,
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--color-border);
  color: var(--color-text-secondary);
}

.btn-ghost,
.icon-btn {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.btn-ghost:hover,
.icon-btn:hover {
  background: var(--color-lime-soft);
  border-color: color-mix(in srgb, var(--color-lime) 45%, var(--color-border));
}

.btn-light {
  background: var(--color-lime);
  color: var(--color-on-lime);
}

.btn-light:hover {
  background: var(--color-lime-hover);
}

.btn-small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-danger-text);
}

.btn-danger:hover {
  filter: brightness(0.95);
}

.segmented button.is-on {
  background: var(--color-lime);
  color: var(--color-on-lime);
  box-shadow: none;
}

.btn.is-on,
.status-row .is-on {
  background: var(--color-lime-soft);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-lime);
}

#main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px 48px;
}

.view:not(.home-view) {
  padding-top: 28px;
}

.legal h2 {
  margin-top: 1.35em;
}

.legal p,
.legal li {
  max-width: 40rem;
}

.view.is-entering {
  animation: view-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.view h1,
.view h2,
.view h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text-primary);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.view h1 {
  font-size: clamp(2.25rem, 4.5vw, 3.875rem);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
}

.view h2 {
  font-size: clamp(1.875rem, 3.2vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.view h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.lead {
  color: var(--muted);
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  max-width: 42rem;
}

.subtitle {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: clamp(1.25rem, 2vw, 1.625rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 16px;
  max-width: 36rem;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas:
    ". kicker"
    "photo title"
    "photo subtitle"
    "photo text";
  column-gap: clamp(32px, 4vw, 64px);
  row-gap: 0;
  align-items: start;
  padding-top: 44px;
  padding-bottom: 64px;
  animation: card-in 0.9s ease both;
}

.hero-kicker {
  grid-area: kicker;
  margin: 0 0 20px;
}

.hero-card > .hero-title {
  grid-area: title;
  margin: 0 0 26px;
  font-size: clamp(48px, 3.4vw, 62px);
  line-height: 1.03;
  font-weight: 600;
  letter-spacing: -0.035em;
  max-width: 7.4em;
  animation: none;
}

.hero-subtitle {
  grid-area: subtitle;
  margin: 0 0 26px;
  max-width: 40rem;
}

.hero-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.hero-lead {
  margin: 0 0 30px;
  font-size: 18px;
  line-height: 1.6;
  font-weight: 400;
  max-width: 620px;
}

.hero {
  grid-area: photo;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 0;
  border-radius: 28px;
  box-shadow: var(--shadow);
  position: relative;
  align-self: start;
  margin: 0;
}

.hero::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--color-surface) 70%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--color-lime) 32%, transparent);
  z-index: 1;
  pointer-events: none;
}

.hero img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: ken-burns 16s ease-in-out infinite alternate;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  margin-top: 0;
  width: 100%;
}

.hero-actions-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
}

.hero-actions .btn[hidden],
#continue-btn[hidden] {
  display: none !important;
}

.hero-demo-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text-primary);
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  min-height: auto;
  border-radius: 0;
}

.hero-demo-link::after {
  content: " →";
}

.hero-demo-link:hover {
  color: var(--color-black);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  transform: none;
  box-shadow: none;
}

.hero-demo-link:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

.hero-legal {
  margin: 2px 0 0;
  max-width: 36rem;
  font-size: 14px;
  line-height: 1.5;
}

.hero-legal a {
  color: inherit;
  text-underline-offset: 3px;
}

.how,
.home-block {
  margin-top: 0;
}

.home-block h2 {
  margin-bottom: 0;
}

.home-cards,
.home-contrast {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-cards);
  margin-top: var(--space-4);
}

.home-cards li,
.home-contrast li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.4rem 0.5rem 1.6rem 0.7rem;
  padding: 20px 18px 18px;
  display: grid;
  gap: 8px;
  min-height: 150px;
}

.home-cards b,
.home-contrast b {
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  font-weight: 600;
  line-height: 1.2;
}

.home-cards em,
.home-contrast em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.home-close-lead {
  margin: var(--space-4) 0 var(--space-3);
  max-width: 36rem;
}

.home-register-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 16px 0 0;
}

.home-register-line .hero-demo-link {
  opacity: 1;
  transform: none;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-cards);
  margin-top: var(--space-4);
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.4rem 0.5rem 1.6rem 0.7rem;
  padding: 20px 18px 18px;
  display: grid;
  gap: 6px;
  min-height: 170px;
}

.steps span {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.7rem;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-on-lime);
  background: var(--color-lime);
}

.steps b {
  font-family: var(--font-body);
  font-size: clamp(1.375rem, 2vw, 1.625rem);
  font-weight: 600;
  line-height: 1.2;
}

.steps em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.quiz,
.panel,
.stat-card,
.meal-card,
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  border-radius: 1.5rem 0.6rem 1.4rem 0.7rem;
  border-left: 3px solid var(--accent);
}

.quiz {
  padding: var(--space-5);
}

.quiz-progress {
  margin-bottom: var(--stack-blocks);
}

.bar {
  height: 6px;
  background: var(--primary-soft);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 12px;
}

#quiz-bar {
  display: block;
  width: 20%;
  height: 100%;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-steps {
  display: flex;
  gap: var(--gap-controls);
  flex-wrap: wrap;
  list-style: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.45;
}

.progress-steps > li {
  margin: 0;
}

.progress-step {
  appearance: none;
  border: 0;
  background: transparent;
  position: relative;
  padding: 4px 10px;
  border-radius: 999px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
  transition: color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.progress-step:disabled {
  cursor: default;
  opacity: 0.4;
}

.progress-step:not(:disabled):hover {
  color: var(--color-text-primary);
}

.progress-step.is-current {
  color: var(--color-text-primary);
  font-weight: 600;
  transform: translateY(-1px);
  background: var(--color-lime-soft);
  opacity: 1;
}

.progress-step.is-done {
  color: var(--color-text-secondary);
}

#quiz-step-hint[hidden] {
  display: none !important;
}

.quiz-panel {
  will-change: transform, opacity;
}

.quiz-panel[hidden] {
  display: none !important;
}

.quiz-panel.is-slide-in-next {
  animation: quiz-slide-in-next 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.quiz-panel.is-slide-in-prev {
  animation: quiz-slide-in-prev 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-4);
}

.form-grid label,
.form-grid fieldset,
.quiz-panel label.full,
#train-log-form label,
#diary-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.full {
  grid-column: 1 / -1;
}

.form-grid > h2 {
  grid-column: 1 / -1;
  margin: 0 0 var(--space-2);
}

.form-grid > .btn {
  margin-top: var(--space-2);
  justify-self: start;
}

input,
select,
textarea {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 80%, white);
  color: var(--text);
  width: 100%;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #151715;
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: var(--space-2);
}

.check input,
.chip input,
.consent input,
.check-list input {
  width: auto;
}

.choice-set {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-3);
  margin: var(--space-3) 0;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: scale(1.02);
}

.field-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.quiz-nav {
  display: flex;
  gap: var(--gap-buttons);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.consent {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin: var(--space-3) 0;
}

.consent.is-error {
  color: var(--color-danger);
}

.today-grid > .today-block:nth-child(n + 5) {
  grid-column: 1 / -1;
}

.today-meals {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.today-meal {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label action"
    "name action"
    "meta action";
  column-gap: 12px;
  align-items: center;
}

.today-meal h3 {
  grid-area: label;
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.today-meal p {
  margin: 0;
}

.today-meal p:first-of-type {
  grid-area: name;
}

.today-meal .muted {
  grid-area: meta;
}

.today-meal .btn {
  grid-area: action;
  margin: 0;
}

.today-ing {
  margin: 0 0 10px;
  padding-left: 18px;
}

.today-ing li {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.4;
}

.today-habits {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.today-habits li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.today-habits strong {
  display: block;
  font-size: 15px;
}

.today-habits small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.today-weight {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 8px 0 16px;
}

.today-weight label {
  margin: 0;
}

.session-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.session-card.is-today,
.session-card.is-next {
  border-color: var(--color-lime);
  box-shadow: 0 0 0 1px var(--color-lime);
}

.ex-list {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ex-list li {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--color-background);
}

.ex-list strong {
  display: block;
  font-size: 15px;
}

.ex-dose {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

.ex-list small {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.week-fold {
  margin: 0 0 var(--stack-blocks);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.week-fold summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  font-weight: 600;
}

.week-fold summary::-webkit-details-marker {
  display: none;
}

.week-fold[open] summary {
  border-bottom: 1px solid var(--border);
}

.week-fold-body {
  padding: 12px 16px 16px;
  display: grid;
  gap: 12px;
}

.week-fold .session-card {
  margin: 0;
  box-shadow: none;
}

.program-fold .week-fold-body {
  gap: 16px;
}

.program-fold .cards {
  margin: 0;
}

.program-fold .panel {
  margin: 0;
  box-shadow: none;
}

@media (max-width: 768px) {
  .today-grid,
  .today-meals {
    grid-template-columns: 1fr;
  }
}

.stat-card,
.panel,
.meal-card,
.session-card {
  padding: var(--pad-card);
}

.stat-card h2 {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.stat-value {
  font-family: var(--font-body);
  font-size: clamp(1.625rem, 2.5vw, 2rem);
  font-weight: 600;
  margin: 4px 0 var(--space-1);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-card > p,
.panel > p,
.meal-card > p,
.session-card > p {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 400;
}

.notice {
  background: var(--primary-soft);
  border-radius: 16px;
  padding: var(--space-3) var(--space-4);
  margin: 0;
}

#admin-temp-password[hidden] {
  display: none !important;
}

.view {
  display: flex;
  flex-direction: column;
  gap: var(--stack-blocks);
}

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

.view > h1 {
  margin-bottom: 0;
}

.view > h1 + .lead {
  margin-top: calc(var(--stack-blocks) * -0.55);
  margin-bottom: 0;
}

.view > .demo-tag {
  margin-bottom: calc(var(--stack-blocks) * -0.6);
}

.home-view {
  gap: 48px;
}

.view[data-view="safety"] h2 {
  margin-top: 0;
  margin-bottom: 0;
}

.view[data-view="safety"] .plain {
  margin: 0;
}

.btn-row,
.btn-stack,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--gap-buttons);
}

.btn-stack,
.settings-actions {
  flex-direction: column;
}

.cycle-start-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
}

.cycle-start-field input[type="date"],
.form-grid input[type="date"] {
  min-height: 44px;
  padding: 8px 12px;
}

.panel .btn,
.panel .btn-row,
.panel .btn-stack,
.meal-card .btn,
.empty .btn {
  margin-top: var(--space-3);
}

.notice-yellow {
  background: var(--yellow-bg);
  color: var(--text);
}

.notice-red {
  background: var(--red-bg);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.badge-green { background: var(--color-success-bg); color: var(--color-success); }
.badge-yellow { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-red { background: var(--color-danger-bg); color: var(--color-danger); }

.plain {
  padding-left: 18px;
  margin: var(--space-2) 0 var(--space-3);
  font-size: 18px;
  line-height: 1.6;
}

.muted {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.day-block {
  margin: 0 0 var(--stack-blocks);
}

.day-block:last-child {
  margin-bottom: 0;
}

.meal-card,
.session-card {
  margin-bottom: var(--space-3);
}

.view > .session-card {
  margin-bottom: 0;
}

.meal-card:last-child,
.session-card:last-child {
  margin-bottom: 0;
}

.view > .session-card:last-child {
  margin-bottom: 0;
}

.meal-card h3,
.session-card h3 {
  font-family: var(--font-body);
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-2);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-controls);
  margin: 0;
}

.segmented button {
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

.nutrition-tabs {
  margin-top: 12px;
}

.nutrition-tabs button {
  min-width: 52px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.nutrition-tabs .tab-today {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.nutrition-tabs button.is-today:not(.is-on) {
  border-color: var(--color-lime);
}

.nutrition-tab-shop {
  min-width: auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-buttons);
  margin: 0;
}

.check-list {
  list-style: none;
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-4);
}

.check-list label {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}

.check-list .is-bought label {
  color: var(--color-text-secondary);
}

.check-list .is-bought .shop-name,
.check-list .is-bought .muted {
  text-decoration: line-through;
  opacity: 0.7;
}

.shop-progress {
  font-weight: 600;
  margin: 0 0 12px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-controls);
  margin-top: var(--space-3);
}

.habit-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.habit-week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.habit-week-label {
  margin: 0;
  font-weight: 600;
  text-align: center;
  flex: 1 1 160px;
}

.habit-week-cards {
  margin: 0 0 12px;
}

.habit-row-count {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
}

.habit-table th.is-today,
.habit-table td.is-today {
  background: var(--primary-soft);
}

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

.habit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.habit-table th,
.habit-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: center;
  vertical-align: middle;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.habit-table th[scope="row"] {
  text-align: left;
  min-width: 180px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.habit-table small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.45;
}

.habit-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.22s ease;
}

.habit-dot:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

.habit-dot.is-on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.habit-dot.is-pulse {
  animation: habit-pulse 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-cards);
}

canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
}

.diary-list {
  list-style: none;
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.diary-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-3);
  display: grid;
  gap: var(--space-3);
}

.diary-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-diary {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.progress-diary > h2 {
  margin: 0;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  text-align: center;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
}

.illust {
  margin: 0 auto;
  width: 100%;
  max-width: var(--illust-max);
}

.illust img {
  display: block;
  width: 100%;
  height: var(--illust-height);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  object-fit: cover;
  object-position: center 22%;
  background: var(--color-lime-soft);
}

.illust-wide img {
  object-position: center;
}

.illust-empty {
  margin: 0 auto;
}

.illust-empty img,
.empty .illust img {
  box-shadow: none;
}

.quiz-panel .illust {
  margin: 4px auto 0;
}

.quiz-panel .illust img {
  box-shadow: none;
}

[data-theme="dark"] .illust img {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.empty .btn {
  margin-top: 0;
}

.bottom-nav,
.more-sheet {
  display: none;
}

.bottom-nav[hidden],
.more-sheet[hidden] {
  display: none !important;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  align-items: stretch;
  justify-content: space-around;
  gap: 0;
  min-height: 64px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(22, 24, 22, 0.06);
}

.bottom-nav a,
.bottom-nav button {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.bottom-nav a[hidden],
.more-sheet a[hidden] {
  display: none !important;
}

.bottom-nav a.is-active,
.bottom-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--color-lime-soft);
  border-radius: 12px;
}

.more-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 44;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.more-sheet a {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
}

.more-sheet a:hover,
.more-sheet a.is-active {
  background: var(--color-lime-soft);
}

.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 32px 32px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

body.has-app-nav .site-footer {
  padding-bottom: 32px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 24px;
  background: var(--color-text-primary);
  color: var(--color-surface);
  padding: 12px 16px;
  border-radius: 16px;
  z-index: 40;
  max-width: min(360px, calc(100% - 32px));
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.toast:not([hidden]) {
  animation: toast-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.scroll-top {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--color-lime);
  color: var(--color-on-lime);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.scroll-top span {
  font-size: 18px;
  line-height: 1;
}

.scroll-top:hover {
  background: var(--color-lime-hover);
}

.scroll-top[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 24, 22, 0.48);
  display: grid;
  place-items: center;
  z-index: 45;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  color: var(--text);
  max-width: 480px;
  width: 100%;
  max-height: min(88vh, 740px);
  overflow: auto;
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.modal-card label.consent {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  margin: 6px 0;
}

.modal-card .btn-row {
  margin-top: var(--space-3);
}

.modal-card.meal-pick-modal {
  max-width: 560px;
  max-height: min(88vh, 740px);
  overflow: auto;
}

.meal-choice-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 16px;
}

.meal-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 0;
  box-shadow: none;
  cursor: pointer;
  font-family: var(--font-body);
}

.meal-choice strong {
  font-size: 16px;
  font-weight: 600;
}

.meal-choice span,
.meal-choice em {
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.meal-choice:hover {
  background: var(--color-lime-soft);
  border-color: color-mix(in srgb, var(--color-lime) 45%, var(--color-border));
  transform: none;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; translate: 0 16px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes ken-burns {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes quiz-slide-in-next {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

@keyframes quiz-slide-in-prev {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}

@keyframes habit-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes nav-pill-in {
  from { transform: translateX(-50%) scaleX(0.4); opacity: 0; }
  to { transform: translateX(-50%) scaleX(1); opacity: 1; }
}

/* Каскадное появление карточек и блоков */
.reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--reveal-i, 0) * 55ms);
}

.reveal-item.is-revealed {
  opacity: 1;
  transform: none;
}

.hero-actions .btn,
.hero-actions .hero-demo-link {
  opacity: 1;
  transform: none;
  transition:
    background 0.2s ease,
    box-shadow 0.22s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.hero-actions.is-ready .btn,
.hero-actions.is-ready .hero-demo-link {
  opacity: 1;
  transform: none;
}

.hero-actions.is-ready .hero-actions-row .btn:nth-child(1) { transition-delay: 0.08s; }
.hero-actions.is-ready .hero-actions-row .btn:nth-child(2) { transition-delay: 0.16s; }
.hero-actions.is-ready .hero-demo-link { transition-delay: 0.24s; }

.how-title-line {
  display: block;
  width: 0;
  height: 3px;
  margin: 10px 0 0;
  border-radius: 99px;
  background: var(--color-lime);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.how.is-inview .how-title-line,
.home-block.is-inview .how-title-line {
  width: 72px;
}

/* FoldText — главный заголовок (адаптация React Bits, без GSAP) */
.hero-title.has-fold-text {
  color: var(--ink);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  animation: none;
}

.view h1.has-fold-text,
.hero-title.has-fold-text {
  overflow: visible;
}

.fold-text {
  display: inline-block;
  max-width: 100%;
  color: var(--fold-text-color, inherit);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: normal;
  user-select: text;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.fold-text-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fold-text-visual {
  display: inline;
}

.fold-text-word {
  display: inline-block;
  white-space: nowrap;
}

.fold-text-whitespace {
  display: inline;
}

.fold-text-segment {
  display: inline-block;
  line-height: inherit;
  perspective: var(--fold-perspective, 700px);
  transform-style: preserve-3d;
  vertical-align: baseline;
}

.fold-text-piece {
  position: relative;
  display: inline-block;
  color: inherit;
  line-height: inherit;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  opacity: 0;
  transform: rotateX(-92deg);
}

.fold-text.is-folding .fold-text-piece {
  animation-name: fold-text-in;
  animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  animation-fill-mode: forwards;
}

.fold-text-piece.is-folded {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto;
  backface-visibility: visible;
}

.fold-text-piece::after {
  content: "";
  position: absolute;
  inset: -0.08em -0.02em;
  pointer-events: none;
  opacity: var(--fold-crease, 0);
  mix-blend-mode: multiply;
  border-radius: 0.08em;
}

.fold-text-piece[data-fold-hinge="top"]::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge="bottom"]::after {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge="left"]::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge="right"]::after {
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text.is-folding .fold-text-piece::after {
  animation-name: fold-crease-fade;
  animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  animation-fill-mode: forwards;
  animation-duration: inherit;
  animation-delay: inherit;
}

@keyframes fold-text-in {
  from {
    opacity: 0;
    transform: rotateX(-92deg);
  }
  to {
    opacity: 1;
    transform: rotateX(0deg) rotateY(0deg);
  }
}

@keyframes fold-crease-fade {
  from { opacity: 0.55; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fold-text-piece,
  .fold-text.is-folding .fold-text-piece {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .fold-text-piece::after {
    opacity: 0 !important;
    animation: none !important;
  }
}

/* Планшет / узкий десктоп */
@media (max-width: 1100px) {
  .hero-card {
    column-gap: clamp(24px, 3vw, 36px);
    padding-top: 36px;
    padding-bottom: 56px;
  }

  .hero-card > .hero-title {
    font-size: clamp(46px, 4.6vw, 52px);
    max-width: 7.4em;
  }

  .hero-actions-row {
    gap: 12px;
  }

  .topbar-inner {
    min-height: 72px;
    padding: 14px 24px;
    flex-wrap: wrap;
  }

  .app-nav {
    flex: 1 1 auto;
    justify-content: center;
    margin-right: 0;
  }

  .app-nav a {
    font-size: 14px;
    padding: 7px 9px;
    min-height: 36px;
  }

  #main {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* Планшет */
@media (max-width: 1024px) {
  body {
    font-size: 17px;
  }

  .view h1 {
    font-size: clamp(3rem, 5vw, 3.25rem);
    line-height: 1.05;
  }

  .hero-card > .hero-title {
    font-size: clamp(46px, 4.6vw, 52px);
    line-height: 1.03;
  }

  .view h2 {
    font-size: clamp(2.25rem, 4vw, 2.5rem);
  }

  .view h3,
  .meal-card h3,
  .session-card h3 {
    font-size: clamp(1.5rem, 2.5vw, 1.75rem);
  }

  .subtitle {
    font-size: clamp(1.375rem, 2vw, 1.5rem);
  }

  .hero-lead,
  .stat-card > p,
  .panel > p,
  .meal-card > p,
  .session-card > p,
  .plain {
    font-size: 17px;
  }
}

/* Телефон */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.55;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    padding: 12px 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .admin-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: 0;
  }

  .admin-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: 0 0 38%;
  }

  .admin-table td:first-child {
    display: block;
    padding-bottom: 10px;
  }

  .admin-table td:first-child::before {
    display: none;
  }

  #main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo tools";
    align-items: center;
    gap: 10px 12px;
    padding: 12px 16px;
    min-height: 0;
  }

  .logo {
    grid-area: logo;
    font-size: 18px;
  }

  .topbar-tools {
    grid-area: tools;
    margin-left: 0;
    justify-self: end;
  }

  .account-name {
    max-width: 120px;
    font-size: 13px;
    padding: 6px 10px;
  }

  .account-menu-panel {
    min-width: 200px;
  }

  .theme-label {
    display: none;
  }

  #theme-toggle.icon-btn {
    padding: 10px 12px;
  }

  .app-nav {
    grid-area: nav;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }

  .app-nav[hidden] {
    display: none !important;
  }

  .app-nav a[hidden] {
    display: none !important;
  }

  .app-nav a {
    flex-shrink: 0;
    font-size: 14px;
    padding: 6px 10px;
    min-height: 36px;
  }

  .hero-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "title"
      "subtitle"
      "photo"
      "text";
    column-gap: 0;
    row-gap: 0;
    padding-top: 28px;
    padding-bottom: 48px;
  }

  .hero {
    aspect-ratio: 3 / 2;
    border-radius: 28px;
    margin: 8px 0 24px;
  }

  .hero::after {
    width: 40px;
    height: 40px;
    right: 16px;
    bottom: 16px;
    box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--color-lime) 32%, transparent);
  }

  .hero img {
    object-position: center 20%;
  }

  .hero-kicker {
    margin-bottom: 16px;
  }

  .hero-card > .hero-title {
    font-size: clamp(36px, 9vw, 40px);
    max-width: none;
    margin-bottom: 18px;
  }

  .hero-subtitle {
    margin-bottom: 0;
  }

  .hero-lead {
    margin: 0 0 24px;
    font-size: 16px;
    line-height: 1.55;
    max-width: none;
  }

  .hero-actions {
    gap: 12px;
  }

  .hero-actions-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 12px;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-demo-link {
    align-self: flex-start;
  }

  .hero-legal {
    font-size: 13px;
  }

  .home-cards li,
  .home-contrast li,
  .steps li {
    min-height: 0;
  }

  .home-close .hero-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .home-close .hero-actions-row .btn {
    width: 100%;
    justify-content: center;
  }

  .view h1 {
    font-size: clamp(2.25rem, 8vw, 2.5rem);
    line-height: 1.08;
  }

  .hero-card > .hero-title {
    font-size: clamp(36px, 9vw, 40px);
    line-height: 1.05;
  }

  .view h2 {
    font-size: clamp(1.875rem, 6vw, 2.125rem);
    line-height: 1.12;
  }

  .view h3,
  .meal-card h3,
  .session-card h3 {
    font-size: clamp(1.375rem, 4.5vw, 1.5625rem);
  }

  .subtitle {
    font-size: clamp(1.25rem, 4vw, 1.375rem);
  }

  .stat-card > p,
  .panel > p,
  .meal-card > p,
  .session-card > p,
  .plain {
    font-size: 16px;
    line-height: 1.55;
  }

  .app-nav a,
  .btn,
  .icon-btn,
  .segmented button {
    font-size: 16px;
  }

  .lead,
  .muted,
  .field-note,
  .site-footer,
  .kicker,
  .logo span {
    font-size: 13px;
  }

  :root {
    --illust-height: 160px;
  }

  .illust img {
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(22, 24, 22, 0.07);
  }

  [data-theme="dark"] .illust img {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  }

  .illust-empty img,
  .quiz-panel .illust img {
    box-shadow: none;
  }

  .app-nav {
    display: none !important;
  }

  .bottom-nav:not([hidden]) {
    display: flex;
  }

  .bottom-nav[hidden] {
    display: none !important;
  }

  .more-sheet:not([hidden]) {
    display: flex;
  }

  body.has-app-nav {
    padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-nav #main {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-nav .site-footer {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }

  .scroll-top,
  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .scroll-top {
    min-width: 46px;
    padding: 10px 12px;
  }
}

@media (max-width: 900px) {
  .charts,
  .steps,
  .home-cards,
  .home-contrast {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  :root {
    --illust-height: 140px;
  }

  #main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .quiz,
  .stat-card,
  .panel {
    padding: var(--space-3);
  }

  .logo {
    font-size: 17px;
  }

  .hero::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero img {
    animation: none !important;
    transform: none !important;
  }

  .btn:hover,
  .btn:active,
  .icon-btn:active,
  .habit-dot:hover,
  .chip:has(input:checked),
  .progress-step.is-current {
    transform: none !important;
  }

  .reveal-item,
  .hero-actions .btn,
  .hero-actions .hero-demo-link {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .how-title-line {
    width: 72px !important;
    transition: none !important;
  }
}

@media print {
  .topbar,
  .bottom-nav,
  .more-sheet,
  .site-footer,
  .toolbar,
  .segmented,
  .nutrition-tabs,
  .hero-actions,
  .btn,
  .grain,
  .scroll-top {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  #print-area,
  .meal-card,
  .shopping-panel {
    break-inside: avoid;
    box-shadow: none;
  }
}
