/* ALMANAC — premium PWA · midnight-copper palette */
*,*::before,*::after { box-sizing: border-box; }

:root {
  /* Palette — midnight-pearl + warm copper */
  --bg-0: #07091A;
  --bg-1: #0A0E1C;
  --bg-2: #131826;
  --surface: rgba(20, 26, 44, 0.62);
  --surface-2: rgba(28, 36, 56, 0.5);
  --surface-3: rgba(12, 16, 30, 0.78);
  --line: rgba(201,164,122,0.18);
  --line-soft: rgba(232,213,168,0.10);
  --line-strong: rgba(201,164,122,0.42);

  --copper: #C9A47A;
  --copper-bright: #E0BC8C;
  --copper-deep: #8A6A45;
  --pearl: #E8D5A8;
  --pearl-cream: #F4E7C6;

  --plum: #6E4F6B;
  --plum-deep: #3C2A3F;
  --jade: #6FA890;
  --rose: #C58A8A;
  --sky: #7C95B3;

  --text: #E4E8F5;
  --text-soft: #B8BED1;
  --muted: #7B829A;
  --muted-2: #555B70;

  --good: #6FA890;
  --warn: #D8A05B;
  --bad: #B95E5E;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 0 1px var(--line), 0 20px 60px -20px rgba(0,0,0,0.6);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.05) inset, 0 0 0 1px var(--line-strong), 0 30px 80px -30px rgba(201,164,122,0.16);
  --shadow-fab: 0 18px 40px -10px rgba(201,164,122,0.45), 0 0 0 1px rgba(232,213,168,0.5) inset;

  --t-sm: 0.18s cubic-bezier(.4,.0,.2,1);
  --t-md: 0.32s cubic-bezier(.34,1.56,.64,1);
  --t-lg: 0.6s cubic-bezier(.34,1.56,.64,1);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-1);
  color: var(--text);
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: 400;
  line-height: 1.55;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse at 80% -10%, rgba(201,164,122,0.10), transparent 55%),
    radial-gradient(ellipse at -10% 30%, rgba(110,79,107,0.16), transparent 50%),
    radial-gradient(ellipse at 50% 110%, rgba(124,149,179,0.07), transparent 60%),
    linear-gradient(180deg, #050714 0%, #0A0E1C 40%, #0B0F1F 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grain texture */
.grain {
  position: fixed; inset: 0;
  z-index: 1; pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix type='matrix' values='0 0 0 0 0.9  0 0 0 0 0.85  0 0 0 0 0.7  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/></svg>");
  mix-blend-mode: overlay;
}

.orb {
  position: fixed; pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 1;
  opacity: .55;
}
.orb-a { top: -150px; right: -150px; width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(201,164,122,0.5), transparent 65%); }
.orb-b { bottom: -100px; left: -200px; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(110,79,107,0.45), transparent 65%); }

/* TOPBAR */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(7,9,26,0.92) 0%, rgba(7,9,26,0.72) 80%, rgba(7,9,26,0) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(201,164,122,0.06);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: var(--copper);
  background: radial-gradient(circle at 30% 25%, rgba(232,213,168,0.18), rgba(201,164,122,0.04) 55%, transparent 70%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 28px -8px rgba(201,164,122,0.4) inset;
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .01em;
  color: var(--pearl-cream);
}
.brand-tag {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .03em;
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
}
.top-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform var(--t-md), background var(--t-sm), color var(--t-sm), border-color var(--t-sm);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--copper);
  background: rgba(28, 36, 56, 0.75);
}
.icon-btn:active { transform: translateY(0) scale(.95); }
.icon-btn:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* PAGE */
.page {
  position: relative; z-index: 5;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 120px;
  display: grid;
  gap: 22px;
}

