/*
 * DailyCalo web — cùng ngôn ngữ thiết kế với app (src/theme/tokens.ts):
 * nền xám rất nhạt + vệt sáng trôi phía sau, mọi khối nổi là kính, màu nhấn là
 * mực, số liệu dùng một màu duy nhất là xanh chanh. Chữ: Be Vietnam Pro cho
 * nội dung, Playfair Display cho tiêu đề, Geist 700 chỉ cho chữ "DailyCalo".
 */
:root {
  --bg: #f5f6f8;
  --glass-from: rgba(255, 255, 255, 0.74);
  --glass-to: rgba(255, 255, 255, 0.38);
  --surface2: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.88);
  --ink: #0b0d12;
  --sub: rgba(11, 13, 18, 0.55);
  --faint: rgba(11, 13, 18, 0.34);
  --accent: #0b0d12;
  --on-accent: #ffffff;
  --track: rgba(11, 13, 18, 0.07);
  --bar-out: rgba(11, 13, 18, 0.22);
  --raised: #ffffff;
  --hairline: rgba(11, 13, 18, 0.12);
  --blob: rgba(11, 13, 18, 0.05);
  --blob-mid: rgba(11, 13, 18, 0.018);
  --data: #85c300;
  --data-soft: #6fa800;
  --data-faint: #5c8e00;
  --shadow-card: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(255, 255, 255, 0.4),
    0 1px 2px rgba(30, 40, 80, 0.05), 0 16px 36px -16px rgba(30, 40, 80, 0.24);
  --shadow-small: inset 0 1px 0 #fff, 0 10px 24px -14px rgba(30, 40, 80, 0.24);

  --r-chip: 999px;
  --r-small: 14px;
  --r-input: 20px;
  --r-tile: 24px;
  --r-card: 26px;

  --ease-enter: cubic-bezier(0.2, 0.9, 0.3, 1);
  --ease-pop: cubic-bezier(0.3, 1.6, 0.5, 1);

  --sans: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --brand: "Geist", var(--sans);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b10;
    --glass-from: rgba(255, 255, 255, 0.11);
    --glass-to: rgba(255, 255, 255, 0.03);
    --surface2: rgba(255, 255, 255, 0.07);
    --line: rgba(255, 255, 255, 0.13);
    --ink: #f3f5f8;
    --sub: rgba(243, 245, 248, 0.56);
    --faint: rgba(243, 245, 248, 0.34);
    --accent: #f3f5f8;
    --on-accent: #0b0d12;
    --track: rgba(255, 255, 255, 0.1);
    --bar-out: rgba(255, 255, 255, 0.3);
    --raised: #1c1e25;
    --hairline: rgba(255, 255, 255, 0.16);
    --blob: rgba(243, 245, 248, 0.07);
    --blob-mid: rgba(243, 245, 248, 0.025);
    --data: #b4fc25;
    --data-soft: #79b400;
    --data-faint: #517700;
    --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 36px -16px rgba(0, 0, 0, 0.6);
    --shadow-small: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0b10;
  --glass-from: rgba(255, 255, 255, 0.11);
  --glass-to: rgba(255, 255, 255, 0.03);
  --surface2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.13);
  --ink: #f3f5f8;
  --sub: rgba(243, 245, 248, 0.56);
  --faint: rgba(243, 245, 248, 0.34);
  --accent: #f3f5f8;
  --on-accent: #0b0d12;
  --track: rgba(255, 255, 255, 0.1);
  --bar-out: rgba(255, 255, 255, 0.3);
  --raised: #1c1e25;
  --hairline: rgba(255, 255, 255, 0.16);
  --blob: rgba(243, 245, 248, 0.07);
  --blob-mid: rgba(243, 245, 248, 0.025);
  --data: #b4fc25;
  --data-soft: #79b400;
  --data-faint: #517700;
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 36px -16px rgba(0, 0, 0, 0.6);
  --shadow-small: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px -14px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ── Nền: ba vệt sáng trôi chậm (Ambient trong app) ─────────────────────── */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blob) 0%, var(--blob-mid) 60%, transparent 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

.blob.b1 {
  left: -220px;
  top: 4vh;
  --dx: 70px;
  --dy: 96px;
}
.blob.b2 {
  right: -200px;
  top: 32vh;
  --dx: -80px;
  --dy: -66px;
  animation-duration: 22s;
}
.blob.b3 {
  left: 12vw;
  top: 66vh;
  --dx: 92px;
  --dy: -78px;
  animation-duration: 16s;
}

