html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  font-family: Calibri, "Segoe UI", sans-serif; font-size: 15px;
  background: #222; overflow: hidden;
}

/* v94 (Peter): the bar stays ONE line — when it is too narrow it scrolls
   sideways (mouse wheel over it, or a touchpad's sideways swipe) instead of
   wrapping, which changed its height and so the drawing's. No scroll bar
   shown: one that came and went with the status line's length would change
   the height too. The menu panels are position: fixed (placed by ui.js
   under their title), since the scrolling bar would clip them. */
#menubar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 2px;
  background: #1b2a4a; color: #e8ecf5; padding: 2px 8px; user-select: none;
  white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
#menubar::-webkit-scrollbar { display: none; }
#menubar > * { flex: 0 0 auto; }
.menu { position: relative; }
.menu-title {
  background: none; border: 0; color: inherit; font: inherit;
  padding: 5px 12px; border-radius: 4px; cursor: pointer;
}
/* v143 (Peter): each title in a color of its own (--menu-bg, set by ui.js from the standard twelve,
   from Coral; Help Dark red), white bold text — the twelve were chosen to carry it; lighter while open */
.menu-title { background: var(--menu-bg, none); color: #fff; font-weight: bold; }
.menu-title:hover, .menu.open .menu-title { filter: brightness(1.2); }
.menu-panel {
  display: none; position: fixed; z-index: 10; white-space: normal;
  min-width: 230px; padding: 6px; border-radius: 0 0 6px 6px;
  background: #24365f; box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
}
.menu.open .menu-panel { display: block; }
.menu-panel .row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 4px 6px;
}
.menu-panel input, .menu-panel select { font: inherit; width: 120px; box-sizing: border-box; }
.menu-panel select#opt-rules { width: 220px; }
.menu-panel select.colour { width: 150px; font-weight: bold; }
.menu-panel input[type=checkbox] { width: auto; }
.menu-panel .val { margin-left: auto; padding-right: 8px; opacity: .8; font-variant-numeric: tabular-nums; }
.menu-panel .row { min-width: 300px; }
.menu-panel .item {
  display: flex; justify-content: space-between; width: 100%;
  background: none; border: 0; color: inherit; font: inherit; text-align: left;
  padding: 5px 6px; border-radius: 4px; cursor: pointer;
}
.menu-panel .item:hover { background: #3d5591; }
.menu-panel .note { font-size: 13px; opacity: .75; max-width: 300px; display: block; }
kbd { opacity: .7; font: inherit; }

/* v142 (Peter): the status line is a line of its own under the menu bar, white
   on dark blue; like the bar it stays one line and scrolls sideways (mouse
   wheel) when the text is longer than the window is wide. Its height is fixed
   so that a message coming or going never changes the drawing's. */
#statusbar {
  flex: 0 0 auto; height: 1.7em; line-height: 1.7em; padding: 0 12px;
  background: #0a1f66; color: #fff;
  white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
#statusbar::-webkit-scrollbar { display: none; }
#status.warn { color: #ffd166; }

/* the Help menu's title: white on Dark red (the standard list's, #990000) */
#help-title { --menu-bg: #990000; }
.menu-panel a.item { color: inherit; text-decoration: none; box-sizing: border-box; }

/* K / ?: the keyboard commands over the drawing, black on white; Space closes */
#keys-overlay {
  position: absolute; inset: 0; z-index: 5; overflow: auto;
  background: #fff; color: #000; padding: 16px 28px; box-sizing: border-box;
}
#keys-overlay[hidden] { display: none; }
#keys-overlay h2 { margin: 0 0 4px; }
#keys-overlay .keys-hint { margin: 0 0 12px; }
#keys-overlay .keys-cols { display: flex; flex-wrap: wrap; gap: 8px 48px; align-items: flex-start; }
#keys-overlay table { border-collapse: collapse; max-width: 640px; }
#keys-overlay th { text-align: left; padding: 12px 0 4px; font-size: 1.1em; }
#keys-overlay tr:first-child th { padding-top: 0; }
#keys-overlay td { padding: 3px 16px 3px 0; vertical-align: top; }
#keys-overlay td:first-child { white-space: nowrap; }
#keys-overlay kbd {
  opacity: 1; font-weight: bold; padding: 0 5px;
  border: 1px solid #999; border-radius: 3px; background: #f2f2f2;
}
#app-version { font-weight: bold; letter-spacing: .04em; padding: 5px 14px 5px 4px; opacity: .85; }

#stage { flex: 1 1 auto; min-height: 0; position: relative; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.menu-panel .row.disabled { opacity: .45; }   /* v68: options greyed out while Heroic is on */
.menu-panel table.auto { border-collapse: collapse; margin: 0 6px 4px; }   /* v152: the Room menu's eight boxes */
.menu-panel table.auto th, .menu-panel table.auto td { padding: 3px 10px; text-align: center; font-weight: normal; }
.menu-panel table.auto th { opacity: .8; }
.menu-panel table.auto td:first-child { text-align: left; padding-left: 0; }
.menu-panel tr.disabled { opacity: .45; }   /* v152: the human's boxes while Heroic is on */
.menu-panel .row.hidden { display: none; }   /* v69: a player's setting that does not apply to what it plays */
.menu-panel .row.net-code input { width: 60px; text-align: center; font-weight: bold; letter-spacing: .1em; }   /* v79: the room code */
.menu-panel .row.net-code .item { width: auto; flex: 0 0 auto; }

/* v154 (Peter 10/11): the hover texts (ui.js showTip), black on white like the keyboard list; the menus
   carry no explanations. A disabled control lets the pointer through to its row, which has the text
   (Chrome sends no pointer events over a disabled button). */
#tip {
  position: fixed; z-index: 20; max-width: min(420px, calc(100vw - 16px)); box-sizing: border-box;
  padding: 8px 12px; background: #fff; color: #000; border: 1px solid #888; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); font-size: 14px; line-height: 1.35; pointer-events: none;
}
#tip[hidden] { display: none; }
#tip ul { margin: 4px 0; padding-left: 20px; }
#tip kbd { opacity: 1; font-weight: bold; padding: 0 4px; border: 1px solid #999; border-radius: 3px; background: #f2f2f2; }
.menu-panel :disabled { pointer-events: none; }

/* v162: Game → Size of the drawing area — two number fields and Set on one row, the five sizes on another */
.menu-panel .size-head { opacity: .8; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.2); margin-top: 4px; }
.menu-panel .size-fields { justify-content: flex-start; }
.menu-panel .size-fields label { display: flex; align-items: center; gap: 6px; }
.menu-panel .size-fields input { width: 72px; }
.menu-panel .size-fields .item, .menu-panel .size-presets .item { width: auto; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.3); }
.menu-panel .size-presets { flex-wrap: wrap; justify-content: flex-start; gap: 6px; max-width: 330px; }