/* HERO */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  min-height: 380px;
  display: grid;
  align-items: end;
  isolation: isolate;
  box-shadow: var(--shadow-2);
}
.hero-bg {
  position: absolute; inset: 0;
  background-image: url("hero_bg.png");
  background-size: cover;
  background-position: center right;
  filter: saturate(108%) brightness(.86);
  z-index: 1;
}
.hero-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(85deg, rgba(7,9,26,0.94) 0%, rgba(7,9,26,0.78) 35%, rgba(7,9,26,0.22) 78%, rgba(7,9,26,0) 100%),
    linear-gradient(180deg, transparent 50%, rgba(7,9,26,0.55) 100%);
  z-index: 2;
}
.hero-inner {
  position: relative; z-index: 3;
  padding: 38px 36px 32px;
  display: grid;
  gap: 18px;
  max-width: 700px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: .07em;
  color: var(--copper);
  text-transform: uppercase;
}
.hero-eyebrow .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--copper-bright);
  box-shadow: 0 0 0 4px rgba(201,164,122,0.18), 0 0 18px rgba(201,164,122,0.7);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: .75; }
}
.hero-title {
  margin: 0;
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 500;
  display: grid; gap: 0;
  line-height: 1.05;
}
.hero-title-line {
  display: block;
}
.line-1 {
  font-size: clamp(34px, 6vw, 60px);
  color: var(--pearl-cream);
  letter-spacing: -0.005em;
  font-weight: 700;
}
.line-2 {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  color: var(--copper);
  font-size: clamp(22px, 3.6vw, 34px);
  margin-top: 4px;
  font-weight: 400;
}
.line-2 em {
  font-style: normal;
  font-family: "IBM Plex Mono", monospace;
  color: var(--pearl-cream);
  padding: 0 4px;
  font-weight: 600;
  font-size: .9em;
}
.hero-sub {
  margin: 0;
  color: var(--text-soft);
  font-size: 15.5px;
  max-width: 480px;
  font-weight: 400;
}
.hero-sub strong {
  color: var(--pearl-cream);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  letter-spacing: .01em;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}
.meta-pill {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 16px;
  background: rgba(20, 26, 44, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(14px);
}
.pill-k {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
}
.pill-v {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 16px;
  color: var(--pearl-cream);
}
.pill-sub {
  font-size: 11px;
  color: var(--muted);
  grid-column: 1 / -1;
}
.pill-sub em {
  font-style: normal;
  color: var(--copper);
  font-family: "IBM Plex Mono", monospace;
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  position: relative;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-md), border-color var(--t-sm);
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(201,164,122,0.10), transparent 50%);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}
.stat-ico {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--copper);
  background: rgba(201,164,122,0.08);
  border: 1px solid rgba(201,164,122,0.18);
  border-radius: 10px;
  margin-bottom: 12px;
}
.stat-ico svg { width: 19px; height: 19px; }
.stat-num {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 30px;
  color: var(--pearl-cream);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-lbl {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .03em;
}
.stat-bar {
  margin-top: 12px;
  height: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 99px;
  overflow: hidden;
}
.stat-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--copper), var(--copper-bright));
  border-radius: 99px;
  transition: width 1.1s cubic-bezier(.4,.0,.2,1);
}

/* ROW : 2 col */
.row.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
}

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.card-h {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 18px;
}
.card-h h2 {
  margin: 0;
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 500;
  font-size: 21px;
  color: var(--pearl-cream);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-h-mark {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--copper);
  display: inline-block;
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(201,164,122,0.55);
}
.card-h-sub {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* YEAR WHEEL */
.year-wheel-card { padding: 24px 24px 20px; }
.wheel-wrap {
  position: relative;
  display: grid;
  place-items: center;
  margin: 8px auto 14px;
  aspect-ratio: 1;
  max-width: 380px;
}
.year-wheel {
  width: 100%;
  height: auto;
}
.wheel-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  pointer-events: none;
}
.wheel-center-month {
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--pearl-cream);
  letter-spacing: .02em;
  line-height: 1;
}
.wheel-center-frac {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--copper);
  margin-top: 6px;
  letter-spacing: .02em;
}
.wheel-center-rem {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.wheel-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.foot-item {
  display: grid;
  gap: 2px;
  text-align: center;
}
.foot-k {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
}
.foot-v {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 16px;
  color: var(--pearl-cream);
  font-weight: 500;
}

/* UPCOMING / EVENTS */
.upcoming-card { display: flex; flex-direction: column; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(201,164,122,0.10);
  border: 1px solid var(--line);
  color: var(--copper);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--t-sm), transform var(--t-md);
  font-family: "Heebo", sans-serif;
}
.link-btn svg { width: 13px; height: 13px; }
.link-btn:hover { background: rgba(201,164,122,0.18); transform: translateY(-1px); }

