
:root {
  --tap-min: 44px; /* iOS/Android recommended min touch target */
}

/* prevent iOS from auto-zooming when focusing inputs (16px+) */
@media screen and (max-width: 736px) {
  body, input, select, textarea {
    font-size: 16px;
  }
}

/* make page behave like a normal scrolling document on small screens */
@media screen and (max-width: 736px) {
  body {
    padding: 3.25em 1.25em 1.25em 1.25em;
    justify-content: flex-start;
  }

  #footer {
    position: relative;
    left: auto;
    bottom: auto;
    margin: 2em 0 0 0;
    opacity: 0.85;
  }

  /* reduce big headings on smaller screens */
  #header h1 { font-size: 2em; }
}

@media screen and (max-width: 480px) {
  body {
    padding: 2.75em 1em 1em 1em;
  }
}

@media screen and (max-width: 736px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  select,
  textarea {
    min-height: var(--tap-min);
  }

  input[type="submit"],
  input[type="reset"],
  input[type="button"],
  button,
  .button {
    min-height: var(--tap-min);
    line-height: var(--tap-min);
  }

  /* wrap buttons if side by side */
  form .actions,
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em;
  }

  form .actions > *,
  .actions > * {
    flex: 1 1 12em;
  }
}

@media screen and (max-width: 736px) {
  input[type="checkbox"] + label,
  input[type="radio"] + label {
    padding-left: 3em;
    padding-top: 0.15em;
    padding-bottom: 0.15em;
  }

  input[type="checkbox"] + label:before,
  input[type="radio"] + label:before {
    height: 2.2em;
    width: 2.2em;
    line-height: 2.2em;
    font-size: 1em;
    top: -0.15em;
  }
}

/* prevent long words/URLs from breaking layout */
.chat-msg, p, li {
  overflow-wrap: anywhere;
}

@media screen and (max-width: 736px) {
  .button-class {
    display: block;
    width: 100%;
    min-height: var(--tap-min);
    line-height: 1.2;
    white-space: normal;
  }
}

/*  halved desktop window & tablet responsiveness  */
@media screen and (max-width: 1200px) {
  .chat-layout {
    flex-direction: column !important;
    gap: 1.25rem !important;
  }

  .chat-left,
  .chat-right {
    width: 100% !important;
    max-width: 100% !important;
  }

  .chat-right {
    border-left: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding-left: 0 !important;
    padding-top: 1rem !important;
  }

  .chat-log {
    max-height: 55vh !important;
  }

  .disclaimer-box,
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* wrap long question text */
#question-list {
  display: grid;
  gap: 0.75rem;
}

#question-list .question-button {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 44px !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  text-align: left !important;
  padding: 0.85rem 1rem !important;
  margin: 0 !important;
}

/* prevent chat content from forcing horizontal overflow */
.chat-container,
.chat-log,
.chat-msg {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* start page at top to allow for vertical scrolling */
@media screen and (max-width: 1200px), screen and (max-height: 800px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
  }

  body {
    justify-content: flex-start !important;
    align-items: stretch !important;
  }

  /* keep content visible from top on smaller screens */
  #wrapper,
  #main,
  #header {
    margin-top: 0 !important;
  }
}