@keyframes drift {
  to {
    transform: translate(var(--dx), var(--dy));
  }
}

/* ── Kính ─────────────────────────────────────────────────────────────── */
.glass {
  background: linear-gradient(145deg, var(--glass-from), var(--glass-to));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.glass.small {
  box-shadow: var(--shadow-small);
}

/* ── Bố cục ───────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 600px) {
  .wrap {
    padding: 0 16px;
  }
}

.label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sub);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--serif);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(42px, 5.4vw, 70px);
  line-height: 1.05;
}

h2 {
  font-size: clamp(32px, 4.4vw, 50px);
  line-height: 1.1;
}

h1 em,
h2 em {
  font-style: italic;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.lead {
  font-size: clamp(17px, 1.6vw, 19px);
  color: var(--sub);
  max-width: 34em;
}

/* ── Nút ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 22px;
  border-radius: var(--r-input);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.35s var(--ease-pop), opacity 0.2s;
}

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

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

.btn.ghost {
  color: var(--ink);
  background: linear-gradient(145deg, var(--glass-from), var(--glass-to));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-small);
}

/* Trên nền kính (khung cuối trang) nút phụ cần viền mực mới tách khỏi nền. */
.glass .btn.ghost {
  border-color: var(--hairline);
  box-shadow: none;
}

.btn svg {
  width: 20px;
  height: 20px;
}

.btn .two {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.btn .two small {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* ── Thanh trên ───────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 14px;
  z-index: 20;
  margin-top: 14px;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  padding: 0 10px 0 20px;
  border-radius: var(--r-card);
}

.lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.lockup svg {
  width: 26px;
  height: 26px;
}

.lockup span {
  font: 700 21px/1 var(--brand);
  letter-spacing: -0.045em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: var(--r-chip);
  font-size: 14px;
  font-weight: 500;
  color: var(--sub);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav .btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 14px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--sub);
  cursor: pointer;
  transition: color 0.2s, transform 0.35s var(--ease-pop);
}

.icon-btn:hover {
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.88);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 820px) {
  .nav-links a:not(.btn) {
    display: none;
  }
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
  padding-top: 72px;
  padding-bottom: 96px;
}

.hero .label {
  margin-bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero .label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--data);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--data) 22%, transparent);
}

.hero h1 {
  margin-bottom: 24px;
}

.hero .lead {
  margin-bottom: 36px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hero-stage {
  position: relative;
  display: flex;
  justify-content: center;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 40px;
    padding-bottom: 56px;
    gap: 48px;
  }
}

/* ── Mô hình điện thoại ───────────────────────────────────────────────── */
.phone {
  position: relative;
  width: 320px;
  max-width: 100%;
  aspect-ratio: 402 / 874;
  padding: 10px;
  border-radius: 54px;
  background: linear-gradient(160deg, #2a2d35, #0b0d12 60%);
  box-shadow: 0 40px 80px -30px rgba(30, 40, 80, 0.45), inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}

.screen {
  position: relative;
  height: 100%;
  border-radius: 44px;
  overflow: hidden;
  background: var(--bg);
  padding: 50px 16px 0;
  font-size: 12px;
}

.screen .ambient-in {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen .ambient-in::before,
.screen .ambient-in::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blob) 0%, transparent 70%);
}

.screen .ambient-in::before {
  left: -120px;
  top: 40px;
}
.screen .ambient-in::after {
  right: -130px;
  bottom: 120px;
}

.island {
  position: absolute;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  width: 96px;
  height: 28px;
  border-radius: 20px;
  background: #000;
  z-index: 3;
}

.statusbar {
  position: absolute;
  top: 16px;
  left: 30px;
  right: 30px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 2;
}

.scr-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 8px 2px 14px;
}

.scr-head .label {
  font-size: 8.5px;
}

.scr-head h4 {
  margin: 2px 0 0;
  font: 400 26px/1.1 var(--serif);
}

.scr-head .date {
  font-size: 10px;
  color: var(--sub);
}

.card {
  position: relative;
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 10px;
}

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

.ring {
  position: relative;
  flex: none;
  width: 104px;
  height: 104px;
}

.ring svg {
  transform: rotate(-90deg);
}