.event-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  max-height: 360px;
  padding-left: 4px;
}
.event-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: background var(--t-sm), transform var(--t-md), border-color var(--t-sm);
}
.event-row:hover {
  background: rgba(36, 46, 70, 0.62);
  border-color: var(--line-strong);
  transform: translateX(-2px);
}
.event-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor, 0 0 0 3px rgba(255,255,255,0.04);
}
.event-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.event-name {
  font-weight: 500;
  color: var(--pearl-cream);
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-date {
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}
.event-count {
  text-align: left;
  font-family: "IBM Plex Mono", monospace;
}
.event-count .ec-n {
  font-size: 20px;
  font-weight: 600;
  color: var(--pearl-cream);
  letter-spacing: -.01em;
}
.event-count .ec-u {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}
.event-count.past .ec-n { color: var(--muted); }
.event-count.today .ec-n { color: var(--copper-bright); }
.event-count.today .ec-u { color: var(--copper); }
.event-count.future .ec-n { color: var(--pearl-cream); }

.empty-event {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px 14px 8px;
  gap: 10px;
}
.empty-event img {
  width: 140px; height: 140px;
  object-fit: contain;
  opacity: .8;
  filter: drop-shadow(0 12px 20px rgba(201,164,122,0.15));
}
.empty-event h3 {
  margin: 4px 0 0;
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 500;
  font-size: 19px;
  color: var(--pearl-cream);
}
.empty-event p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
}

/* LIFE CALENDAR */
.life-card { padding: 22px 24px; }
.life-legend {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}
.life-legend .lg {
  width: 12px; height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.life-legend .lg-past { background: var(--copper-deep); }
.life-legend .lg-now { background: var(--copper-bright); box-shadow: 0 0 8px var(--copper); }
.life-legend .lg-future { background: rgba(255,255,255,0.07); }
.life-grid-wrap {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 4px;
  margin: 6px 0;
}
.life-axis-y {
  display: grid;
  grid-template-rows: repeat(9, 1fr);
  font-size: 10px;
  color: var(--muted-2);
  font-family: "IBM Plex Mono", monospace;
  align-items: start;
  padding-top: 1px;
}
.life-axis-y span { line-height: 1; }
.life-grid {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  grid-template-rows: repeat(80, 1fr);
  gap: 1.5px;
  aspect-ratio: 52 / 80;
  max-height: 480px;
}
.life-cell {
  background: rgba(255,255,255,0.05);
  border-radius: 1.5px;
  transition: transform var(--t-sm);
}
.life-cell.past { background: rgba(138,106,69,0.55); }
.life-cell.past:nth-child(7n) { background: rgba(138,106,69,0.78); }
.life-cell.now { background: var(--copper-bright); box-shadow: 0 0 10px var(--copper); transform: scale(1.3); z-index: 5; position: relative; }
.life-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.lf-k {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
}
.lf-v {
  font-family: "IBM Plex Mono", monospace;
  color: var(--pearl-cream);
  font-size: 18px;
  font-weight: 600;
  margin-top: 2px;
}

/* JOURNAL */
.journal-card { display: flex; flex-direction: column; gap: 12px; }
.mood-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 11.5px;
  cursor: pointer;
  transition: transform var(--t-md), background var(--t-sm), border-color var(--t-sm), color var(--t-sm);
  font-family: "Heebo", sans-serif;
}
.mood-btn span {
  font-size: 17px;
  line-height: 1;
  color: var(--muted);
}
.mood-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--copper);
}
.mood-btn:hover span { color: var(--copper); }
.mood-btn.active {
  background: linear-gradient(180deg, rgba(201,164,122,0.18), rgba(201,164,122,0.06));
  border-color: var(--copper);
  color: var(--pearl-cream);
}
.mood-btn.active span { color: var(--copper-bright); }

.journal-text {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  font-family: "Heebo", sans-serif;
  font-size: 14.5px;
  line-height: 1.7;
  transition: border-color var(--t-sm), background var(--t-sm);
}
.journal-text:focus {
  outline: none;
  border-color: var(--copper);
  background: rgba(8, 10, 22, 0.78);
}
.journal-text::placeholder { color: var(--muted-2); font-style: italic; }

.journal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.journal-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.journal-saved {
  font-size: 12px;
  color: var(--jade);
  font-family: "IBM Plex Mono", monospace;
  align-self: flex-end;
  opacity: 0;
  transition: opacity var(--t-sm);
}
.journal-saved.show { opacity: 1; }

