/* SEODACH Group Quiz — per-site assets.
 * Desktop (≥1024): 38vh, options in one symmetric row.
 * Mobile (<1024): original 2-column icon tiles, natural height. */

.seodach-quiz-host,
.seodach-quiz,
.seodach-quiz-root {
  width: 100%;
  box-sizing: border-box;
}

.seodach-quiz-host {
  min-width: 0;
}

.seodach-quiz {
  --sq-primary: #0f766e;
  --sq-accent: #14b8a6;
  --sq-cols: 2;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #0f172a;
}

/* ─── Mobile: first tile version (2 columns, full-width squares) ─── */

@media (max-width: 1023px) {
  .seodach-quiz-host {
    margin-top: 1.5rem;
  }

  .seodach-quiz--no-foot .seodach-quiz__foot {
    display: none;
  }

  .seodach-quiz__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
    justify-items: stretch;
  }

  .seodach-quiz__opt:nth-child(5):last-child {
    grid-column: 1 / -1;
    width: calc(50% - 4px);
    justify-self: center;
  }

  .seodach-quiz__opt {
    width: 100%;
    aspect-ratio: 1;
    max-height: none;
    padding: 10px 8px 12px;
    border-radius: 12px;
  }

  .seodach-quiz__opt-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .seodach-quiz__svg {
    width: 22px;
    height: 22px;
  }

  .seodach-quiz__opt-label {
    font-size: 0.72rem;
    line-height: 1.3;
    -webkit-line-clamp: 3;
  }

  .seodach-quiz__contact-row {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
}

/* ─── Desktop: one row, ~38vh (room for larger icons + labels) ─── */

@media (min-width: 1024px) {
  .seodach-quiz {
    --sq-h: 38vh;
    height: var(--sq-h);
    max-height: var(--sq-h);
  }

  .seodach-quiz-host {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    height: 38vh;
    max-height: 38vh;
  }

  .seodach-quiz-root {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .seodach-quiz__head {
    padding: 10px 14px 8px;
  }

  .seodach-quiz__title {
    font-size: 0.95rem;
  }

  .seodach-quiz__intro {
    display: none;
  }

  .seodach-quiz__body {
    padding: 8px 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .seodach-quiz__q {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .seodach-quiz__label {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 6px;
    line-height: 1.25;
    flex-shrink: 0;
  }

  .seodach-quiz__foot {
    padding: 8px 12px 10px;
  }

  .seodach-quiz__btn {
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .seodach-quiz__options {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-height: 0;
    gap: 6px;
    align-items: stretch;
    justify-content: space-between;
  }

  .seodach-quiz__opt:nth-child(5):last-child {
    grid-column: unset;
  }

  .seodach-quiz__opt {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    width: auto;
    max-width: 100%;
    align-self: stretch;
    justify-content: center;
    padding: 10px 8px;
    gap: 10px;
    border-radius: 10px;
    font-size: clamp(12px, 1.15vw, 15px);
    color: #0f172a;
  }

  .seodach-quiz__opt-icon {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0;
    border-radius: 10px;
    color: var(--sq-primary);
  }

  .seodach-quiz__svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: currentColor;
  }

  .seodach-quiz__opt-label {
    flex: 0 1 auto;
    width: 100%;
    color: #0f172a;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    hyphens: auto;
  }

  .seodach-quiz--contact {
    --sq-h: 42vh;
    height: var(--sq-h);
    max-height: var(--sq-h);
  }

  .seodach-quiz-host:has(.seodach-quiz--contact) {
    height: 42vh;
    max-height: 42vh;
  }

  .seodach-quiz--contact .seodach-quiz__body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 6px;
  }

  .seodach-quiz__contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
  }

  .seodach-quiz__contact-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .seodach-quiz__field {
    min-width: 0;
  }

  .seodach-quiz__field .seodach-quiz__label {
    margin-bottom: 4px;
  }

  .seodach-quiz__field .seodach-quiz__input {
    margin-bottom: 0;
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .seodach-quiz__contact .seodach-quiz__check {
    flex-shrink: 0;
    font-size: 0.68rem;
    line-height: 1.35;
    margin: 0;
  }
}

/* ─── Shared ─── */

.seodach-quiz__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.seodach-quiz__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
}

.seodach-quiz__intro {
  margin: 6px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

.seodach-quiz__step {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sq-primary);
  background: color-mix(in srgb, var(--sq-accent) 15%, transparent);
  padding: 4px 8px;
  border-radius: 8px;
  height: fit-content;
  white-space: nowrap;
}

.seodach-quiz__bar {
  height: 4px;
  background: #f1f5f9;
  flex-shrink: 0;
}

.seodach-quiz__bar-fill {
  height: 100%;
  background: var(--sq-primary);
  transition: width 0.25s ease;
}

.seodach-quiz__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px;
  overscroll-behavior: contain;
}

