:root {
  color-scheme: dark;
  --bg: #07111a;
  --bg-secondary: #0d1b28;
  --panel: rgba(15, 27, 40, 0.84);
  --panel-strong: rgba(18, 34, 50, 0.96);
  --border: rgba(155, 196, 255, 0.14);
  --text: #f5f7fb;
  --muted: #94a8bd;
  --accent: #8df5c7;
  --accent-strong: #36d18a;
  --accent-soft: rgba(141, 245, 199, 0.14);
  --danger: #ff7a90;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(54, 209, 138, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(104, 163, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #08131d 0%, #050a10 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 90%);
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.hero-card,
.metric-card,
.habit-card,
.empty-state {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 30px;
  border-radius: var(--radius-xl);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: 0.96;
  max-width: 10ch;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.habit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.field input,
.field select,
.primary-button,
.delete-button,
.habit-toggle {
  font: inherit;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.field input:focus,
.field select:focus {
  border-color: rgba(141, 245, 199, 0.45);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.primary-button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 800;
  color: #032512;
  background: linear-gradient(135deg, var(--accent) 0%, #d8ffe8 100%);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(54, 209, 138, 0.22);
  filter: saturate(1.05);
}

.dashboard-grid {
  margin-top: 24px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 24px;
  border-radius: var(--radius-lg);
}

.metric-label,
.metric-note,
.section-meta,
.habit-status,
.streak-label {
  margin: 0;
  color: var(--muted);
}

.metric-value {
  margin: 10px 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
}

.habits-section {
  margin-top: 28px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.8rem;
}

.habit-list {
  display: grid;
  gap: 14px;
}

.habit-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.habit-card:hover {
  transform: translateY(-2px);
  border-color: rgba(141, 245, 199, 0.2);
}

.habit-card.completed {
  background:
    linear-gradient(135deg, rgba(141, 245, 199, 0.12), rgba(17, 30, 43, 0.9)),
    var(--panel);
}

.habit-toggle {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  position: relative;
  transition: transform 160ms ease, background 180ms ease, border-color 180ms ease;
}

.habit-toggle::before,
.habit-toggle::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  transform-origin: center;
  opacity: 0;
  transition: opacity 180ms ease, transform 220ms ease;
}

.habit-toggle::before {
  width: 14px;
  height: 26px;
  border-right: 4px solid #032512;
  border-bottom: 4px solid #032512;
  transform: translate(-50%, -58%) rotate(40deg) scale(0.7);
}

.habit-toggle::after {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(141, 245, 199, 0.65), transparent 62%);
  transform: translate(-50%, -50%) scale(0.65);
}

.habit-card.completed .habit-toggle {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-color: transparent;
  animation: pop 260ms ease;
}

.habit-card.completed .habit-toggle::before,
.habit-card.completed .habit-toggle::after {
  opacity: 1;
}

.habit-card.completed .habit-toggle::after {
  transform: translate(-50%, -50%) scale(1.1);
}

.habit-main {
  min-width: 0;
}

.habit-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.habit-name {
  margin: 0;
  font-size: 1.1rem;
}

.habit-frequency {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(104, 163, 255, 0.14);
  color: #bed7ff;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.habit-status {
  margin-top: 8px;
  line-height: 1.5;
}

.habit-side {
  text-align: right;
}

.streak-value {
  margin: 6px 0 12px;
  font-size: 1.8rem;
  font-weight: 800;
}

.delete-button {
  border: 1px solid rgba(255, 122, 144, 0.24);
  background: rgba(255, 122, 144, 0.08);
  color: #ff9aae;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.delete-button:hover,
.delete-button:focus-visible {
  background: rgba(255, 122, 144, 0.14);
  transform: translateY(-1px);
}

.empty-state {
  padding: 26px;
  border-radius: 22px;
  text-align: center;
}

.empty-state p {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
}

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

.empty-state.hidden {
  display: none;
}

@keyframes pop {
  0% {
    transform: scale(0.88);
  }
  65% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 860px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding-top: 20px;
  }

  .hero-card,
  .metric-card,
  .habit-card,
  .empty-state {
    border-radius: 20px;
  }

  .hero-card,
  .metric-card,
  .habit-card {
    padding: 16px;
  }

  .habit-card {
    grid-template-columns: auto 1fr;
  }

  .habit-side {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .streak-value {
    margin: 0;
  }
}
