:root {
  color-scheme: dark;
  --bg: #08101e;
  --bg-2: #0d1729;
  --card: rgba(12, 19, 34, 0.72);
  --card-strong: rgba(17, 26, 46, 0.9);
  --text: #eef4ff;
  --muted: #a6b3cc;
  --border: rgba(159, 182, 232, 0.18);
  --accent: #7c5cff;
  --accent-2: #2ee6a6;
  --accent-3: #55b6ff;
  --warning: #ffd36e;
  --danger: #ff6b8b;
  --shadow: 0 30px 80px rgba(1, 4, 15, 0.45);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.22), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(46, 230, 166, 0.14), transparent 22%),
    linear-gradient(180deg, #050912 0%, var(--bg) 40%, #060d18 100%);
  overflow-x: hidden;
}

.bg-orb,
.bg-grid {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  width: 42vw;
  aspect-ratio: 1;
  filter: blur(30px);
  opacity: 0.35;
  border-radius: 50%;
  animation: drift 16s ease-in-out infinite alternate;
}

.orb-a {
  top: -12vw;
  left: -10vw;
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, 0.95), rgba(55, 119, 255, 0.18) 68%, transparent 74%);
}

.orb-b {
  right: -12vw;
  bottom: -10vw;
  background: radial-gradient(circle at 30% 30%, rgba(46, 230, 166, 0.9), rgba(85, 182, 255, 0.16) 60%, transparent 74%);
  animation-delay: -7s;
}

.bg-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(166, 179, 204, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(166, 179, 204, 0.09) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 78%);
  opacity: 0.5;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.card {
  background: linear-gradient(180deg, rgba(19, 28, 49, 0.84), rgba(10, 15, 28, 0.68));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.28), transparent 70%);
}

.hero-copy,
.hero-card,
.tracker-card,
.insights-card {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: #8ee8ff;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
  margin-bottom: 14px;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  margin-bottom: 0;
}

.lede {
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.02rem;
  margin-bottom: 24px;
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-btn,
.ghost-btn,
.text-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.text-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  border-radius: 999px;
  min-height: 50px;
  padding: 0 20px;
  color: #09111f;
  font-weight: 800;
  background: linear-gradient(135deg, #8ef9c7, #65c7ff 48%, #a38bff 100%);
  box-shadow: 0 18px 40px rgba(86, 174, 255, 0.24);
}

.ghost-btn,
.text-btn {
  border-radius: 999px;
  min-height: 50px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.text-btn {
  min-height: 40px;
  padding: 0 14px;
  color: var(--accent-3);
}

.hero-card {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 300px;
  border-radius: 26px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(25, 36, 61, 0.94), rgba(10, 15, 28, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ring-shell {
  display: grid;
  place-items: center;
}

.completion-ring {
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0deg, rgba(255, 255, 255, 0.06) 0deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.completion-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at top, rgba(124, 92, 255, 0.25), rgba(8, 15, 29, 0.96) 58%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ring-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.ring-center strong {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.05em;
}

.ring-center span {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.hero-meta > div,
.stat-card,
.insight-tile,
.timeline-item,
.habit-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-meta > div {
  border-radius: 18px;
  padding: 14px 16px;
}

.meta-label,
.stat-card p,
.insight-tile span,
.section-head p,
.timeline-score {
  color: var(--muted);
}

.hero-meta strong,
.stat-card strong,
.insight-tile strong {
  display: block;
  margin-top: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 122px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  position: relative;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -18% -30% auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 72%);
}

.stat-card p {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  line-height: 1;
}

.stat-card span:last-child {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 20px;
}

.tracker-card,
.insights-card {
  border-radius: var(--radius-xl);
  padding: 24px;
}

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

.section-head.compact {
  margin-bottom: 12px;
}

.section-head.compact h3 {
  margin-bottom: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  color: #0c1422;
  background: linear-gradient(135deg, #8ef9c7, #65c7ff);
}

.chip-soft {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

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

.form-grid label,
.note-field {
  display: grid;
  gap: 10px;
}

.form-grid label span,
.note-field span {
  font-size: 0.92rem;
  color: var(--muted);
}

.form-grid input[type="number"],
.form-grid select,
.note-field textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-grid input[type="number"]:focus,
.form-grid select:focus,
.note-field textarea:focus,
.range-row input[type="range"]:focus {
  border-color: rgba(110, 200, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(93, 165, 255, 0.15);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

output {
  min-width: 52px;
  text-align: right;
  color: #d2e7ff;
  font-weight: 700;
}

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.75), rgba(46, 230, 166, 0.85));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 4px solid rgba(117, 109, 255, 0.95);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(117, 109, 255, 0.95);
}

.habit-panel {
  margin-bottom: 18px;
}

.habit-panel p {
  color: var(--muted);
  margin-bottom: 0;
}

.habit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.habit-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.habit-pill:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
}

.habit-pill input {
  accent-color: var(--accent-2);
}

.habit-pill.selected {
  background: rgba(142, 249, 199, 0.14);
  border-color: rgba(142, 249, 199, 0.35);
}

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

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 22px 0 14px;
}

.chart-wrap {
  min-height: 240px;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.weekly-bars {
  height: 100%;
  min-height: 200px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.bar-item {
  display: grid;
  gap: 10px;
  align-content: end;
  text-align: center;
}

.bar-track {
  height: 156px;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 10px 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bar-fill {
  width: 66%;
  border-radius: 999px 999px 20px 20px;
  background: linear-gradient(180deg, #8ef9c7 0%, #65c7ff 45%, #8462ff 100%);
  box-shadow: 0 14px 28px rgba(95, 161, 255, 0.22);
  min-height: 8px;
  transition: height 0.45s ease;
}

.bar-label,
.bar-score {
  font-size: 0.8rem;
}

.bar-label {
  color: var(--muted);
}

.bar-score {
  color: #d8f9f0;
  font-weight: 700;
}

.insight-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.insight-tile {
  border-radius: 22px;
  padding: 16px;
}

.insight-tile strong {
  font-size: 1.2rem;
}

.insight-tile p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 20px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8ef9c7, #65c7ff);
  box-shadow: 0 0 0 4px rgba(101, 199, 255, 0.15);
}

.timeline-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.timeline-date {
  font-size: 0.98rem;
}

.timeline-summary {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label:focus-within {
  outline: 3px solid rgba(118, 198, 255, 0.8);
  outline-offset: 3px;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0, 14px, 0) scale(1.04);
  }
}

@media (max-width: 1060px) {
  .hero,
  .content-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .completion-ring {
    width: min(240px, 68vw);
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 16px;
  }

  .hero,
  .tracker-card,
  .insights-card {
    padding: 18px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(2.3rem, 12vw, 3.4rem);
  }

  .form-grid,
  .insight-list {
    grid-template-columns: 1fr;
  }

  .timeline-head,
  .section-head,
  .timeline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .weekly-bars {
    gap: 8px;
  }

  .bar-track {
    height: 140px;
  }
}
