/* =============================================
   DayOne App — One-screen habit tracker
   Matches landing page design language.
   Uses CSS vars from theme.css.
   ============================================= */

.hidden { display: none !important; }

/* NAV */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  border-bottom: 1px solid var(--border);
}
.app-nav__back {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  transition: color 0.15s;
}
.app-nav__back:hover { color: var(--fg); }
.app-nav__date {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-family: 'Karla', sans-serif;
}

/* MAIN */
.app-main {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 2rem;
}

/* SET HABIT STATE */
.orb {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #3d8c6a, var(--accent) 60%, #1a3a2f);
  box-shadow: 0 0 60px rgba(44, 95, 74, 0.2);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}
.orb--small {
  width: 90px;
  height: 90px;
  margin-bottom: 0;
}
.app-headline {
  font-family: 'Fraunces', serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 500;
  color: var(--fg);
  text-align: center;
  line-height: 1.1;
}
.app-headline em {
  font-style: italic;
  color: var(--accent);
}
.app-sub {
  color: var(--fg-muted);
  font-size: 1.05rem;
  text-align: center;
  max-width: 38ch;
  line-height: 1.6;
}
.habit-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 480px;
}
.habit-form input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  font-family: 'Karla', sans-serif;
  font-size: 1rem;
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s;
}
.habit-form input:focus {
  border-color: var(--accent);
}
.habit-form input::placeholder {
  color: var(--fg-muted);
}

/* BUTTONS */
.btn-primary {
  padding: 0.85rem 1.8rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-family: 'Karla', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #24503c; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  padding: 0.7rem 1.4rem;
  background: transparent;
  color: var(--fg-muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Karla', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

/* CHECKIN STATE */
.habit-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.6rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.habit-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.habit-card__name {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--fg);
}
.habit-card__edit {
  background: none;
  border: none;
  font-family: 'Karla', sans-serif;
  font-size: 0.78rem;
  color: var(--fg-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  text-align: left;
  margin-top: 0.3rem;
}
.habit-card__edit:hover { color: var(--fg); }

.checkin-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 400px;
}
.checkin-panel__question {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--fg);
}
.done-row {
  display: flex;
  gap: 0.8rem;
}
.done-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 1.6rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  font-family: 'Karla', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.done-btn:hover { border-color: var(--accent); }
.done-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.energy-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding-top: 0.5rem;
}
.energy-question {
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-family: 'Karla', sans-serif;
}
.energy-scale {
  display: flex;
  gap: 0.4rem;
}
.energy-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-family: 'Karla', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.energy-btn:hover { border-color: var(--accent); color: var(--accent); }
.energy-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}
.energy-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.7rem;
  color: var(--fg-muted);
  font-family: 'Karla', sans-serif;
  padding: 0 0.5rem;
}

.checkin-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}
.checkin-summary__energy {
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-family: 'Karla', sans-serif;
}
.btn-save {
  padding: 0.8rem 2rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-family: 'Karla', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-save:hover { background: #24503c; }

/* DONE STATE */
.done-orb {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #3d8c6a, var(--accent) 60%, #1a3a2f);
  box-shadow: 0 0 40px rgba(44, 95, 74, 0.2);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(44, 95, 74, 0.2); }
  50% { box-shadow: 0 0 70px rgba(44, 95, 74, 0.35); }
}
.done-headline {
  font-family: 'Fraunces', serif;
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--fg);
}
.done-body {
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-align: center;
  max-width: 36ch;
}
.streak-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 400px;
}
.streak-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
}
.streak-dot--filled {
  background: var(--accent);
  border-color: var(--accent);
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal__inner {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.modal__inner h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--fg);
}
.modal__inner input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Karla', sans-serif;
  font-size: 0.95rem;
  color: var(--fg);
  outline: none;
}
.modal__inner input:focus { border-color: var(--accent); }
.modal__actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .app-nav { padding: 1rem 1.5rem; }
  .app-main { padding: 2rem 1.5rem; }
  .app-headline { font-size: 2.2rem; }
  .streak-grid { grid-template-columns: repeat(7, 1fr); }
}