/* Portal pages — mobile layout */

@media (max-width: 768px) {
  body {
    margin: 0;
    padding: 0 8px 12px;
    font-size: 15px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
  }

  table[width="100%"],
  table[width="95%"],
  table[width="80%"],
  table[width="10%"] {
    width: 100% !important;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  input.chatInput,
  select.chatInput,
  textarea.chatInput {
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    min-height: 44px;
    padding: 8px 10px;
  }

  input.chatInput[type="submit"],
  input.chatInput[type="button"],
  input.chatInput[type="reset"] {
    min-height: 44px;
  }

  font[size="-1"] {
    font-size: 13px !important;
  }

  /* Login / register forms */
  form[name="login"] table tr,
  #register-form tr,
  #settings-form tr {
    display: block;
  }

  form[name="login"] table td,
  #register-form td,
  #settings-form td {
    display: block;
    width: 100% !important;
    text-align: left !important;
    padding: 6px 0;
  }

  form[name="login"] input.chatInput,
  #register-form input.chatInput,
  #register-form select.chatInput,
  #register-form textarea.chatInput {
    width: 100% !important;
  }

  form[name="login"] input[type="submit"],
  #register-form input[type="submit"] {
    width: 100%;
    margin-top: 8px;
  }

  /* Nav menu row */
  table[width="80%"] tr {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 4px 0;
  }

  table[width="80%"] td {
    width: auto !important;
    flex: 1 1 28%;
    min-width: 72px;
    padding: 8px 4px !important;
    background: #fff9e6;
    border: 1px solid #99aadd;
    border-radius: 6px;
    box-sizing: border-box;
  }

  table[width="80%"] td a {
    display: block;
    padding: 4px 0;
  }

  /* Chapter bars */
  td.chapter {
    font-size: 14px !important;
    padding: 10px 8px !important;
  }

  /* Profile / settings content */
  table.text {
    font-size: 14px;
    width: 100%;
  }

  table.text tr {
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px solid #e8d49a;
    padding-bottom: 8px;
  }

  table.text td {
    display: block;
    width: 100% !important;
    padding: 2px 0 !important;
  }

  table.text td:first-child {
    color: #444;
    font-weight: bold;
    margin-bottom: 2px;
  }

  #profile-content hr,
  #not-found hr {
    margin: 12px 0;
  }

  #profile-content form table tr {
    display: table-row;
  }

  #profile-content form table td {
    display: table-cell;
  }

  .color-cube {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 3px;
  }

  .color-cube-cell {
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    min-height: 22px;
  }

  table[width="100%"][bgcolor="#d9e2ff"] td {
    padding: 12px 8px !important;
    font-size: 12px;
  }
}
