#psych-overlay,
#season-end-modal,
#tradzy-auth-overlay,
#sr-create-modal,
#sr-browse-modal,
#reward-bg {
  
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  
  overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top, 0px)) 12px
           max(16px, env(safe-area-inset-bottom, 0px)) 12px;
  box-sizing: border-box;
}

#psych-overlay > *,
#season-end-modal > *,
#tradzy-auth-overlay > *,
#sr-create-modal > *,
#sr-browse-modal > *,
#reward-bg > * {
  
  margin: auto;
  box-sizing: border-box;

  
}

#psych-overlay > .psych-card {
  max-height: none;
  overflow: visible;
}

@media (max-width: 768px) {
  #psych-overlay > *,
  #season-end-modal > *,
  #tradzy-auth-overlay > *,
  #sr-create-modal > *,
  #sr-browse-modal > *,
  #reward-bg > * {
    width: 100%;
    max-width: 100%;
  }
  #psych-overlay,
  #season-end-modal,
  #tradzy-auth-overlay,
  #sr-create-modal,
  #sr-browse-modal,
  #reward-bg {
    padding: max(12px, env(safe-area-inset-top, 0px)) 8px
             max(20px, env(safe-area-inset-bottom, 0px)) 8px;
  }

  
  #tradzy-auth-overlay input,
  #sr-create-modal input,
  #sr-create-modal textarea {
    font-size:var(--fs-16);
  }
}

@media (max-height: 520px) {
  #psych-overlay,
  #season-end-modal,
  #tradzy-auth-overlay {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

.app {
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
}

@media (max-width: 768px) {
  #tz-notif-stack {
    top: max(52px, env(safe-area-inset-top, 0px));
    left: 8px;
    right: 8px;
    width: auto;
    
    max-height: 46dvh;
    overflow: hidden;
  }
  .tz-notif {
    padding: 10px;
  }
  .tz-notif-msg {
    
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .toast {
    left: 8px;
    right: 8px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

#tradzy-chat-unread {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius:var(--rad-999);
  font-size:var(--fs-10);
  line-height: 1;
  font-weight: 700;
  box-sizing: border-box;
}
#tradzy-chat-panel #chat-messages {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  html body input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  html body select,
  html body textarea,
  html body .inp {
    font-size: 16px !important;
  }
}

@media (max-width: 768px) {
  html body .r-tab, html body .mode-pill-new, html body .log-btn, html body .modal-btn, html body .ll-view-tab {
    min-height: 44px !important;
  }
  html body .debrief-btn, html body .lw-psych-btn {
    min-height: 40px !important;
  }
}

@media (max-width: 768px) {
  .tsm-dots { gap: 6px !important; }
  .tsm-dot.tsm-bear-dot,
  .tsm-dot.tsm-bull-dot { width: 16px !important; height: 16px !important; }
}

@media (max-width: 768px) {
  .r-tabs {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
  }
  
}

@media (max-height: 500px) and (orientation: landscape) {
  
  .modal-bg.open .modal { max-height: 96dvh !important; padding: 10px !important; }
}

@media (min-width: 1600px) {
  .trade-items {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
  }
  .trade-items > *:not(.trade-card) { grid-column: 1 / -1; }
}
