/* ===== Modal base ===== */
.dn-modal { position: fixed; inset: 0; display: none; }
.dn-modal.is-open {
  display: flex;                 /* center with flex, not margins */
  align-items: center;
  justify-content: center;
  z-index: 99999;
  /* padding keeps it off screen edges (also supports iOS safe areas) */
  padding: max(12px, env(safe-area-inset-top))
           max(12px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom))
           max(12px, env(safe-area-inset-left));
}

.dn-modal__overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
}

/* The panel sizes to the viewport, scrolls internally if needed */
.dn-modal__panel {
  position: relative;
  width: min(820px, 100%);       /* never wider than the viewport */
  max-height: calc(100vh - 24px);
  margin: 0;                     /* centered by flex container */
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  overflow: auto;                /* scroll content on small screens */
  -webkit-overflow-scrolling: touch;
}

/* Lock page scroll while open */
.dn-no-scroll { overflow: hidden; }

/* Close button on top-right */
.dn-modal__close {
  position: sticky;              /* stays visible while scrolling */
  float: right;
  top: 0;
  background: #ffe9ef; color: #e83e8c; border: 0;
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  margin-left: auto; margin-bottom: 8px;
}
.dn-modal__title { margin: 0 0 16px; font-size: 22px; }

/* Grid helpers */
.dn-grid { display: grid; gap: 16px; }
.dn-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dn-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .dn-grid--2, .dn-grid--3 { grid-template-columns: 1fr; }
}

/* Fields */
.dn-field label { display: block; font-size: 13px; margin-bottom: 6px; color: #606060; }
.dn-input { width: 100%; padding: 12px; border: 1px solid #d9d9d9; border-radius: 6px; background: #fff; color:#333; font-size: 15px; line-height: 1.2; }
.dn-input:focus { outline: 0; border-color: #97c47b; box-shadow: 0 0 0 3px rgba(151,196,123,.2); }
.dn-btn { display: inline-block; border: 0; padding: 10px 16px; border-radius: 6px; cursor: pointer; }
.dn-submit { background: #97c47b; color: #1d3b1f; }

/* Rating */
.dn-rating-group { margin-top: 8px; }
.dn-rating-label { font-weight: 700; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.dn-rating { display: inline-flex; flex-direction: row-reverse; }
.dn-rating input { position: absolute; opacity: 0; pointer-events: none; }
.dn-rating label { font-size: 24px; line-height: 1; cursor: pointer; user-select: none; padding: 0 2px; color: #c9c9c9; transition: color .15s ease; }
.dn-rating label:hover, .dn-rating label:hover ~ label { color: #f5b50a; }
.dn-rating input:checked ~ label { color: #f5b50a; }

textarea.dn-input { resize: vertical; min-height: 110px; }
.dn-modal input, .dn-modal textarea { appearance: none; }