:root {
  --bg: #f2f2f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --bg-card: #ffffff;
  --bg-fill: rgba(120, 120, 128, 0.12);
  --bg-fill-strong: rgba(120, 120, 128, 0.2);
  --label: #1c1c1e;
  --secondary: #8e8e93;
  --separator: rgba(60, 60, 67, 0.12);
  --blue: #007aff;
  --blue-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #ff9500;
  --orange-soft: rgba(255, 149, 0, 0.14);
  --red: #ff3b30;
  --purple: #af52de;
  --purple-soft: rgba(175, 82, 222, 0.14);
  --teal: #5ac8fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: rgba(28, 28, 30, 0.82);
    --bg-card: #1c1c1e;
    --bg-fill: rgba(120, 120, 128, 0.24);
    --bg-fill-strong: rgba(120, 120, 128, 0.36);
    --label: #f5f5f7;
    --secondary: #8e8e93;
    --separator: rgba(84, 84, 88, 0.65);
    --blue: #0a84ff;
    --blue-soft: rgba(10, 132, 255, 0.18);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.18);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.18);
    --red: #ff453a;
    --purple: #bf5af2;
    --purple-soft: rgba(191, 90, 242, 0.18);
    --teal: #64d2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.45);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 12px) 20px 12px;
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--secondary);
  text-transform: none;
}

.title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 2px;
}

.view-root {
  flex: 1;
  padding: 16px 16px calc(var(--tab-h) + var(--safe-bottom) + 28px);
  width: 100%;
  overflow-x: hidden;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.card-sub {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 500;
}

.streak-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.streak-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background:
    conic-gradient(var(--green) calc(var(--pct, 0) * 1%), var(--bg-fill) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.streak-ring-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card);
  display: grid;
  place-items: center;
  text-align: center;
}

.streak-num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.streak-unit {
  font-size: 10px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.streak-copy h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.streak-copy p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.35;
}

.week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.day-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary);
  letter-spacing: 0.02em;
}

.day-bar-track {
  width: 100%;
  height: 56px;
  border-radius: 999px;
  background: var(--bg-fill);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}

.day-bar-fill {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #5ce87a, var(--green));
  min-height: 0;
  transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.day-cell.today .day-label {
  color: var(--blue);
}

.day-cell.complete .day-bar-fill {
  background: linear-gradient(180deg, #5ce87a, var(--green));
}

.day-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-fill-strong);
}

.day-cell.complete .day-dot {
  background: var(--green);
}

.day-cell.today .day-dot {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  background: var(--bg-fill);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
}

.metric-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-fill-strong);
  color: transparent;
  flex-shrink: 0;
}

.metric.done .metric-badge {
  background: var(--green);
  color: #fff;
}

.metric-badge svg {
  width: 12px;
  height: 12px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-hint {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 2px;
}

.rule-note {
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.4;
  padding: 0 4px;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px;
}

.nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-fill);
  flex-shrink: 0;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.nav-btn:active {
  transform: scale(0.94);
  opacity: 0.85;
}

.nav-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.date-center {
  flex: 1;
  text-align: center;
  min-width: 0;
  padding: 4px 0;
}

.date-center .date-main {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.date-center .date-sub {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 2px;
}

.date-center input[type="date"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.date-picker-btn {
  width: 100%;
  padding: 4px 8px;
  border-radius: 10px;
}

.date-picker-btn:active {
  background: var(--bg-fill);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 16px;
  min-height: 72px;
  transition: transform 0.12s ease;
}

.check-row:active {
  transform: scale(0.985);
}

.check-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 20px;
}

.check-icon.creatine { background: var(--blue-soft); color: var(--blue); }
.check-icon.omega { background: var(--teal); color: #fff; background: rgba(90, 200, 250, 0.18); color: #0a84ff; }
.check-icon.workout { background: var(--orange-soft); color: var(--orange); }
.check-icon.protein { background: var(--purple-soft); color: var(--purple); }

.check-body {
  flex: 1;
  min-width: 0;
}

.check-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.check-desc {
  font-size: 13px;
  color: var(--secondary);
  margin-top: 2px;
}

.toggle {
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-fill-strong);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.toggle.on {
  background: var(--green);
}

.toggle.on::after {
  transform: translateX(20px);
}

.protein-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.protein-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.protein-total {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.protein-total span {
  font-size: 15px;
  font-weight: 600;
  color: var(--secondary);
  margin-left: 4px;
}

.protein-counts {
  font-size: 13px;
  color: var(--secondary);
  text-align: right;
}

.shake-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shake-btn {
  min-height: 56px;
  border-radius: var(--radius-md);
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.shake-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.shake-btn small {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

.shake-log {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shake-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 8px 12px;
  border-radius: 999px;
  background: var(--bg-fill);
  font-size: 13px;
  font-weight: 600;
}

.shake-chip button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-fill-strong);
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  color: var(--secondary);
}

.complete-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--green-soft);
  color: var(--green);
}

.complete-banner strong {
  font-size: 15px;
  font-weight: 650;
  color: var(--label);
  display: block;
}

.complete-banner span {
  font-size: 13px;
  color: var(--secondary);
}

.complete-banner .star {
  font-size: 22px;
}

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 0 8px var(--safe-bottom);
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  z-index: 30;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--secondary);
  min-height: var(--tab-h);
  border-radius: 12px;
}

.tab.active {
  color: var(--blue);
}

.tab-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}

.tab-icon svg {
  width: 24px;
  height: 24px;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cta-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 15px;
  font-weight: 650;
}

.cta-link svg {
  width: 16px;
  height: 16px;
}

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(1200px 600px at 50% -10%, rgba(0, 122, 255, 0.08), transparent),
      var(--bg);
  }

  #app {
    border-left: 0.5px solid var(--separator);
    border-right: 0.5px solid var(--separator);
  }
}
