html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font: 15px/1.4 system-ui, sans-serif; color: #111;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#screen { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
#textin { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; }
#menu-btn { position: fixed; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); z-index: 5;
  width: 36px; height: 36px; border-radius: 6px; border: 1px solid #555; background: rgba(30,30,30,.55); color: #ddd; font-size: 20px; cursor: pointer; opacity: .55; }
#menu-btn:hover, #menu-btn:focus-visible { opacity: 1; }
#keypad { position: fixed; z-index: 4; right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3, 44px); gap: 5px; touch-action: none; }
#keypad[hidden] { display: none; }
#keypad:not(.side) { opacity: .8; }
#keypad button { height: 44px; border-radius: 8px; border: 1px solid #777; background: rgba(40,40,40,.8); color: #fff; font-size: 20px; padding: 0; }
#keypad button.small { height: 30px; font-size: 14px; }
#keypad button:active { background: #08f; }
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.overlay[hidden] { display: none; }
#paused { background: rgba(0,0,0,.35); cursor: pointer; }
.box { background: #c0c0c0; border: 2px outset #fff; padding: 14px 18px; max-width: min(92vw, 460px); max-height: 88vh; overflow: auto;
  display: flex; flex-direction: column; gap: 8px; -webkit-user-select: text; user-select: text; }
.box.wide { max-width: min(96vw, 900px); }
.box h2 { margin: 0 0 4px; font-size: 17px; }
.box p { margin: 0; }
.group { display: flex; flex-wrap: wrap; gap: 6px; }
.box button, .button { font: inherit; padding: 6px 12px; background: #dcdcdc; border: 2px outset #fff; cursor: pointer; color: #000; }
.box button:active, .button:active { border-style: inset; }
.box button.current { font-weight: bold; }
.box button.primary { align-self: flex-end; }
.box button.danger { color: #900; }
.button input { display: none; }
.box label { display: flex; align-items: center; gap: 6px; }
#file-list { margin: 0; padding-left: 18px; font-family: monospace; font-size: 13px; max-height: 30vh; overflow: auto; }
#import-msg, #readme-text { white-space: pre-wrap; font-size: 13px; margin: 0; }
#readme-text { max-height: 70vh; overflow: auto; background: #fff; padding: 8px; }
#print-pages { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#print-pages img { width: min(100%, 600px); background: #fff; box-shadow: 0 0 6px #000; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; overflow: visible; height: auto; }
  body > *:not(#print) { display: none !important; }
  #print { position: static; display: block; background: none; }
  #print .box { border: 0; padding: 0; max-height: none; max-width: none; background: none; overflow: visible; }
  #print .box > :not(#print-pages) { display: none; }
  #print-pages img { width: 210mm; height: 297mm; box-shadow: none; page-break-after: always; }
}
.help-box { width: min(900px, 94vw); }
.help-body { display: flex; gap: 8px; height: min(62vh, 520px); }
#help-index { flex: 0 0 34%; overflow: auto; background: #fff; border: 1px solid #808080; font-size: 13px; }
#help-index button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 3px 6px; font: inherit; cursor: pointer; }
#help-index button.current { background: #000080; color: #fff; }
#help-text { flex: 1; overflow: auto; background: #fff; border: 1px solid #808080; padding: 8px 10px; white-space: pre-wrap; font-size: 14px; }
#help-text h3 { margin: 0 0 8px; font-size: 16px; }
.help-note { font-size: 12px; opacity: .8; margin: 6px 0; }
@media (max-width: 640px) { .help-body { flex-direction: column; } #help-index { flex: 0 0 30%; } }
