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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cbd3e0;
  -webkit-font-smoothing: antialiased;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#view:active { cursor: grabbing; }
body.tool-bless #view, body.tool-mutate #view,
body.tool-breed #view, body.tool-smite #view { cursor: crosshair; }

/* Panels. One background, one border, one radius, everywhere. */
#top, #kinds, #tree, #card, #tools, #status, #hint, #panels, #viewpad {
  background: rgba(8, 10, 16, 0.78);
  border: 1px solid rgba(140, 160, 200, 0.18);
  border-radius: 4px;
  backdrop-filter: blur(3px);
}

#top {
  position: fixed;
  top: 10px;
  left: 10px;
  padding: 5px 10px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  letter-spacing: 0.08em;
}

#top b { color: #f0e4c8; font-weight: 600; }
#clock { color: #8d9ab4; }

#panels {
  position: fixed;
  top: 46px;
  left: 10px;
  display: flex;
  gap: 4px;
  padding: 4px;
}

#kinds, #tree {
  position: fixed;
  top: 82px;
  left: 10px;
  width: 216px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding: 7px 8px;
}

/* The descent needs room across as well as down: a lineage seven splits deep
   is seven columns wide, and squeezed into the species list's width it is an
   indented list again, which is the thing it is not. */
#tree {
  width: auto;
  min-width: 216px;
  max-width: min(46vw, 520px);
  overflow: auto;
}

#tree svg { display: block; overflow: visible; }
#tree .edges path {
  fill: none;
  stroke: rgba(150, 175, 220, 0.42);
  stroke-width: 1.2;
}
#tree .edges path.x {
  stroke: rgba(150, 220, 190, 0.6);
  stroke-dasharray: 3 3;
}
#tree g.n { cursor: pointer; }
#tree g.n circle { stroke-width: 1.4; }
#tree g.n text { fill: #dfe6f2; font-size: 11px; }
#tree g.n .ct { fill: #7c88a2; }
#tree g.n.gone circle { stroke-opacity: 0.45; }
#tree g.n.gone text { fill: #67718a; }
#tree g.n:hover text { fill: #f0e4c8; }
#tree g.n:hover circle { stroke: #f0e4c8; }
#tree .none { color: #67718a; }
#tree h2 span { color: #67718a; letter-spacing: 0; text-transform: none; }

#kinds h2, #tree h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7c88a2;
  margin-bottom: 5px;
}

#kindlist { list-style: none; }

#kindlist li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
}

#kindlist li:hover { background: rgba(150, 175, 220, 0.12); }
#kindlist li.on { background: rgba(150, 175, 220, 0.2); }
#kindlist .swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  flex: none;
}
#kindlist .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#kindlist .ct { color: #7c88a2; }
#kindlist .blessed { color: #f0d48a; }
#kindlist .gone { color: #67718a; }
.swatch.new {
  background: repeating-linear-gradient(45deg, #6f7b93 0 2px, transparent 2px 4px);
}

#card {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 268px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 9px 10px 10px;
}

#card h4 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7c88a2;
  margin: 9px 0 4px;
  border-top: 1px solid rgba(140, 160, 200, 0.14);
  padding-top: 7px;
}

.gifts { list-style: none; }
.gifts li { color: #8d9ab4; margin-bottom: 2px; }
.gifts b { color: #dfe6f2; font-weight: 600; }

.nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr auto);
  gap: 1px 6px;
}
.nums span { color: #7c88a2; }
.nums b { color: #dfe6f2; font-weight: 600; }

.traits {
  display: grid;
  grid-template-columns: 54px 1fr 54px 1fr;
  gap: 2px 6px;
  align-items: center;
}
.traits span { color: #7c88a2; font-size: 11px; }
.traits span.far { color: #e2d7b4; }
.tbar { position: relative; height: 4px; background: rgba(120, 140, 175, 0.18); border-radius: 2px; }
.tbar i { display: block; height: 100%; background: #8fa6cc; border-radius: 2px; }
.tbar.far i { background: #e2c98a; }
/* Where the base animal sat. Everything to either side of it is the world's
   doing rather than yours. */
.tbar u {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 8px;
  background: rgba(230, 236, 246, 0.5);
}

#card h3 {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #f0e4c8;
  display: flex;
  align-items: center;
  gap: 7px;
}

#card h3 .swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.55);
}

#card .sub { color: #7c88a2; margin-bottom: 7px; }

.bar {
  height: 5px;
  background: rgba(120, 140, 175, 0.2);
  border-radius: 2px;
  margin: 2px 0 5px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; }

.rows { display: grid; grid-template-columns: 52px 1fr; gap: 0 8px; align-items: center; }
.rows span { color: #7c88a2; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0; }
.chip {
  padding: 1px 6px;
  border-radius: 9px;
  background: rgba(150, 175, 220, 0.14);
  border: 1px solid rgba(150, 175, 220, 0.2);
  color: #b9c4d8;
  font-size: 11px;
}

#card .acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
#card .grafts { display: none; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
#card.grafting .grafts { display: flex; }

button {
  font: inherit;
  color: #cbd3e0;
  background: rgba(150, 175, 220, 0.12);
  border: 1px solid rgba(150, 175, 220, 0.24);
  border-radius: 3px;
  padding: 3px 8px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
button:hover { background: rgba(150, 175, 220, 0.24); }
button.on { background: #dfe6f2; color: #10131b; border-color: #dfe6f2; }
button.warn:hover { background: rgba(224, 96, 88, 0.34); border-color: rgba(224, 96, 88, 0.5); }
button.good:hover { background: rgba(232, 200, 120, 0.28); border-color: rgba(232, 200, 120, 0.5); }

#tools {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 5px;
  max-width: calc(100vw - 20px);
  flex-wrap: wrap;
  justify-content: center;
}

#tools .group { display: flex; gap: 4px; }
#tools .group + .group { border-left: 1px solid rgba(140, 160, 200, 0.2); padding-left: 10px; }

#tools #brush .tag {
  align-self: center;
  min-width: 48px;
  text-align: center;
  color: #7c8aa4;
  font-size: 10px;
  letter-spacing: 0.4px;
}
#tools #brush button { min-width: 22px; text-align: center; }

body.brushing #view { cursor: cell; }

/* Somewhere to press. The wheel and the keyboard were the only way to move
   around a world sixteen thousand pixels wide, which is fine if you already
   know they work and no use at all if you have just opened the page. */
#viewpad {
  position: fixed;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(3, 30px);
  gap: 3px;
  padding: 5px;
}

#viewpad button {
  padding: 3px 0;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  user-select: none;
  touch-action: none;
}

#viewpad button[data-view="wide"] { font-size: 10px; letter-spacing: 0; }
#viewpad .tag {
  grid-column: span 1;
  color: #5f6a80;
  font-size: 10px;
  text-align: center;
  align-self: center;
}

#hint {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  color: #e2d7b4;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
#hint.show { opacity: 1; }

/* In the top bar rather than in a corner of its own: the tools take two rows
   on a narrow window and anything else along the bottom ends up underneath
   them. */
#status {
  color: #5f6a80;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

/* The ring around whatever is selected. Drawn in the page rather than in the
   world because it is a thing the player sees, not a thing the world has. */
.ring {
  position: fixed;
  border: 1.5px solid rgba(240, 228, 200, 0.9);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(240, 228, 200, 0.35);
  animation: pulse 1.6s ease-in-out infinite;
}
.ring.mate { border-color: rgba(150, 220, 190, 0.9); box-shadow: 0 0 10px rgba(150, 220, 190, 0.35); }

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