/* ON THIS DAY */
.otd-card { display: flex; flex-direction: column; }
.otd-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.otd-row {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  border-right: 3px solid var(--copper);
  display: grid;
  gap: 6px;
}
.otd-row .otd-y {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--copper);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
}
.otd-row .otd-y .yrs-ago {
  color: var(--muted);
  font-weight: 400;
}
.otd-row .otd-txt {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.otd-row .otd-mood {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .02em;
}
.otd-empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--muted);
}
.otd-empty svg {
  width: 70px; height: 70px;
  color: var(--copper-deep);
  opacity: .55;
}
.otd-empty p {
  margin: 0;
  font-size: 13px;
  max-width: 280px;
  line-height: 1.7;
}

/* INSIGHTS / HEATMAP */
.insights-card { padding: 22px 24px; }
.heatmap-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(31, 1fr);
  gap: 4px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  position: relative;
  transition: transform var(--t-sm);
}
.hm-cell.m1 { background: rgba(110,79,107,0.35); }
.hm-cell.m2 { background: rgba(138,106,69,0.45); }
.hm-cell.m3 { background: rgba(201,164,122,0.55); }
.hm-cell.m4 { background: rgba(224,188,140,0.78); }
.hm-cell.m5 { background: var(--pearl); box-shadow: 0 0 8px rgba(232,213,168,0.45); }
.hm-cell:hover {
  transform: scale(1.4);
  z-index: 5;
}
.heatmap-scale {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  justify-content: center;
  margin-top: 8px;
}
.hs {
  width: 12px; height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.hs-1 { background: rgba(110,79,107,0.35); }
.hs-2 { background: rgba(138,106,69,0.45); }
.hs-3 { background: rgba(201,164,122,0.55); }
.hs-4 { background: rgba(224,188,140,0.78); }
.hs-5 { background: var(--pearl); }

.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.insight-bx {
  padding: 14px 14px 12px;
  background: rgba(20, 26, 44, 0.4);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.ix-k {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
}
.ix-v {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 19px;
  color: var(--pearl-cream);
  margin-top: 6px;
  font-weight: 500;
  line-height: 1.2;
}

/* FOOTER */
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 30px 12px 12px;
  border-top: 1px solid var(--line-soft);
}
.foot-sub {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: .02em;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 25%, #F4E7C6 0%, var(--copper) 60%, var(--copper-deep) 100%);
  color: #2A1B0A;
  border: none;
  cursor: pointer;
  z-index: 20;
  box-shadow: var(--shadow-fab);
  transition: transform var(--t-md);
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { transform: scale(1.07) rotate(90deg); }
.fab:active { transform: scale(.95); }
.fab:focus-visible { outline: 2px solid var(--pearl); outline-offset: 4px; }

/* BUTTONS */
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(180deg, var(--copper-bright), var(--copper) 60%, var(--copper-deep));
  color: #1A100A;
  border: 1px solid var(--copper);
  border-radius: 12px;
  font-family: "Heebo", sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--t-md), box-shadow var(--t-sm), filter var(--t-sm);
  box-shadow: 0 6px 18px -6px rgba(201,164,122,0.6), 0 0 0 1px rgba(255,255,255,0.1) inset;
}
.primary-btn svg { width: 16px; height: 16px; }
.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 10px 24px -6px rgba(201,164,122,0.7), 0 0 0 1px rgba(255,255,255,0.15) inset;
}
.primary-btn:active { transform: translateY(0) scale(.98); }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: "Heebo", sans-serif;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--t-sm), border-color var(--t-sm), transform var(--t-md);
}
.ghost-btn:hover {
  background: rgba(36, 46, 70, 0.62);
  border-color: var(--line-strong);
  color: var(--copper);
  transform: translateY(-1px);
}

/* MODAL */
.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 100;
  padding: 16px;
  animation: modalIn .28s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal[hidden] { display: none; }
.modal-bg {
  position: absolute; inset: 0;
  background: rgba(5, 7, 18, 0.78);
  backdrop-filter: blur(14px);
  cursor: pointer;
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: linear-gradient(180deg, #131826 0%, #0C1020 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,164,122,0.06) inset;
  animation: panelIn .36s cubic-bezier(.34,1.56,.64,1);
}
.about-panel { max-width: 540px; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-h h3 {
  margin: 0;
  font-family: "Frank Ruhl Libre", serif;
  font-weight: 500;
  font-size: 20px;
  color: var(--pearl-cream);
}
.modal-close {
  width: 32px; height: 32px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--t-sm), color var(--t-sm), transform var(--t-md);
}
.modal-close:hover { background: rgba(185, 94, 94, 0.18); color: var(--rose); transform: rotate(90deg); }
.modal-body { padding: 18px 22px; display: grid; gap: 14px; }
.modal-f {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-soft);
}
.spacer { flex: 1; }

