/* ===== Base ===== */
:root {
  --bg: #0b0c14;
  --bg-elev: rgba(255, 255, 255, 0.045);
  --bg-elev-2: rgba(255, 255, 255, 0.07);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #ecedf3;
  --text-dim: #a1a4b8;
  --text-mute: #6b6f85;
  --accent: #8b9bff;
  --accent-2: #c5a4ff;
  --grad: linear-gradient(135deg, #8b9bff 0%, #c5a4ff 50%, #ffb4a2 100%);

  --bad: #ff6b7a;
  --soso: #ffc857;
  --good: #6ee7a7;

  --bad-soft: rgba(255, 107, 122, 0.18);
  --soso-soft: rgba(255, 200, 87, 0.18);
  --good-soft: rgba(110, 231, 167, 0.18);

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow: 0 30px 60px -30px rgba(8, 9, 18, 0.55), 0 1px 0 rgba(255,255,255,0.04) inset;

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
}

body { padding-bottom: env(safe-area-inset-bottom); }

/* ===== Aurora background ===== */
.aurora {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.aurora .orb {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite;
  will-change: transform;
}
.orb-1 { background: radial-gradient(circle at 30% 30%, #4f5dff 0%, transparent 60%); top: -20vmax; left: -20vmax; }
.orb-2 { background: radial-gradient(circle at 70% 30%, #c084fc 0%, transparent 60%); top: 10vmax; right: -25vmax; animation-delay: -6s; opacity: 0.45; }
.orb-3 { background: radial-gradient(circle at 50% 70%, #ff9aaa 0%, transparent 60%); bottom: -30vmax; left: 10vmax; animation-delay: -12s; opacity: 0.35; }

.aurora .grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  opacity: 0.4;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(3vmax, -2vmax) scale(1.05); }
  66%      { transform: translate(-2vmax, 2vmax) scale(0.97); }
}

/* ===== Container ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 480px) {
  .container { padding: 22px 14px 60px; gap: 12px; }
}

/* ===== Hero ===== */
.hero { padding: 8px 6px 14px; }
.hero-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 8px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.hero-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #6ee7a7;
  box-shadow: 0 0 0 3px rgba(110,231,167,0.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(110,231,167,0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(110,231,167,0.06); }
}

.hero-title {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 800;
  line-height: 1.05;
  margin: 18px 0 8px;
  letter-spacing: -0.025em;
}
.hero-comma { color: var(--text-dim); margin-right: 4px; }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 500;
}
.hero-sub span { color: var(--text); font-weight: 600; }

/* ===== Card base ===== */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow);
}
.card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.card-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head .card-title { margin: 0; }

/* ===== Today ===== */
.today { padding: 22px; }
.today-grid {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 16px;
  margin-top: 4px;
}
.today-divider { background: var(--stroke); width: 1px; }
.today-cell-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.today-mood { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.today-emoji {
  font-size: 30px;
  line-height: 1;
  transform: translateY(-1px);
}
.today-label {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.today-msg {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
  font-style: italic;
}

@media (max-width: 480px) {
  .today-grid { grid-template-columns: 1fr; }
  .today-divider { width: auto; height: 1px; }
}

/* ===== Stats grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid .stat:nth-child(3) { grid-column: span 2; }
}
.stat { padding: 18px; }
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-mute);
}
.stat-value {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.stat-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mute);
  -webkit-text-fill-color: var(--text-mute);
  background: none;
}
.stat-foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== Timeline ===== */
.legend { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot.bad { background: var(--bad); }
.legend-dot.soso { background: var(--soso); }
.legend-dot.good { background: var(--good); }

.timeline-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.timeline-rowlabel {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.timeline-cells {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 4px;
}
.cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  transition: transform .2s var(--ease), background .3s var(--ease);
  transform: scale(0.6);
  opacity: 0;
  animation: pop .35s var(--ease) forwards;
}
.cell.bad  { background: var(--bad);  box-shadow: 0 0 0 1px rgba(255,107,122,0.35); }
.cell.soso { background: var(--soso); box-shadow: 0 0 0 1px rgba(255,200,87,0.35); }
.cell.good { background: var(--good); box-shadow: 0 0 0 1px rgba(110,231,167,0.35); }
.cell:hover { transform: scale(1.18); z-index: 2; }

@keyframes pop {
  to { transform: scale(1); opacity: 1; }
}

.timeline-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.timeline-foot-sep { flex: 1; height: 1px; background: var(--stroke); }

@media (max-width: 480px) {
  .timeline-row { grid-template-columns: 56px 1fr; gap: 8px; }
  .timeline-cells { gap: 3px; }
}

/* ===== Distribution ===== */
.dist-rows { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.dist-row { display: flex; flex-direction: column; gap: 8px; }
.dist-rowhead {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.dist-rowhead span:last-child { font-variant-numeric: tabular-nums; color: var(--text-mute); }
.dist-bar {
  display: flex;
  height: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  overflow: hidden;
}
.dist-bar .seg {
  height: 100%;
  transition: width .8s var(--ease);
}
.dist-bar .seg.good { background: var(--good); }
.dist-bar .seg.soso { background: var(--soso); }
.dist-bar .seg.bad  { background: var(--bad); }

/* ===== Messages ===== */
.msg-list { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.msg-list::-webkit-scrollbar { width: 6px; }
.msg-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.msg {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  align-items: flex-start;
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.msg:hover { transform: translateY(-1px); background: var(--bg-elev-2); }
.msg.bad  { border-left: 3px solid var(--bad); }
.msg.soso { border-left: 3px solid var(--soso); }
.msg.good { border-left: 3px solid var(--good); }

.msg-emoji { font-size: 18px; line-height: 1.4; }
.msg-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-author { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.msg-text { font-size: 14px; color: var(--text-dim); line-height: 1.45; word-wrap: break-word; }
.msg-date { font-size: 11px; color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }

.msg-empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ===== Footer ===== */
.foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 11px; color: var(--text-mute);
  letter-spacing: 0.04em;
  margin-top: 12px;
}
.foot-dot { width: 3px; height: 3px; background: var(--text-mute); border-radius: 50%; }

/* ===== Loading ===== */
.loading {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}
.loader { display: flex; gap: 8px; }
.loader span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s var(--ease) infinite;
}
.loader span:nth-child(2) { background: var(--accent-2); animation-delay: 0.15s; }
.loader span:nth-child(3) { background: #ffb4a2; animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30%           { transform: translateY(-8px); opacity: 1; }
}
.loader-text { color: var(--text-mute); font-size: 13px; letter-spacing: 0.02em; }

/* ===== Error ===== */
.error {
  max-width: 360px;
  margin: 30vh auto 0;
  text-align: center;
  padding: 24px;
}
.error-emoji { font-size: 48px; margin-bottom: 12px; }
.error h2 { font-size: 20px; margin-bottom: 6px; }
.error p { color: var(--text-dim); font-size: 14px; }

/* ===== Pair Deeds ===== */
.deeds .card-eyebrow { color: #a1ffd4; }

.deeds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .deeds-grid { grid-template-columns: 1fr; }
}

.deed-card {
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
.deed-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.18;
  z-index: 0;
}
.deed-prayer::before  { background: radial-gradient(140% 80% at 50% 0%, #a78bfa 0%, transparent 60%); }
.deed-weekly::before  { background: radial-gradient(140% 80% at 50% 0%, #6ee7a7 0%, transparent 60%); }
.deed-kind::before    { background: radial-gradient(140% 80% at 50% 0%, #ff9aaa 0%, transparent 60%); }

.deed-card:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
}

.deed-card > * { position: relative; z-index: 1; }

.deed-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 10px;
}
.deed-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.deed-today {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
  min-height: 18px;
  line-height: 1.4;
}
.deed-today.is-done    { color: var(--good); }
.deed-today.is-waiting { color: var(--soso); }
.deed-today.is-pending { color: var(--text-mute); }

.deed-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.deed-streak {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.deed-streak-num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.deed-streak-unit {
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}
.deed-month {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.deed-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.deed-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s var(--ease);
}
.deed-bar-fill.prayer { background: linear-gradient(90deg, #a78bfa, #c5a4ff); }
.deed-bar-fill.weekly { background: linear-gradient(90deg, #6ee7a7, #a1ffd4); }
.deed-bar-fill.kind   { background: linear-gradient(90deg, #ff9aaa, #ffb4a2); }

/* ===== Reveal animation ===== */
[data-anim] {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal .6s var(--ease) forwards;
}
[data-anim]:nth-of-type(1) { animation-delay: 0.05s; }
[data-anim]:nth-of-type(2) { animation-delay: 0.12s; }
[data-anim]:nth-of-type(3) { animation-delay: 0.18s; }
[data-anim]:nth-of-type(4) { animation-delay: 0.24s; }
[data-anim]:nth-of-type(5) { animation-delay: 0.30s; }
[data-anim]:nth-of-type(6) { animation-delay: 0.36s; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
