/* UNUTMA Mini App. Uslub mijoz dizayni bo‘yicha: docs/design/bosh-sahifa-v2-12-bolim.png */

:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #1c2340;
  --text: #27304d;
  --muted: #8a90a6;
  --line: rgba(176, 140, 96, 0.14);
  --accent: #b1844c;
  --accent-ink: #9a6731;
  --accent-soft: #f7eee2;
  --water: #2f7bf0;
  --water-soft: #eaf3ff;
  --danger: #e5484d;
  --shadow: 0 6px 18px rgba(130, 98, 60, 0.08), 0 1px 2px rgba(130, 98, 60, 0.06);
  --radius: 18px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 85% 0%, rgba(232, 214, 190, 0.45), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(236, 222, 202, 0.5), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; }

.app { max-width: 520px; margin: 0 auto; padding: 12px 16px calc(104px + var(--safe-bottom)); }
.app.sub { padding-bottom: calc(28px + var(--safe-bottom)); }

.boot { min-height: 100vh; }

/* ---------- Bosh sahifa sarlavhasi ---------- */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 4px 0 18px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent); border-radius: 50%; position: relative; }
.icon-btn:active { background: var(--accent-soft); }
.icon-btn svg { width: 28px; height: 28px; }
.dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.brand { text-align: center; }
.brand-name { font-size: 28px; font-weight: 800; letter-spacing: 0.03em; color: var(--ink); line-height: 1.1; }
.brand-sub { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 16px; font-weight: 600; color: var(--accent); }
.brand-sub::before { content: ""; width: 20px; height: 2.5px; border-radius: 2px; background: var(--accent); }

/* ---------- Bo‘limlar ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 9px; min-height: 76px; padding: 10px 9px 10px 10px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left;
  border: 1px solid var(--line); transition: transform 0.12s ease;
}
.tile:active { transform: scale(0.97); }
.tile-icon { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 5px rgba(40, 40, 80, 0.16)); }
.tile-icon svg { width: 42px; height: 42px; }
.tile-label { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; color: var(--text); overflow-wrap: break-word; hyphens: auto; line-height: 1.2; }
.chev { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.chev svg { width: 15px; height: 15px; }
/* Tor telefonlarda (360px) nom sig‘ishi uchun strelka yashiriladi */
@media (max-width: 374px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .grid { gap: 10px; }
  .tile .chev { display: none; }
}

.banner { display: block; margin-top: 14px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--card); }
.banner img { display: block; width: 100%; height: auto; }

/* ---------- Pastki menyu ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 520px; margin: 0 auto; padding: 10px 8px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.97); border-radius: 26px 26px 0 0;
  box-shadow: 0 -4px 22px rgba(130, 98, 60, 0.1);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.nav-item svg { width: 28px; height: 28px; }
.nav-item.active { color: var(--accent-ink); }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- Ichki sahifalar ---------- */
.page-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; min-height: 40px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 800; color: var(--ink); }
.back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); color: var(--accent-ink); }
.back svg { width: 20px; height: 20px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }

