*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #08080f;
  overflow: hidden;
  font-family: Helvetica, Arial, sans-serif;
}

/* Galaxy background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('galaxy.jpeg') center center / cover no-repeat;
  opacity: 0.60;
  z-index: 0;
}

#p5-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* ── UI ── */
#ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

header {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 2rem 3rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: all;
}

.title-block h1 {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f0ead6;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-block p {
  font-size: 0.62rem;
  font-weight: 400;
  color: #f0ead6;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.25rem;
  opacity: 0.4;
}

.counter {
  text-align: right;
}

.counter .num {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 1.6rem;
  font-weight: 300;
  color: #f0ead6;
  line-height: 1;
}

.counter .label {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.3;
  margin-top: 0.15rem;
}

.bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 2rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: all;
}

#add-btn {
  background: transparent;
  border: 1px solid rgba(240,234,214,0.35);
  color: #f0ead6;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.7rem 1.8rem;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}

#add-btn:hover {
  border-color: #c4622d;
  background: rgba(196,98,45,0.1);
}

.manifesto-link {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.25;
  cursor: pointer;
  background: none;
  border: none;
  font-family: Helvetica, Arial, sans-serif;
  transition: opacity 0.25s;
  pointer-events: all;
}

.manifesto-link:hover { opacity: 0.65; }

/* ── TOOLTIP ── */
#pin-tooltip {
  position: fixed;
  background: rgba(8,8,15,0.88);
  border: 1px solid rgba(240,234,214,0.12);
  padding: 1.2rem 1.4rem;
  width: min(280px, 75vw);
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  transform: translate(-50%, calc(-100% - 14px));
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

#pin-tooltip.visible { opacity: 1; }

#pin-tooltip .t-city {
  font-size: 0.56rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #e8a0b0;
  margin-bottom: 0.45rem;
  font-weight: 400;
}

#pin-tooltip .t-text {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #f0ead6;
  opacity: 0.85;
}

/* ── OVERLAYS ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,8,15,0.88);
  backdrop-filter: blur(14px);
  z-index: 10;
  align-items: center;
  justify-content: center;
}

.overlay.open { display: flex; }

/* ── MODAL ── */
.modal {
  background: #0d0d1a;
  border: 1px solid rgba(240,234,214,0.1);
  padding: 3rem;
  width: min(520px, 92vw);
  position: relative;
}

.modal h2 {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f0ead6;
  margin-bottom: 0.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal .sub {
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.3;
  margin-bottom: 2rem;
}

.field-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.35;
  margin-bottom: 0.45rem;
}

.modal textarea {
  width: 100%;
  border: 1px solid rgba(240,234,214,0.12);
  background: rgba(240,234,214,0.04);
  color: #f0ead6;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  line-height: 1.75;
  padding: 0.9rem;
  resize: none;
  height: 125px;
  outline: none;
  transition: border-color 0.25s;
  margin-bottom: 1.5rem;
}

.modal textarea:focus { border-color: rgba(240,234,214,0.35); }
.modal textarea::placeholder { color: rgba(240,234,214,0.18); }

.coord-block { margin-bottom: 1.8rem; }

.coord-input-row { display: flex; gap: 0.7rem; }

.coord-input-row input {
  flex: 1;
  border: 1px solid rgba(240,234,214,0.12);
  background: rgba(240,234,214,0.04);
  color: #f0ead6;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.25s;
}

.coord-input-row input:focus { border-color: rgba(240,234,214,0.35); }
.coord-input-row input::placeholder { color: rgba(240,234,214,0.18); }

.coord-hint {
  margin-top: 0.5rem;
  font-size: 0.6rem;
  color: #f0ead6;
  opacity: 0.28;
  line-height: 1.55;
}

.coord-hint a { color: #e8a0b0; opacity: 1; text-decoration: none; }
.coord-hint a:hover { text-decoration: underline; }

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
}

.btn-cancel {
  background: none; border: none;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.25;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-cancel:hover { opacity: 0.6; }

.btn-submit {
  background: #c4622d;
  border: none;
  color: #f0ead6;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 0.75rem 1.8rem;
  cursor: pointer;
  transition: background 0.25s;
}

.btn-submit:hover { background: #a8521f; }

.modal-close {
  position: absolute;
  top: 1.1rem; right: 1.4rem;
  background: none; border: none;
  font-size: 1.1rem;
  color: #f0ead6;
  opacity: 0.2;
  cursor: pointer;
  font-family: Helvetica, Arial, sans-serif;
  transition: opacity 0.2s;
}

.modal-close:hover { opacity: 0.6; }

/* ── MANIFESTO ── */
.manifesto-inner {
  width: min(600px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 3.5rem;
  border: 1px solid rgba(240,234,214,0.08);
  background: #0d0d1a;
  position: relative;
}

.manifesto-inner h2 {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f0ead6;
  margin-bottom: 0.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.manifesto-inner .eyebrow {
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.28;
  margin-bottom: 2.5rem;
}

.manifesto-inner p {
  font-size: 0.78rem;
  line-height: 1.9;
  color: #f0ead6;
  opacity: 0.6;
  margin-bottom: 1.2rem;
  font-weight: 300;
}

.manifesto-inner p strong { font-weight: 700; opacity: 1; }

.right-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.hint {
  position: static;
  transform: none;
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #c4622d;
  opacity: 0.85;
  white-space: nowrap;
  pointer-events: none;
}

/* ── LANGUAGE INPUT ────────────────────────────────────────────────────────
   Sits above the textarea. Matches the coordinate input style. */
.modal input[type="text"]#t-lang {
  width: 100%;
  border: 1px solid rgba(240,234,214,0.12);
  background: rgba(240,234,214,0.04);
  color: #f0ead6;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.25s;
  margin-bottom: 1.5rem;
  display: block;
}

.modal input[type="text"]#t-lang:focus {
  border-color: rgba(240,234,214,0.35);
}

.modal input[type="text"]#t-lang::placeholder {
  color: rgba(240,234,214,0.18);
}

/* ── WORD COUNT ────────────────────────────────────────────────────────────
   Live feedback below the textarea. Changes colour based on validation state. */
.word-count-row {
  margin-top: -1rem;
  margin-bottom: 1.2rem;
}

.word-count-msg {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.3;
}

/* Under minimum — shown in terracotta */
.word-count-msg.warn {
  color: #c4622d;
  opacity: 0.8;
}

/* Over maximum — shown in pink warning */
.word-count-msg.error {
  color: #e8a0b0;
  opacity: 1;
}

/* Within valid range — subtle confirmation */
.word-count-msg.ok {
  color: #f0ead6;
  opacity: 0.55;
}

/* ── CONSENT CHECKBOX ──────────────────────────────────────────────────────
   The inline-link button opens the community guidelines panel without leaving the submission modal. */
.consent-block {
  margin-bottom: 1.5rem;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0ead6;
  opacity: 0.45;
  line-height: 1.6;
}

.consent-label input[type="checkbox"] {
  margin-top: 0.1rem;
  accent-color: #c4622d;
  flex-shrink: 0;
}

/* Inline text button that opens guidelines from inside the form */
.inline-link {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(232,160,176,0.5);
  color: #e8a0b0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.inline-link:hover { opacity: 0.75; }

/* ── HONEYPOT ──────────────────────────────────────────────────────────────
   Invisible to humans. Positioned off-screen so screen readers also skip it.
   Bots fill it; humans never see it. Checked in ui.js before submission. */
#hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  tabindex: -1;
}