html, body {
  margin: 0;
  height: 100%;
  background: #f3d9a4;
  overflow: hidden;
  overscroll-behavior: none;
}
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
#hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 520px);
  box-sizing: border-box;
  padding: 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 600 18px system-ui, sans-serif;
  color: #4a3418;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
#hud #score { font-size: 24px; font-weight: 700; min-width: 4ch; }
#hud #best { font-size: 15px; opacity: 0.8; }
#hud #time { min-width: 4ch; text-align: right; }
#hud #time.low { color: #c0392b; }
#hud.idle #score, #hud.idle #time { visibility: hidden; }
/* sound toggle (card db:1009): a small corner button under the time */
#mute {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 32px);
  right: max(10px, calc(50vw - 250px));
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 248, 230, 0.6);
  font-size: 17px;
  line-height: 36px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#mute[aria-pressed="true"] { opacity: 0.6; }
/* Top clouds (card db:1008): the shared board on the game-over screen */
#board {
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 20px), 340px);
  max-height: 34vh;
  max-height: 34dvh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 248, 230, 0.94);
  box-shadow: 0 4px 18px rgba(74, 52, 24, 0.18);
  font: 500 15px system-ui, sans-serif;
  color: #4a3418;
}
/* wide screens: off to the side, clear of the game-over text */
@media (min-aspect-ratio: 5/4) {
  #board { left: auto; right: 16px; transform: none; bottom: auto; top: 50%; translate: 0 -50%; max-height: 70vh; width: 280px; }
}
#board[hidden], #board form[hidden] { display: none; }
#board h2 { margin: 0 0 6px; font-size: 16px; }
#board form { display: flex; gap: 6px; margin-bottom: 4px; }
#board input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid #d9ab62; border-radius: 8px; background: #fff; color: inherit; }
#board button { font: 600 15px system-ui, sans-serif; padding: 6px 10px; border: 0; border-radius: 8px; background: #2f8a2a; color: #fff; cursor: pointer; }
#board button:disabled { opacity: 0.5; }
#board .note { margin: 2px 0; font-size: 14px; color: #2f8a2a; }
#board .note:empty { display: none; }
#board ol { margin: 0; padding-left: 2.2em; }
#board li { padding: 1px 0; }
#board li span { display: inline-block; width: calc(100% - 4em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
#board li b { display: inline-block; width: 4em; text-align: right; }
#board li.me { color: #2f8a2a; font-weight: 700; }
#board li.empty { list-style: none; margin-left: -2.2em; opacity: 0.75; }
/* result card (card db:1010): the daily label, score, best combo, weather strip and Share, under the hud */
#result {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 44px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 20px), 300px);
  box-sizing: border-box;
  padding: 10px 14px 12px;
  border-radius: 14px;
  background: rgba(255, 248, 230, 0.94);
  box-shadow: 0 4px 18px rgba(74, 52, 24, 0.18);
  text-align: center;
  font: 500 15px system-ui, sans-serif;
  color: #4a3418;
}
#result[hidden] { display: none; }
#result p { margin: 0; }
#result .day { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; }
#result .score { font: 700 34px system-ui, sans-serif; line-height: 1.15; }
#result .combo { color: #2f8a2a; font-weight: 600; }
#result .strip { font-size: 20px; letter-spacing: 1px; margin: 6px 0 8px; white-space: nowrap; }
#result .share { font: 600 16px system-ui, sans-serif; padding: 7px 22px; border: 0; border-radius: 999px; background: #2f8a2a; color: #fff; cursor: pointer; }
#result .note { margin-top: 4px; font-size: 13px; color: #2f8a2a; }
#result .note:empty { display: none; }
