html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: radial-gradient(ellipse at 50% 26%, #f7f0e5 0, #ede4d6 46%, #e1d5c4 100%);
}

.preview-stage {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 15px;
  height: 100%;
  height: 100dvh;
  padding: 18px;
}

.preview-caption {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5d4f53;
  font-size: 12px;
  line-height: 18px;
}

.preview-caption strong {
  color: #362a3d;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .17em;
}

.preview-device {
  width: 410px;
  max-width: 100%;
  height: min(864px, calc(100dvh - 78px));
  overflow: hidden;
  border: 10px solid #2b2529;
  border-radius: 40px;
  background: var(--paper);
  box-shadow: 0 0 0 1px #8e7d74, 0 26px 72px #2f22272b, 0 5px 17px #382a2a23;
}

.preview-device .board {
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
}

.preview-device .board-header,
.preview-device .chapter > h2,
.preview-device .chapter-intro,
.preview-device .caption {
  display: none;
}

.preview-device .chapter,
.preview-device .deck-row,
.preview-device .cell {
  display: contents;
}

.preview-device .phone {
  display: none;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
}

.preview-device .phone:focus {
  outline: none;
}

html:not([data-preview-ready]) .preview-device #welcome,
.preview-device .phone[data-current] {
  display: flex;
}

.preview-device .viewport {
  overscroll-behavior: contain;
}

.preview-device .welcome-stage {
  height: 100%;
  min-height: 430px;
}

.preview-device .welcome-stage .stage-body {
  height: 100%;
}

@media (max-width: 600px), (pointer: coarse) and (max-width: 920px) {
  .preview-stage {
    display: block;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
      env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--paper);
  }

  .preview-caption {
    display: none;
  }

  .preview-device {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .preview-device .ctrl :is(input, select, textarea) {
    font-size: max(1em, 16px);
  }
}
