:root {
  color-scheme: light;
  --bg: #eef0f4;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --ink: #151924;
  --muted: #626b7a;
  --line: rgba(127, 136, 153, 0.28);
  --silver: #d7dbe3;
  --silver-dark: #8c94a3;
  --purple: #7c3aed;
  --purple-deep: #4c1d95;
  --purple-soft: #ede9fe;
  --violet-line: rgba(124, 58, 237, 0.32);
  --error: #b42318;
  --shadow: 0 24px 70px rgba(45, 49, 66, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.84), rgba(217, 220, 228, 0.74)),
    repeating-linear-gradient(90deg, rgba(124, 58, 237, 0.08) 0 1px, transparent 1px 76px),
    linear-gradient(145deg, #f8f9fb 0%, #d7dbe3 46%, #f2effb 100%);
}

button,
input { font: inherit; }

button { touch-action: manipulation; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  gap: 20px;
}

.hero {
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 300px);
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.9), rgba(233, 229, 246, 0.74)),
    linear-gradient(180deg, rgba(124, 58, 237, 0.1), transparent 60%);
  box-shadow: var(--shadow);
  padding: 32px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}

.hero-copy { position: relative; z-index: 1; }

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--purple-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p { overflow-wrap: anywhere; }

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.45rem, 6vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.orbital-mark {
  position: relative;
  width: min(100%, 280px);
  aspect-ratio: 1;
  justify-self: end;
}

.orbital-mark::before,
.orbital-mark::after,
.orbital-mark span {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid var(--violet-line);
  border-radius: 50%;
  transform: rotate(18deg) scaleX(1.55);
}

.orbital-mark::after { transform: rotate(-34deg) scaleX(1.35); }
.orbital-mark span:nth-child(1) { inset: 30%; background: linear-gradient(145deg, #ffffff, #c8ceda); box-shadow: inset 0 0 22px rgba(124, 58, 237, 0.18); }
.orbital-mark span:nth-child(2) { inset: 8%; transform: rotate(62deg) scaleX(1.15); }
.orbital-mark span:nth-child(3) { inset: 42%; border-color: rgba(76, 29, 149, 0.44); }

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr) minmax(280px, 360px);
  grid-template-areas:
    "controls daily chart"
    "wish wish chart"
    "notice notice notice";
  gap: 16px;
}

.control-panel,
.daily-panel,
.chart-panel,
.wish-panel,
.disclaimer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(45, 49, 66, 0.1);
  backdrop-filter: blur(18px);
}

.control-panel {
  grid-area: controls;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 20px;
}

.field-grid { display: grid; gap: 14px; }

.field,
.tone-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.field span,
.tone-field legend {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

input[type="date"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
button:focus-visible,
.segmented input:focus-visible + span {
  outline: 3px solid rgba(124, 58, 237, 0.24);
  outline-offset: 2px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.segmented label { min-width: 0; }

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.segmented input:checked + span {
  border-color: var(--purple);
  background: var(--purple-soft);
  color: var(--purple-deep);
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

button[type="submit"] {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--purple), #5b21b6);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

button[type="submit"]:hover { filter: brightness(1.06); }
button[type="submit"]:disabled { cursor: wait; opacity: 0.7; }

.daily-panel {
  grid-area: daily;
  min-height: 360px;
  padding: 24px;
  display: grid;
  align-content: center;
}

.status { color: var(--muted); line-height: 1.5; }
.status.error { color: var(--error); }

.daily-reading[hidden] { display: none; }

.meta-row,
.chart-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span,
.chart-summary span {
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  padding: 5px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.daily-reading h2,
.chart-panel h2,
.wish-panel h2 {
  margin: 16px 0 10px;
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0;
}

#reading-text,
#daily-wish {
  margin: 0;
  color: #2d3342;
  font-size: 1.06rem;
  line-height: 1.58;
}

.lucky-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.lucky-row div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.lucky-row span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lucky-row strong {
  display: block;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.chart-panel {
  grid-area: chart;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 20px;
}

#natal-chart {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  display: block;
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #eef0f6 58%, #d9dde7 100%);
}

.wish-panel {
  grid-area: wish;
  padding: 22px 24px;
}

.disclaimer {
  grid-area: notice;
  margin: 0;
  border-left: 4px solid var(--purple);
  padding: 16px 18px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    grid-template-areas:
      "controls chart"
      "daily chart"
      "wish wish"
      "notice notice";
  }

  .daily-panel { min-height: 300px; }
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 680px); padding: 16px 0; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 24px; }
  .orbital-mark { width: 170px; justify-self: start; }
  .workspace { grid-template-columns: 1fr; grid-template-areas: "controls" "daily" "chart" "wish" "notice"; }
  .control-panel,
  .daily-panel,
  .chart-panel,
  .wish-panel { padding: 18px; }
  .segmented { grid-template-columns: 1fr; }
  .lucky-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .orbital-mark { animation: drift 18s linear infinite; }
  @keyframes drift { to { transform: rotate(360deg); } }
}
