﻿@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&display=swap");

:root {
  --bg: #ececf1;
  --card: #f8f8fb;
  --line: #dfe0e7;
  --ink: #111318;
  --muted: #8e919e;
  --blue: #4b76f1;
  --blue-dark: #3156c9;
  --green: #32c759;
  --orange: #ff9f0a;
  --red: #ff375f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-shell {
  max-width: 430px;
  margin: 0 auto;
  padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
}

h1 {
  margin: 4px 0 18px;
  font-size: 48px;
  line-height: 0.95;
  font-weight: 800;
}

h2 {
  margin: 14px 0;
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
}

h3 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 800;
  color: #808493;
  letter-spacing: 0.02em;
}

p { margin: 0; }

.screen { display: none; }
.screen.active { display: block; }

.day-switch {
  background: #fff;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 6px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-bottom: 16px;
}

.day-label {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
}

.day-arrow {
  border: none;
  background: transparent;
  font-size: 38px;
  line-height: 1;
  color: #111;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  margin-bottom: 16px;
}

.metric-circles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ring-item { text-align: center; }

.ring {
  width: 74px;
  height: 74px;
  margin: 0 auto 8px;
  background:
    radial-gradient(closest-side, #f8f8fb 76%, transparent 77% 100%),
    conic-gradient(#4b76f1 var(--p, 0%), #e2e3e8 0);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  line-height: 0.95;
}

.ring small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  margin-top: -1px;
  line-height: 1;
}

.ring-item span {
  font-size: 10px;
  font-weight: 700;
  color: #6f7383;
  display: block;
  white-space: nowrap;
}

.progress-list { display: grid; gap: 12px; }

.progress-row label {
  display: flex;
  justify-content: space-between;
  font-size: 33px;
  font-weight: 800;
  margin-bottom: 6px;
  gap: 10px;
}

.progress-row label em {
  font-style: normal;
  font-weight: 700;
  color: #7f8493;
  font-size: 29px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pct-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e8eeff;
  color: #2f6fff;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.track {
  height: 8px;
  background: #e5e6ec;
  border-radius: 999px;
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f6fff, #3ea3ff);
}

.week-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.pill-btn {
  border: none;
  border-radius: 999px;
  background: #eceef6;
  padding: 8px 14px;
  font-size: 28px;
  font-weight: 700;
}

.week-range {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
}

.legend-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 22px;
  color: #6f7383;
  margin-bottom: 8px;
}