.lab { display: grid; gap: 6px; }
.lab > span { font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }
.lab .lab-row { display: flex; justify-content: space-between; align-items: center; color: var(--text-soft); font-size: 14px; }
.lab input[type="text"],
.lab input[type="date"],
.lab input[type="number"],
.lab select,
.lab textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: "Heebo", sans-serif;
  font-size: 14px;
  transition: border-color var(--t-sm);
}
.lab input:focus, .lab select:focus, .lab textarea:focus {
  outline: none; border-color: var(--copper);
}
.lab input[type="date"] { color-scheme: dark; }
.two-col-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.range-val {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  color: var(--copper);
  min-width: 32px;
  text-align: center;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  background: var(--surface-3);
  height: 6px; border-radius: 99px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--copper-bright);
  border: 2px solid var(--bg-1);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(201,164,122,0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--copper-bright);
  border: 2px solid var(--bg-1);
  cursor: pointer;
}
.switch {
  position: relative;
  width: 40px; height: 22px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: background var(--t-sm), border-color var(--t-sm);
}
.switch-track::before {
  content: "";
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--t-md), background var(--t-sm);
}
.switch input:checked + .switch-track {
  background: rgba(201,164,122,0.25);
  border-color: var(--copper);
}
.switch input:checked + .switch-track::before {
  background: var(--copper-bright);
  transform: translateX(-18px);
}
.color-pick { display: flex; gap: 8px; padding-top: 4px; }
.cdot {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--copper);
  cursor: pointer;
  transition: transform var(--t-md), border-color var(--t-sm);
}
.cdot:hover { transform: scale(1.1); }
.cdot.active { border-color: var(--pearl); box-shadow: 0 0 0 1px rgba(0,0,0,0.6); }
.c-copper { background: var(--copper); }
.c-pearl { background: var(--pearl); }
.c-plum { background: var(--plum); }
.c-jade { background: var(--jade); }
.c-rose { background: var(--rose); }

.cfg-actions { display: flex; gap: 8px; margin-top: 4px; }
.cfg-actions .ghost-btn { flex: 1; justify-content: center; }

/* ABOUT */
.about-lead {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--copper-bright);
  margin: 0 0 14px;
  line-height: 1.5;
}
.about-list {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 10px;
}
.about-list li {
  position: relative;
  padding: 10px 16px 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-right: 3px solid var(--copper);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.6;
}
.about-list li strong { color: var(--pearl-cream); }
.about-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* TOAST */
.toast {
  position: fixed;
  top: 88px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px;
  background: rgba(20, 26, 44, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  color: var(--pearl-cream);
  font-size: 13.5px;
  z-index: 200;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6);
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
  backdrop-filter: blur(14px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast[hidden] { display: none; }

/* INSTALL BANNER */
.install-banner {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px 12px 18px;
  background: linear-gradient(180deg, #131826 0%, #0C1020 100%);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  z-index: 200;
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.7);
  animation: panelIn .4s cubic-bezier(.34,1.56,.64,1);
  max-width: calc(100vw - 40px);
}
.install-banner[hidden] { display: none; }
.install-banner .ghost-btn { padding: 6px 12px; font-size: 12.5px; }
.install-banner .primary-btn { padding: 7px 14px; font-size: 12.5px; }

/* RESPONSIVE */
@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .row.two-col { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { padding: 28px 22px 24px; }
  .hero-meta { gap: 8px; }
  .meta-pill { padding: 8px 12px; }
  .page { padding: 14px 14px 110px; gap: 16px; }
  .card { padding: 18px 18px; }
  .topbar { padding: 12px 14px; }
  .brand-name { font-size: 19px; }
  .brand-tag { font-size: 10px; }
}
@media (max-width: 540px) {
  .heatmap-grid { grid-template-columns: repeat(15, 1fr); }
  .life-grid { max-height: 360px; }
}
@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-num { font-size: 26px; }
  .stat-card { padding: 14px; }
  .mood-btn { font-size: 10.5px; padding: 10px 2px 8px; }
  .mood-btn span { font-size: 15px; }
}

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