:root {
  color-scheme: light;
  --paper: #f4f3ed;
  --paper-deep: #e9e7de;
  --ink: #171a18;
  --ink-soft: #424640;
  --lime: #c7ff64;
  --violet: #7657ff;
  --coral: #ff7a66;
  --white: #ffffff;
  --line: rgba(23, 26, 24, 0.17);
  --radius-lg: 30px;
  --radius-md: 22px;
  --shadow: 0 18px 48px rgba(23, 26, 24, 0.1);
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(199, 255, 100, 0.2), transparent 32rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

.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;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 22px calc(116px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
}

.brand {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.08em;
  cursor: pointer;
}

.brand span {
  color: var(--coral);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.text-button,
.link-button,
.timer-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.view {
  animation: view-in 180ms ease-out;
}

.view[hidden] {
  display: none;
}

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

.hero-card {
  padding: clamp(28px, 6vw, 52px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.ink-card {
  color: var(--white);
  background:
    radial-gradient(circle at 4% 8%, rgba(118, 87, 255, 0.42), transparent 17rem),
    var(--ink);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--lime);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--ink-soft);
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 9vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h3 {
  margin: 0;
  font-size: 1.06rem;
}

.priority-field {
  display: block;
  margin-top: 34px;
}

.priority-field input {
  width: 100%;
  padding: 17px 0;
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.36);
  border-radius: 0;
  color: var(--white);
  background: transparent;
  font-size: clamp(1.12rem, 4vw, 1.45rem);
  font-weight: 700;
}

.priority-field input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.priority-field input:focus {
  border-bottom-color: var(--lime);
  outline: 0;
}

.hero-actions,
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.primary-button,
.secondary-button,
.small-button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.primary-button:active,
.secondary-button:active,
.small-button:active,
.anchor-card:active,
.meal-card:active {
  transform: scale(0.98);
}

.primary-button {
  color: var(--ink);
  background: var(--lime);
}

.secondary-button {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.28);
  background: transparent;
}

.primary-button.wide {
  width: min(100%, 320px);
}

.focus-timer {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 24px;
}

.focus-timer[hidden] {
  display: none;
}

#focusTime {
  margin-left: auto;
  color: var(--lime);
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-button {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.section-block {
  margin-top: 48px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.count-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--lime);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.count-chip.violet {
  color: var(--white);
  background: var(--violet);
}

.anchor-grid,
.workout-list,
.meal-grid {
  display: grid;
  gap: 12px;
}

.anchor-card {
  display: grid;
  grid-template-columns: 42px 1fr 22px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 92px;
  padding: 16px 18px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
}

.anchor-card.checked {
  border-color: rgba(23, 26, 24, 0.4);
  background: var(--white);
}

.anchor-index {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.anchor-copy {
  display: grid;
  gap: 5px;
}

.anchor-copy strong {
  font-size: 1.12rem;
}

.anchor-copy small,
.meal-card small,
.section-note,
.safety-note {
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.check-dot {
  width: 21px;
  height: 21px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.checked .check-dot {
  border: 6px solid var(--ink);
  background: var(--lime);
}

.next-card,
.target-card {
  margin-top: 26px;
  padding: 26px;
  border-radius: var(--radius-md);
  background: var(--paper-deep);
}

.next-card h2 {
  max-width: 500px;
  font-size: 1.45rem;
}

.next-card .link-button {
  margin-top: 18px;
}

.page-intro {
  max-width: 660px;
  padding: 30px 0 10px;
}

.page-intro p:last-child,
.quiet-layout > p {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.metric-card {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 18px;
  margin-top: 28px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow);
}

.metric-copy {
  display: grid;
  align-content: center;
  gap: 3px;
}

.metric-copy span,
.week-stat span,
.target-card > span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-copy strong {
  font-size: 2.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-copy small {
  color: var(--ink-soft);
}

.progress-ring {
  display: grid;
  place-items: center;
  width: 116px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--violet) var(--progress, 0%), var(--paper-deep) 0);
}

.progress-ring::before {
  grid-area: 1 / 1;
  width: 84px;
  aspect-ratio: 1;
  content: "";
  border-radius: 50%;
  background: var(--white);
}

.progress-ring span {
  z-index: 1;
  grid-area: 1 / 1;
  font-weight: 900;
}

.step-controls {
  display: flex;
  grid-column: 1 / -1;
  gap: 10px;
}

.step-controls input {
  min-width: 0;
  flex: 1;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.small-button {
  min-height: 42px;
  padding: 0 16px;
  border-color: var(--line);
  background: var(--white);
  font-size: 0.82rem;
}

.workout-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.workout-card.completed {
  border-color: var(--violet);
  background: rgba(118, 87, 255, 0.08);
}

.workout-topline,
.workout-topline > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workout-topline {
  justify-content: space-between;
}

.workout-letter {
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  border-radius: 12px;
  color: var(--white);
  background: var(--violet);
  font-weight: 900;
}

.workout-letter.coral {
  color: var(--ink);
  background: var(--coral);
}

details summary {
  margin-top: 18px;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.exercise-list {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: exercise;
}

.exercise-list li {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  counter-increment: exercise;
}

.exercise-list li strong::before {
  content: counter(exercise, decimal-leading-zero) ". ";
  color: var(--violet);
}

.exercise-list li span {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.safety-note {
  margin: 14px 4px 0;
}

.food-section {
  padding-bottom: 20px;
}

.meal-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 16px;
}

.meal-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 166px;
  padding: 20px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
}

.meal-card span {
  color: var(--violet);
  font-size: 0.78rem;
  font-weight: 900;
}

.meal-card strong {
  max-width: 92%;
  font-size: 1rem;
  line-height: 1.35;
}

.meal-card i {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.meal-card.checked {
  background: var(--lime);
}

.meal-card.checked i {
  border: 5px solid var(--ink);
}

.quiet-layout {
  display: flex;
  align-items: center;
  flex-direction: column;
  min-height: calc(100vh - 210px);
  padding: 48px 0 20px;
  text-align: center;
}

.quiet-layout h1 {
  max-width: 620px;
}

.breath-orb {
  display: grid;
  place-items: center;
  width: min(52vw, 240px);
  aspect-ratio: 1;
  margin: 44px 0 20px;
  border: 1px solid rgba(118, 87, 255, 0.26);
  border-radius: 50%;
  background: rgba(118, 87, 255, 0.08);
}

.breath-orb span {
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--violet);
  transform: scale(0.7);
}

.breath-orb.running span {
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.7); }
  50% { transform: scale(1.65); }
}

.quiet-time {
  margin-bottom: 20px;
  font-size: 2.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.quiet-layout .link-button {
  margin-top: 14px;
}

.writing-card {
  display: block;
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow);
}

.writing-card textarea {
  width: 100%;
  resize: vertical;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1.05rem;
  line-height: 1.7;
}

.writing-card textarea:focus {
  outline: 0;
}

.writing-card > span:last-child {
  display: block;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.danger-link {
  color: #9d2f24;
}

#clearWritingButton {
  margin-top: 20px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
}

.week-stat {
  display: grid;
  min-height: 150px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--white);
}

.week-stat strong {
  align-self: center;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-variant-numeric: tabular-nums;
}

.week-stat small {
  align-self: end;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.checkin-card {
  margin-top: 28px;
  padding: 26px;
  border-radius: var(--radius-lg);
  color: var(--white);
  background: var(--ink);
}

.checkin-card .eyebrow {
  color: var(--lime);
}

.checkin-fields {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 14px;
  margin: 24px 0;
}

.checkin-fields label {
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 800;
}

.checkin-fields input[type="number"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.09);
}

.checkin-fields input[type="range"] {
  accent-color: var(--lime);
}

.checkin-card .section-note {
  color: rgba(255, 255, 255, 0.64);
}

.target-card {
  color: var(--ink);
  background: var(--lime);
}

.target-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.8rem, 6vw, 3rem);
  letter-spacing: -0.04em;
}