.ring .center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring b {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ring small {
  font-size: 7.5px;
  letter-spacing: 0.12em;
  color: var(--sub);
  margin-top: 3px;
}

.arc {
  stroke: var(--data);
  stroke-dasharray: 0 400;
  transition: stroke-dasharray 1.6s var(--ease-enter);
}

.in .arc {
  stroke-dasharray: var(--len) 400;
}

.macros {
  flex: 1;
  display: grid;
  gap: 9px;
}

.macro .row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 4px;
}

.macro .row span {
  color: var(--sub);
}

.bar {
  height: 6px;
  border-radius: 6px;
  background: var(--track);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--data);
  transition: width 1.4s var(--ease-enter) 0.2s;
}

.in .bar i {
  width: var(--w);
}

.meal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.meal + .meal {
  border-top: 1px solid var(--track);
}

.thumb {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--track);
  display: grid;
  place-items: center;
  color: var(--sub);
}

.thumb svg {
  width: 20px;
  height: 20px;
}

.meal .name {
  flex: 1;
  min-width: 0;
}

.meal .name b {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal .name span {
  display: block;
  font-size: 9.5px;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal .k {
  font-size: 12px;
  font-weight: 600;
}

.tabbar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 18px;
  height: 56px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  z-index: 2;
}

.tabbar button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 8px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.5;
}

.tabbar button.on,
.tabbar button:hover {
  opacity: 1;
}

.tabbar svg {
  width: 19px;
  height: 19px;
}

/* Bong bóng nổi quanh điện thoại */
.float {
  position: absolute;
  border-radius: 20px;
  padding: 12px 14px;
  font-size: 13px;
  animation: bob 6s ease-in-out infinite alternate;
  z-index: 2;
}

.float.david {
  left: -120px;
  bottom: 8%;
  width: 230px;
}

.float.scan {
  right: -64px;
  top: 14%;
  animation-delay: -3s;
}

.float .who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.float .who .label {
  font-size: 9.5px;
}

.receipt {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: var(--r-chip);
  border: 1px solid var(--hairline);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sub);
}

.float.scan b {
  display: block;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

@keyframes bob {
  to {
    transform: translateY(-10px);
  }
}

@media (max-width: 600px) {
  .phone {
    width: 280px;
  }
  .float {
    display: none;
  }
}

/* Orb của David — gradient nón xoay */
.orb {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--ink), var(--data), var(--faint), var(--ink));
  animation: spin 6s linear infinite;
}

.orb::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--raised);
  filter: blur(2px);
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Mục ──────────────────────────────────────────────────────────────── */
section {
  padding: 88px 0;
}

.sec-head {
  max-width: 640px;
  margin-bottom: 44px;
}

.sec-head .label {
  display: block;
  margin-bottom: 14px;
}

.sec-head h2 {
  margin-bottom: 16px;
}

/* Lưới tính năng */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.tile {
  border-radius: var(--r-card);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 230px;
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.6s var(--ease-enter), transform 0.6s var(--ease-enter);
}

.tile.in {
  opacity: 1;
  transform: none;
}

.tile .ico {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.tile .ico svg {
  width: 24px;
  height: 24px;
}

.tile p {
  color: var(--sub);
  font-size: 15px;
}

.tile .chips {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
}

.chip {
  padding: 5px 11px;
  border-radius: var(--r-chip);
  border: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--sub);
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .tile {
    min-height: 0;
  }
}

/* Mục tách đôi: chữ một bên, minh hoạ một bên */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.split.flip > :first-child {
  order: 2;
}

@media (max-width: 900px) {
  .split,
  .split.flip {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .split.flip > :first-child {
    order: 0;
  }
}

.points {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.points li {
  display: flex;
  gap: 12px;
  color: var(--sub);
}

.points li b {
  color: var(--ink);
  font-weight: 600;
}

.points svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--ink);
}

/* Minh hoạ: quét món ăn */
.scanner {
  border-radius: 30px;
  padding: 16px;
}

.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  overflow: hidden;
  background: var(--track);
}

.photo > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.photo .line {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--data);
  box-shadow: 0 0 18px 4px color-mix(in srgb, var(--data) 60%, transparent);
  animation: scan 2.4s ease-in-out infinite alternate;
}

@keyframes scan {
  from {
    top: 6%;
  }
  to {
    top: 94%;
  }
}

.photo .tag {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 12px;
  border-radius: var(--r-chip);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.items {
  margin-top: 14px;
  display: grid;
  gap: 2px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
}

.item + .item {
  border-top: 1px solid var(--track);
}

.check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
}

