/* The same colours as art.js. Change both together. */
:root {
  --px: 2; /* set by game.js: the biggest whole number at which the play screen fits */
  --u: calc(var(--px) * 1px); /* one pixel in the scenes */
  --U: calc(var(--px) * 2px); /* a double pixel, for the title */
  --ink: #1a1626;
  --cream: #f3e6c4;
  --paper-shade: #d9cfb4;
  --white: #fffaf0;
  --steel: #a9b6dc;
  --yellow: #f2c94c;
  --wood: #6b4329;
  --wood-light: #96673e;
  --wood-dark: #3b2418;
  --board: #2f5d50;
  --board-rubbed: #244a42;
  --green: #5dbb63;
  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; }

/* One size of letter, ten scene pixels tall, and twice that for the things that matter. */
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 1.25rem/1.2 'Jersey 10', monospace;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
p, h1, h2, h3, ol, ul { margin: 0; padding: 0; font-weight: normal; font-size: inherit; }
ol, ul { list-style: none; }

#loading, #trouble { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: calc(8 * var(--u)); }

/* Each screen is a scene the size of the window, with the things to press laid over it where they belong in it.
   game.js puts each of those boxes in its place, measured in scene pixels. */
section { position: fixed; inset: 0; overflow: hidden; }
#home { background: var(--green); }
#play { background: var(--wood-light); }
#front { background: var(--wood); }
canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
#title, #menu, #say, #board, #tray, #keys, #note, #chalked { position: absolute; }

button, textarea { font: inherit; color: inherit; margin: 0; }
button {
  touch-action: manipulation;
  cursor: pointer;
  background: var(--cream);
  color: var(--ink);
  border: var(--u) solid var(--ink);
  border-bottom-width: calc(3 * var(--u));
  padding: 0 calc(3 * var(--u));
  min-height: calc(18 * var(--u));
}
button.main { background: var(--yellow); }
button:active { border-bottom-width: var(--u); margin-top: calc(2 * var(--u)); min-height: calc(16 * var(--u)); }
button:disabled { background: var(--paper-shade); color: var(--wood-light); cursor: default; }
button:focus-visible, textarea:focus-visible { outline: var(--u) solid var(--white); outline-offset: var(--u); }
button.plain { background: none; border: 0; color: var(--white); min-height: calc(12 * var(--u)); text-shadow: var(--u) var(--u) 0 var(--ink); }
.pair { display: flex; gap: calc(3 * var(--u)); }
.pair > * { flex: 1; }
.unseen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Home: the name over the sky, the buttons over the lawn. */
#title { text-align: center; color: var(--white); }
h1 { font-size: 5rem; line-height: calc(34 * var(--u)); color: var(--cream); text-shadow: var(--U) var(--U) 0 var(--ink); text-transform: uppercase; }
#day, #stats { text-shadow: var(--u) var(--u) 0 var(--ink); color: var(--white); }
#menu { display: flex; flex-direction: column; gap: calc(3 * var(--u)); text-align: center; }
#menu button.main { min-height: calc(22 * var(--u)); }

/* Play: the professor's words on the big board, the sum on the player's own, the tiles on the desk. */
#say { color: var(--cream); overflow: hidden; }
#round { color: var(--steel); }
#board { display: flex; flex-direction: column; justify-content: center; padding: calc(4 * var(--u)) calc(5 * var(--u)) calc(3 * var(--u)); }
#sum { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; line-height: 1; min-height: 0; }
#sum.long { font-size: 1.25rem; }
#sum button { background: none; border: 0; color: var(--cream); padding: 0 var(--u); min-height: calc(26 * var(--u)); min-width: calc(9 * var(--u)); }
#sum button:active { margin: 0; color: var(--yellow); }
#sum button:disabled { color: var(--cream); }
.caret { width: var(--u); height: calc(20 * var(--u)); background: var(--yellow); flex: none; }
.caret.off { background: none; }
#typed { flex: 1; width: 100%; min-height: 0; background: none; border: 0; resize: none; color: var(--cream); caret-color: var(--yellow); font-size: 2.5rem; line-height: 1; text-align: center; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; scrollbar-width: thin; scrollbar-color: var(--cream) var(--board-rubbed); }
#typed.long { font-size: 1.25rem; text-align: left; }
#worth { color: var(--steel); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; min-height: calc(12 * var(--u)); }

