






@media (max-width: 959.98px) {
  html, body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  #bar { flex-wrap: wrap; height: auto; min-height: var(--bar, 46px); row-gap: 6px; padding: 6px 12px; }
  #bar .fld.wide { min-width: 0; }
  #bar .brand { white-space: normal; min-width: 0; max-width: 100%; }
  #app-ver { white-space: normal; }
  main { flex-direction: column; height: auto; }
  
  #chartwrap { flex: none; width: 100%; height: auto; display: flex; flex-direction: column; }
  #chart { flex: none; height: clamp(300px, 46vh, 560px); min-height: 300px; }
  #ws-pos { position: static !important; }
  #ctools { order: -1; position: static; flex-wrap: wrap; row-gap: 5px; padding: 6px 8px; background: var(--panel, #141019);
            border-bottom: 1px solid var(--line, #2a2237); }
  
  #ctools > .grp { flex: 0 1 auto; max-width: 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
                   scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #ctools > .grp::-webkit-scrollbar { display: none; }
  #ctools > .grp > *, #ctools > .grp > * > * { flex-shrink: 0; }
  #ctools > .grp * { flex-wrap: nowrap !important; white-space: nowrap; }
  
  #rail { width: 100%; flex: none; border-right: 0; border-left: 0; border-top: 1px solid var(--line, #2a2237); overflow: visible; }
  #rail > #ticket { flex: none; min-height: 0; overflow: visible; }
  #rail > #ticket > .tk-acts, #rail > #ticket > #mod-journal-tag { position: static; box-shadow: none; }
  
  #ws-draw { inset-inline-end: 0 !important; top: 30% !important; }
  .ob-card, .modal .sheet, #bug-pop { max-width: calc(100vw - 16px) !important; }
  .ob-card { left: 8px !important; right: 8px !important; transform: none !important; width: auto !important; }
}

@media (max-width: 640px) {
  #bar, #rail > #ticket { padding-left: 12px; padding-right: 12px; }
  #bar button, #bar select, #ctools button, #ctools select, #rail button, #rail select, #rail input { min-height: 44px; }
}
