:root {
  --night: #0B1026;
  --deep: #141B3C;
  --panel: #1B2450;
  --edge: #2C376B;
  --ink: #EEF0FA;
  --muted: #A3ABCF;
  --gold: #F2C14E;
  --rose: #F08BB4;
  --sky: #4FB3F6;
  --danger: #FF8A7A;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ink); font: 16px/1.5 var(--sans);
  background-image: radial-gradient(1200px 600px at 80% -10%, #24306E 0%, transparent 60%),
                    radial-gradient(900px 500px at -10% 10%, #2A1E55 0%, transparent 55%);
  background-attachment: fixed; min-height: 100vh;
}
a { color: var(--sky); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font: 600 22px/1 var(--serif); letter-spacing: .01em; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--night);
  background: var(--gold); border-radius: 99px; padding: 3px 9px; font-weight: 700; }

main { max-width: 1180px; margin: 0 auto; padding: 0 18px 40px; }
.intro { max-width: 620px; margin: 3vh auto 0; }
.intro h1 { font-size: clamp(30px, 6vw, 46px); }
.lead { color: var(--muted); font-size: 17px; margin: 14px 0 22px; }

.card { background: color-mix(in srgb, var(--deep) 92%, transparent); border: 1px solid var(--edge);
  border-radius: 16px; padding: 18px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.form legend { font-weight: 650; padding: 0; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
legend .hint { margin-left: 6px; }
.row3 { display: grid; grid-template-columns: 1fr 1.5fr 1.2fr; gap: 10px; }
.row3 label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=time], input:not([type]), select {
  width: 100%; height: 48px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--edge);
  background: var(--night); color: var(--ink); font: inherit; font-size: 16px; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
input:disabled, select:disabled { opacity: .4; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }
.consent { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.note { background: #2A2350; border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 10px 0 0; }
.error { color: var(--danger); margin: 0 0 12px; font-size: 14px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

.btn { height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--edge); background: var(--panel);
  color: var(--ink); font: 600 15px var(--sans); cursor: pointer; }
.btn.primary { background: var(--gold); color: #1A1503; border-color: var(--gold); width: 100%; height: 52px; font-size: 17px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: progress; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn.primary { width: auto; flex: 1; }

.ac { position: relative; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; max-height: 260px; overflow: auto;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.ac-list li { padding: 10px 10px; border-radius: 8px; cursor: pointer; }
.ac-list li small { color: var(--muted); }
.ac-list li:hover, .ac-list li.on { background: var(--edge); }

.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 8px 0 10px; }
.result-head h2 { font-size: clamp(24px, 4.5vw, 34px); }
.sub { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
#r-notes .note { margin: 0 0 10px; }
#r-notes .note button { margin: 6px 8px 0 0; height: 36px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 12px 0 10px; border-radius: 99px; border: 1px solid var(--edge); background: transparent;
  color: var(--muted); font: 600 14px var(--sans); display: flex; align-items: center; gap: 7px; cursor: pointer; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); opacity: .35; }
.chip.on { color: var(--ink); background: var(--panel); border-color: var(--c); }
.chip.on i { opacity: 1; }
.chip.all { padding: 0 14px; }

.mapwrap { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--edge); background: #0F1530; }
#map { height: min(68vh, 640px); min-height: 420px; }
.citysearch { position: absolute; top: 10px; left: 10px; width: min(300px, calc(100% - 64px)); z-index: 5; }
.citysearch input { height: 42px; background: rgba(11,16,38,.92); }
.citycard { position: absolute; z-index: 6; right: 10px; top: 10px; width: 340px; max-height: calc(100% - 20px); overflow: auto;
  background: rgba(20,27,60,.97); border: 1px solid var(--edge); border-radius: 14px; padding: 16px; box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.citycard h3 { font-size: 22px; padding-right: 30px; }
.citycard .where { color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.citycard .head { font-weight: 650; margin: 0 0 8px; }
.citycard p { margin: 0 0 10px; font-size: 14.5px; }
.citycard .x { position: absolute; right: 8px; top: 8px; }
.citycard ul { list-style: none; margin: 0 0 10px; padding: 0; }
.citycard li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--edge); font-size: 14px; }
.citycard li i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.citycard li b { font-weight: 650; }
.citycard li span { margin-left: auto; color: var(--muted); white-space: nowrap; }
.x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 10px 2px 16px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.ln { width: 26px; height: 0; border-top: 2.5px solid var(--ink); }
.ln.dash { border-top-style: dashed; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--night); outline: 1px solid var(--muted); }
.star { color: var(--gold); font-style: normal; }
.soon, .saved { margin-top: 14px; }
.soon h3, .saved h3 { font-size: 19px; margin-bottom: 6px; }
.soon p, .saved p { margin: 0; color: var(--muted); font-size: 14.5px; }
.saved .linkrow { display: flex; gap: 8px; margin: 10px 0; }
.saved .linkrow input { flex: 1; font-size: 14px; height: 42px; }
.saved .btn { height: 42px; }
.linklike { background: none; border: 0; color: var(--danger); padding: 0; font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5,8,22,.78); display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-box { background: var(--deep); border: 1px solid var(--edge); border-radius: 18px; padding: 16px; width: min(440px, 100%); max-height: 96vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 21px; }
.seg { display: flex; background: var(--night); border-radius: 10px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); }
.share-preview { display: flex; justify-content: center; }
.share-preview canvas { max-width: 100%; max-height: 54vh; border-radius: 10px; border: 1px solid var(--edge); }

.foot { max-width: 1180px; margin: 0 auto; padding: 18px 18px 40px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--edge); }
.foot p { margin: 0 0 6px; }

.birth-pin { color: var(--gold); font-size: 22px; line-height: 1; text-shadow: 0 0 6px #000, 0 0 2px #000; }
.maplibregl-popup-content { background: var(--deep); color: var(--ink); border: 1px solid var(--edge); border-radius: 12px; padding: 12px 14px; font: 14px/1.45 var(--sans); max-width: 260px; }
.maplibregl-popup-content b { font-family: var(--serif); font-size: 16px; }
.maplibregl-popup-tip { border-top-color: var(--deep) !important; border-bottom-color: var(--deep) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; }
.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 720px) {
  main { padding: 0 12px 30px; }
  .top { padding: 12px; }
  .row3 { grid-template-columns: 1fr 1.4fr 1.1fr; gap: 8px; }
  #map { height: 62vh; min-height: 380px; }
  .mapwrap { border-radius: 14px; }
  .citycard { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62%; border-radius: 16px 16px 0 0; border-width: 1px 0 0; }
  .result-head .actions { width: 100%; }
  .result-head .actions .btn { flex: 1; }
}

/* birth date and time entry */
.form.mdy #date-row { grid-template-columns: 1.5fr 1fr 1.2fr; }
.form.mdy #date-row [data-part=month] { order: -1; }
#date-row input, #f-time { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: .02em; height: 54px; }
#date-row select { height: 54px; font-size: 17px; }
#date-row input { text-align: center; }
.timerow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#f-time { width: 170px; flex: none; color-scheme: dark; }
.bad { border-color: var(--danger) !important; }
.echo { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(242,193,78,.1); border: 1px solid rgba(242,193,78,.35);
  color: var(--ink); font-size: 15px; }
.echo b { color: var(--gold); font-weight: 650; }
.echo.warn { background: rgba(255,138,122,.1); border-color: rgba(255,138,122,.45); }

/* reports */
.reports { margin-top: 14px; }
.reports h3 { font-size: 21px; margin-bottom: 6px; }
.reports > p { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; }
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.product { border: 1px solid var(--edge); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.product span { color: var(--muted); font-size: 13.5px; flex: 1; }
.product .btn { width: 100%; height: 44px; font-size: 15px; }
.partner { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--edge); }
.partner .timerow { margin: 10px 0 12px; }
.partner .grow { flex: 1; min-width: 180px; }
.partner .row3 input, .partner #p-time { height: 48px; font-size: 17px; text-align: center; }
.citycard .btn.full { width: 100%; margin: 4px 0 10px; height: 42px; }
@media (max-width: 720px) { .products { grid-template-columns: 1fr; } }
.partner.mdy .row3 { grid-template-columns: 1.5fr 1fr 1.2fr; }
.partner.mdy [data-part=month] { order: -1; }
