.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  opacity: 0;
  background: var(--color-overlay-subtle);
  backdrop-filter: blur(5px);
  transition: opacity var(--motion-control) ease;
}

.sheet-backdrop.is-open,
.sheet-backdrop.is-closing {
  display: flex;
}

.sheet-backdrop.is-open {
  opacity: 1;
}

.sheet-backdrop.is-closing {
  opacity: 0;
  pointer-events: none;
}

.bottom-sheet {
  display: none;
  width: 100%;
  max-height: 88%;
  padding: 10px 16px calc(18px + var(--inset-safe-bottom));
  overflow-y: auto;
  background: var(--color-bg-surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--elevation-sheet);
  animation: sheet-up var(--motion-control) ease-out both;
}

.bottom-sheet.is-open {
  display: grid;
  gap: 14px;
}

.bottom-sheet.is-closing {
  display: grid;
  gap: 14px;
  animation: sheet-down var(--motion-exit) cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes sheet-up {
  from { transform: translateY(28px); opacity: 0.72; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes sheet-down {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(42px); opacity: 0; }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 2px;
  border-radius: var(--radius-pill);
  background: var(--color-control-handle-muted);
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-heading h2 {
  line-height: 1.2;
}

.sheet-heading p {
  margin-top: 3px;
  color: var(--color-text-secondary);
}

.privacy-chip,
.online-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  font-style: normal;
  white-space: nowrap;
}

.privacy-chip svg {
  width: 13px;
  height: 13px;
}

.online-chip {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.online-chip > span,
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-circle);
  background: var(--color-success-indicator);
}

.device-sheet-image {
  width: 100%;
  height: 146px;
  border-radius: var(--radius-card);
  object-fit: contain;
  background: var(--color-surface-warm);
}

.sheet-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  background: var(--color-border-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  gap: 1px;
}

.sheet-metrics div {
  display: grid;
  gap: 4px;
  padding: 13px 8px;
  text-align: center;
  background: var(--color-bg-surface);
}

.sheet-metrics strong {
}

.sheet-metrics span {
  color: var(--color-text-secondary);
}

.readiness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--color-bg-page);
  border-radius: var(--radius-control);
}

.readiness-row span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.readiness-row em {
  color: var(--color-success);
  font-style: normal;
}

.toast {
  position: absolute;
  right: 16px;
  bottom: calc(var(--nav-height) + var(--inset-safe-bottom) + 12px);
  left: 16px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 10px 13px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  background: var(--color-overlay-control-strong);
  border-radius: var(--radius-control);
  box-shadow: var(--elevation-sheet);
  color: var(--ref-white);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--color-success-inverse);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 700px) {
  body {
    min-height: 876px;
    padding: 16px;
    place-items: start center;
  }

  #app {
    width: min(390px, calc(100vw - 32px));
    height: 844px;
    border: 8px solid var(--color-device-shell);
    border-radius: var(--radius-device-shell);
    box-shadow: var(--elevation-device);
  }

  .app-shell {
    border-radius: var(--radius-device-screen);
  }
}
