* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d0d0d; color: #faebd7;
  font: 15px system-ui, sans-serif; overflow: hidden; overscroll-behavior: none; }
.hidden { display: none !important; }

#splash { height: 100%; display: grid; place-items: center; }
#startForm { display: grid; gap: 14px; text-align: center; width: min(280px, 80vw); }
#startForm h1 { font-weight: 500; margin: 0 0 8px; }
#startForm input, #startForm button { font: inherit; padding: 12px; border-radius: 8px; border: 1px solid #555;
  background: #1a1a1a; color: inherit; }
#startForm button { background: #2a4a6a; cursor: pointer; font-size: 18px; }
#status { min-height: 1.2em; color: #aaa; margin: 0; }

#game { height: 100%; display: flex; }
#stage { flex: 1; min-width: 0; min-height: 0; width: 100%; height: 100%; touch-action: none; display: block; }

#panel { width: 190px; flex: none; background: #200000; padding: 14px 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; user-select: none; -webkit-user-select: none; }
#inGame { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.row input[type=range] { flex: 1; min-width: 0; accent-color: #5aa0d0; }
.row input[type=checkbox] { width: 18px; height: 18px; accent-color: #5aa0d0; }
.lbl { font-size: 12px; color: #b9a; width: 100%; flex: none; }
.row:has(.lbl) { flex-wrap: wrap; row-gap: 2px; }
.box { border: 1px solid #ccc; padding: 2px 10px; min-width: 34px; text-align: center; }
#clock { color: #fff; font-variant-numeric: tabular-nums; font-size: 13px; }

button { font: inherit; color: #aaa; background: #000; border: 1px solid #666; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; touch-action: manipulation; }
button:active, button.on { background: #333; color: #fff; }
.wide { width: 100%; justify-content: center; }
.multi { gap: 0; }
.multi button { border-radius: 0; flex: 1; }
.multi button:first-child { border-radius: 6px 0 0 6px; }
.multi button:last-child { border-radius: 0 6px 6px 0; }

#offline { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: #a00; color: #fff;
  padding: 8px 16px; border-radius: 6px; }

/* phones and portrait tablets: wheel on top, controls in a wrapping strip underneath */
@media (orientation: portrait), (max-width: 700px) {
  #game { flex-direction: column-reverse; }
  #panel { width: 100%; max-height: 38%; flex-direction: row; flex-wrap: wrap; align-content: flex-start;
    gap: 8px 16px; padding: 10px; }
  #inGame { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; width: 100%; }
  .row:has(.lbl) { width: 45%; }
  .wide { width: auto; }
}
