.c-modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.c-modal-root[hidden] {
  display: none !important;
}

.c-modal-root__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.c-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 60vh;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.c-modal-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.c-modal-sheet__title {
  font-size: var(--text-md);
  font-weight: 500;
  margin: 0;
}

.c-modal-sheet__close {
  width: 44px;
  height: 44px;
}

.c-modal-sheet__grabber {
  display: none;
}

.c-modal-sheet__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2) var(--space-3) var(--space-4);
  flex: 1;
  min-height: 0;
}

@media (max-width: 640px) {
  .c-modal-root {
    align-items: flex-end;
    padding: 0;
  }

  .c-modal-sheet {
    max-width: none;
    width: 100%;
    max-height: 48dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
  }

  .c-modal-sheet__grabber {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--color-border-strong);
    margin: var(--space-2) auto 0;
  }

  .c-modal-sheet__header {
    padding-top: var(--space-2);
  }
}