* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  background: #183d32 url("winter-tile.gif") repeat;
  color: #181811;
  font: 100%/1.35 "Times New Roman", Times, serif;
}
main {
  position: relative;
  width: min(800px, calc(100% - 24px));
  margin: 28px auto;
  padding: 14px 22px;
  background: #fffdf2;
  border: 1px solid #2b241c;
}
header { text-align: center; }
h1 { margin: 0; font-size: 2.5em; color: #800000; }
.masthead { display: flex; gap: 12px; align-items: center; justify-content: center; }
.masthead h1 { white-space: nowrap; }
.vignette { flex: 0 1 126px; min-width: 0; }
.vignette img, .vignette canvas { display: block; width: 100%; height: auto; }
header p { margin: 2px 0 6px; font-style: italic; }
.verse { font-size: .95em; font-style: normal; margin: 5px 0 8px; }
.verse a { white-space: nowrap; }
nav, small, .note { font-size: .94em; }
nav span, .meter output { display: inline-block; white-space: nowrap; }
a:link, summary, .link, #calendar button { color: #0000ad; }
a:visited { color: #551a8b; }
hr { height: 2px; border: 0; border-top: 1px solid #998e75; border-bottom: 1px solid white; margin: 12px 0; }
.layout { display: grid; grid-template-columns: 242px minmax(0, 1fr); gap: 20px; }
aside { text-align: center; }
.scene { border: 1px solid #413a2e; background: #152438; }
.scene canvas { display: block; width: 100%; image-rendering: pixelated; }
.meter { margin: 4px 0 11px; }
.meter output { background: #191919; color: #ffd888; padding: 1px 4px; }
#calendar { border-collapse: collapse; width: 100%; background: white; }
#calendar caption { font-weight: bold; color: #16482c; font-size: 1.15em; margin-bottom: 2px; }
#calendar td, #calendar th { border: 1px solid #aaa68c; padding: 0; text-align: center; }
#calendar th { background: #e4e6ce; font-weight: normal; }
#calendar button, .link { background: none; border: none; padding: 0; text-decoration: underline; }
#calendar button { display: block; width: 100%; min-height: 26px; }
#calendar .selected { background: #fff1b9; font-weight: bold; }
#calendar .lit { color: #782414; }
#calendar button:disabled { color: #68675e; text-decoration: none; }
.note { margin: 6px 0; text-align: left; }
h2 { color: #16482c; font-size: 1.55em; margin: -3px 0 5px; line-height: 1.15; }
#brief { margin: 6px 0; }
.references { margin: 7px 0 0; }
.link { padding: 0 3px; }
summary { text-decoration: underline; width: fit-content; cursor: pointer; }
#hint { margin: 4px 0 10px; }
#hint p { margin: 4px 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
#editor, pre, code, .cell, .meter output, #useful a, #trace tbody th, .scratch input, .scratch output {
  font-family: "Courier New", Courier, monospace;
}
label[for="editor"] { font-weight: bold; }
textarea { display: block; width: 100%; margin-top: 2px; padding: 5px; resize: vertical; font-size: 1em; }
.example { margin: 7px 0 5px; }
.example select { max-width: 100%; }
.controls { display: flex; gap: 4px; flex-wrap: wrap; }
#trace, #words { width: 100%; border-collapse: collapse; margin: 8px 0; }
#trace { table-layout: fixed; }
#trace th:first-child { width: 34%; }
#trace th, #trace td, #words th, #words td { text-align: left; padding: 4px 6px; border: 1px solid #aba994; vertical-align: top; overflow-wrap: anywhere; }
#trace thead, #words thead { background: #e4e6ce; }
#trace tbody th { font-weight: normal; }
.cell { display: inline-block; min-width: 1.4em; text-align: center; }
.changed { background: #fff1a3; font-weight: bold; }
#next, #status, #verdict { margin: 4px 0; }
#next:empty, #status:empty, #verdict:empty { display: none; }
#next a { font-family: "Courier New", Courier, monospace; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#words .notation { display: block; font-weight: normal; }
#words .lookup { background: #fff1b9; }
#words .lookup th::before { content: "▸ "; color: #782414; }
#words .return-link { display: none; }
#words .lookup .return-link { display: inline; }
.scratch form { padding: 3px; }
.scratch input { max-width: 100%; }
.scratch output { display: block; }
#useful a { display: inline-block; padding: 0 2px; }
/* Falling flakes share the wallpaper layer, beneath the opaque paper. */
#snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main { z-index: 1; }
.snow-switch { white-space: nowrap; cursor: pointer; }
.snow-switch input { vertical-align: middle; margin: 0 2px; cursor: pointer; }

@media (max-width: 680px) {
  main { padding: 10px; width: calc(100% - 32px); margin: 30px auto 16px; }
  h1 { font-size: 1.85em; }
  .masthead { gap: 4px; }
  .vignette { flex-basis: 80px; }
  nav { line-height: 1.8; }
  .layout { display: block; }
  aside { display: grid; grid-template-columns: 38% 1fr; gap: 3px 8px; align-items: center; margin-bottom: 13px; }
  .scene { grid-column: 1; grid-row: 1; }
  .meter { grid-column: 1; grid-row: 2; font-size: .9em; margin: 0; }
  #calendar { grid-column: 2; grid-row: 1 / 3; }
  .note { grid-column: 1 / 3; margin: 4px 0; }
  #calendar button { min-height: 29px; }
  #useful a { min-width: 36px; min-height: 34px; text-align: center; }
  .controls button, #resetStack { min-height: 36px; }
  #words, #words tbody { display: block; }
  #words thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  #words tr { display: grid; grid-template-columns: 43% 1fr; border-bottom: 1px solid #aba994; }
  #words td, #words th { border: 0; }
  #words tbody th { grid-row: span 2; }
  #words td:last-child { grid-column: 2; }
  #words .scratch td { grid-column: 1 / -1; }
}