.target-card p {
  max-width: 530px;
  margin: 12px 0 0;
  line-height: 1.45;
}

.target-date-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.target-date-controls label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.target-date-controls input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(23, 26, 24, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.data-panel {
  margin-top: 24px;
  padding: 4px 6px 30px;
}

.data-panel p {
  color: var(--ink-soft);
  line-height: 1.5;
}

.file-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(calc(100% - 24px), 590px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(23, 26, 24, 0.94);
  box-shadow: 0 20px 45px rgba(23, 26, 24, 0.28);
  backdrop-filter: blur(16px);
  transform: translateX(50%);
}

.bottom-nav button {
  min-height: 52px;
  padding: 0 6px;
  border: 0;
  border-radius: 17px;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.bottom-nav button.active {
  color: var(--ink);
  background: var(--lime);
}

.toast {
  position: fixed;
  z-index: 20;
  right: 50%;
  bottom: 104px;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--white);
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 10px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(50%, 0);
}

@media (max-width: 620px) {
  .app-shell {
    padding-inline: 16px;
  }

  .topbar {
    min-height: 76px;
  }

  .topbar-meta > span {
    display: none;
  }

  .hero-card {
    padding: 28px 22px;
  }

  .hero-actions > button {
    flex: 1 1 auto;
  }

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

  .meal-card {
    min-height: 132px;
  }

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

  .week-stat:last-child {
    grid-column: 1 / -1;
    min-height: 118px;
  }

  .checkin-fields {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .metric-card {
    grid-template-columns: 1fr 96px;
  }

  .progress-ring {
    width: 96px;
  }

  .progress-ring::before {
    width: 70px;
  }

  .step-controls {
    flex-wrap: wrap;
  }

  .step-controls > * {
    flex: 1 1 100%;
    min-height: 44px;
  }

  .workout-topline {
    align-items: flex-start;
  }

  .workout-topline h3 {
    max-width: 125px;
  }
}

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