:root {
  --bg: #07080d;
  --ink: #ECEAE3;
  --muted: #8d92a8;
  --faint: #5b6076;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.055);
  --gold: #E7C26A;
  --gold-dim: #c2a25a;
  --panel: rgba(255, 255, 255, 0.025);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --symbol: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols2", var(--serif);
}

* { box-sizing: border-box; }

/* Dark base on the root (not body) so the fixed z-index:-1 starfield shows. */
html { background: var(--bg); color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) 1.5rem 4rem;
  min-height: 100vh;
}

/* --- masthead --- */
.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  line-height: 1.03;
  letter-spacing: -0.02em;
}
/* --- query form --- */
.query { margin-top: 2.6rem; display: flex; flex-direction: column; gap: 1.1rem; }

/* Date as Month / Day / Year, to avoid the native date picker. */
.field { display: flex; flex-direction: column; gap: .5rem; }
.field-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.date-fields { display: flex; gap: .6rem; }
.date-fields > * { min-width: 0; }
.date-fields select { flex: 2; }
.date-fields #day { flex: 1; }
.date-fields #year { flex: 1.4; }

label {
  display: flex; flex-direction: column; gap: .5rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted);
}

input, select {
  width: 100%;
  font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 9px; padding: .72rem .8rem;
  transition: border-color .15s ease, background .15s ease;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus {
  outline: none; border-color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}

.actions { display: flex; gap: .7rem; justify-content: flex-end; margin-top: .2rem; }
button {
  font-family: var(--sans); font-size: .92rem; font-weight: 600;
  border-radius: 9px; padding: .72rem 1.3rem; cursor: pointer;
  border: 1px solid transparent; transition: filter .15s ease, border-color .15s ease;
}
#submit { background: var(--gold); color: #0b0b12; }
#submit:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: var(--gold-dim); }

.hint { margin: 0; min-height: 1.1em; font-size: .8rem; color: var(--muted); }

/* --- results view --- */
.back-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--sans); font-size: .85rem; color: var(--muted);
  letter-spacing: .02em; margin-bottom: 1.8rem;
}
.back-btn:hover { color: var(--gold); }

/* --- result reading --- */
.reading { margin-top: 0; }
.context {
  margin: 0; font-size: .8rem; color: var(--muted); letter-spacing: .02em;
}
.context-place { display: block; margin-top: .2rem; color: var(--faint); }

.loading { margin-top: 2rem; color: var(--muted); font-family: var(--serif); font-style: italic; }

.notice {
  margin-top: 2rem; padding: 1rem 1.1rem; border-radius: 10px;
  border: 1px solid rgba(231, 194, 106, 0.3);
  background: rgba(231, 194, 106, 0.06); color: var(--gold);
}

/* hero (the ISS) */
.hero {
  margin: 1.6rem 0 2.4rem; padding: 1.6rem 0 1.8rem;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.hero-obj {
  margin: 0; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .2em; color: var(--muted);
}
.hero-sign { display: flex; align-items: baseline; gap: .85rem; margin: .55rem 0 .3rem; }
.hero-glyph { font-family: var(--symbol); font-size: 3rem; line-height: 1; color: var(--gold); }
.hero-name {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.1rem, 8vw, 3.1rem); letter-spacing: -0.01em;
}
.hero-flavor { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink); }
.hero-meta { margin: .7rem 0 0; font-size: .8rem; color: var(--muted); }
.hero.is-empty .hero-empty { margin: .6rem 0 0; font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--faint); }

/* groups + rows */
.group { margin-top: 2rem; }
.group-title {
  margin: 0 0 .2rem; padding-bottom: .55rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .2em;
  color: var(--gold-dim); border-bottom: 1px solid var(--line);
}
.row-item {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 1rem;
  padding: .72rem .1rem; border-bottom: 1px solid var(--line-soft);
}
.obj { display: flex; align-items: baseline; gap: .65rem; font-size: 1.02rem; }
.obj-emoji { width: 1.5em; flex: none; font-size: 1.05rem; }
.obj-sign { display: flex; align-items: baseline; gap: .5rem; font-size: 1.02rem; white-space: nowrap; }
.obj-sign .glyph { font-family: var(--symbol); font-size: 1.2rem; color: var(--gold); }
.obj-sign.none { font-family: var(--serif); font-style: italic; color: var(--faint); }
.obj-aside { font-size: .76rem; color: var(--muted); text-align: right; white-space: nowrap; min-width: 7ch; }

.row-item.absent { opacity: .42; }
.row-item.absent .obj-emoji { filter: grayscale(1); }

/* colophon */
.colophon {
  margin-top: 3.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1.5rem;
  font-size: .72rem; color: var(--faint);
}

@media (max-width: 460px) {
  .row-item { grid-template-columns: 1fr auto; }
  .obj-aside { display: none; }
  .actions { flex-direction: column-reverse; }
  .actions button { width: 100%; }
}
