.ahpi {
  --ahpi-black: #0a0a0a;
  --ahpi-ink: #121212;
  --ahpi-gray-700: #555;
  --ahpi-gray-500: #8a8a8a;
  --ahpi-gray-300: #d5d5d5;
  --ahpi-gray-200: #e9e9e9;
  --ahpi-white: #fff;
  --ahpi-danger: #a4001d;
  --ahpi-good: #27734a;
  --ahpi-radius: 32px;
  --ahpi-ease: cubic-bezier(.2, .75, .25, 1);
  container-type: inline-size;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 72px) clamp(16px, 3vw, 32px);
  color: var(--ahpi-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Noto Sans KR", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.ahpi *, .ahpi *::before, .ahpi *::after { box-sizing: border-box; }
.ahpi :where(h2, p, dl, dd) { margin-block: 0; }

/*
 * Elementor applies height:100% and flex-grow:1 to boxed container inners.
 * A tall mobile shortcode can then make its widget substantially taller than
 * the rendered form. Restrict the correction to the direct container that
 * owns this shortcode so unrelated Elementor sections keep their layout.
 */
@supports selector(.e-con:has(.ahpi)) {
  .elementor-widget-shortcode:has(> .elementor-shortcode > .ahpi) {
    align-self: auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  .elementor-widget-shortcode:has(> .elementor-shortcode > .ahpi) > .elementor-shortcode {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  .e-con > .e-con-inner:has(> .elementor-widget-shortcode > .elementor-shortcode > .ahpi) {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  .e-con:has(> .e-con-inner > .elementor-widget-shortcode > .elementor-shortcode > .ahpi) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
}

.ahpi__form {
  width: 100%;
  padding: clamp(28px, 4.5vw, 68px);
  border: 1px solid var(--ahpi-gray-300);
  border-radius: var(--ahpi-radius);
  overflow: hidden;
  background: var(--ahpi-white);
}

.ahpi__section {
  padding: 0 0 52px;
  margin: 0 0 52px;
  border: 0;
  border-bottom: 1px solid #ddd;
}

.ahpi__section + .ahpi__section { border-top: 0; }
.ahpi__section:last-of-type { padding-bottom: 0; margin-bottom: 34px; border-bottom: 0; }

.ahpi__section-head {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 34px;
}

.ahpi__number {
  padding-top: 9px;
  color: #888;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

.ahpi__section h2 {
  margin: 0;
  color: var(--ahpi-ink);
  font-size: clamp(26px, 4.4cqw, 43px);
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -.05em;
}

.ahpi__section-head p {
  grid-column: 2;
  max-width: 720px;
  margin-top: 8px;
  color: #777;
  font-size: 14px;
  line-height: 1.7;
}

.ahpi__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 25px 22px;
}

.ahpi__field { display: grid; min-width: 0; gap: 10px; }
.ahpi__field--wide { grid-column: 1 / -1; }
.ahpi__textarea-field { margin-bottom: 25px; }

.ahpi__label {
  margin: 0;
  color: var(--ahpi-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.ahpi__label i { color: #777; font-style: normal; }

.ahpi input:not([type="radio"]):not([type="checkbox"]),
.ahpi select,
.ahpi textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid #aaa;
  border-radius: 0;
  outline: 0;
  background-color: var(--ahpi-white);
  color: #111;
  -webkit-text-fill-color: #111;
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  box-shadow: none;
  transition: border-color .2s, box-shadow .2s;
}

.ahpi input:not([type="radio"]):not([type="checkbox"]), .ahpi select {
  height: auto;
  min-height: 48px;
  padding: 14px 1px 13px;
}

.ahpi select {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #555 50%), linear-gradient(135deg, #555 50%, transparent 50%);
  background-position: calc(100% - 15px) 21px, calc(100% - 9px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  appearance: none;
}

.ahpi textarea {
  min-height: 150px;
  padding: 14px 1px 13px;
  resize: vertical;
  line-height: 1.7;
}

.ahpi input::placeholder, .ahpi textarea::placeholder { color: #8a8a8a; opacity: 1; }
.ahpi input:focus, .ahpi select:focus, .ahpi textarea:focus { border-color: #000; box-shadow: 0 1px 0 #000; }
.ahpi .was-validated :invalid:not(fieldset) { border-color: var(--ahpi-danger) !important; }

.ahpi__count {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 1px;
  color: var(--ahpi-gray-500);
  font-size: 11px;
  line-height: 1.5;
}

.ahpi__count b { font-weight: 500; }
.ahpi__count.is-recommended span { color: var(--ahpi-good); font-weight: 750; }
.ahpi__count.is-near-limit b { color: var(--ahpi-danger); font-weight: 750; }

.ahpi__choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ahpi__choice { position: relative; min-width: 0; cursor: pointer; }
.ahpi__choice input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ahpi__choice span {
  display: flex;
  min-height: 90px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 17px;
  background: #fff;
  color: #111;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
  transition: transform .22s var(--ahpi-ease), border-color .22s, background .22s, color .22s;
}

.ahpi__choice:hover span { border-color: #111; transform: translateY(-2px); }
.ahpi__choice input:checked + span { border-color: var(--ahpi-black); background: var(--ahpi-black); color: #fff; -webkit-text-fill-color: #fff; }
.ahpi__choice input:focus-visible + span { outline: 2px solid currentColor; outline-offset: 3px; }

.ahpi__consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
  color: #555;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
}

.ahpi__consent input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: #111;
}

.ahpi__footer { display: flex; align-items: center; justify-content: space-between; gap: 25px; }
.ahpi__footer p { max-width: 430px; color: #888; font-size: 11px; line-height: 1.6; }

.ahpi__review-button, .ahpi__submit-button, .ahpi__edit-button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.ahpi__review-button {
  display: inline-flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 27px;
  border-radius: 999px;
  background: #070707;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 14px;
  font-weight: 780;
  transition: transform .25s var(--ahpi-ease), opacity .25s, background .25s;
}

.ahpi__review-button span { font-size: 19px; line-height: 1; }
.ahpi__review-button:hover { background: #242424; transform: translateY(-3px); }
.ahpi__review-button:focus-visible, .ahpi__submit-button:focus-visible, .ahpi__edit-button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.ahpi__notice {
  display: flex;
  gap: 6px;
  flex-direction: column;
  margin: 0 auto 24px;
  padding: 18px 22px;
  border-radius: 18px;
  outline: 0;
  width: min(100%, 916px);
}

.ahpi__notice--success { background: #eaf5ee; color: #155d38; }
.ahpi__notice--error { background: #fff0ee; color: #9b291c; }
.ahpi__trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.ahpi__modal[hidden], .ahpi.ahpi__modal[hidden] { display: none !important; }
.ahpi.ahpi__modal {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  display: grid;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: none;
  place-items: center;
  margin: 0;
  padding: 24px;
  overflow: visible;
  container-type: normal;
  isolation: isolate;
}
.ahpi__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); }
.ahpi__dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(700px, 100%);
  min-width: 0;
  max-height: min(820px, calc(100dvh - 48px));
  overflow: hidden;
  padding: clamp(32px, 6vw, 60px);
  border-radius: var(--ahpi-radius);
  background: #fff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .28);
}

.ahpi .ahpi__close {
  position: absolute !important;
  z-index: 3;
  top: 18px !important;
  right: 18px !important;
  display: grid !important;
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  height: 54px !important;
  min-height: 54px !important;
  max-height: 54px !important;
  place-items: center;
  margin: 0 !important;
  padding: 0 0 5px !important;
  border: 1px solid #d8d8d8 !important;
  border-radius: 50% !important;
  outline: 0;
  background: #fff !important;
  background-image: none !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  font-family: Arial, sans-serif !important;
  font-size: 46px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  text-align: center !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .08) !important;
  cursor: pointer;
  appearance: none !important;
}
.ahpi .ahpi__close:hover { border-color: #aaa !important; background: #f3f3f3 !important; transform: none !important; }
.ahpi .ahpi__close:focus-visible { outline: 2px solid #111 !important; outline-offset: 3px; }
.ahpi__eyebrow { margin: 0 0 12px; color: #777; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.ahpi__dialog h2 { max-width: 540px; margin: 0 72px 34px 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.05em; }
.ahpi__summary {
  display: grid;
  min-height: 0;
  max-height: min(52dvh, 500px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 12px;
  border-top: 1px solid var(--ahpi-gray-300);
  scrollbar-color: #777 #eee;
  scrollbar-width: thin;
}
.ahpi__summary::-webkit-scrollbar { width: 8px; }
.ahpi__summary::-webkit-scrollbar-track { border-radius: 999px; background: #eee; }
.ahpi__summary::-webkit-scrollbar-thumb { border-radius: 999px; background: #777; }
.ahpi__summary > div { display: grid; grid-template-columns: 150px 1fr; gap: 22px; padding: 16px 0; border-bottom: 1px solid var(--ahpi-gray-300); }
.ahpi__summary dt { color: #777; font-size: 11px; font-weight: 800; }
.ahpi__summary dd { margin: 0; color: #222; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ahpi__dialog-actions { position: relative; z-index: 2; display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; background: #fff; }
.ahpi__edit-button, .ahpi__submit-button { min-height: 50px; padding: 0 22px; border-radius: 999px; font-size: 13px; font-weight: 750; }
.ahpi__edit-button { border: 1px solid #bbb; background: #fff; color: #222; }
.ahpi__submit-button { background: var(--ahpi-black); color: #fff; -webkit-text-fill-color: #fff; }
.ahpi__submit-button:disabled { opacity: .55; cursor: wait; }
.ahpi-modal-open { overflow: hidden; }

@container (max-width: 700px) {
  .ahpi__grid { grid-template-columns: 1fr; }
  .ahpi__choices { grid-template-columns: 1fr 1fr; }
  .ahpi__footer { align-items: stretch; flex-direction: column; }
  .ahpi__review-button { width: 100%; }
}

@container (max-width: 500px) {
  .ahpi { --ahpi-radius: 24px; padding-inline: 0; }
  .ahpi__form { padding: 28px 20px; }
  .ahpi__section-head { grid-template-columns: 42px minmax(0, 1fr); }
  .ahpi__section-head p { grid-column: 1 / -1; }
  .ahpi__choices { grid-template-columns: 1fr; }
  .ahpi__count { align-items: flex-start; flex-direction: column; gap: 2px; }
  .ahpi__summary > div { grid-template-columns: 1fr; gap: 4px; }
  .ahpi__dialog-actions { flex-direction: column-reverse; }
  .ahpi__edit-button, .ahpi__submit-button { width: 100%; }
  .ahpi__dialog { max-height: calc(100dvh - 28px); padding: 66px 20px 20px; }
  .ahpi__dialog h2 { margin-right: 0; }
  .ahpi__summary { max-height: 48dvh; padding-right: 8px; }
  .ahpi .ahpi__close { top: 12px !important; right: 12px !important; }
}

@media (max-width: 700px) {
  .ahpi__grid { grid-template-columns: 1fr; }
  .ahpi__choices { grid-template-columns: 1fr 1fr; }
  .ahpi__footer { align-items: stretch; flex-direction: column; }
  .ahpi__review-button { width: 100%; }
}

@media (max-width: 500px) {
  .ahpi { --ahpi-radius: 24px; padding: 28px 0 0; }
  .ahpi__form { padding: 28px 20px; }
  .ahpi__section-head { grid-template-columns: 42px minmax(0, 1fr); }
  .ahpi__section-head p { grid-column: 1 / -1; }
  .ahpi__choices { grid-template-columns: 1fr; }
  .ahpi__count { align-items: flex-start; flex-direction: column; gap: 2px; }
  .ahpi__summary > div { grid-template-columns: 1fr; gap: 4px; }
  .ahpi__dialog-actions { flex-direction: column-reverse; }
  .ahpi__edit-button, .ahpi__submit-button { width: 100%; }
  .ahpi.ahpi__modal { padding: 14px; }
  .ahpi__dialog { width: 100%; max-height: calc(100dvh - 28px); padding: 66px 20px 20px; }
  .ahpi__dialog h2 { margin-right: 0; }
  .ahpi__summary { max-height: 48dvh; padding-right: 8px; }
  .ahpi .ahpi__close { top: 12px !important; right: 12px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .ahpi *, .ahpi *::before, .ahpi *::after { scroll-behavior: auto !important; transition: none !important; }
}
