/* The same colours as sprites.js. Change both together. */
:root {
  --px: 2; /* set by game.js: 2 on phones, 3 when there is room */
  --u: calc(var(--px) * 1px); /* one pixel in the scenes */
  --U: calc(var(--px) * 2px); /* a double pixel, for borders and the logo */
  --ink: #1a1626;
  --night: #262245;
  --night-2: #3b3870;
  --dusk: #5c63a6;
  --steel: #a9b6dc;
  --beam: #bdf2cf;
  --cream: #f3e6c4;
  --white: #fffaf0;
  --green: #5dbb63;
  --green-dark: #2a7a5e;
  --yellow: #f2c94c;
  --orange: #ee8a3a;
  --red: #d6453d;
  font-size: calc(var(--px) * 8px);
}

/* Jersey 10, kept with the game so nothing is fetched from anyone else. Its licence is fonts/OFL.txt. */
@font-face {
  font-family: 'Jersey 10';
  src: url(fonts/jersey-10-latin.woff2) format('woff2');
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Jersey 10';
  src: url(fonts/jersey-10-latin-ext.woff2) format('woff2');
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--night);
  color: var(--cream);
  /* Jersey 10 is drawn on a 10px grid, so every size here is a multiple of 10px. It has one weight. */
  font-family: 'Jersey 10', ui-monospace, monospace;
  font-size: 1.25rem;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.1;
  -webkit-font-smoothing: none;
}

main {
  width: calc(160 * var(--u));
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
}

canvas {
  display: block;
  image-rendering: pixelated;
}
h1, h2, dt, dd, button, summary { font-weight: 400; }
p { margin: 0 0 0.5rem; }
a { color: var(--beam); }
:focus-visible {
  outline: var(--U) solid var(--beam);
  outline-offset: var(--U);
}
.sr { /* read out, not shown */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums; }

button {
  padding: 0.5rem 0.875rem;
  background: var(--yellow);
  color: var(--ink);
  border: var(--U) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--U) var(--U) 0 var(--ink);
  font: inherit;
  cursor: pointer;
}
button:active {
  transform: translate(var(--U), var(--U));
  box-shadow: none;
}
button.quiet { background: var(--steel); }
button.big {
  display: block;
  width: calc(100% - var(--U));
  padding: 0.375rem 0.5rem 0.5rem;
  font-size: 2.5rem;
  line-height: 1;
}

/* The five-colour code for a photo: the number is the look it was named on, so colour is never the only clue. */
.pips {
  display: flex;
  gap: var(--U);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pips li,
.pip {
  display: grid;
  place-items: center;
  flex: 1;
  height: 1.5rem;
  background: var(--night-2);
  color: var(--steel);
  border: var(--U) solid var(--ink);
  line-height: 1;
}
.pips li[aria-current] { border-color: var(--cream); }
.look1 { background: var(--green) !important; color: var(--ink) !important; }
.look2 { background: var(--yellow) !important; color: var(--ink) !important; }
.look3 { background: var(--orange) !important; color: var(--ink) !important; }
.look0 { background: var(--red) !important; color: var(--white) !important; }

.stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.25rem;
  margin: 1rem 0;
}
.stats dd {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1;
}

#loading,
#trouble {
  margin-top: 2rem;
  text-align: center;
}

/* ---- Title screen */
#title { text-align: center; }
#title h1 { margin: 0.75rem 0 0.5rem; }
.logo {
  width: calc(51 * var(--U));
  height: calc(16 * var(--U));
  margin: 0 auto;
}
.stage {
  width: calc(160 * var(--u));
  height: calc(120 * var(--u));
}
#title-day { margin-top: 0.5rem; }
#title-next { margin-top: 1rem; }
#title .stats {
  padding: 0.5rem 0;
  border-top: var(--u) solid var(--dusk);
  border-bottom: var(--u) solid var(--dusk);
}
#title dt { color: var(--steel); }
details { text-align: left; margin: 0.75rem 0; }
summary { cursor: pointer; }
#how-text p { margin: 0.5rem 0; }
.switches {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--U) * 2);
  margin: 1rem 0;
}

