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

:root {
  color-scheme: light;
  --bg: #eef7f5;
  --bg-deep: #d6f0ea;
  --text: #153039;
  --muted: rgba(21, 48, 57, 0.68);
  --panel: rgba(255, 255, 255, 0.44);
  --panel-strong: rgba(255, 255, 255, 0.64);
  --panel-border: rgba(255, 255, 255, 0.5);
  --accent: #1f9f94;
  --accent-strong: #138278;
  --accent-soft: rgba(31, 159, 148, 0.16);
  --shadow: 0 22px 60px rgba(26, 66, 72, 0.16);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081519;
  --bg-deep: #10232a;
  --text: #edf8f7;
  --muted: rgba(237, 248, 247, 0.7);
  --panel: rgba(13, 31, 37, 0.58);
  --panel-strong: rgba(19, 39, 46, 0.72);
  --panel-border: rgba(172, 240, 229, 0.16);
  --accent: #66d6c4;
  --accent-strong: #8ff2e0;
  --accent-soft: rgba(102, 214, 196, 0.14);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.7), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(159, 241, 224, 0.52), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--text);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  max-width: 1040px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 16px calc(124px + var(--safe-bottom));
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.7;
  pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}

.ambient-a {
  top: 70px;
  left: -40px;
  width: 180px;
  height: 180px;
  background: rgba(117, 233, 207, 0.48);
}

.ambient-b {
  top: 360px;
  right: -30px;
  width: 210px;
  height: 210px;
  background: rgba(255, 224, 173, 0.38);
  animation-duration: 15s;
}

.ambient-c {
  bottom: 120px;
  left: 42%;
  width: 140px;
  height: 140px;
  background: rgba(129, 192, 255, 0.28);
  animation-duration: 17s;
}

.glass-panel {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.1)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.4), transparent 42%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.35), transparent 30%);
  pointer-events: none;
}

.hero,
.empty-state,
.status-banner,
.spotlight-card,
.support-card,
.action-card,
.chart-panel,
.profile-card,
.macro-panel,
.tab-strip,
.metric-card,
.glass-panel {
  border-radius: var(--radius-xl);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  animation: reveal 0.4s ease-out both;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.02;
  max-width: 12ch;
}

.hero-subtitle {
  margin: 12px 0 0;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.55;
}

.icon-button,
.ghost-button,
.primary-button {
  position: relative;
  z-index: 1;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.icon-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.26);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f8fffe;
  box-shadow: 0 16px 30px rgba(19, 130, 120, 0.24);
}

.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.chip-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.status-banner {
  z-index: 2;
  margin-top: 16px;
  padding: 14px 18px;
  font-weight: 700;
  animation: reveal 0.25s ease-out both;
}

.status-banner.success {
  color: #0b6f63;
  background: rgba(162, 239, 220, 0.82);
}

.status-banner.error {
  color: #8c2d31;
  background: rgba(255, 203, 206, 0.88);
}

.hidden {
  display: none !important;
}

.empty-state {
  margin-top: 18px;
  padding: 28px;
  text-align: center;
}

.empty-icon {
  font-size: 2.2rem;
}

.empty-state h2 {
  margin: 14px 0 10px;
  font-size: 1.45rem;
}

.empty-state p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.55;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.content {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.tab-strip {
  position: sticky;
  top: calc(8px + var(--safe-top));
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px;
  margin-bottom: 18px;
}

.tab-button {
  min-height: 48px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab-button.active {
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.tab-pane {
  display: none;
  animation: reveal 0.35s ease-out both;
}

.tab-pane.active {
  display: grid;
  gap: 18px;
}

.metrics-grid,
.meal-columns {
  display: grid;
  gap: 16px;
}

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

.progress-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
  min-height: 148px;
}

.metric-label,
.metric-hint,
.section-note,
.mini-label {
  color: var(--muted);
}

.metric-label,
.mini-label {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.metric-value {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.05;
  font-weight: 800;
}

.metric-hint,
.section-note {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

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

.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.35s ease;
}

.spotlight-card,
.support-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px;
}

.spotlight-card h2,
.support-card h2,
.section-head h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.spotlight-card p:last-child,
.support-card p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.goal-pill {
  min-width: 136px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.36);
  text-align: center;
}

.goal-pill span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.goal-pill small {
  color: var(--muted);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.action-card,
.profile-card,
.chart-panel,
.macro-panel,
.support-card,
.spotlight-card {
  padding: 22px;
}

.action-head h3 {
  margin: 0;
  font-size: 1.12rem;
}

.action-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.chip-button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--text);
  font-weight: 700;
}

.stack-form,
.settings-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

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

.field span {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(31, 159, 148, 0.5);
  background: rgba(255, 255, 255, 0.5);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.timeline-list,
.events-list,
.meal-list,
.preset-list,
.facts-grid,
.tag-cloud,
.chart-legend,
.macro-chips {
  display: grid;
  gap: 12px;
}

.timeline-item,
.event-item,
.meal-item,
.fact-item,
.macro-chip {
  position: relative;
  z-index: 1;
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.timeline-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: flex-start;
}

.timeline-time {
  font-weight: 800;
  color: var(--accent-strong);
}

.timeline-detail,
.event-time,
.meal-note,
.fact-value {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.event-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.event-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  font-size: 1.1rem;
}

.meal-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preset-list {
  grid-template-columns: 1fr;
}

.preset-card {
  position: relative;
  z-index: 1;
  border-radius: 28px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.preset-card.active {
  background: rgba(219, 255, 239, 0.42);
  border-color: rgba(58, 158, 103, 0.42);
  box-shadow: 0 18px 38px rgba(58, 158, 103, 0.14);
}

.preset-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.preset-topline h3 {
  margin: 0;
  font-size: 1.15rem;
}

.preset-subtitle,
.preset-goal,
.preset-meta,
.preset-section ul,
.preset-section li {
  color: var(--muted);
}

.preset-subtitle,
.preset-goal {
  margin: 8px 0 0;
  line-height: 1.5;
}

.preset-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 800;
  white-space: nowrap;
}

.preset-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.preset-macros span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  font-weight: 700;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.preset-section {
  border-radius: 22px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.22);
}

.preset-section h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.preset-meta {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.preset-section ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.meal-item-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.meal-item-title h3 {
  margin: 0;
  font-size: 1rem;
}

.meal-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.meal-meta span,
.macro-chip span,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.macro-chips {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.weight-chart {
  width: 100%;
  height: 180px;
  margin-top: 8px;
}

.chart-grid line {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: url(#chartGradient);
  opacity: 0.5;
}

.chart-dot {
  fill: #ffffff;
  stroke: var(--accent-strong);
  stroke-width: 3;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chart-legend {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.facts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fact-item {
  min-height: 92px;
}

.fact-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.fact-value {
  margin-top: 8px;
  font-weight: 800;
  color: var(--text);
}

.tags-stack {
  display: grid;
  gap: 18px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background: rgba(255, 255, 255, 0.34);
}

@media (max-width: 900px) {
  .metrics-grid,
  .progress-grid,
  .macro-chips,
  .quick-grid,
  .meal-columns,
  .facts-grid,
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero,
  .spotlight-card,
  .support-card,
  .section-head {
    display: grid;
  }

  .hero {
    gap: 18px;
  }

  .tab-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics-grid,
  .progress-grid,
  .macro-chips,
  .quick-grid,
  .meal-columns,
  .facts-grid,
  .chart-legend,
  .preset-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(20px, -24px, 0) scale(1.1);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
