:root{
  --bg:#050506; --card:#101014; --card2:#17151b; --text:#fff;
  --muted:#a7a1aa; --pink:#ff36b5; --violet:#a42cff; --red:#ff4365;
}
*{box-sizing:border-box}
body{
  margin:0;background:
  radial-gradient(circle at 50% 5%,rgba(164,44,255,.18),transparent 28%),
  linear-gradient(#050506,#09070b);
  color:var(--text);font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.app-shell{width:min(100%,520px);margin:auto;min-height:100vh;padding:24px 16px 48px}
.top{display:flex;align-items:center;justify-content:space-between;padding:12px 4px 22px}
.top small,.eyebrow{letter-spacing:.14em;color:#9a949e;font-size:11px;font-weight:700}
h1{margin:3px 0 0;font-size:24px}.top h1 span{color:var(--pink)}
.avatar{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;
background:linear-gradient(135deg,#2d2930,#131116);border:1px solid #312b34;color:#ff8bd5}
.card{background:linear-gradient(160deg,rgba(26,23,29,.97),rgba(12,11,14,.98));border:1px solid #252129;
border-radius:28px;padding:22px;margin-bottom:14px;box-shadow:0 18px 40px rgba(0,0,0,.24)}
.hero{text-align:center;padding:28px 22px}
.weight-row{display:flex;justify-content:center;align-items:baseline;gap:7px;margin:3px 0 8px}
.weight-row input{width:190px;background:transparent;border:0;outline:0;color:#fff;font-size:72px;line-height:1;
font-weight:700;text-align:right;font-variant-numeric:tabular-nums}
.weight-row span{font-size:18px;color:#b8b1bc}
.mini{border:0;background:#211d24;color:#ddd;padding:9px 13px;border-radius:14px}
.subtle{color:var(--muted);font-size:13px}
.glow{position:relative;overflow:hidden}
.glow:after{content:"";position:absolute;width:180px;height:180px;right:-60px;bottom:-120px;
background:radial-gradient(circle,var(--pink),transparent 65%);filter:blur(25px);opacity:.26}
.motivation p{font-size:18px;line-height:1.45;margin-bottom:0}
.section-title{display:flex;justify-content:space-between;gap:12px;align-items:center}
h2{font-size:34px;margin:4px 0 10px}h2 small{font-size:13px;color:#aaa;font-weight:500}
.badge{font-size:12px;background:#231d27;border:1px solid #332b37;padding:9px 12px;border-radius:999px}
.bar{height:12px;border-radius:99px;background:#262229;overflow:hidden}
#calBar{height:100%;width:0;background:linear-gradient(90deg,var(--violet),var(--pink),#ff5b6f);border-radius:inherit;transition:.4s}
.macros{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-top:18px}
.macros div{background:#17141a;padding:11px 8px;border-radius:16px;text-align:center}
.macros strong,.macros span{display:block}.macros strong{font-size:15px}.macros span{color:#918a95;font-size:10px;margin-top:4px}
h3{font-size:20px;margin:5px 0 14px}
input[type=file],textarea{width:100%;background:#0b0a0c;border:1px solid #2b2630;color:#eee;border-radius:18px;padding:14px;margin:6px 0 10px}
textarea{min-height:90px;resize:vertical}
.primary{width:100%;border:0;color:white;font-weight:800;padding:15px 18px;border-radius:18px;
background:linear-gradient(90deg,#9f25ff,#f12eff,#ff3e9f)}
.primary.secondary{background:linear-gradient(90deg,#342341,#7c2cf0,#ff39aa)}
.result{font-size:13px;line-height:1.5;color:#d8d2db;margin-top:12px}
.disclaimer{text-align:center;color:#706a74;font-size:11px;line-height:1.5;padding:8px 18px}
@media(max-width:380px){.weight-row input{font-size:62px;width:165px}.macros{grid-template-columns:repeat(2,1fr)}}

.progress-card{
  padding-bottom:20px;
}

.range-tabs{
  display:flex;
  gap:5px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.range-btn{
  border:1px solid #302a34;
  background:#151218;
  color:#8f8892;
  font-size:10px;
  font-weight:800;
  padding:7px 9px;
  border-radius:999px;
  cursor:pointer;
}

.range-btn.active{
  color:white;
  border-color:#9f25ff;
  background:linear-gradient(
    90deg,
    rgba(159,37,255,.25),
    rgba(255,54,181,.22)
  );
}

.chart-wrap{
  position:relative;
  width:100%;
  height:220px;
  margin-top:18px;
  padding:4px 0;
}

#weightChart{
  width:100%;
  height:100%;
  display:block;
}

.progress-summary{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-top:15px;
}

.progress-summary div{
  background:#151217;
  border:1px solid #242028;
  border-radius:16px;
  padding:12px;
}

.progress-summary span{
  display:block;
  font-size:10px;
  color:#8e8791;
  margin-bottom:4px;
}

.progress-summary strong{
  font-size:15px;
  color:#fff;
}

.meal-preview{
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  border-radius:20px;
  margin:12px 0 16px;
}

.meal-editor label{
  display:block;
  font-size:11px;
  color:#918a95;
  margin-bottom:10px;
}

.meal-editor input{
  width:100%;
  background:#0b0a0c;
  border:1px solid #2b2630;
  color:white;
  padding:13px;
  border-radius:14px;
  margin-top:5px;
}

.nutrition-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:8px;
}

.history-link{
  color:#ff55bf;
  text-decoration:none;
  font-size:12px;
}

.meal-list-item{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  color:white;
  padding:10px 0;
  border-bottom:1px solid #211d24;
}

.meal-list-item:last-child{
  border-bottom:0;
}

.meal-list-item img{
  width:58px;
  height:58px;
  border-radius:15px;
  object-fit:cover;
}

.meal-list-info{
  flex:1;
}

.meal-list-info strong{
  display:block;
  font-size:14px;
}

.meal-list-info span{
  display:block;
  color:#918a95;
  font-size:11px;
  margin-top:4px;
}

.meal-arrow{
  color:#77717b;
  font-size:25px;
}

.history-header{
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px 4px 24px;
}

.history-header small{
  display:block;
  color:#8f8892;
  font-size:10px;
  font-weight:800;
  letter-spacing:.16em;
}

.history-header h1{
  margin:3px 0 0;
  font-size:30px;
}

.back-button{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:50%;
  text-decoration:none;
  color:white;
  font-size:20px;
  background:linear-gradient(
    145deg,
    #211d24,
    #0e0d10
  );
  border:1px solid #302a34;
}

.history-day{
  margin-bottom:26px;
}

.history-day-title{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin:0 6px 10px;
}

.history-day-title > div:first-child span{
  display:block;
  font-size:18px;
  font-weight:800;
}

.history-day-title > div:first-child small{
  color:#817a84;
  font-size:11px;
}

.history-day-total{
  text-align:right;
}

.history-day-total strong{
  display:block;
  font-size:13px;
}

.history-day-total span{
  display:block;
  color:#817a84;
  font-size:10px;
  margin-top:3px;
}

.history-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.history-meal-card{
  display:flex;
  gap:13px;
  text-decoration:none;
  color:white;
  background:
    linear-gradient(
      145deg,
      rgba(25,22,28,.98),
      rgba(12,11,14,.98)
    );
  border:1px solid #27222b;
  border-radius:22px;
  padding:11px;
}

.history-meal-card img,
.history-placeholder{
  width:88px;
  height:88px;
  flex:0 0 88px;
  border-radius:17px;
  object-fit:cover;
}

.history-placeholder{
  display:grid;
  place-items:center;
  background:#18151b;
  color:#ff55bf;
}

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

.history-meal-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}

.history-meal-top strong{
  display:block;
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.history-meal-top span{
  display:block;
  font-size:10px;
  color:#8d8690;
  margin-top:3px;
}

.history-chevron{
  font-size:22px !important;
  color:#6f6872 !important;
  line-height:1;
  margin-top:-2px !important;
}

.history-calories{
  display:flex;
  align-items:baseline;
  gap:4px;
  margin-top:8px;
}

.history-calories strong{
  font-size:23px;
  line-height:1;
}

.history-calories span{
  color:#8f8892;
  font-size:10px;
}

.history-macros{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:8px;
}

.history-macros span{
  font-size:9px;
  color:#bbb4be;
  background:#18151b;
  border:1px solid #262129;
  border-radius:999px;
  padding:5px 7px;
}

.empty-history{
  text-align:center;
  padding:40px 24px;
}

.empty-icon{
  width:64px;
  height:64px;
  margin:0 auto 14px;
  display:grid;
  place-items:center;
  border-radius:50%;
  font-size:24px;
  color:#ff65c4;
  background:
    radial-gradient(
      circle,
      rgba(255,54,181,.22),
      rgba(164,44,255,.08)
    );
  border:1px solid #34293a;
}

.history-primary{
  display:block;
  text-decoration:none;
  margin-top:18px;
}

@media(max-width:380px){

  .history-meal-card img,
  .history-placeholder{
    width:76px;
    height:76px;
    flex-basis:76px;
  }

}

.meal-detail-image{
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  border-radius:22px;
  margin-bottom:22px;
}

.meal-detail-date{
  color:#8d8690;
  font-size:12px;
  margin:5px 0 22px;
}

.meal-detail-label{
  display:block;
  color:#918a95;
  font-size:11px;
}

.meal-detail-label input,
.meal-detail-card .nutrition-grid input{
  width:100%;
  background:#0b0a0c;
  border:1px solid #2b2630;
  color:white;
  padding:13px;
  border-radius:14px;
  margin-top:6px;
}

.meal-main-calories{
  display:flex;
  align-items:baseline;
  gap:8px;
  margin:20px 0;
}

.meal-main-calories input{
  width:160px;
  border:0;
  outline:0;
  background:transparent;
  color:white;
  font-size:58px;
  font-weight:800;
}

.meal-main-calories span{
  color:#9b949f;
  font-size:16px;
}

.ai-note-box{
  margin:18px 0;
  padding:15px;
  background:#151218;
  border:1px solid #29232d;
  border-radius:18px;
}

.ai-note-box span{
  display:block;
  color:#ff55bf;
  font-size:10px;
  font-weight:800;
  letter-spacing:.12em;
}

.ai-note-box p{
  color:#bbb4be;
  font-size:12px;
  line-height:1.5;
  margin:7px 0 0;
}

.danger-button{
  width:100%;
  border:1px solid rgba(255,67,101,.3);
  background:rgba(255,67,101,.08);
  color:#ff6b82;
  padding:14px 18px;
  border-radius:18px;
  margin-top:10px;
  font-weight:700;
  cursor:pointer;
}

.meal-detail-card{
  padding:18px;
}

.meal-detail-card .eyebrow{
  margin-top:6px;
}

.meal-detail-image{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:4/3;
  object-fit:cover;
  border-radius:22px;
  margin:0 0 20px;
}

.meal-detail-label{
  display:block;
  color:#918a95;
  font-size:11px;
  margin-bottom:16px;
}

.meal-detail-label input{
  display:block;
  width:100%;
  margin-top:7px;
  padding:14px;
  border-radius:14px;
  border:1px solid #2b2630;
  background:#0b0a0c;
  color:#fff;
  font-size:14px;
}

.meal-main-calories{
  display:flex;
  align-items:baseline;
  gap:8px;
  margin:18px 0 22px;
}

.meal-main-calories input{
  width:170px;
  max-width:70%;
  padding:0;
  margin:0;
  border:0;
  outline:0;
  background:transparent;
  color:#fff;
  font-size:58px;
  line-height:1;
  font-weight:800;
}

.meal-main-calories span{
  color:#9b949f;
  font-size:15px;
}

.meal-detail-card .nutrition-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.meal-detail-card .nutrition-grid label{
  display:block;
  color:#918a95;
  font-size:11px;
}

.meal-detail-card .nutrition-grid input{
  display:block;
  width:100%;
  margin-top:6px;
  padding:13px;
  border-radius:14px;
  border:1px solid #2b2630;
  background:#0b0a0c;
  color:#fff;
  font-size:14px;
}

.ai-note-box{
  margin:20px 0;
  padding:15px;
  border-radius:18px;
  border:1px solid #29232d;
  background:#151218;
}

.ai-note-box span{
  display:block;
  color:#ff55bf;
  font-size:10px;
  font-weight:800;
  letter-spacing:.12em;
}

.ai-note-box p{
  margin:7px 0 0;
  color:#bbb4be;
  font-size:12px;
  line-height:1.5;
}

.meal-detail-card .primary{
  margin-top:6px;
}

.danger-button{
  width:100%;
  margin-top:10px;
  padding:14px 18px;
  border-radius:18px;
  border:1px solid rgba(255,67,101,.3);
  background:rgba(255,67,101,.08);
  color:#ff6b82;
  font-weight:700;
  cursor:pointer;
}

@media(max-width:420px){
  .meal-main-calories input{
    font-size:50px;
  }

  .meal-detail-card .nutrition-grid{
    grid-template-columns:1fr 1fr;
  }
}