/* ---- Categories mode */
#cat-title,
#ideas-title {
  margin: 0.75rem 0 0.5rem;
  font-size: 2.5rem;
  line-height: 1;
}
#cat-list {
  display: grid;
  gap: calc(var(--U) * 3);
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}
.cat {
  display: block;
  width: calc(100% - var(--U));
  background: var(--cream);
  text-align: left;
  font-size: 2.5rem;
  line-height: 1;
}
.cat small:last-child { color: var(--green-dark); }
.cat small {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  line-height: 1.1;
}
button.wide {
  display: block;
  width: calc(100% - var(--U));
  margin-top: calc(var(--U) * 3);
}

/* ---- Suggestion box. A word cloud on a ship's screen: the more backers, the bigger the letters.
   game.js measures each idea and packs them round the most-backed one. */
#cloud {
  position: relative;
  margin: 0.75rem 0;
  padding: 0.5rem 0.625rem;
  background: var(--ink);
  color: var(--beam);
  border: var(--U) solid var(--ink);
  box-shadow: inset 0 0 0 var(--u) var(--green-dark);
  list-style: none;
  text-align: center;
}
#cloud li {
  position: absolute;
  max-width: calc(100% - 1.25rem);
}
#cloud.empty li { position: static; }
#cloud button {
  display: block;
  padding: 0;
  background: none;
  color: var(--steel);
  border: 0;
  box-shadow: none;
  line-height: 1;
  overflow-wrap: anywhere;
}
#cloud button:active { transform: none; }
/* Every size is a whole number of the font's own pixels. */
#cloud .size2 { color: var(--beam); font-size: 1.875rem; }
#cloud .size3 { color: var(--cream); font-size: 2.5rem; }
#cloud .size4 { color: var(--green); font-size: 3.125rem; }
#cloud .size5 { color: var(--yellow); font-size: 3.75rem; }
#cloud .tall { writing-mode: vertical-rl; }
/* The number of backers, so size is never the only clue. A line under the ones you backed. */
#cloud small { color: var(--orange); font-size: 1.25rem; }
#cloud [aria-pressed='true'] {
  text-decoration: underline;
  text-decoration-thickness: var(--U);
  text-underline-offset: var(--U);
}
#ideas-note { min-height: 1.1em; margin: 0.75rem 0; }

/* ---- Farm scenes */
#caption {
  min-height: 2.2em;
  margin: 0.75rem 0;
}

/* ---- Inside the saucer. The cockpit, then the answer console or the Next button, fill the first
   screenful of a phone and no more, so nothing a player has to press needs scrolling to.
   What there is to read sits underneath. */
#play { margin-top: -0.5rem; }
/* Photo number, stack and score, written along the cockpit ceiling. */
#hud {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  height: calc(9 * var(--u));
  padding: 0 calc(2 * var(--u));
  background: var(--night);
  border-bottom: var(--u) solid var(--ink);
  line-height: calc(8 * var(--u));
  white-space: nowrap;
}
#hud p { margin: 0; }
#stack { color: var(--yellow); }
#pips { margin-top: 0.5rem; }

