:root {
  --bg: #121A2B;
  --bg-2: #182236;
  --card: #1D2938;
  --card-2: #273449;
  --line: rgba(255,255,255,0.08);
  --ink: #F2F5FA;
  --muted: #A7B3C6;
  --muted-2: #74829A;
  --accent: #5B8DEF;
  --accent-2: #7A5C9E;
  --accent-3: #8A93AD;
  --cyan: #5B8DEF;
  --gold: #E9C46A;
  --rose: #A98BB0;
  --grad: linear-gradient(135deg, #5B8DEF 0%, #3E6DB5 22%, #A9C3E8 46%, #7A5C9E 74%, #D9B35A 100%);
  --grad-btn: linear-gradient(135deg, #3D6FD6 0%, #5B8DEF 55%, #6C5C9E 100%);
  --grad-soft: linear-gradient(135deg, rgba(91,141,239,0.16), rgba(122,92,158,0.14), rgba(233,196,106,0.14));
  --shadow: 0 12px 40px rgba(0,0,0,0.45);
  --radius: 18px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Plus Jakarta Sans', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image: linear-gradient(180deg, #121A2B 0%, #162032 45%, #1F2A40 100%);
  background-attachment: fixed;
}

.hero { position: relative; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(18,26,43,0.42) 0%, rgba(18,26,43,0.80) 74%, var(--bg) 100%); }
.hero-inner { position: relative; z-index: 2; text-align: center; max-width: 800px; margin: 0 auto; padding: 62px 22px 36px; }
.brand-mark { font-size: 0.82em; margin-right: 6px; }
.brand {
  font-family: var(--serif);
  font-size: 44px; font-weight: 700; letter-spacing: -0.5px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.tagline { color: var(--muted); font-size: 13px; margin-top: 4px; letter-spacing: 1.5px; text-transform: uppercase; }
.desc { color: var(--muted); font-size: 16px; max-width: 720px; margin: 14px auto 0; line-height: 1.7; }

.layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; padding: 14px 32px 44px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; padding: 14px 16px 44px; } .hero-inner { padding: 40px 18px 24px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.form { padding: 26px; }
.form h2 { margin: 0 0 18px; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.form h2::after, .cal h3::after { content: ""; display: block; width: 46px; height: 3px; margin-top: 9px; border-radius: 2px; background: var(--grad); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field > span em { color: var(--muted-2); font-weight: 400; font-style: normal; }
.field small { display: block; color: var(--muted-2); font-size: 12px; margin-top: 5px; }

input, select, textarea {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2); color: var(--ink); font-family: var(--sans);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(0.7); }

fieldset.starts { border: none; padding: 0; margin: 0 0 16px; }
fieldset.starts legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.start-grid { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cta {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 700; color: #FFFFFF;
  background: var(--grad-btn); border: none; border-radius: 12px; cursor: pointer; margin-top: 4px;
  box-shadow: 0 8px 26px rgba(91,141,239,0.32);
  transition: transform 0.06s ease, filter 0.12s ease;
}
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: scale(0.99); }
.privacy { color: var(--muted-2); font-size: 12px; margin-top: 12px; text-align: center; }
.privacy a { color: var(--cyan); }

.results { display: flex; flex-direction: column; gap: 18px; }
.empty { display: flex; align-items: center; justify-content: center; min-height: 420px; }
.empty-inner { text-align: center; color: var(--muted); max-width: 360px; padding: 20px; }
.empty .big { font-size: 56px; margin-bottom: 12px; }
.empty p { font-size: 17px; }
.empty strong { color: var(--ink); }
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 16px; }

/* banner */
.banner {
  border-radius: var(--radius); padding: 28px 30px; color: #F6F1E8;
  background: linear-gradient(135deg, #1B2A45 0%, #22355A 45%, #453565 100%);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.banner::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 220px at 85% 15%, rgba(233,196,106,0.22), transparent 60%);
  pointer-events: none;
}
.banner .phase-emoji { font-size: 40px; display: block; margin-bottom: 6px; position: relative; z-index: 1; }
.banner h1 { margin: 0 0 6px; font-family: var(--serif); font-size: 32px; letter-spacing: -0.3px; position: relative; z-index: 1; }
.banner .blurb { opacity: 0.96; font-size: 15px; max-width: 560px; position: relative; z-index: 1; }
.banner .affirm { margin-top: 14px; font-family: var(--serif); font-style: italic; font-size: 17px; opacity: 0.98; position: relative; z-index: 1; }

/* facts */
.facts { display: flex; flex-wrap: wrap; gap: 12px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; min-width: 110px; box-shadow: var(--shadow); }
.fact .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.fact .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.cal h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.month + .month { margin-top: 22px; }
.month h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays div { font-size: 11px; color: var(--muted-2); text-align: center; padding: 4px 0; }
.day {
  aspect-ratio: 1 / 1.05; border-radius: 9px; padding: 5px 4px;
  font-size: 13px; text-align: center; position: relative;
  background: var(--bg-2); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.day.blank { background: transparent; }
.day .dnum { font-weight: 600; color: var(--ink); }
.day .cday { font-size: 9.5px; opacity: 0.7; }
.day.is-start::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.day.today { outline: 2px solid var(--gold); outline-offset: 1px; }
.day.has-log::before { content: ""; position: absolute; top: 4px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.day .dbest { font-size: 11px; line-height: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend + .cal-legend { margin-top: 6px; }

/* daily log */
.log { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.log h4 { margin: 0 0 2px; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.log-meta { color: var(--muted-2); font-size: 12px; margin-bottom: 14px; }
.log-row { margin-bottom: 14px; }
.log-row .lbl { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.4px; }
.energy { display: flex; gap: 8px; }
.energy-btn { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); transition: all 0.12s ease; }
.energy-btn.on { background: var(--grad-btn); border-color: transparent; color: #FFFFFF; }
.symptom-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; background: var(--bg-2); color: var(--muted); user-select: none; transition: all 0.12s ease; }
.chip.on { background: var(--accent-2); border-color: transparent; color: #FFFFFF; }
.log textarea { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); color: var(--ink); font-family: var(--sans); resize: vertical; }
.log-actions { display: flex; align-items: center; gap: 12px; }
.cta.secondary { width: auto; padding: 10px 20px; }
.log-saved { color: var(--cyan); font-weight: 700; font-size: 14px; }

/* history + astrology */
.phase-badge, .cd-tag, .energy-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; margin-right: 6px; }
.cd-tag { background: #2A3B5C; }
.energy-tag { background: var(--cyan); color: #0A1630; }
.chip.mini { padding: 3px 9px; font-size: 11px; cursor: default; }
.hist-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist-row:last-child { border-bottom: none; }
.hist-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.hist-date { font-weight: 700; margin-right: 6px; }
.hist-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.hist-note { color: var(--muted); font-size: 13px; margin-top: 4px; font-style: italic; }
.patterns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.pattern { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--muted); }

.astro-sign { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.astro-sep { color: var(--line); }
.astro-today { background: var(--grad-soft); border: 1px solid rgba(233,196,106,0.30); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.astro-today .astro-shadow { color: var(--muted); font-size: 13px; margin-top: 3px; }
.astro-weeks { display: flex; flex-direction: column; gap: 6px; }
.aw-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 4px; }
.astro-week { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.astro-week.now { background: var(--bg-2); outline: 1px solid var(--line); }
.aw-phase { color: #fff; font-weight: 700; font-size: 11px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.aw-note { color: var(--muted); }
.astro-disc { color: var(--muted-2); font-size: 11px; margin-top: 10px; }

/* plan your weeks */
.wk-nowbox { background: var(--grad-soft); border: 1px solid rgba(233,196,106,0.30); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.wk-best { margin-top: 4px; }
.wk-avoid { color: var(--muted); margin-top: 3px; font-size: 13px; }
.wk-list { display: flex; flex-direction: column; gap: 6px; }
.wk-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.wk-row.now { background: var(--bg-2); outline: 1px solid var(--line); }
.wk-type { flex: 1; color: var(--ink); }
.wk-phase { color: #fff; font-weight: 700; font-size: 11px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.wk-nowtag { color: var(--cyan); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }

/* export */
.export .export-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.xbtn {
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2); color: var(--ink); cursor: pointer;
  font-size: 14px; font-weight:600; font-family: var(--sans);
  transition: all 0.12s ease;
}
.xbtn:hover { border-color: var(--accent-2); background: var(--card-2); }
.export-note { color: var(--muted-2); font-size: 12px; margin-top: 10px; }

/* rec cards */
.recs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .recs { grid-template-columns: 1fr; } }
.rec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.rec h4 { margin: 0 0 10px; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.rec ul { margin: 0; padding-left: 18px; }
.rec li { margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.rec li:last-child { margin-bottom: 0; }

.foot { color: var(--muted-2); font-size: 12px; text-align: center; padding: 0 32px 44px; }
.foot .motto { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); margin-bottom: 8px; }
.foot .disc { font-size: 12px; }

/* ---- mobile + PWA refinements ---- */
html { -webkit-text-size-adjust: 100%; }

button, .chip, .energy-btn, .xbtn, .cta {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .hero-inner { padding-top: max(44px, env(safe-area-inset-top)); }
  .brand { font-size: 32px; }
  .tagline { font-size: 11px; letter-spacing: 1.1px; }
  .desc { font-size: 14px; }
  .layout { padding: 10px 12px 36px; gap: 16px; }
  .form { padding: 20px 16px; }
  .form h2 { font-size: 21px; }
  .cal { padding: 16px 12px; }
  .cal h3 { font-size: 19px; }
  .log { padding: 16px 14px; }
  .banner { padding: 22px 18px; }
  .banner h1 { font-size: 25px; }
  .banner .blurb { font-size: 14px; }
  .rec { padding: 16px 14px; }
  .foot { padding-bottom: max(36px, env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* stop iOS auto-zoom on focus */
  .cta { padding: 16px; font-size: 17px; }
  .energy-btn { padding: 12px 6px; }
  .chip { padding: 9px 14px; }
  .xbtn { padding: 12px 16px; }
  .day { font-size: 11px; }
  .day .cday { font-size: 8px; }
  .day .dbest { font-size: 9px; }
  .fact { padding: 10px 12px; min-width: 96px; }
  .fact .v { font-size: 16px; }
}