.check svg {
  width: 13px;
  height: 13px;
}

.item .name {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
}

.item .name span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--sub);
}

.item .k {
  font-weight: 600;
}

.add {
  margin-top: 12px;
  width: 100%;
  justify-content: center;
}

/* Minh hoạ: trò chuyện với David */
.chat {
  border-radius: 30px;
  padding: 22px;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--track);
}

.chat-head .orb {
  width: 44px;
  height: 44px;
}

.chat-head b {
  display: block;
  font-size: 16px;
}

.msgs {
  display: grid;
  gap: 12px;
}

.msg {
  max-width: 82%;
  padding: 12px 15px;
  font-size: 14.5px;
  line-height: 1.5;
}

.msg.me {
  justify-self: end;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 20px 20px 6px 20px;
}

.msg.ai {
  border-radius: 20px 20px 20px 6px;
}

.receipts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
}

.composer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 8px 0 18px;
  border-radius: var(--r-input);
  color: var(--faint);
  font-size: 14.5px;
}

.composer > span:first-child {
  flex: 1;
}

.composer .send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
}

.composer svg {
  width: 17px;
  height: 17px;
}

/* Minh hoạ: biểu đồ năng lượng nạp vs tiêu */
.chart {
  border-radius: 30px;
  padding: 24px;
}

.chart-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.chart .big {
  font-size: 26px;
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: var(--r-chip);
  background: var(--track);
  font-size: 12px;
  font-weight: 600;
}

.seg button {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--r-chip);
  color: var(--sub);
  transition: background 0.25s, color 0.25s;
}

.seg .on {
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-small);
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  height: 180px;
}

.day {
  display: grid;
  gap: 8px;
  height: 100%;
  grid-template-rows: 1fr auto;
}

.pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.pair i {
  width: 9px;
  border-radius: 5px;
  height: 0;
  transition: height 1.2s var(--ease-enter);
}

.pair i:first-child {
  background: var(--data);
}

.pair i:last-child {
  background: var(--bar-out);
}

.in .pair i {
  height: var(--h);
}

.day small {
  text-align: center;
  font-size: 11px;
  color: var(--sub);
}

.legend {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--sub);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

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

.stat {
  border-radius: 18px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--line);
}

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.stat .label {
  font-size: 9.5px;
}

/* Chuyên gia */
.pros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.pro {
  border-radius: var(--r-card);
  padding: 22px;
}

.pro .top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--track);
  font-weight: 600;
}

.pro .top b {
  display: block;
  font-size: 15.5px;
}

.pro .top span {
  font-size: 13px;
  color: var(--sub);
}

.pro p {
  font-size: 14.5px;
  color: var(--sub);
}

.pro .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .pros {
    grid-template-columns: 1fr;
  }
}

/* Kêu gọi cuối trang */
.final {
  text-align: center;
  border-radius: 36px;
  padding: 72px 24px;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.final svg.mark {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

.final .lead {
  margin-bottom: 14px;
}

/* Chân trang */
/* `footer.wrap` để thắng `.wrap` (chỉ đặt lề hai bên). */
footer.wrap {
  margin-top: 56px;
  padding-bottom: 72px;
  color: var(--sub);
  font-size: 14.5px;
}

.foot {
  padding-top: 56px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 40px 56px;
}

.foot-brand {
  display: grid;
  gap: 14px;
  max-width: 300px;
}

.foot-brand .lockup {
  color: var(--ink);
}

.foot-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 40px 72px;
}

.foot-cols div {
  display: grid;
  gap: 12px;
  align-content: start;
}

.foot-cols .label {
  margin-bottom: 4px;
  font-size: 10.5px;
  color: var(--faint);
}

.foot a {
  text-decoration: none;
  transition: color 0.2s;
}

.foot a:hover {
  color: var(--ink);
}

.foot-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--track);
  font-size: 13px;
  color: var(--faint);
}

@media (max-width: 600px) {
  footer.wrap {
    padding-bottom: 56px;
  }
  .foot {
    padding-top: 44px;
  }
  .foot-cols {
    gap: 32px 48px;
  }
}

/* Trang văn bản (chính sách, hỗ trợ) */
.doc {
  max-width: 760px;
  margin: 56px auto 40px;
  border-radius: 32px;
  padding: clamp(28px, 5vw, 56px);
}

.doc h1 {
  font-size: clamp(36px, 5vw, 52px);
  margin: 10px 0 12px;
}

