.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.modal::backdrop {
  background: rgba(3, 7, 9, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.modal[open] {
  animation: modal-in 380ms var(--ease-out);
}

.modal[open]::backdrop {
  animation: modal-fade 300ms ease;
}

.modal.is-closing {
  animation: modal-out 220ms ease-in forwards;
}

.modal.is-closing::backdrop {
  animation: modal-fade 220ms ease-in reverse forwards;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
}

@keyframes modal-out {
  to { opacity: 0; transform: translateY(12px) scale(0.97); }
}

@keyframes modal-fade {
  from { opacity: 0; }
}

.modal__box {
  position: relative;
  display: grid;
  gap: 18px;
  max-height: calc(100dvh - 32px);
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(80% 60% at 100% 0%, var(--tide-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.modal__view {
  display: grid;
  gap: 18px;
}

.modal__head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 16px;
  padding-right: 40px;
}

.modal__head p {
  grid-column: 1 / -1;
}

.modal__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--icon-tile);
}

.modal__icon img {
  width: 36px;
  height: 36px;
}

.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.modal__head p,
.modal__done p {
  margin: 0;
  color: var(--ink-2);
}

.modal__group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.modal__group legend {
  margin-bottom: 8px;
  padding: 0;
  font: 500 14px/20px var(--font-sans);
}

.modal__actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.field__input--area {
  height: auto;
  min-height: 112px;
  padding-block: 12px;
  line-height: 22px;
  resize: vertical;
}

.modal__done {
  justify-items: center;
  padding-block: 12px 0;
  text-align: center;
}

.modal__check {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--tide-soft);
  color: var(--tide-ink);
  animation: modal-pop 500ms var(--ease-out);
}

.modal__check path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: modal-draw 450ms 180ms var(--ease-out) forwards;
}

@keyframes modal-pop {
  from { transform: scale(0.4); opacity: 0; }
}

@keyframes modal-draw {
  to { stroke-dashoffset: 0; }
}

.order-summary {
  display: grid;
  margin: 0;
  padding: 6px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.order-summary div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-block: 9px;
  font-size: 15px;
}

.order-summary div + div {
  border-top: 1px solid var(--line);
}

.order-summary dt {
  color: var(--ink-3);
}

.order-summary dd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.order-summary img {
  width: 20px;
  height: 20px;
}

.order-extra {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.order-extra:hover {
  border-color: var(--tide);
}

.order-extra:has(input:checked) {
  border-color: var(--tide);
  background: var(--tide-soft);
}

.order-extra input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--tide);
}

.order-extra__text {
  display: grid;
  gap: 2px;
  font-size: 15px;
}

.order-extra__text span {
  font-size: 13px;
  color: var(--ink-3);
}

.order-extra__price {
  font: 500 14px/1 var(--font-mono);
  color: var(--tide-ink);
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-top: 4px;
  border-top: 1px dashed var(--line-strong);
}

.order-total > span:first-child {
  padding-bottom: 6px;
  color: var(--ink-2);
}

.order-total__value {
  display: grid;
  justify-items: end;
}

.order-total b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.order-total small {
  font-size: 13px;
  color: var(--ink-3);
}

body:has(.modal[open]) {
  overflow: hidden;
}

@media (max-width: 760px) {
  .modal {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }

  .modal[open] {
    animation-name: modal-sheet-in;
  }

  .modal.is-closing {
    animation-name: modal-sheet-out;
  }

  @keyframes modal-sheet-in {
    from { transform: translateY(100%); }
  }

  @keyframes modal-sheet-out {
    to { transform: translateY(100%); }
  }

  .modal__box {
    max-height: 92dvh;
    padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .modal__actions {
    grid-template-columns: 1fr;
  }

  .modal__actions .btn--primary {
    order: -1;
  }
}