.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.list-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item:active { background: #fdfaf5; }
.li-emoji { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 13px; font-size: 22px; }
.li-label { flex: 1; font-size: 16px; font-weight: 500; }
.badge { font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; margin: 0 auto 12px; color: #d9c4a6; }

.btn {
  width: 100%; min-height: 50px; padding: 12px 18px; border-radius: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #c3955d, #a8733c); box-shadow: 0 6px 14px rgba(168, 115, 60, 0.28);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; }
.btn-soft { width: 100%; min-height: 46px; border-radius: 14px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); }

.note { font-size: 13px; color: var(--muted); margin: 4px 4px 0; }
.lead { margin: 0 0 14px; color: var(--text); }

/* ---------- Sozlamalar ---------- */
.lang-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; text-align: left; }
.lang-item + .lang-item { border-top: 1px solid var(--line); }
.lang-item .flag { font-size: 24px; line-height: 1; }
.lang-item .name { flex: 1; font-weight: 500; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #d8c9b4; flex: none; }
.lang-item.active .radio { border: 7px solid var(--accent); }
.section-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 6px 8px; }

/* ---------- Suv nazorati ---------- */
.water-hero { text-align: center; padding: 20px 16px 16px; }
.ring { position: relative; width: 210px; height: 210px; margin: 0 auto; }
.ring > svg { width: 210px; height: 210px; }
.ring-bg { fill: none; stroke: var(--water-soft); stroke-width: 16; }
.ring-fg { fill: none; stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-drop { width: 26px; height: 26px; color: var(--water); margin-bottom: 2px; }
.ring-drop svg { width: 26px; height: 26px; }
.ring-value { font-size: 36px; font-weight: 800; color: var(--ink); line-height: 1.05; font-variant-numeric: tabular-nums; }
.ring-goal { font-size: 14px; color: var(--muted); font-weight: 500; }
.ring-pct { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--water); background: var(--water-soft); padding: 2px 10px; border-radius: 999px; }
.water-status { margin: 14px 0 16px; font-weight: 600; color: var(--text); }
.water-status.done { color: #12a05c; }
.portions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.portion {
  min-height: 54px; border-radius: 14px; font-weight: 700; color: var(--water); background: var(--water-soft);
  display: flex; align-items: center; justify-content: center; gap: 4px; transition: transform 0.12s ease;
}
.portion:active { transform: scale(0.95); background: #dcebff; }
.portion small { font-weight: 600; font-size: 12px; opacity: 0.8; }
.link { margin-top: 12px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-val { font-size: 11px; color: var(--muted); height: 14px; font-variant-numeric: tabular-nums; }
.bar-track { position: relative; width: 100%; max-width: 30px; height: 120px; border-radius: 9px; background: #f3f6fb; display: flex; align-items: flex-end; overflow: visible; }
.bar-track::after { content: ""; position: absolute; left: -5px; right: -5px; bottom: 80%; border-top: 1.5px dashed rgba(47, 123, 240, 0.35); pointer-events: none; }
.bar { width: 100%; border-radius: 9px; background: linear-gradient(180deg, #8fd0ff, #5aa2f5); min-height: 0; transition: height 0.4s ease; }
.bar.full { background: linear-gradient(180deg, #5cc2ff, #2f6fed); }
.bar-day { font-size: 12px; color: var(--muted); font-weight: 500; }
.bar-col.today .bar-day { color: var(--water); font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: #fbf8f3; border-radius: 14px; padding: 12px; }
.stat-label { display: block; font-size: 12.5px; color: var(--muted); }
.stat-value { display: block; font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.stat-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input-unit { display: flex; align-items: center; gap: 8px; background: #fbf8f3; border: 1.5px solid #eadfce; border-radius: 14px; padding: 0 14px; }
.input-unit:focus-within { border-color: var(--accent); }
.input-unit input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 24px; font-weight: 700; padding: 12px 0; color: var(--ink); }
.input-unit span { font-weight: 600; color: var(--muted); }
.goal-preview { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 2px 16px; color: var(--muted); font-size: 14px; }
.goal-preview b { font-size: 20px; color: var(--water); }

.row { display: flex; align-items: center; gap: 12px; }
.row-text { flex: 1; font-weight: 600; }
.switch { width: 52px; height: 32px; border-radius: 999px; background: #e3dccf; position: relative; flex: none; transition: background 0.2s ease; }
.switch span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18); transition: transform 0.2s ease; }
.switch.on { background: var(--water); }
.switch.on span { transform: translateX(20px); }
.sub-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 13px; border-radius: 999px; background: #f4f1ec; font-size: 14px; font-weight: 600; color: var(--text); }
.chip.active { background: var(--water); color: #fff; }
.time-row { display: flex; align-items: center; gap: 10px; }
.time-row input { flex: 1; min-width: 0; border: 1.5px solid #eadfce; background: #fbf8f3; border-radius: 12px; padding: 10px 12px; font-size: 17px; font-weight: 600; text-align: center; }
.time-row span { color: var(--muted); }

.loading { height: 260px; border-radius: var(--radius); background: linear-gradient(90deg, #f6efe4 0%, #fbf7f1 50%, #f6efe4 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Sport: so‘rovnoma, reja, vazn ---------- */
.cta { text-align: center; }
.cta-emoji { font-size: 44px; line-height: 1; margin: 4px 0 10px; }
.stat-value.small { font-size: 16px; padding-top: 5px; }
.progress { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #d6aa72, #a8733c); transition: width 0.4s ease; }
.progress-text { font-size: 13px; color: var(--accent-ink); font-weight: 600; margin-top: 6px; }

.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 2px 0 10px; }
.steps span { height: 6px; border-radius: 999px; background: #eadfce; transition: background 0.2s ease; }
.steps span.on { background: var(--accent); }
.step-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.question { font-size: 24px; font-weight: 800; color: var(--ink); margin: 4px 0 18px; line-height: 1.2; }
.options { display: grid; gap: 10px; }
.option {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left;
  background: var(--card); border-radius: 16px; border: 1.5px solid var(--line); box-shadow: var(--shadow);
}
.option.active { border-color: var(--accent); background: #fffaf3; }
.option.active .radio { border: 7px solid var(--accent); }
.option-emoji { width: 40px; flex: none; font-size: 28px; text-align: center; }
.option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option-text b { font-size: 16px; font-weight: 600; color: var(--text); }
.option-text small { font-size: 13px; color: var(--muted); }
.onb-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 22px; }
.onb-actions .btn-soft { min-height: 50px; }

.success { background: linear-gradient(135deg, #fff6e8, #fbe7cc); color: var(--accent-ink); font-weight: 700; font-size: 17px; text-align: center; }
.kcal { margin: 2px 0 14px; color: var(--muted); font-weight: 600; }
.kcal b { font-size: 40px; font-weight: 800; color: var(--ink); margin-right: 6px; font-variant-numeric: tabular-nums; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.macro { background: #fbf8f3; border-radius: 14px; padding: 10px; min-width: 0; }
.macro b { display: block; font-size: 17px; color: var(--ink); margin: 2px 0 8px; white-space: nowrap; }
.macro-bar { height: 6px; border-radius: 999px; background: #eee5d8; overflow: hidden; }
.macro-bar span { display: block; height: 100%; border-radius: 999px; }
.macro-protein .macro-bar span { background: #e8735a; }
.macro-fat .macro-bar span { background: #f2b544; }
.macro-carbs .macro-bar span { background: #5aa2f5; }
.meal { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.meal + .meal { border-top: 1px solid var(--line); }
.meal-emoji { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #fbf5ec; font-size: 20px; }
.meal-name { flex: 1; font-weight: 500; }
.meal b { color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.eta { margin: 12px 0 0; font-size: 14px; font-weight: 600; color: var(--text); }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tips li { position: relative; padding-left: 28px; font-size: 14.5px; line-height: 1.45; }
.tips li::before {
  content: "✓"; position: absolute; left: 0; top: 1px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 800;
}
.note.warn { color: #b4541e; }

.stats.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats.three .stat { padding: 10px; }
.stats.three .stat-value { font-size: 20px; }
.changes { display: grid; gap: 6px; margin-top: 12px; }
.changes div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.changes b { color: var(--ink); white-space: nowrap; }
.changes b.good { color: #12a05c; }
.changes b.bad { color: #c9772f; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #efe7da; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .target-line { stroke: #12a05c; stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .target-label { fill: #12a05c; font-size: 11px; font-weight: 700; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.chart .pt.last { fill: var(--accent); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.inline-form .btn { width: auto; min-height: 0; padding: 0 20px; }
.inline-form .input-unit { min-width: 0; }
.inline-form .input-unit input { width: 100%; font-size: 20px; padding: 10px 0; }

/* ---------- Pastdan chiquvchi oyna va xabar ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(28, 25, 20, 0.36); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease; }
.sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 24px 24px 0 0; padding: 22px 20px calc(20px + var(--safe-bottom)); text-align: center; animation: rise 0.22s ease; }
.sheet h3 { margin: 10px 0 6px; font-size: 20px; color: var(--ink); }
.sheet p { margin: 0 0 18px; color: var(--muted); }
.sheet-icon { width: 64px; height: 64px; margin: 0 auto; filter: drop-shadow(0 6px 8px rgba(40, 40, 80, 0.16)); }
.sheet-icon svg { width: 64px; height: 64px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom)); z-index: 30; transform: translate(-50%, 20px);
  max-width: calc(100% - 40px); padding: 11px 18px; border-radius: 999px; background: rgba(28, 35, 64, 0.92); color: #fff;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.outside { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 20px; }
.outside a { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; max-width: 320px; }