.seodach-quiz__q {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.seodach-quiz__label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.seodach-quiz__req { color: #ef4444; }

.seodach-quiz__help {
  margin: -6px 0 10px;
  font-size: 0.78rem;
  color: #64748b;
  flex-shrink: 0;
}

.seodach-quiz__options {
  width: 100%;
}

.seodach-quiz__opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.65em;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.seodach-quiz__opt:hover {
  border-color: #94a3b8;
}

.seodach-quiz__opt--sel {
  border-color: var(--sq-primary);
  background: color-mix(in srgb, var(--sq-accent) 10%, #fff);
  color: var(--sq-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sq-accent) 35%, transparent);
}

.seodach-quiz__opt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--sq-accent) 12%, #f8fafc);
  color: var(--sq-primary);
  flex-shrink: 0;
}

.seodach-quiz__opt--sel .seodach-quiz__opt-icon {
  background: color-mix(in srgb, var(--sq-accent) 22%, #fff);
}

.seodach-quiz__svg {
  display: block;
}

.seodach-quiz__opt-label {
  font-weight: 600;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

.seodach-quiz__range-wrap { padding: 4px 0; }

.seodach-quiz__range {
  width: 100%;
  accent-color: var(--sq-primary);
}

.seodach-quiz__range-val {
  margin-top: 8px;
  font-weight: 800;
  color: var(--sq-primary);
}

.seodach-quiz__textarea,
.seodach-quiz__input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  margin-bottom: 12px;
}

.seodach-quiz__textarea {
  resize: vertical;
  min-height: 88px;
}

.seodach-quiz__check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.4;
  margin: 0;
}

.seodach-quiz__check input {
  flex-shrink: 0;
  margin-top: 2px;
}

.seodach-quiz__hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
}

.seodach-quiz__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.seodach-quiz__foot--contact {
  align-items: flex-start;
}

.seodach-quiz__foot-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.seodach-quiz__check--foot {
  font-size: 0.72rem;
}

.seodach-quiz__check--foot span {
  min-width: 0;
}

.seodach-quiz__btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  background: var(--sq-primary);
  color: #fff;
}

.seodach-quiz__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.seodach-quiz__btn--ghost {
  background: transparent;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.seodach-quiz__err {
  color: #dc2626;
  font-size: 0.82rem;
  margin-top: 10px;
}

.seodach-quiz__done {
  text-align: center;
  padding: 24px 8px;
}

.seodach-quiz__checkicon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sq-accent) 18%, transparent);
  color: var(--sq-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
}

.seodach-quiz__done h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.seodach-quiz__done p {
  margin: 0;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Desktop overrides (after shared — centered tile content, label must not flex-grow) */
@media (min-width: 1024px) {
  .seodach-quiz__body {
    overflow: hidden;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
  }

  .seodach-quiz__label {
    font-size: 0.88rem;
    margin-bottom: 6px;
  }

  .seodach-quiz__options {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-height: 0;
    gap: 6px;
    align-items: stretch;
    justify-content: space-between;
  }

  .seodach-quiz__opt {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    width: auto;
    justify-content: center;
    padding: 10px 8px;
    gap: 10px;
    font-size: clamp(12px, 1.15vw, 15px);
  }

  .seodach-quiz__opt-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: 0;
  }

  .seodach-quiz__svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .seodach-quiz__opt-label {
    flex: 0 1 auto;
    width: 100%;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.2;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  .seodach-quiz--contact .seodach-quiz__body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .seodach-quiz__foot--contact {
    flex-direction: row;
    align-items: flex-end;
    padding: 8px 12px 10px;
  }

  .seodach-quiz__foot-main {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
  }

  .seodach-quiz__check--foot {
    flex: 1 1 auto;
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .seodach-quiz__foot--contact .seodach-quiz__btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}
