/* Responsive shell rules. Keep the compact header and drawer in one place. */

@media (max-width: 900px) {
  .topbar,
  body.workspace-active .topbar,
  body.setup-active .topbar {
    position: relative;
    align-items: center;
    flex-direction: row;
    overflow: visible;
  }

  .brand-lockup,
  body.workspace-active .brand-lockup,
  body.setup-active .brand-lockup {
    width: auto;
    justify-content: flex-start;
  }

  .topbar-actions,
  body.workspace-active .topbar-actions,
  body.setup-active .topbar-actions {
    display: grid;
    grid-template-columns: auto auto;
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .topbar-actions > .status-pill {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-actions > .app-menu-toggle {
    display: grid;
    grid-column: 2;
    grid-row: 1;
  }

  .menu-drawer {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: min(280px, calc(100vw - 28px));
    padding: 10px;
    border: 1px solid rgba(159, 207, 255, 0.2);
    border-radius: 12px;
    background: rgba(5, 15, 28, 0.96);
  }

  body.app-menu-open .menu-drawer {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .menu-drawer .language-picker {
    display: block;
    width: 100%;
    order: 1;
  }

  .menu-drawer .app-menu {
    display: none;
    width: 100%;
    flex: 0 0 auto;
    max-width: none;
    order: 2;
  }

  body.app-menu-open .menu-drawer .app-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 901px) {
  .menu-drawer {
    display: contents;
  }
}

/* Phase 25: touch targets and the notification bell in the phone header. */
@media (max-width: 900px) {
  /* the bell gets its own column next to the status pill instead of wrapping onto a second row */
  body[data-theme="classic"] .topbar-actions:has(> .notification-bell:not(.hidden)) {
    grid-template-columns: auto auto auto;
    gap: 6px;
  }

  body[data-theme="classic"] .topbar-actions > .notification-bell {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 38px;
    height: 38px;
  }

  body[data-theme="classic"] .topbar-actions:has(> .notification-bell:not(.hidden)) > .status-pill { grid-column: 2; }
  body[data-theme="classic"] .topbar-actions:has(> .notification-bell:not(.hidden)) > .app-menu-toggle { grid-column: 3; }

  /* footer links: a tap area of at least 44px */
  body[data-theme="classic"] .footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 6px;
    border-bottom: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  /* read-only links to copy (invite link, spectator link) */
  body[data-theme="classic"] input[readonly] {
    min-height: 44px;
  }

  /* +/- buttons in the scoreboard */
  body[data-theme="classic"] .scoreboard-point-minus,
  body[data-theme="classic"] .scoreboard-point-plus {
    min-width: 40px;
  }
}

/* The account forms: on phones .inline-form is a column, so its labels must not keep their row sizing
   (flex: 1 1 220px meant a 220px-tall box, and align-items: end pushed them to the right). */
@media (max-width: 760px) {
  .account-auth-panel .inline-form {
    align-items: stretch;
    flex-wrap: nowrap;
  }

  .account-auth-panel .inline-form > label {
    flex: 0 0 auto;
  }
}
