:root {
  --bg: #0b0d12;
  --card: #14171f;
  --card-2: #1e222d;
  --text: #f2f5fa;
  --muted: #97a1b2;
  --line: #262b37;
  --accent: #6d5efc;
  --accent-2: #4f8cff;
  --cal-a: #ff8a3d; --cal-b: #ff4d6d;
  --pro: #34d399;
  --carb: #fbbf24;
  --fat: #f472b6;
  --water: #38bdf8;
  --series: #6db0ff;      /* kilo grafiği çizgisi (koyu tema) */
  --grid: #262b37;
  --danger: #f0616d;
  --good: #34d399;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1f7; --card: #ffffff; --card-2: #f1f4fa;
    --text: #141821; --muted: #5c6576; --line: #e4e9f2;
    --series: #2a78d6; --grid: #e4e9f2;
    --shadow: 0 10px 28px rgba(30,41,59,.10);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
.app { max-width: 540px; margin: 0 auto; }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: calc(env(safe-area-inset-top) + 20px) 20px 26px;
  background: linear-gradient(135deg, #6d5efc 0%, #4f8cff 55%, #22d3ee 120%);
  color: #fff;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(120px 120px at 85% 0%, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(160px 160px at 10% 120%, rgba(255,255,255,.18), transparent 70%);
  pointer-events: none;
}
.hero-top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
.greet { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.greet-date { opacity: .85; font-size: 13px; margin-top: 2px; text-transform: capitalize; }
.bell {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 20px; width: 46px; height: 46px; border-radius: 15px;
  cursor: pointer; backdrop-filter: blur(6px); transition: transform .15s;
}
.bell:active { transform: scale(.92); }
.bell.on { background: #fff; }

.streak {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px; padding: 7px 13px; border-radius: 999px;
  background: rgba(0,0,0,.18); font-weight: 700; font-size: 14px;
}
.streak .flame { filter: drop-shadow(0 0 6px rgba(255,180,80,.9)); font-size: 16px; }
.streak.active { background: rgba(255,255,255,.22); }

.hero-workout { position: relative; margin-top: 18px; }
.hw-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; opacity: .8; }
.hw-name { font-size: 27px; font-weight: 800; letter-spacing: -.5px; margin-top: 3px; }

/* ---------- CONTENT ---------- */
.content { padding: 18px 16px 40px; }
.motiv {
  text-align: center; color: var(--muted); font-size: 14px; font-style: italic;
  margin: 4px 4px 18px;
}

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
  animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card-head { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head .ico { font-size: 19px; }
.tag {
  margin-left: auto; font-size: 11px; background: linear-gradient(120deg,#38bdf8,#0ea5e9);
  color: #04222e; padding: 3px 9px; border-radius: 999px; font-weight: 800;
}
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 12px; }

/* ---------- KALORİ HALKASI + MAKRO ---------- */
.ring-row { display: flex; gap: 18px; align-items: center; margin-top: 14px; }
.ring-wrap { position: relative; width: 124px; height: 124px; flex: none; }
.ring { width: 124px; height: 124px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--card-2); stroke-width: 13; }
.ring-fg {
  fill: none; stroke: url(#calGrad); stroke-width: 13; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 2px 6px rgba(255,77,109,.35));
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-val { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.ring-unit { font-size: 11px; color: var(--muted); margin-top: 1px; }

.macro-bars { flex: 1; display: flex; flex-direction: column; gap: 13px; }
.macro-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.macro-top span:last-child { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.bar { background: var(--card-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fg { height: 100%; width: 0; border-radius: 999px; transition: width 1s cubic-bezier(.22,1,.36,1); }
.bar-fg.pro { background: linear-gradient(90deg,#10b981,#34d399); }
.bar-fg.carb { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.bar-fg.fat { background: linear-gradient(90deg,#ec4899,#f472b6); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  font-size: 12.5px; font-weight: 700; padding: 7px 12px; border-radius: 999px;
  background: var(--card-2); color: var(--text); display: inline-flex; gap: 6px; align-items: center;
}
.chip.done { background: rgba(52,211,153,.16); color: var(--good); }

/* ---------- YEMEK ---------- */
.photo-btn {
  display: block; text-align: center; padding: 15px; border-radius: 15px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700; cursor: pointer; border: none; user-select: none;
  box-shadow: 0 6px 18px rgba(79,140,255,.35); transition: transform .15s, filter .15s;
}
.photo-btn:active { transform: scale(.98); filter: brightness(1.05); }
.status { margin-top: 12px; padding: 11px 13px; border-radius: 13px; font-size: 14px; background: var(--card-2); }
.status.err { background: rgba(240,97,109,.15); color: #fca5a5; }
.status.ok { background: rgba(52,211,153,.15); color: #6ee7b7; }
.status.loading { background: rgba(109,94,252,.14); color: #b6adff; }

.food-list { list-style: none; padding: 0; margin: 14px 0 0; }
.food-list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.food-list li:first-child { border-top: none; }
.food-list .fname { flex: 1; font-size: 14px; font-weight: 600; }
.food-list .fmacros { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.food-list .del { background: none; border: none; color: var(--danger); font-size: 18px; cursor: pointer; }
.conf { font-size: 11px; color: var(--muted); }

/* ---------- SU ---------- */
.water-body { display: flex; gap: 16px; align-items: center; margin-top: 14px; }
.bottle {
  position: relative; width: 46px; height: 96px; flex: none;
  border: 2.5px solid var(--water); border-radius: 12px 12px 14px 14px;
  overflow: hidden; background: var(--card-2);
}
.bottle::before {
  content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 8px; background: var(--water); border-radius: 3px;
}
.bottle-fill {
  position: absolute; bottom: 0; left: 0; right: 0; height: 0%;
  background: linear-gradient(180deg,#7dd3fc,#0ea5e9);
  transition: height 1s cubic-bezier(.22,1,.36,1);
}
.water-info { flex: 1; }
.water-val { font-size: 24px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.water-goal { font-size: 14px; color: var(--muted); font-weight: 500; }
.water-btns { display: flex; gap: 9px; margin-top: 12px; }
.water-btns button {
  flex: 1; padding: 12px 0; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .12s;
}
.water-btns button:active { transform: scale(.94); background: var(--water); color: #04222e; }

/* ---------- KİLO ---------- */
.weight-stats { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.wstat { flex: 1; min-width: 74px; background: var(--card-2); border-radius: 14px; padding: 11px 12px; }
.wstat .l { font-size: 11px; color: var(--muted); font-weight: 600; }
.wstat .v { font-size: 19px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; }
.wstat .v.down { color: var(--good); }
.wstat .v.up { color: var(--cal-b); }
.chart-box { position: relative; margin: 8px 0 14px; }
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 10px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.chart .wline { fill: none; stroke: var(--series); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .warea { fill: var(--series); opacity: .12; }
.chart .wdot { fill: var(--series); stroke: var(--card); stroke-width: 2; }
.chart .target { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .target-label { fill: var(--good); font-size: 9px; font-weight: 700; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; transform: translate(-50%, -120%); pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700;
  padding: 5px 9px; border-radius: 9px; white-space: nowrap; opacity: 0; transition: opacity .12s;
  box-shadow: var(--shadow);
}
.weight-add { display: flex; gap: 10px; }
.weight-add input {
  flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 12px; font-size: 16px;
}
.weight-add button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.weight-add button:active { filter: brightness(1.08); }

/* ---------- AYARLAR ---------- */
.settings-toggle {
  width: 100%; background: none; border: none; color: var(--text);
  font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; padding: 0;
}
.settings { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.settings input {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 12px; border-radius: 11px; font-size: 16px;
}
.split-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.split-edit { display: flex; flex-direction: column; gap: 8px; }
.split-edit .row { display: flex; align-items: center; gap: 10px; }
.split-edit .row span { width: 92px; font-size: 13px; color: var(--muted); font-weight: 600; }
.split-edit .row input { flex: 1; }
.save-btn {
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  padding: 13px; border-radius: 13px; font-weight: 700; font-size: 15px; cursor: pointer;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; opacity: .8; }
