:root {
  --bg: #080d18;
  --bg-2: #0d1526;
  --panel: #111b2e;
  --line: #1e2b45;
  --text: #e8eefb;
  --muted: #92a3c0;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --lived: #38bdf8;
  --left: #1e2b45;
  --warm: #fbbf24;
  --good: #34d399;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(29, 78, 216, 0.28), transparent 60%),
    radial-gradient(700px 500px at 8% 104%, rgba(167, 139, 250, 0.22), transparent 60%),
    linear-gradient(160deg, var(--bg-2), var(--bg));
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: 1120px;
  margin: 0 auto;
}

.mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.35);
}

.langs { display: flex; gap: 4px; background: rgba(17, 27, 46, 0.8); padding: 4px; border-radius: 10px; }
.lang {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
}
.lang.is-active { background: var(--panel); color: var(--accent); }

/* ---------- layout ---------- */

main { max-width: 1120px; margin: 0 auto; padding: 8px 24px 40px; }

.intro { text-align: center; padding: 36px 0 20px; }

h1 {
  font-size: clamp(36px, 7vw, 68px);
  line-height: 1.05;
  margin: 0 0 18px;
  letter-spacing: -1.5px;
  background: linear-gradient(120deg, #ffffff 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 19px);
  max-width: 620px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

/* ---------- the question ---------- */

.ask { max-width: 460px; margin: 0 auto; text-align: left; }
.ask label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ask-row { display: flex; gap: 10px; }

input[type="date"] {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  font-family: inherit;
  color-scheme: dark;
}
input[type="date"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07101f;
  border-color: transparent;
}

.error { color: #f87171; font-size: 14px; min-height: 20px; margin: 10px 0 0; }

/* ---------- result ---------- */

.result { animation: rise 0.5s ease-out; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.headline { text-align: center; padding: 10px 0 30px; }
.headline-main { font-size: clamp(30px, 6vw, 56px); letter-spacing: -1px; }
.headline-main b {
  font-size: clamp(52px, 12vw, 108px);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-right: 12px;
}
.headline-sub { color: var(--muted); margin-top: 10px; font-size: clamp(14px, 2.4vw, 18px); }
.headline-sub b { color: var(--text); margin-right: 6px; }
.headline-sub .born { display: block; margin-top: 6px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 19px; margin: 0 0 4px; }
.panel-head p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.section-title { font-size: 19px; margin: 26px 0 14px; }

canvas#grid {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 76vh;
}

.grid-legend {
  display: flex; flex-wrap: wrap; gap: 20px;
  margin-top: 16px; color: var(--muted); font-size: 13px;
}
.grid-legend b { color: var(--text); }
.sq { width: 11px; height: 11px; border-radius: 2px; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.sq-lived { background: var(--lived); }
.sq-left { background: var(--left); }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.stat b {
  display: block;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.stat span { color: var(--muted); font-size: 13px; }
.stat:nth-child(1) b { color: #f87171; }
.stat:nth-child(2) b { color: var(--accent); }
.stat:nth-child(3) b { color: var(--accent-2); }
.stat:nth-child(4) b { color: var(--good); }
.stat:nth-child(5) b { color: var(--warm); }
.stat:nth-child(6) b { color: #e2e8f0; }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .two-up { grid-template-columns: 1fr; } }

.planets, .next { list-style: none; padding: 0; margin: 10px 0 0; }
.planets li, .next li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.planets li:last-child, .next li:last-child { border-bottom: 0; }
.planets .value, .next .value { font-weight: 700; font-variant-numeric: tabular-nums; }
.planets .value { color: var(--accent); }
.next .value { color: var(--good); }
.next .label, .planets .label { color: var(--muted); }

/* ---------- actions ---------- */

.actions { display: flex; gap: 10px; justify-content: center; margin: 28px 0 8px; flex-wrap: wrap; }
.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 24px; }

.note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 8px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 26px 24px 40px;
}
footer a { color: var(--accent); margin-left: 8px; }

@media (prefers-reduced-motion: reduce) {
  .result { animation: none; }
  html { scroll-behavior: auto; }
}
