:root {
  --bg: #08090b;
  --panel: #111317;
  --card: #15171a;
  --card-2: #1b1d22;
  --line: rgba(255,255,255,.08);
  --lime: #c9ff2e;
  --lime-2: #9bec1e;
  --purple: #d7b7ff;
  --coral: #ff6666;
  --text: #f6f7f8;
  --muted: #9ea3ad;
  --quiet: #6f7580;
  --shadow: 0 24px 60px rgba(0,0,0,.42);
  --glow: 0 0 32px rgba(201,255,46,.26);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: radial-gradient(circle at top, #202819 0, #08090b 44%, #030405 100%); color: var(--text); min-height: 100%; }
body { margin: 0; min-height: 100vh; display: grid; place-items: center; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; }
.hidden { display: none !important; }

.splash-screen {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 10px;
  background: #08090b; transition: opacity .55s ease, transform .55s ease;
}
.splash-screen.out { opacity: 0; transform: scale(1.02); pointer-events: none; }
.splash-mark {
  width: 92px; height: 92px; border-radius: 30px; display: grid; place-items: center;
  color: #08090b; font-weight: 950; font-size: 42px; letter-spacing: -3px;
  background: linear-gradient(145deg, var(--lime), #eaff8f); box-shadow: var(--glow);
}
.splash-screen h1 { margin: 10px 0 0; letter-spacing: .18em; font-size: 20px; }
.splash-screen p { margin: 0; color: var(--muted); }

.phone-shell {
  width: min(100vw, 430px); min-height: 100svh; max-height: 100svh; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 18%), var(--bg);
  border-left: 1px solid rgba(255,255,255,.08); border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow);
}
@media (min-width: 700px) {
  body { padding: 22px; }
  .phone-shell { border-radius: 44px; min-height: 880px; max-height: 880px; outline: 10px solid #07080a; }
}

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(8,9,11,.98) 0%, rgba(8,9,11,.88) 78%, rgba(8,9,11,0) 100%);
  backdrop-filter: blur(18px);
}
.topbar h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.eyebrow { margin: 0 0 4px; color: var(--lime); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; }
.icon-btn, .avatar-btn {
  width: 42px; height: 42px; border-radius: 15px; color: var(--text); background: var(--card-2);
  border: 1px solid var(--line); display: grid; place-items: center; font-weight: 850;
}
.icon-btn { font-size: 30px; }
.avatar-btn { color: #08090b; background: var(--lime); box-shadow: var(--glow); }

.screen { height: calc(100svh - 76px); overflow-y: auto; padding: 0 16px 118px; scroll-behavior: smooth; }
.screen::-webkit-scrollbar { width: 0; }

.bottom-nav {
  position: absolute; left: 14px; right: 14px; bottom: calc(12px + var(--safe-bottom)); z-index: 25;
  height: 76px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; align-items: center;
  padding: 8px; border-radius: 28px; background: rgba(19,21,24,.9); border: 1px solid var(--line);
  backdrop-filter: blur(24px); box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.bottom-nav button { min-width: 0; height: 58px; border-radius: 20px; color: var(--quiet); background: transparent; display: grid; place-items: center; gap: 2px; }
.bottom-nav span { font-size: 18px; line-height: 1; }
.bottom-nav small { font-size: 9px; font-weight: 700; }
.bottom-nav button.active { background: rgba(201,255,46,.10); color: var(--lime); }
.bottom-nav .primary-action { transform: translateY(-16px); }
.bottom-nav .primary-action span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: #08090b; box-shadow: var(--glow); font-size: 26px; font-weight: 700; }
.bottom-nav .primary-action small { margin-top: -10px; color: var(--lime); }

.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card, .hero-card, .stat-card, .workout-card, .exercise-card, .glass-card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
.hero-card { border-radius: var(--radius-xl); min-height: 210px; position: relative; overflow: hidden; display: grid; align-content: end; }
.hero-card::before {
  content: ''; position: absolute; inset: 0; opacity: .35;
  background: radial-gradient(circle at 76% 16%, rgba(201,255,46,.55), transparent 30%), radial-gradient(circle at 25% 90%, rgba(215,183,255,.22), transparent 34%);
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { margin: 0; font-size: 42px; letter-spacing: -.07em; line-height: .9; }
.hero-card p { margin: 8px 0 0; max-width: 270px; color: var(--muted); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-title { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.card-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.kicker { color: var(--lime); font-weight: 850; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.big-number { font-size: 34px; font-weight: 900; letter-spacing: -.06em; line-height: .95; }
.muted { color: var(--muted); }
.quiet { color: var(--quiet); }

.primary-btn, .secondary-btn, .danger-btn, .ghost-btn, .chip, .pill-btn {
  border-radius: 999px; padding: 12px 16px; font-weight: 850; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.primary-btn { color: #08090b; background: var(--lime); box-shadow: var(--glow); }
.secondary-btn { color: var(--text); background: var(--card-2); border: 1px solid var(--line); }
.danger-btn { color: white; background: rgba(255,102,102,.16); border: 1px solid rgba(255,102,102,.35); }
.ghost-btn { color: var(--lime); background: rgba(201,255,46,.08); }
.primary-btn:active, .secondary-btn:active, .danger-btn:active, .ghost-btn:active { transform: scale(.97); }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1; }
.chip { padding: 8px 12px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 12px; border: 1px solid var(--line); }
.chip.lime { background: var(--lime); color: #08090b; border-color: transparent; }
.chip.red { background: rgba(255,102,102,.15); color: #ff9a9a; }

.progress-ring { width: 118px; height: 118px; border-radius: 50%; position: relative; display: grid; place-items: center; background: conic-gradient(var(--lime) var(--value, 70%), rgba(255,255,255,.08) 0); box-shadow: var(--glow); }
.progress-ring::after { content: ''; width: 86px; height: 86px; border-radius: 50%; background: var(--card); position: absolute; }
.progress-ring strong, .progress-ring span { position: relative; z-index: 1; }
.progress-ring strong { display: block; font-size: 23px; letter-spacing: -.05em; }
.progress-ring span { color: var(--muted); font-size: 11px; }
.ring-stack { display: flex; align-items: center; gap: 16px; }
.progress-line { height: 10px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress-line span { display: block; height: 100%; width: var(--value, 0%); background: linear-gradient(90deg, var(--lime), #eaff8f); border-radius: inherit; box-shadow: var(--glow); }

.stat-card { min-height: 116px; display: grid; align-content: space-between; }
.stat-card .label { color: var(--muted); font-size: 12px; }
.stat-card .unit { color: var(--quiet); font-size: 12px; font-weight: 700; }
.stat-icon { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: rgba(201,255,46,.12); color: var(--lime); }

.workout-card { position: relative; overflow: hidden; min-height: 180px; display: grid; align-content: end; isolation: isolate; }
.workout-card::before { content: ''; position: absolute; inset: 0; background: var(--image) center/cover no-repeat; opacity: .48; z-index: -2; }
.workout-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,.86)); z-index: -1; }
.workout-card h3 { margin: 0; font-size: 22px; letter-spacing: -.06em; }
.workout-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.workout-meta span { font-size: 11px; background: rgba(255,255,255,.12); padding: 7px 9px; border-radius: 999px; backdrop-filter: blur(12px); }

.calendar-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.calendar-day { min-height: 98px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 12px; text-align: left; }
.calendar-day.active { background: var(--lime); color: #08090b; box-shadow: var(--glow); }
.calendar-day.done { border-color: rgba(201,255,46,.4); }
.calendar-day small { display: block; opacity: .75; font-weight: 800; }
.calendar-day strong { display: block; margin: 8px 0; font-size: 21px; }
.day-list { display: grid; gap: 10px; }
.day-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.day-dot { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 16px; background: rgba(255,255,255,.06); color: var(--lime); font-weight: 900; }
.day-item.complete .day-dot { background: var(--lime); color: #08090b; }

.exercise-card { padding: 0; overflow: hidden; }
.exercise-cover { min-height: 145px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.8)), var(--image) center/cover no-repeat; display: grid; align-content: end; padding: 16px; }
.exercise-cover h3 { margin: 0; font-size: 21px; letter-spacing: -.05em; }
.exercise-body { padding: 14px; display: grid; gap: 14px; }
.set-grid { display: grid; gap: 8px; }
.set-row { display: grid; grid-template-columns: 28px 1fr 1fr 28px; gap: 8px; align-items: center; }
.set-row label { width: 28px; height: 28px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.set-row input[type='number'], .set-row input[type='text'] { width: 100%; min-width: 0; }
.set-check { appearance: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid var(--line); position: relative; }
.set-check:checked { background: var(--lime); border-color: var(--lime); }
.set-check:checked::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #08090b; font-weight: 900; }

input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.055); color: var(--text); padding: 12px 13px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(201,255,46,.55); box-shadow: 0 0 0 4px rgba(201,255,46,.08); }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
input[type='range'] { accent-color: var(--lime); padding: 0; }

.muscle-map { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; }
.body-svg { width: 100%; max-height: 240px; }
.body-svg .active { fill: var(--lime); filter: drop-shadow(0 0 8px rgba(201,255,46,.5)); }
.body-svg .base { fill: #31343a; }
.body-svg .line { stroke: rgba(255,255,255,.2); stroke-width: 2; }
.legend { display: grid; gap: 8px; }
.legend span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); }

.award-card { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; padding: 14px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); }
.award-icon { width: 54px; height: 54px; border-radius: 20px; display: grid; place-items: center; background: rgba(255,255,255,.06); font-size: 24px; filter: grayscale(1); opacity: .45; }
.award-card.unlocked { border-color: rgba(201,255,46,.42); background: linear-gradient(180deg, rgba(201,255,46,.08), rgba(255,255,255,.02)), var(--card); }
.award-card.unlocked .award-icon { filter: none; opacity: 1; background: var(--lime); box-shadow: var(--glow); }
.award-card h3 { margin: 0; font-size: 16px; }
.award-card p { margin: 3px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.photo-tile { min-height: 210px; border-radius: 28px; overflow: hidden; border: 1px solid var(--line); background: var(--card); position: relative; }
.photo-tile img { width: 100%; height: 210px; object-fit: cover; display: block; }
.photo-tile .caption { padding: 13px; }
.photo-tile .emotion { position: absolute; top: 12px; right: 12px; background: var(--lime); color: #08090b; padding: 8px 10px; border-radius: 999px; font-weight: 900; font-size: 12px; }
.preview-img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 24px; border: 1px solid var(--line); }

.timer-card { min-height: 500px; display: grid; align-content: center; justify-items: center; text-align: center; gap: 22px; }
.countdown { font-size: 98px; line-height: .85; letter-spacing: -.09em; color: var(--lime); font-weight: 950; text-shadow: var(--glow); }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center; background: rgba(0,0,0,.62); backdrop-filter: blur(12px); padding: 16px; }
.modal-panel { width: min(100%, 430px); max-height: 84svh; overflow-y: auto; border-radius: 32px; padding: 18px; background: #111317; border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .24s ease both; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 80; background: var(--lime); color: #08090b; padding: 12px 16px; border-radius: 999px; font-weight: 900; box-shadow: var(--glow); }

.trophy-pop { text-align: center; display: grid; gap: 12px; justify-items: center; }
.trophy-pop .mega { width: 118px; height: 118px; border-radius: 42px; display: grid; place-items: center; font-size: 54px; background: var(--lime); box-shadow: var(--glow); animation: trophy .7s cubic-bezier(.15, 1.35, .3, 1); }
@keyframes trophy { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); } 100% { transform: scale(1) rotate(0); } }

.notice { border-left: 3px solid var(--lime); padding: 12px 13px; border-radius: 15px; background: rgba(201,255,46,.08); color: var(--muted); line-height: 1.45; }
.warning { border-left-color: var(--coral); background: rgba(255,102,102,.08); }
.chart-box { height: 230px; }
canvas { max-width: 100%; }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 24px; }
.small-text { font-size: 12px; line-height: 1.45; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
