/* Mobile history and chat adaptive layout */
.chat-toggle{border:1px solid var(--line);background:#f7faf3;color:#66834a;border-radius:6px;padding:5px 8px;font:inherit;font-size:10px;cursor:pointer}
.chat.chat-collapsed{height:auto!important;min-height:0!important;max-height:none!important}
.chat.chat-collapsed .chat-messages,.chat.chat-collapsed .chat-compose,.chat.chat-collapsed .chat-hint{display:none}
@media(max-width:850px){
  .dashboard{max-height:none;overflow:visible}
  .dashboard .chart-card{display:none!important}
  .dashboard .history{display:block}
  .view-six .dashboard,.view-pick .dashboard{display:none!important}
  .view-six .chat,.view-pick .chat{height:auto;min-height:calc(100vh + 260px);max-height:none;overflow:visible}
  .content{grid-template-columns:1fr}
  .chat{height:auto;min-height:calc(100vh + 260px);max-height:none;width:100%;overflow:visible}
  .chat-messages{min-height:720px;flex:none;padding:14px 12px}
  .chat-compose{min-height:78px;margin:0 8px;padding:9px}
  .chat-compose textarea{min-height:52px;max-height:120px;font-size:16px;line-height:1.6}
  .chat-hint{padding:7px 10px 10px;font-size:10px}
  .chat-message p{font-size:16px;line-height:1.8;padding:10px 12px}
  .chat-message b{font-size:16px}
  .chat-message time{font-size:14px}
  .chat-message .msg-actions button{font-size:14px;padding:4px 8px}
  .history{margin-top:12px;padding:12px}
  .history .draw-row{grid-template-columns:70px 1fr;gap:6px;padding:11px 2px}
  .history .draw-row strong,.history .draw-row>span,.history .draw-row time{grid-column:1 / -1}
  .history .row-balls{min-width:0;overflow:hidden;gap:3px}
  .history .row-ball{width:21px;height:21px;flex:none}
  .history.expanded #drawTable{max-height:none;overflow:visible}
  .history.collapsed #drawTable{max-height:98px}

  /* Chat must grow with its messages; do not let the legacy 520px mobile rule cover them. */
  .chat,
  .view-six .chat,
  .view-pick .chat{
    height:auto!important;
    min-height:780px!important;
    max-height:none!important;
    overflow:visible!important;
  }
  .chat-messages{
    height:auto!important;
    min-height:720px!important;
    max-height:none!important;
    flex:none!important;
    overflow:visible!important;
  }
  .chat-compose,
  .chat-hint{
    position:relative!important;
    z-index:1;
  }
}
