html, body { margin: 0; height: 100%; background: #000; color: #ddd; font: 14px system-ui, sans-serif;
  overflow: hidden; overscroll-behavior: none; }
  html { height: 100vh; height: 100dvh; }
  body { display: grid; place-items: center; }
  #canvas { display: block; width: min(100vw, calc(100vh * 4 / 3));
    height: min(100vh, calc(100vw * 3 / 4));
    width: min(100vw, calc(100dvh * 4 / 3));
    height: min(100dvh, calc(100vw * 3 / 4)); outline: none;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  #canvas:focus-visible { outline: 2px solid #d8c893; outline-offset: -2px; }
  #status { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
            flex-direction: column; gap: 12px; text-align: center; line-height: 1.5;
            padding: 24px; white-space: pre-line; overflow-wrap: anywhere;
            background: rgba(0,0,0,.88); pointer-events: none; }
  #status a { pointer-events: auto; color: #8cf; }
  #stream { position: fixed; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 4px;
            background: rgba(0, 0, 0, .55); color: #bbb; font-size: 12px; pointer-events: none; }
  #enable-sound { position: fixed; z-index: 25; top: max(12px, env(safe-area-inset-top));
    left: 50%; transform: translateX(-50%); padding: 10px 18px; border: 1px solid #d8c893;
    border-radius: 6px; background: #242014; color: #fff; font: 600 15px system-ui, sans-serif;
    cursor: pointer; touch-action: manipulation; }
  [hidden] { display: none !important; }
  #guest-dialog-layer { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center;
    justify-content: center; background: rgba(0,0,0,.15); color: #000; }
  .guest-dialog { padding: 3px; background: #c0c0c0; font: 11px "MS Sans Serif", Arial, sans-serif;
    box-shadow: inset -1px -1px #000, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #fff;
    transform-origin: center; flex: none; }
  .guest-titlebar { height: 18px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 2px 0 3px; color: #fff; font-weight: bold; background: #000080; }
  .guest-titlebar button { padding: 0; width: 16px; height: 14px; font: bold 14px Arial; line-height: 10px; }
  .guest-dialog-client { position: relative; margin: 2px 1px; }
  .guest-control { position: absolute; box-sizing: border-box; padding: 0; margin: 0; font: inherit; color: #000; }
  .guest-dialog button { border: 0; border-radius: 0; background: #c0c0c0; color: #000;
    box-shadow: inset -1px -1px #000, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf; }
  .guest-dialog button:active { box-shadow: inset 1px 1px #000, inset -1px -1px #fff, inset 2px 2px #808080; }
  .guest-dialog button:focus { outline: 1px dotted #000; outline-offset: -5px; }
  .guest-dialog button.guest-default { border: 1px solid #000; }
  .guest-dialog input:not([type=checkbox]):not([type=radio]), .guest-dialog textarea, .guest-dialog select {
    border: 0; border-radius: 0; background: #fff; padding: 2px 3px;
    box-shadow: inset 1px 1px #808080, inset -1px -1px #fff, inset 2px 2px #000; }
  .guest-dialog textarea { resize: none; }
  .guest-dialog input[readonly], .guest-dialog textarea[readonly] { background: #c0c0c0; }
  .guest-choice { display: flex; align-items: center; gap: 4px; white-space: pre-wrap; }
  .guest-choice input { margin: 0; padding: 0; accent-color: #000080; width: 13px; height: 13px; }
  .guest-static { white-space: pre-wrap; overflow: hidden; }
  .guest-dialog fieldset { border: 2px groove #fff; padding: 0 6px; }
  .guest-dialog legend { padding: 0 2px; }
  .guest-dialog canvas { image-rendering: pixelated; }
  .guest-dialog :disabled { color: #808080; }
  #game-touch-controls { display: none; position: fixed; z-index: 20; bottom: max(18px,env(safe-area-inset-bottom));
    left: 18px; right: 18px; height: 164px; pointer-events: none; user-select: none; }
  #game-touch-controls button { position: absolute; width: 52px; height: 52px; pointer-events: auto;
    touch-action: none; border: 1px solid #798894; border-radius: 8px; color: #fff;
    background: rgba(23,34,44,.88); font: 14px Arial,sans-serif; }
  #game-touch-controls button.pressed { background: #48657c; }
  #game-touch-controls .touch-up { left: 56px; top: 0; font-size: 25px; }
  #game-touch-controls .touch-left { left: 0; top: 56px; font-size: 25px; }
  #game-touch-controls .touch-right { left: 112px; top: 56px; font-size: 25px; }
  #game-touch-controls .touch-down { left: 56px; top: 112px; font-size: 25px; }
  #game-touch-controls .touch-enter { right: 0; top: 0; width: 80px; }
  #game-touch-controls .touch-pause { right: 84px; top: 0; width: 64px; }
  #game-touch-controls .touch-escape { right: 0; top: 56px; }
  #game-touch-controls .touch-yes { right: 56px; top: 112px; width: 40px; height: 40px; }
  #game-touch-controls .touch-no { right: 0; top: 112px; width: 40px; height: 40px; }
  @media (max-width:768px), (pointer:coarse) { #game-touch-controls { display: block; } }
  @media (max-height:500px) and (max-width:1000px) { #game-touch-controls { display: block; } }
  .guest-modal-open #game-touch-controls { display: none; }