#cockpit {
  position: relative;
  width: calc(160 * var(--u));
  height: calc(222 * var(--u));
}
#room,
#hands {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#hands {
  z-index: 2;
  pointer-events: none;
}
#hands.away { visibility: hidden; }
#burst {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The photo card. Its place and size match CARD in scenes.js. */
#card {
  position: absolute;
  z-index: 1;
  left: calc(12 * var(--u));
  top: calc(66 * var(--u));
  width: calc(136 * var(--u));
  height: calc(146 * var(--u));
  margin: 0;
  padding: calc(3 * var(--u)) calc(3 * var(--u)) 0;
  background: var(--cream);
  border: var(--u) solid var(--ink);
}
.glass {
  position: relative;
  width: calc(128 * var(--u));
  height: calc(128 * var(--u));
  overflow: hidden;
  background: var(--ink);
  border: var(--u) solid var(--ink);
}
#photo {
  position: absolute;
  max-width: none;
  transition: left 0.5s steps(6), top 0.5s steps(6), width 0.5s steps(6), height 0.5s steps(6);
}
#back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* A right answer: the card's frame goes green and flashes, and the points land across the photo. */
#card.right {
  box-shadow: 0 0 0 calc(2 * var(--u)) var(--green);
  animation: right 0.7s steps(1);
}
@keyframes right {
  0%, 40%, 80% { box-shadow: 0 0 0 calc(4 * var(--u)) var(--beam); }
  20%, 60% { box-shadow: 0 0 0 calc(2 * var(--u)) var(--green); }
}
#cheer {
  position: absolute;
  z-index: 1;
  inset: calc(44 * var(--u)) 0 auto;
  margin: 0;
  padding: 0.25rem 0 0.375rem;
  background: var(--green);
  color: var(--ink);
  border-top: var(--U) solid var(--ink);
  border-bottom: var(--U) solid var(--ink);
  font-size: 3.75rem;
  line-height: 1;
  text-align: center;
  animation: stamp 0.24s steps(2);
}
/* Written on the card: the alien's label for the photo, and the mothership's difficulty rating. */
#card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  padding-top: calc(2 * var(--u));
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
}
#kind {
  overflow: hidden;
  text-overflow: clip;
}
#stars {
  display: flex;
  flex: none;
  gap: var(--u);
}
#stars i {
  width: calc(4 * var(--u));
  height: calc(6 * var(--u));
  border: var(--u) solid var(--ink);
}
#stars i.on { background: var(--ink); }

/* The time left on this look: a bar along the cockpit floor, under the card. */
#pot-bar {
  position: absolute;
  z-index: 3;
  left: calc(12 * var(--u));
  right: calc(12 * var(--u));
  bottom: 0;
  height: calc(6 * var(--u));
  background: var(--ink);
  border: var(--u) solid var(--ink);
}
#pot-fill {
  display: block;
  height: 100%;
  background: var(--yellow);
}
#pot-bar.low #pot-fill { background: var(--red); }
/* The look and what it is worth right now, on the console's top row. */
#pot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  white-space: nowrap;
}
#pot p { margin: 0; }

/* The ship's translator: what the alien says, printed on a screen. */
#says-box {
  min-height: 3.7em;
  margin: 0.25rem 0;
  padding: 0.375rem 0.625rem 0.5rem;
  background: var(--ink);
  color: var(--beam);
  border: var(--U) solid var(--ink);
  box-shadow: inset 0 0 0 var(--u) var(--green-dark);
}
#says { margin: 0; }
#clues {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--white);
}
#clues li { margin-top: 0.375rem; }
#clues .lead { color: var(--yellow); }

/* The answer console: part of the ship, like the panels in the scene above. */
#guess,
#idea-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.375rem 0.5rem;
  padding: 0.375rem 0.5rem 0.5rem;
  background: var(--dusk);
  border: var(--U) solid var(--ink);
  box-shadow: inset var(--u) var(--u) 0 var(--steel), inset calc(var(--u) * -1) calc(var(--u) * -1) 0 var(--night-2);
}
#idea-form label { grid-column: 1 / -1; }
/* Matching names, in one row above the answer box. They lie over the look and its worth, so the row never changes height. */
#answers {
  position: absolute;
  inset: 0;
  display: flex;
  gap: var(--U);
  background: var(--dusk);
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}
#answers:empty { display: none; }
#answers li {
  flex: none;
  display: grid;
  place-items: center;
  padding: 0 0.5rem;
  background: var(--white);
  color: var(--ink);
  border: var(--U) solid var(--ink);
  white-space: nowrap;
  cursor: pointer;
}
#answers li.on,
#answers li:hover { background: var(--yellow); }
#guess input,
#idea-form input {
  min-width: 0;
  padding: 0.5rem;
  background: var(--white);
  color: var(--ink);
  border: var(--U) solid var(--ink);
  border-radius: 0;
  font: inherit;
}
#noidea { padding: 0.125rem 0.5rem 0.25rem; }
#guess input::placeholder,
#idea-form input::placeholder { color: var(--dusk); }