.legend-row span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 12px; height: 12px; display: inline-block; border-radius: 2px; }
.dot.kcal { background: var(--red); }
.dot.protein { background: #2d9cdb; }
.dot.fats { background: #ff9800; }
.dot.carbs { background: #4caf50; }

.week-chart {
  width: 100%;
  height: 190px;
  border-top: 1px solid #dadce5;
  padding-top: 8px;
}

.week-chart svg { width: 100%; height: 100%; display: block; }
.week-chart text { fill: #7d8190; font-size: 11px; font-weight: 700; }
.week-chart .grid { stroke: #e2e5ee; stroke-width: 1; }
.week-chart .line { fill: none; stroke-width: 2.4; }
.week-chart .kcal-line { stroke: var(--red); }
.week-chart .protein-line { stroke: #2d9cdb; }
.week-chart .fats-line { stroke: #ff9800; }
.week-chart .carbs-line { stroke: #4caf50; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.month-stat {
  background: #eff0f5;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.month-stat b { display: block; font-size: 50px; line-height: 1; margin-bottom: 6px; }
.month-stat span { color: #7b8090; font-size: 30px; font-weight: 700; }

.month-avg {
  border: 1px solid #d3d5df;
  border-radius: 18px;
  padding: 14px;
  background: #f0f1f6;
}

.avg-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.avg-main b { display: block; font-size: 54px; line-height: 1; }
.avg-main span { color: #7e8291; font-size: 30px; font-weight: 700; }
.avg-main .accent { color: var(--blue); }

.avg-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.macro-chip {
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.macro-chip span { display: block; font-size: 23px; font-weight: 700; margin-bottom: 4px; }
.macro-chip b { font-size: 34px; }
.macro-chip.protein { background: #deeffd; color: #2d9cdb; }
.macro-chip.fats { background: #f8efe1; color: #ff9800; }
.macro-chip.carbs { background: #e4f4ea; color: #28a745; }

.cta {
  width: 100%;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  padding: 16px;
  margin-bottom: 12px;
}

#diary-summary .kcal-left {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #d8dae4;
}
#diary-summary .kcal-left > div { text-align: center; }

#diary-summary .kcal-left span { color: #868a99; font-size: 30px; font-weight: 800; }
#diary-summary .kcal-left b { font-size: 66px; line-height: 1; }
#diary-summary .kcal-left em { color: #6f7483; font-size: 33px; font-style: normal; font-weight: 700; }

.diary-macros { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.diary-macro strong { display: block; color: #7f8392; font-size: 24px; margin-bottom: 4px; }
.diary-macro b { font-size: 34px; }

.diary-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 14px;
  margin-bottom: 10px;
}

.diary-empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 18px;
  text-align: center;
}

.diary-empty .emoji { font-size: 60px; margin-bottom: 8px; }
.diary-empty b { display: block; font-size: 42px; margin-bottom: 6px; }
.diary-empty p { color: #99a0af; font-size: 30px; font-weight: 700; }

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.profile-head h2 { margin: 2px 0 0; font-size: 52px; }

.plan-chip {
  padding: 8px 14px;
  background: #3ac95f;
  color: #fff;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 800;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0;
}

.profile-metrics > div {
  text-align: center;
  padding: 6px 8px;
  border-right: 1px solid #d8dae3;
}

.profile-metrics > div:last-child { border-right: none; }
.profile-metrics span { color: #8a8f9e; font-size: 24px; font-weight: 800; }
.profile-metrics b { display: block; font-size: 46px; }
.profile-metrics .goal-row {
  grid-column: 1 / -1;
  border-right: none;
  border-top: 1px solid #d8dae3;
  margin-top: 8px;
  padding-top: 12px;
  text-align: left;
  display: flex;
  justify-content: space-between;
}

.profile-goals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-measures h3 {
  margin-bottom: 8px;
}

.profile-weight-card h3 {
  margin-bottom: 8px;
}

.profile-weight-chart {
  width: 100%;
  height: 190px;
  border-top: 1px solid #dadce5;
  padding-top: 8px;
}

.profile-weight-chart svg {
  width: 100%;
  height: 160px;
  display: block;
}

.profile-weight-chart text {
  fill: #7d8190;
  font-size: 11px;
  font-weight: 700;
}

.profile-weight-chart .grid {
  stroke: #e2e5ee;
  stroke-width: 1;
}

.profile-weight-chart .line {
  fill: none;
  stroke-width: 2.6;
  stroke: var(--blue);
}

.weight-trend {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.weight-trend.up { color: #d94860; }
.weight-trend.down { color: #2d9c66; }
.weight-trend.flat { color: #7d8190; }

.measure-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.measure-list span {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eceef6;
  color: #2f3547;
  font-size: 11px;
  font-weight: 700;
}

.kcal-card {
  border: 1px solid #d6d8e1;
  border-radius: 18px;
  padding: 14px;
  background: #f5f6fa;
}

.kcal-card span { display: block; color: #f23b64; font-size: 30px; font-weight: 800; }
.kcal-card b { display: block; margin-top: 6px; font-size: 64px; line-height: 1; }

.goal-list { display: grid; gap: 8px; }
.goal-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 28px;
  font-weight: 800;
}
.goal-line.protein { background: #deeffd; color: #2d9cdb; }
.goal-line.fats { background: #f8efe1; color: #ff9800; }
.goal-line.carbs { background: #e4f4ea; color: #28a745; }
.goal-line b { color: #111; }

.plain-btn,
.dark-btn,
.gold-btn,
.invite-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 14px;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 10px;
}

.plain-btn { background: transparent; color: #121317; }
.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 10px;
  margin-bottom: 8px;
}
.dark-btn { background: #000; color: #fff; }
.gold-btn { background: #ffbf00; color: #111; }

.status-card {
  display: grid;
  gap: 10px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  font-size: 36px;
  font-weight: 700;
}

.status-line b.on { color: var(--green); }
.status-line b.off { color: #8e93a1; }

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.time-row b { display: block; font-size: 64px; line-height: 1; margin-bottom: 6px; }
.time-row span { color: #8c91a0; font-size: 28px; font-weight: 700; }
.status-dot { width: 16px; height: 16px; border-radius: 50%; background: #9da2b0; }
.status-dot.on { background: var(--green); box-shadow: 0 0 10px rgba(52, 199, 89, 0.7); }

.invite-card {
  background: linear-gradient(160deg, #4f7cf6, #3460db);
  border-radius: 26px;
  padding: 18px;
  color: #fff;
  margin-bottom: 16px;
}

.invite-card h2 { margin: 0 0 8px; font-size: 54px; text-align: center; }
.invite-card p { font-size: 30px; text-align: center; color: #dbe6ff; margin-bottom: 12px; }
.invite-link {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 12px;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  word-break: break-all;
  margin-bottom: 12px;
}

.invite-btn { background: rgba(255,255,255,0.08); color: #fff; margin: 0; }

.stat-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 34px;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 430px;
  background: #f6f6fa;
  border-top: 1px solid #d8dbe5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.bottom-tab {
  border: none;
  background: transparent;
  color: #9ca1b0;
  display: grid;
  gap: 2px;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
}

.bottom-tab span { font-size: 10px; }
.bottom-tab.active { color: var(--blue); }

.muted { color: var(--muted); }

@media (max-width: 420px) {
  h1 { font-size: 40px; }
  h2 { font-size: 31px; }
  h3 { font-size: 22px; }
  .day-label { font-size: 26px; }
  .progress-row label, .status-line, .stat-line, .diary-empty p, .invite-card p { font-size: 24px; }
  .month-stat b { font-size: 40px; }
  .avg-main b { font-size: 44px; }
  .kcal-card b, .time-row b { font-size: 52px; }
  .profile-head h2 { font-size: 44px; }
  .plain-btn, .dark-btn, .gold-btn, .invite-btn { font-size: 28px; }
}

/* Compact tune for real device viewport */
h1 { font-size: 24px; margin-bottom: 10px; }
h2 { font-size: 18px; margin: 10px 0; }
h3 { font-size: 12px; margin-bottom: 8px; }
.card { padding: 12px; border-radius: 18px; margin-bottom: 10px; }
.day-switch { margin-bottom: 10px; }
.day-label { font-size: 18px; }
.day-arrow { font-size: 28px; }
.progress-row label { font-size: 18px; }
.progress-row label em { font-size: 16px; }
.week-range { font-size: 16px; }
.pill-btn { font-size: 14px; padding: 6px 10px; }
.legend-row { font-size: 11px; }
.month-stat b { font-size: 24px; }
.month-stat span { font-size: 12px; }
.avg-main b { font-size: 24px; }
.avg-main span { font-size: 12px; }
.macro-chip span { font-size: 11px; }
.macro-chip b { font-size: 18px; }
.cta { font-size: 16px; padding: 12px; border-radius: 14px; }
#diary-summary .kcal-left span { font-size: 12px; }
#diary-summary .kcal-left b { font-size: 38px; }
#diary-summary .kcal-left em { font-size: 14px; }
.diary-macro strong { font-size: 11px; }
.diary-macro b { font-size: 14px; }
.diary-empty .emoji { font-size: 40px; }
.diary-empty b { font-size: 22px; }
.diary-empty p { font-size: 14px; }
.profile-head h2 { font-size: 28px; }
.plan-chip { font-size: 11px; padding: 6px 10px; }
.profile-metrics span { font-size: 10px; }
.profile-metrics b { font-size: 22px; }
.kcal-card span { font-size: 12px; }
.kcal-card b { font-size: 34px; }
.goal-line { font-size: 12px; padding: 8px 10px; }
.plain-btn, .dark-btn, .gold-btn, .invite-btn { font-size: 14px; padding: 10px; margin-bottom: 8px; }
.pct-badge { font-size: 11px; padding: 1px 6px; }
.status-line { font-size: 14px; }
.time-row b { font-size: 32px; }
.time-row span { font-size: 12px; }
.invite-card h2 { font-size: 24px; }
.invite-card p { font-size: 13px; }
.invite-link { font-size: 12px; }
.stat-line { font-size: 14px; }
