body.ly-modal-open {
  overflow: hidden;
}

.ly-modal[hidden] {
  display: none;
}

.ly-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
}

.ly-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ly-modal-dialog {
  position: relative;
  width: min(680px, calc(100vw - 70px));
  max-height: calc(100vh - 32px);
  margin: 0;
  background: #fff;
  border-radius: 14px;
  padding: 0;
  overflow: visible;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.ly-modal-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.ly-modal-header {
  position: relative;
  background: #7cb342;
  padding: 12px 48px 12px 68px;
}

.ly-modal-close {
  position: absolute;
  top: -14px;
  right: -10px;
  width: 34px;
  height: 34px;
  border: 1px solid #d7d7d7;
  border-radius: 50%;
  background: #fff !important;
  color: #3f3f3f;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

.ly-modal-header-icon {
  position: absolute;
  top: -10px;
  left: -30px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px solid #7cb342;
  background: #fff;
  color: #7cb342;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.ly-modal-header-icon svg,
.ly-modal-header-icon img {
  width: 45px;
  height: 45px;
  display: block;
}

/* Fallback: if icon path has no explicit fill/stroke, inherit theme color. */
.ly-modal-header-icon .ly-section-icon-svg path:not([fill]):not([stroke]) {
  fill: currentColor;
}

.ly-modal-title {
  margin: 0;
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1;
  color: #fff;
  flex: 0 0 auto;
}

.ly-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.ly-modal-body:has(> .ly-modal-tabs) {
  padding-top: 0;
}

.ly-modal-tab-panel {
  padding-top: 18px;
}

.ly-modal-body .ly-detail-item:last-child {
  margin-bottom: 0;
}

.ly-modal-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #ececec;
  padding-top: 14px;
  padding-bottom: 14px;
}

.ly-modal-tab {
  border: 1px solid #dcdcdc;
  background: #f7f7f7;
  color: #333;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  word-break: keep-all;
}

.ly-modal-tab.is-active {
  background: #fff;
  border-color: #7ab446;
  color: #2d6e35;
  font-weight: 600;
}

.ly-modal-dialog.ly-modal-theme-bmi .ly-modal-header {
  background: #27c8d1;
}

.ly-modal-dialog.ly-modal-theme-exercise .ly-modal-header {
  background: #7cb342;
}

.ly-modal-dialog.ly-modal-theme-wellbeing .ly-modal-header {
  background: #ff6f61;
}

.ly-modal-dialog.ly-modal-theme-nutrition .ly-modal-header {
  background: #f3c94b;
}

.ly-modal-dialog.ly-modal-theme-harmful .ly-modal-header {
  background: #a86acd;
}

.ly-modal-dialog.ly-modal-theme-sleep .ly-modal-header {
  background: #5c6bc0;
}

.ly-modal-dialog.ly-modal-theme-stress .ly-modal-header {
  background: #26a69a;
}

.ly-modal-dialog.ly-modal-theme-bmi .ly-modal-header-icon {
  border-color: #27c8d1;
  color: #27c8d1;
}

.ly-modal-dialog.ly-modal-theme-exercise .ly-modal-header-icon {
  border-color: #7cb342;
  color: #7cb342;
}

.ly-modal-dialog.ly-modal-theme-wellbeing .ly-modal-header-icon {
  border-color: #ff6f61;
  color: #ff6f61;
}

.ly-modal-dialog.ly-modal-theme-nutrition .ly-modal-header-icon {
  border-color: #f3c94b;
  color: #c59a12;
}

.ly-modal-dialog.ly-modal-theme-harmful .ly-modal-header-icon {
  border-color: #a86acd;
  color: #a86acd;
}

.ly-modal-dialog.ly-modal-theme-sleep .ly-modal-header-icon {
  border-color: #5c6bc0;
  color: #5c6bc0;
}

.ly-modal-dialog.ly-modal-theme-stress .ly-modal-header-icon {
  border-color: #26a69a;
  color: #26a69a;
}

@media (max-width: 768px) {
  .ly-modal-header-icon {
    top: -10px;
    left: -20px;
    width: 68px;
    height: 68px;
  }
}
