/* Responsive mobile sandbox. The framed Figma reference remains in index.html and td.css. */

body[data-layout="responsive"] {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  background: #edf2ee;
  overflow: hidden;
}

body[data-layout="responsive"] .stage {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

body[data-layout="responsive"] .device {
  position: relative;
  inset: auto;
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  padding: 0;
  border-radius: 0;
  transform: none;
  background: #fff;
  box-shadow: 0 0 42px rgba(0, 30, 10, 0.16);
}

body[data-layout="responsive"] .device-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

body[data-layout="responsive"] .app-status {
  padding-top: env(safe-area-inset-top);
  height: calc(47px + env(safe-area-inset-top));
}

body[data-layout="responsive"] .device-screen[data-sheet="true"] .app-status {
  height: calc(66px + env(safe-area-inset-top));
}

body[data-layout="responsive"] .td-sticky {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

body[data-layout="responsive"] .cpb-panel {
  padding-bottom: env(safe-area-inset-bottom);
}

body[data-layout="responsive"] .cpb-keyboard {
  display: none !important;
}

/* The responsive page uses the phone's keyboard; these simulated-keyboard states are unreachable. */
body[data-layout="responsive"] .cpb[data-keyboard="open"] .cpb-panel {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--cpb-dock);
  max-height: none;
  border-radius: 18px 18px 0 0;
}

body[data-layout="responsive"] .sandbox-drawer {
  position: fixed;
  z-index: 90;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  max-width: min(420px, calc(100vw - 16px));
  color: #fff;
  font-family: var(--td-font);
}

body[data-layout="responsive"] .sandbox-drawer > summary {
  display: block;
  width: max-content;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(21, 24, 27, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

body[data-layout="responsive"] .sandbox-drawer > summary::-webkit-details-marker {
  display: none;
}

body[data-layout="responsive"] .sandbox-drawer[open] > summary {
  border-radius: 8px 8px 0 0;
}

body[data-layout="responsive"] .demo-bar {
  max-height: min(62vh, 440px);
  padding: 12px;
  overflow: auto;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

body[data-layout="responsive"] .demo-bar [data-live-status],
body[data-layout="responsive"] .demo-bar-voice {
  margin-left: 0;
}

@media (min-width: 601px) {
  body[data-layout="responsive"] .stage {
    padding: 18px;
  }

  body[data-layout="responsive"] .device {
    height: calc(100vh - 36px);
    height: calc(100dvh - 36px);
    border-radius: 24px;
    overflow: hidden;
  }

  body[data-layout="responsive"] .device-screen {
    border-radius: 24px;
  }
}

/* Preserve the reference composition while tightening its measured gaps on shorter phones. */
@media (max-height: 760px) and (orientation: portrait) {
  body[data-layout="responsive"] .td-signin-body {
    min-height: 100%;
    padding-top: 12px;
  }

  body[data-layout="responsive"] .td-signin-greeting {
    margin-top: 12px;
  }

  body[data-layout="responsive"] .td-signin-form {
    margin-top: 22px;
  }

  body[data-layout="responsive"] .td-screen-signin .td-field + .td-field {
    margin-top: 14px;
  }

  body[data-layout="responsive"] .td-signin-forgot,
  body[data-layout="responsive"] .td-signin-remember,
  body[data-layout="responsive"] .td-screen-signin .td-btn-primary,
  body[data-layout="responsive"] .td-signin-promo {
    margin-top: 18px;
  }

  body[data-layout="responsive"] .td-signin-icons {
    margin-top: 30px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  body[data-layout="responsive"] .app-status {
    display: none;
  }

  body[data-layout="responsive"] .td-content {
    padding-top: 24px;
  }

  body[data-layout="responsive"] .cpb {
    --cpb-dock: 48%;
    --cpb-tall: 92%;
  }
}
