:root {
  --ink: #0b1a22;
  --panel: rgba(8, 26, 34, 0.86);
  --edge: #3f8f9c;
  --text: #dff6f0;
  --muted: #8fbcb8;
  --hot: #ffd166;
  --btn: #123644;
  --btn-edge: #255d6b;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0e3a46;
  color: var(--text);
  font-family: 'Silkscreen', ui-monospace, monospace;
}

#pond {
  position: fixed;
  inset: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
  transform-origin: 0 0;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 40% 35%, transparent 55%, rgba(4, 18, 26, 0.55));
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 248px;
  max-height: calc(100vh - 120px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 4px 4px 0 var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--btn-edge) transparent;
  transition: opacity 0.2s, transform 0.2s;
}

#hud.hidden { opacity: 0; transform: translateX(-12px); pointer-events: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h1 {
  flex: 1;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--hot);
  text-shadow: 2px 2px 0 var(--ink);
}

.hint, .keys {
  margin: 4px 0 0;
  font-size: 10px;
  color: var(--muted);
}

details {
  margin-top: 10px;
  border-top: 2px solid var(--btn-edge);
  padding-top: 8px;
}

summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--hot);
  list-style: none;
  user-select: none;
}

summary::-webkit-details-marker { display: none; }
summary::before { content: '▸ '; }
details[open] summary::before { content: '▾ '; }
summary:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }

.grid2, .grid3 {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.grid2 { grid-template-columns: repeat(2, 1fr); }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.foot { margin-top: 12px; }

button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 4px;
  font: inherit;
  font-size: 10px;
  color: var(--text);
  background: var(--btn);
  border: 2px solid var(--btn-edge);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}

button:hover { background: #1a4a5a; border-color: var(--edge); }
button:active { transform: translate(2px, 2px); box-shadow: none; }
button:focus-visible { outline: 2px solid var(--hot); outline-offset: 1px; }
button[aria-pressed="true"] { background: #5a4a14; border-color: var(--hot); color: var(--hot); }

button.wide { width: 100%; margin-top: 6px; }
button.icon { width: 26px; height: 26px; padding: 0; font-size: 14px; flex: none; }

#animals button { justify-content: flex-start; padding: 6px; }
#animals span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button i {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--c);
  box-shadow: 1px 1px 0 var(--ink);
}

button b {
  margin-left: auto;
  font-weight: 400;
  color: var(--muted);
}

.fields {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.fields label {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}

.fields select { grid-column: 2 / 4; }

select {
  min-width: 0;
  padding: 4px;
  font: inherit;
  font-size: 10px;
  color: var(--text);
  background: var(--btn);
  border: 2px solid var(--btn-edge);
  border-radius: 0;
}

select:focus-visible, input:focus-visible { outline: 2px solid var(--hot); outline-offset: 1px; }

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--hot);
}

output {
  min-width: 34px;
  text-align: right;
  color: var(--text);
}

.inspect {
  position: fixed;
  z-index: 5;
  display: grid;
  gap: 3px;
  min-width: 140px;
  max-width: 220px;
  padding: 8px 10px;
  font-size: 10px;
  color: var(--muted);
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 3px 3px 0 var(--ink);
  pointer-events: none;
}

.inspect .nm { font-size: 12px; font-weight: 400; color: var(--hot); }

.inspect .sp { color: var(--text); }

.inspect .sp:empty { display: none; }

.inspect .bar { height: 5px; background: var(--ink); border: 1px solid var(--btn-edge); }

