:root {
  color-scheme: dark;
  --bg: #07080c;
  --bg-deep: #040506;
  --surface: rgba(10, 16, 22, 0.82);
  --surface-2: rgba(18, 32, 38, 0.92);
  --ink: #d8ecec;
  --muted: #8fb4b8;
  --faint: #6d8c90;
  --ember: #e23b32;
  --flame: #f07a3a;
  --cyan: #3ec8d0;
  --line: #2a4046;
  --talked: #3ec8d0;
  --danger: #e07a6a;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 18px;
  --max: 760px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(7, 8, 12, 0.55) 0%, rgba(7, 8, 12, 0.78) 42%, rgba(7, 8, 12, 0.92) 100%),
    url("../images/bg-cosmos.jpg");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}
a { color: var(--cyan); }
a:hover { color: var(--flame); }
:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 3px;
}

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; padding-bottom: 72px; }
.site-header, .site-footer { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 22px 0 10px;
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
.brand h1 {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.2;
  margin: 0;
}
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; }
.nav a, .btn, button.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn-primary, button.btn-primary {
  background: var(--ember);
  border-color: #b22a24;
  color: #fff5f2;
  font-weight: 650;
}
.btn-quiet { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.notice, .card, .tonight, .editor-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
  backdrop-filter: blur(10px);
}
.notice { border-color: #8a3a28; background: rgba(48, 18, 16, 0.82); }
.notice strong { color: var(--flame); }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--cyan);
  margin: 0 0 8px;
}
.tonight h2, .card h2, .section-title {
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0 0 10px;
}
.lede, .muted, .meta { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.88rem; margin: 0 0 12px; }
.questions { font-size: 1.05rem; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--faint);
  font-size: 0.75rem;
}
.tag.myth { color: var(--flame); border-color: #8a4a28; }
.tag.talked { color: var(--talked); border-color: #2a5a5e; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 8px 0 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 0.8rem; }
input, select, textarea {
  width: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.check input { width: auto; }

.list { display: flex; flex-direction: column; gap: 8px; }
.night-btn {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.night-btn[aria-current="true"] {
  border-color: var(--cyan);
  background: var(--surface-2);
}
.night-btn .when { display: block; color: var(--faint); font-size: 0.78rem; margin-bottom: 4px; }
.night-btn .name { display: block; font-weight: 650; }

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.heat-label {
  color: var(--faint);
  font-size: 0.68rem;
  text-align: center;
}
.heat-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 4px;
  background: #1a2226;
  color: transparent;
  cursor: pointer;
  padding: 0;
}
.heat-day.empty { background: transparent; cursor: default; }
.heat-day.planned { background: #2a4a50; }
.heat-day.talked { background: var(--ember); }
.heat-day.today { box-shadow: inset 0 0 0 2px var(--cyan); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--faint); font-size: 0.78rem; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-footer {
  color: var(--faint);
  font-size: 0.82rem;
  padding: 8px 0 28px;
}
.hidden { display: none !important; }
.boot-error { color: var(--danger); padding: 24px; }

body.embed {
  min-height: 0;
  background: var(--bg);
  background-attachment: scroll;
}
body.embed .site-header,
body.embed .site-footer,
body.embed .browse,
body.embed .map,
body.embed .hero,
body.embed .notice-extend,
body.embed .jump-bar { display: none !important; }
body.embed .wrap { width: min(640px, calc(100% - 20px)); padding: 10px 0; }
body.embed .tonight { margin: 10px 0; box-shadow: var(--shadow); }

.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.row-btns, .toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.item-row button { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }
.preview-date { color: var(--flame); font-size: 0.8rem; }

@media (min-width: 840px) {
  .controls { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .editor-layout { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

.hero {
  margin: 8px 0 4px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: cover;
  object-position: center 42%;
}
.hero-compact img { max-height: 190px; }
.hero figcaption { display: none; }
.panel-art {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: center 40%;
  border-radius: 12px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
}
.brand img { border: 1px solid var(--line); }

@media (prefers-reduced-motion: no-preference) {
  body { background-attachment: fixed; }
}
@media (max-width: 700px) {
  body { background-attachment: scroll; }
  .hero img { max-height: 220px; }
  .panel-art { height: 150px; }
}