/* The answer card and the end-of-day report share the same paper. */
#reveal,
#file,
#report {
  padding: 0.75rem;
  background: var(--cream);
  color: var(--ink);
  border: var(--U) solid var(--ink);
}
#file a,
#report a { color: inherit; }
#stamp {
  display: inline-block;
  margin: 0;
  padding: 0.125rem 0.5rem;
  border: var(--U) solid var(--ink);
  animation: stamp 0.24s steps(2);
}
@keyframes stamp {
  from { transform: scale(2); }
}
#points {
  display: inline;
  margin-left: 0.5rem;
  font-size: 2.5rem;
  line-height: 1;
  vertical-align: middle;
}
#name {
  margin: 0.5rem 0 0;
  font-size: 2.5rem;
  line-height: 1;
}
#maths { color: var(--green-dark); }
.lead { color: var(--green-dark); }
#what { margin-top: 0.5rem; }
#learn,
#r-rounds ul {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}
#learn li,
#r-rounds ul li { /* a square pixel bullet */
  position: relative;
  margin-bottom: 0.25rem;
  padding-left: 0.875rem;
}
#learn li::before,
#r-rounds ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4em;
  width: var(--U);
  height: var(--U);
  background: var(--ink);
}
#credit { overflow-wrap: anywhere; }

/* ---- Field report */
#report h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}
.result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
#r-alien {
  flex: none;
  width: calc(44 * var(--U));
  height: calc(34 * var(--U));
}
#r-score {
  margin: 0;
  font-size: 3.75rem;
  line-height: 1;
}
#r-rank { margin: 0; }
#r-ending { margin: 0.75rem 0 0; }
#r-standing { margin: 0.5rem 0 0; color: var(--green-dark); }
#r-rounds {
  margin: 0.75rem 0;
  padding: 0;
  list-style: none;
  border-top: var(--u) solid var(--ink);
}
#r-rounds > li { border-bottom: var(--u) solid var(--ink); }
#r-rounds summary {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  list-style: none;
}
#r-rounds summary::-webkit-details-marker { display: none; }
#r-rounds details { margin: 0; }
#r-rounds details > div { padding: 0.25rem 0 0.25rem 2rem; }
.hint { margin: 0.75rem 0 0; color: var(--green-dark); }
.hint + #r-rounds { margin-top: 0.25rem; }
#r-rounds .pip { flex: none; }
#r-rounds small {
  display: block;
  font-size: inherit;
  color: var(--green-dark);
}
#report .stats {
  grid-auto-flow: row;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.25rem;
}
#share { margin-top: 0.75rem; }
#r-note:empty { display: none; }
#r-note { margin: 0.75rem 0 0; }
.copy {
  width: 100%;
  padding: 0.5rem;
  background: var(--white);
  color: var(--ink);
  border: var(--U) solid var(--ink);
  border-radius: 0;
  font: inherit;
}

/* ---- Photo credits page */
.credits h1 { font-size: 2.5rem; margin: 0.5rem 0; }
.credits h2 { font-size: 1.25rem; margin: 1.5rem 0 0.25rem; }
.credits ul { margin: 0; padding-left: 1.25rem; }
.credits li { margin-bottom: 0.25rem; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  #photo { transition: none; }
  #stamp, #cheer, #card.right { animation: none; }
}
