:root {
  --bg: #3f4d60;
  --panel: rgba(90, 102, 118, 0.8);
  --panel-2: rgba(78, 90, 106, 0.9);
  --ink: #f1f4f9;
  --muted: #b6c0cc;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --line: rgba(255,255,255,0.08);
  --shadow: 0 14px 30px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }

body {
  touch-action: manipulation;
  margin: 0;
  font-family: "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 20% -10%, #56647a 0%, #3e4d61 40%, #364354 100%);
}

.app { max-width: 480px; margin: 0 auto; padding: 14px 12px 100px; }

.topbar {
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 12px;
}

.title { text-align: center; font-weight: 700; }

.link-btn, .icon-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
}

.hero-card {
  background: var(--panel);
  border-radius: 24px;
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.streak {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  padding: 6px 10px;
  border-radius: 14px;
  display: inline-block;
  font-weight: 600;
  margin-bottom: 10px;
}

.date-switch {
  background: var(--panel-2);
  border-radius: 18px;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  border: 1px solid var(--line);
}

.date { text-align: center; font-size: 18px; font-weight: 600; }

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

.glass-card {
  background: var(--panel);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.glass-card h2 { margin: 0 0 10px; font-size: 20px; }

.progress .bar {
  height: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}

.progress .bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.progress-text { margin-top: 8px; color: var(--muted); font-size: 14px; }

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

.macro { text-align: center; }

.macro-title { color: var(--muted); font-size: 13px; }

.ring {
  width: 78px;
  height: 78px;
  margin: 8px auto;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.macro-sub { color: var(--muted); font-size: 12px; }

.fasting {
  display: grid;
  gap: 8px;
}

.fasting-time { font-size: 30px; font-weight: 700; }

.fasting-sub { color: var(--muted); font-size: 13px; }

.fasting-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.table { margin-top: 10px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }

.thead, .row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px;
}

.thead { background: rgba(255,255,255,0.08); font-size: 12px; color: var(--muted); }

.row { background: rgba(0,0,0,0.1); font-size: 13px; }

.empty { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.form { display: grid; gap: 10px; }

input, select, button {
  font: inherit;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.15);
  color: var(--ink);
}

button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}

button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.note { font-size: 13px; color: var(--muted); min-height: 18px; }

.shop-grid { display: grid; gap: 10px; }

.shop-card {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.shop-title { font-weight: 700; }

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

.profile-card {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: grid;
  gap: 12px;
  text-align: center;
}

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

.tabbar {
  pointer-events: auto;
  z-index: 9999;
  z-index: 1000;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(88, 100, 116, 0.95);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 8px 6px 14px;
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
}

.tab {
  pointer-events: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 4px;
  font-size: 11px;
}

.tab.active {
  background: rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 8px 0;
  color: var(--ink);
}

.tab-page { display: none; }
.tab-page.active { display: block; }

.tab-page.active { display: block; }

@media (max-width: 420px) {
  .macro-grid { grid-template-columns: 1fr; }
  .tabbar {
  pointer-events: auto;
  z-index: 9999;
  z-index: 1000; grid-template-columns: repeat(3, 1fr); row-gap: 8px; }
}


.chart {
  margin-top: 10px;
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,0.12);
  border: 1px solid var(--line);
}

.chart-meta {
  color: var(--muted);
  font-size: 12px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  height: 140px;
  margin-top: 12px;
}

.bar-col {
  display: grid;
  gap: 6px;
  align-items: end;
  justify-items: center;
}

.bar-fill {
  width: 100%;
  height: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
}


.js-status {
  font-size: 12px;
  color: #ffd166;
  margin: 6px 4px 4px;
}
