.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-root.is-open { display: flex; animation: fade-in 0.2s ease-out; }

/* ----- bottom-right slide-in variant (Survicate-style toast) ----- */
.modal-root.position-bottom-right {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 24px 24px 0;
  pointer-events: none;
}
.modal-root.position-bottom-right .modal-backdrop { display: none; }
.modal-root.position-bottom-right .modal-card {
  pointer-events: auto;
  width: min(400px, calc(100% - 24px));
  max-height: min(640px, calc(100vh - 48px));
  border-radius: 16px;
  animation: slide-in-right 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-root.position-bottom-right.is-open { animation: none; }
@keyframes slide-in-right {
  from { opacity: 0; transform: translate(24px, 12px); }
  to { opacity: 1; transform: translate(0, 0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes card-up {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  animation: card-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="light"] .modal-card {
  background: #FFFFFF;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .modal-card {
  background: #1A1A1D;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: var(--lg-red-soft);
  color: var(--lg-red);
}

.modal-header {
  padding: 32px 32px 0;
}

.modal-eyebrow {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lg-red);
  font-weight: 600;
  margin-bottom: 12px;
  padding: 4px 10px;
  background: var(--lg-red-soft);
  border-radius: 999px;
}

.modal-title {
  font-size: 22px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-sub {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-progress .step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.modal-progress .step.active {
  background: var(--lg-red);
  color: #fff;
}

.modal-progress .step.done {
  background: var(--lg-red);
  color: #fff;
  opacity: 0.6;
}

.modal-progress .step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
}

.modal-body {
  padding: 28px 32px 8px;
  overflow-y: auto;
  flex: 1;
}

.question.hidden, .thanks.hidden, .other-input.hidden { display: none; }

.q-label {
  font-size: 16px;
  line-height: 1.55;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 18px;
}

.likert {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.likert-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.likert-btn:hover {
  border-color: var(--lg-red);
  background: var(--lg-red-soft);
}

.likert-btn[aria-checked="true"] {
  border-color: var(--lg-red);
  background: var(--lg-red-soft);
  color: var(--lg-red);
}

.likert-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.likert-btn[aria-checked="true"] .likert-num {
  background: var(--lg-red);
  color: #fff;
}

.likert-text { font-size: 14px; }

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.choice-btn:hover {
  border-color: var(--lg-red);
  background: var(--lg-red-soft);
}

.choice-btn[aria-checked="true"] {
  border-color: var(--lg-red);
  background: var(--lg-red);
  color: #fff;
}

.other-input {
  margin-top: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
}

.other-input:focus {
  outline: none;
  border-color: var(--lg-red);
}

.thanks {
  text-align: center;
  padding: 20px 0 30px;
}

.thanks-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--lg-red);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.thanks h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.thanks p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 32px 28px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.btn-ghost, .btn-primary {
  padding: 11px 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover { color: var(--text); }
.btn-ghost.hidden { visibility: hidden; }

.btn-primary {
  background: var(--lg-red);
  color: #fff;
  border-color: var(--lg-red);
  margin-left: auto;
}

.btn-primary:hover:not(:disabled) {
  background: var(--lg-red-dark);
  border-color: var(--lg-red-dark);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary.hidden { display: none; }

@media (max-width: 540px) {
  .modal-card { border-radius: 14px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 22px; padding-right: 22px; }
  .modal-title { font-size: 19px; }
  .q-label { font-size: 15px; }
}