.inspect .bar i { display: block; height: 100%; background: #7ed07a; }

.seed {
  margin: 4px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.seed b { font-weight: 400; color: var(--text); }

.about h2, .about h3 {
  margin: 10px 0 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
}

.about p, .about ul {
  margin: 4px 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.about ul {
  margin: 4px 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.about a { color: var(--text); }

.follow {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  font-size: 11px;
  color: var(--hot);
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 3px 3px 0 var(--ink);
  white-space: nowrap;
}

.follow[hidden] { display: none; }

.noscript {
  position: fixed;
  inset: 40% 16px auto;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text);
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.inspect .traits { color: #ffd166; }

.inspect .traits:empty { display: none; }

#show-hud {
  position: fixed;
  top: 16px;
  left: 16px;
}

.note {
  margin: 6px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}

.note:empty { display: none; }

.pond-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.pond-item { display: flex; gap: 4px; }

.pond-open {
  flex: 1;
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 5px 8px;
  text-align: left;
  box-shadow: none;
}

.pond-open b { margin: 0; font-weight: 400; color: var(--text); }
.pond-open span { font-size: 9px; color: var(--muted); }
.pond-item.current .pond-open { border-color: var(--hot); cursor: default; }
.pond-item.current .pond-open b { color: var(--hot); }
.pond-item .icon { flex: none; align-self: stretch; height: auto; }
#save-status { color: var(--muted); }

/* ---- pop-up panels (journal, census, sky) ---- */

.pop {
  position: absolute;
  bottom: calc(100% + 8px);
  z-index: 4;
  max-height: min(62vh, 560px);
  overflow-y: auto;
  padding: 10px 12px 12px;
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 4px 4px 0 var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--btn-edge) transparent;
}

.pop[hidden] { display: none; }

.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--hot);
}

.pop-head b { font-weight: 400; }
.caret { flex: none; color: var(--muted); transition: transform 0.15s; }
[aria-expanded="true"] > .caret { transform: rotate(180deg); }

/* ---- bottom bar: journal, animal dock, map ---- */

.bottom {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.bottom > * { pointer-events: auto; }
.log { position: relative; flex: 0 1 360px; min-width: 0; }
.dock { position: relative; flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.corner { flex: none; display: flex; align-items: flex-end; gap: 6px; }

/* Category colours shared by the journal line, list and filters. */
.dot { flex: none; width: 8px; height: 8px; background: var(--muted); box-shadow: 1px 1px 0 var(--ink); }
.cat-life .dot, .dot.cat-life { background: #7ed07a; }
.cat-rare .dot, .dot.cat-rare { background: #ffd166; }
.cat-hunt .dot, .dot.cat-hunt { background: #ef6f6c; }
.cat-come .dot, .dot.cat-come { background: #6fb7ef; }
.cat-sky .dot, .dot.cat-sky { background: #b49cf0; }
.cat-pond .dot, .dot.cat-pond { background: #dff6f0; }

.log-line {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  font-size: 10px;
  text-align: left;
  background: var(--panel);
  border-color: var(--edge);
}

.log-line time { flex: none; color: var(--muted); }
.log-line time:empty { display: none; }
.log-line .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-line.flash { animation: flash 1.4s ease-out; }
.log-line.flash.pri3 { animation: flash-hot 2.2s ease-out; }
.log-line .more { flex: none; font-size: 9px; color: var(--hot); }

@keyframes flash-hot {
  from { background: #5a4a14; border-color: var(--hot); }
}

@keyframes flash {
  from { background: #2c5a4a; border-color: var(--hot); }
}

.log-panel { left: 0; width: min(480px, calc(100vw - 24px)); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip { gap: 5px; padding: 3px 6px; font-size: 9px; box-shadow: none; }
.chip::before { content: ''; width: 6px; height: 6px; background: var(--muted); }
.chip.cat-all::before { display: none; }
.chip.cat-life::before { background: #7ed07a; }
.chip.cat-rare::before { background: #ffd166; }
.chip.cat-hunt::before { background: #ef6f6c; }
.chip.cat-come::before { background: #6fb7ef; }
.chip.cat-sky::before { background: #b49cf0; }

.journal {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text);
}

.journal li { display: grid; grid-template-columns: 8px 62px 1fr; gap: 8px; align-items: baseline; }
.journal li.empty { display: block; color: var(--muted); }
.journal .dot { align-self: center; }
.journal time { color: var(--muted); white-space: nowrap; }
.journal li.link { cursor: pointer; }
.journal li.link:hover span { color: var(--hot); }

.dock-bar {
  display: flex;
  align-items: stretch;
  gap: 6px;
  max-width: 100%;
  padding: 6px;
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 4px 4px 0 var(--ink);
}

.animals { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-width: 0; }

.ani {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  background: #0f2c38;
  box-shadow: none;
}

.ani img, .census img, .sky canvas { image-rendering: pixelated; }
.ani.none img { opacity: 0.45; }

.ani b {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 9px;
  font-weight: 400;
  color: var(--text);
  text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink);
}

.ani.none b { color: var(--muted); }

.census-btn {
  flex: none;
  flex-direction: column;
  gap: 2px;
  min-width: 44px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--hot);
}

.census-btn b { margin: 0; font-weight: 400; color: var(--hot); }
.census { left: 50%; transform: translateX(-50%); width: min(700px, calc(100vw - 24px)); }
.census h3 { margin: 14px 0 6px; font-size: 11px; font-weight: 400; color: var(--hot); }
.census h3 span { color: var(--muted); }

.census-rows { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }

.row-head {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  grid-template-areas: "ic nm ct" "ic facts facts";
  justify-items: start;
  align-items: center;
  gap: 2px 10px;
  padding: 4px 8px;
  text-align: left;
  box-shadow: none;
}

.row-head .ic { grid-area: ic; display: grid; place-items: center; width: 32px; height: 28px; }
.row-head .nm { grid-area: nm; margin: 0; font-weight: 400; color: var(--text); }
.row-head .ct { grid-area: ct; color: var(--hot); }
.row-head .facts { grid-area: facts; font-size: 9px; color: var(--muted); }
.row.open .row-head { border-color: var(--edge); background: #16404e; }

.members { list-style: none; margin: 4px 0 8px 40px; padding: 0; display: grid; gap: 3px; }
.members .more { font-size: 9px; color: var(--muted); }

.member {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 64px;
  grid-template-areas: "nm bar" "sub sub" "mood mood";
  justify-items: start;
  gap: 2px 8px;
  padding: 4px 8px;
  text-align: left;
  background: transparent;
  border-color: #1c4654;
  box-shadow: none;
}

.member b { grid-area: nm; margin: 0; font-weight: 400; color: var(--text); }
.member.rare b { color: var(--hot); }
.member .sub { grid-area: sub; font-size: 9px; color: var(--muted); }
.member .mood { grid-area: mood; font-size: 9px; color: var(--muted); }
.member .mini-bar { grid-area: bar; justify-self: stretch; }

.mini-bar { display: block; height: 5px; align-self: center; background: var(--ink); border: 1px solid var(--btn-edge); }
.mini-bar i { display: block; height: 100%; background: #7ed07a; box-shadow: none; }
.mini-bar i.low { background: #ef6f6c; }

.wild-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.wild-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-areas: "ic nm" "ic sub" "ic ct";
  align-items: center;
  gap: 1px 8px;
  padding: 6px;
  font-size: 10px;
  border: 2px solid var(--btn-edge);
}

.wild-card img { grid-area: ic; justify-self: center; }
.wild-card b { grid-area: nm; font-weight: 400; color: var(--text); }
.wild-card .sub { grid-area: sub; font-size: 9px; color: var(--muted); }
.wild-card .ct { grid-area: ct; font-size: 9px; color: var(--hot); }
.wild-card.gone { opacity: 0.55; }
.wild-card.gone .ct { color: var(--muted); }

/* Zoom sits in a column to the left of the minimap: + on top, the level, − below. */
.corner .zoom { display: flex; flex-direction: column; gap: 4px; }
.corner .zoom button { width: 34px; height: 32px; padding: 0; }
.zoom #zoom-level { font-size: 10px; color: var(--hot); }

.minimap {
  width: 192px;
  height: 108px;
  image-rendering: pixelated;
  border: 2px solid var(--edge);
  box-shadow: 3px 3px 0 var(--ink);
  background: var(--ink);
  cursor: pointer;
  touch-action: none;
}

/* ---- sky tracker ---- */

.sky { position: fixed; top: 16px; right: 16px; }

.sky-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  background: var(--panel);
  border-color: var(--edge);
}

.sky-btn canvas { width: 32px; height: 32px; }
.sky-panel { top: calc(100% + 8px); bottom: auto; right: 0; width: 280px; }

.sky-head { display: flex; align-items: center; gap: 10px; }
.sky-head canvas { flex: none; width: 48px; height: 48px; }
.sky-head div, .moon-row div { display: grid; gap: 2px; font-size: 10px; color: var(--muted); }
.sky-head b { font-size: 13px; font-weight: 400; color: var(--hot); }

.daybar {
  position: relative;
  height: 8px;
  margin: 12px 0 4px;
  border: 1px solid var(--btn-edge);
  background: linear-gradient(90deg, #1a2346 0%, #1a2346 19%, #b0707a 26%, #e8b88a 31%, #8fd0e8 40%, #8fd0e8 62%, #f0a060 70%, #9a5a8a 77%, #1a2346 84%, #1a2346 100%);
}

.daybar i {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 12px;
  margin-left: -1px;
  background: var(--hot);
  box-shadow: 1px 1px 0 var(--ink);
}

.moon-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.moon-row canvas { flex: none; width: 32px; height: 32px; }
.moon-row b { font-size: 11px; font-weight: 400; color: var(--text); }

.tide-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 10px;
  color: var(--muted);
}

.tidebar { height: 8px; background: var(--ink); border: 1px solid var(--btn-edge); }
.tidebar i { display: block; height: 100%; background: linear-gradient(90deg, #2f7fae, #7fd0e0); transition: width 0.4s; }
.sky-panel .fields { margin-top: 12px; padding-top: 10px; border-top: 2px solid var(--btn-edge); }

@media (max-width: 760px) {
  #hud { width: auto; right: 76px; max-height: 55vh; }
  .keys { display: none; }
  .bottom { flex-wrap: wrap; gap: 8px; }
  .log { order: 1; flex: 1 1 100%; }
  .dock { order: 2; flex: 1 1 0; }
  .corner { order: 3; align-self: flex-end; }
  .minimap { display: none; }
  .animals { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .dock-bar { width: 100%; }
  .ani { flex: none; width: 42px; height: 42px; }
  .census { left: 0; transform: none; width: calc(100vw - 24px); }
  .follow { top: auto; bottom: 150px; }
  .sky { top: 12px; right: 12px; }
}