.doc h2 {
  font-size: 26px;
  margin: 40px 0 12px;
}

.doc p,
.doc li {
  color: var(--sub);
}

.doc p + p {
  margin-top: 12px;
}

.doc ul {
  padding-left: 20px;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.doc strong {
  color: var(--ink);
  font-weight: 600;
}

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

/* Mô hình điện thoại trên màn hẹp: vòng nhỏ lại để nhãn macro không xuống dòng. */
.ring svg {
  width: 100%;
  height: 100%;
}

.macro .row {
  gap: 6px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .kcal {
    gap: 12px;
  }
  .ring {
    width: 84px;
    height: 84px;
  }
  .ring b {
    font-size: 18px;
  }
  .macro .row {
    font-size: 9px;
  }
}

/* Điện thoại: mục gần nhau hơn, số lớn nhỏ lại cho khỏi gãy dòng. */
@media (max-width: 600px) {
  section {
    padding: 56px 0;
  }
  .sec-head {
    margin-bottom: 28px;
  }
  .nav-inner {
    padding: 0 8px 0 16px;
  }
  .nav .btn {
    height: 40px;
    padding: 0 14px;
  }
  .chart {
    padding: 20px;
  }
  .chart .big {
    font-size: 21px;
  }
  .bars {
    gap: 6px;
    height: 150px;
  }
  .final {
    padding: 52px 20px;
  }
  footer.wrap {
    margin-top: 24px;
  }
}

/* ── Demo bấm được ──────────────────────────────────────────────────── */
.try {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding: 8px 14px;
  border-radius: var(--r-chip);
  border: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--sub);
}

.try i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--data);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--data) 25%, transparent);
  }
}

/* Quét món */
.scanning .photo .line {
  display: block;
}

.photo > svg {
  transition: opacity 0.3s, transform 0.5s var(--ease-enter);
}

.scanning .photo > svg {
  opacity: 0.55;
  transform: scale(0.97);
}

button.item {
  appearance: none;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 14px;
  transition: opacity 0.25s, background 0.2s;
}

button.item:hover {
  background: var(--track);
}

button.item + button.item {
  border-top: 1px solid var(--track);
}

.item .name {
  display: block;
}

.item .check {
  transition: transform 0.35s var(--ease-pop), background 0.2s;
}

.item.off {
  opacity: 0.45;
}

.item.off .check {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--faint);
  transform: scale(0.88);
}

.item.off .check svg {
  opacity: 0;
}

.item.off .k {
  text-decoration: line-through;
}

.items.loading .item {
  opacity: 0.25;
  pointer-events: none;
}

.items .item {
  animation: rise 0.45s var(--ease-enter) both;
}

.items .item:nth-child(2) {
  animation-delay: 60ms;
}
.items .item:nth-child(3) {
  animation-delay: 120ms;
}
.items .item:nth-child(4) {
  animation-delay: 180ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.scan-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.scan-actions .btn.primary {
  flex: 1;
  justify-content: center;
}

.btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.btn.primary.done {
  opacity: 1;
  background: var(--data);
  color: #0b0d12;
}

/* Món mới trong điện thoại */
.meal.new {
  animation: rise 0.5s var(--ease-enter) both;
}

.meal.new .k {
  color: var(--data-faint);
}

/* David */
.msgs {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.msgs > * {
  animation: rise 0.4s var(--ease-enter) both;
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sub);
  animation: blink 1s ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  50% {
    opacity: 0.25;
    transform: translateY(-2px);
  }
}

.orb.thinking {
  animation-duration: 1.2s;
}

.suggest {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 16px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.suggest::-webkit-scrollbar {
  display: none;
}

button.chip {
  appearance: none;
  flex: none;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, transform 0.35s var(--ease-pop);
}

button.chip:hover {
  background: var(--track);
}

button.chip:active,
.send:active,
.tabbar button:active,
.seg button:active {
  transform: scale(0.92);
}

.composer {
  margin-top: 10px;
  color: var(--ink);
}

.composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  /* 16px để Safari trên iPhone không tự phóng to khi bấm vào ô. */
  font-size: 16px;
  color: var(--ink);
}

.composer input::placeholder {
  color: var(--faint);
}

.composer:focus-within {
  border-color: var(--hairline);
}

.composer .send {
  border: 0;
  cursor: pointer;
  transition: transform 0.35s var(--ease-pop);
}