#tray { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: calc(4 * var(--u)) calc(2 * var(--u)); }
#tray button { width: calc(22 * var(--u)); height: calc(20 * var(--u)); min-height: 0; padding: 0; font-size: 2.5rem; line-height: calc(14 * var(--u)); background: var(--board); color: var(--cream); border: calc(2 * var(--u)) solid var(--wood); border-bottom-color: var(--wood-dark); border-right-color: var(--wood-dark); }
#tray button:active { margin: 0; background: var(--board-rubbed); }
#tray button.used { visibility: hidden; }

#keys { display: flex; flex-wrap: wrap; gap: calc(2 * var(--u)); align-content: flex-start; }
#keys button { height: calc(20 * var(--u)); min-height: 0; }
#keys button:active { margin-top: 0; height: calc(18 * var(--u)); align-self: flex-end; }
#left, #right { width: calc(22 * var(--u)); display: grid; place-items: center; padding: 0; }
#left canvas, #right canvas { position: static; }
#wipe { flex: 1; }
#blank, #quit { flex: 2; }
#show { flex-basis: 100%; }

/* The marked paper that comes back after a round. */
#note { background: var(--cream); color: var(--ink); border: var(--u) solid var(--ink); border-bottom-width: calc(2 * var(--u)); border-right-width: calc(2 * var(--u)); padding: calc(3 * var(--u)) calc(4 * var(--u)); display: flex; flex-direction: column; gap: var(--u); }
#points { color: var(--wood); }
#note button { margin-top: auto; }

/* The big board close up: the report, and the rules. */
#chalked { overflow-y: auto; text-align: center; padding: 0 calc(2 * var(--u)); scrollbar-width: thin; scrollbar-color: var(--cream) var(--board-rubbed); }
#chalked > div { display: flex; flex-direction: column; gap: calc(3 * var(--u)); }
#sum-total { font-size: 5rem; line-height: calc(32 * var(--u)); color: var(--yellow); }
#out-of, #running, #tomorrow, #shared { color: var(--steel); }
h2 { font-size: 2.5rem; line-height: 1; }
/* His grade, in red on the board, and a star for each round under it. hall.js draws both. */
#grade { position: static; align-self: center; width: calc(92 * var(--u)); height: calc(64 * var(--u)); }
#stars { position: static; align-self: center; width: calc(166 * var(--u)); height: calc(22 * var(--u)); }
#rounds canvas { position: static; float: right; width: calc(22 * var(--u)); height: calc(22 * var(--u)); margin-left: calc(3 * var(--u)); }
#gold { left: auto; right: calc(4 * var(--u)); top: calc(3 * var(--u)); width: calc(22 * var(--u)); height: calc(22 * var(--u)); }
#gold + p { padding-right: calc(26 * var(--u)); }
#share-text { width: 100%; background: var(--board-rubbed); border: var(--u) solid var(--cream); user-select: text; -webkit-user-select: text; resize: none; }
#graph { display: flex; flex-direction: column; align-items: center; }
#curve { position: static; width: calc(172 * var(--u)); height: calc(64 * var(--u)); }
.ends { width: calc(172 * var(--u)); display: flex; justify-content: space-between; color: var(--steel); }
#rounds, #how-list { text-align: left; display: flex; flex-direction: column; gap: calc(4 * var(--u)); padding-bottom: calc(6 * var(--u)); }
#rounds li { border-top: var(--u) solid var(--board-rubbed); padding-top: calc(3 * var(--u)); overflow-wrap: anywhere; }
#rounds .wrote, #how-list h3 { color: var(--yellow); }
#how-list h3 { margin-top: calc(4 * var(--u)); }
#rounds .small { color: var(--steel); }
