.tool-grid > .piv2-card-btn {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  aspect-ratio: auto;
  justify-self: stretch;
  box-sizing: border-box;
}

.piv2-card-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  aspect-ratio: auto;
  background: linear-gradient(160deg, #ffffff 70%, #f0fdf4);
  border: 2px solid #b7e4c7;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  padding: 18px 14px 16px;
  box-shadow: 0 3px 12px rgba(45, 106, 79, 0.10);
  font-family: "DM Sans", sans-serif;
  outline: none;
}

.piv2-card-btn:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 32px rgba(45, 106, 79, 0.22);
  border-color: #52b788;
}

.piv2-card-btn:active {
  transform: translateY(-1px) scale(1.01);
}

.piv2-icon-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d8f3dc, #95d5b2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(82, 183, 136, 0.30);
  transition: transform 0.2s ease;
}

.piv2-card-btn:hover .piv2-icon-circle {
  transform: scale(1.08);
}

.piv2-icon-circle svg {
  width: 55%;
  height: 55%;
}

.piv2-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1a5c3a;
  text-align: center;
  line-height: 1.3;
}

#overlayProvaInteligenteV2 {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#overlayProvaInteligenteV2.open .piv2-modal {
  animation: piv2-scale-in 0.22s ease;
}

.piv2-modal {
  position: relative;
  background: #fff;
  width: 95vw;
  max-width: 1100px;
  height: 90vh;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  margin: auto;
}

@keyframes piv2-scale-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.piv2-topbar,
.piv2-preview-topbar,
.piv2-editor-topbar,
.piv2-download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  flex-shrink: 0;
  gap: 12px;
}

.piv2-btn-back,
.piv2-btn-close,
.piv2-preview-btn {
  font-family: "DM Sans", sans-serif;
}

.piv2-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.piv2-btn-back:hover,
.piv2-btn-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.piv2-btn-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  transition: all 0.15s;
}

.piv2-header {
  background: linear-gradient(135deg, #1a5c3a, #2d6a4f);
  padding: 22px 28px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.piv2-header::before {
  content: "✦";
  position: absolute;
  right: 30px;
  top: 10px;
  font-size: 80px;
  opacity: 0.08;
  pointer-events: none;
}

.piv2-header-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.piv2-header-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.piv2-header-sub {
  font-size: 14px;
  color: #a7f3d0;
  font-weight: 400;
  margin-bottom: 12px;
}

.piv2-header-frase {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
}

.piv2-screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.piv2-screen.is-active {
  display: flex;
}

.piv2-body,
.piv2-preview-body,
.piv2-editor-body {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.piv2-body {
  padding: 22px 26px;
}

.piv2-form-hero {
  margin: -22px -26px 0;
}

.piv2-preview-body {
  padding: 22px 26px;
}

.piv2-editor-body {
  padding: 24px 40px;
  background: #fafafa;
}

.piv2-body::-webkit-scrollbar,
.piv2-preview-body::-webkit-scrollbar,
.piv2-editor-body::-webkit-scrollbar,
.piv2-editor-textarea::-webkit-scrollbar {
  width: 5px;
}

.piv2-body::-webkit-scrollbar-thumb,
.piv2-preview-body::-webkit-scrollbar-thumb,
.piv2-editor-body::-webkit-scrollbar-thumb,
.piv2-editor-textarea::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.piv2-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2d6a4f;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d8f3dc;
}

.piv2-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 26px;
}

.piv2-compare-card {
  border-radius: 12px;
  padding: 16px 18px;
}

.piv2-compare-card.is-normal {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
}

.piv2-compare-card.is-smart {
  background: linear-gradient(135deg, #f0fdf4, #d8f3dc);
  border: 1.5px solid #52b788;
}

.piv2-compare-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.piv2-compare-card.is-normal .piv2-compare-title {
  color: #64748b;
}

.piv2-compare-card.is-smart .piv2-compare-title {
  color: #1a5c3a;
}

.piv2-compare-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 7px;
}

.piv2-compare-card.is-normal .piv2-compare-item {
  color: #94a3b8;
}

.piv2-compare-card.is-smart .piv2-compare-item {
  color: #374151;
  font-weight: 500;
}

.piv2-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.piv2-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 7px;
  display: block;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.piv2-required {
  color: #ef4444;
}

.piv2-optional {
  font-weight: 400;
  color: #94a3b8;
  text-transform: none;
  font-size: 11px;
}

.piv2-select,
.piv2-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: "DM Sans", sans-serif;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.piv2-select {
  padding: 10px 36px 10px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.piv2-input {
  padding: 10px 12px;
}

.piv2-select:focus,
.piv2-input:focus,
.piv2-editor-textarea:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.10);
}

.piv2-alerta {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: none;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.piv2-alerta.is-visible {
  display: flex;
}

.piv2-alerta-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.piv2-alerta-text {
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
  flex: 1;
  min-width: 160px;
}

.piv2-alerta-nomes {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  color: #78350f;
}

.piv2-alerta-btn {
  background: #f59e0b;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.piv2-alerta-btn:hover {
  background: #d97706;
}

.piv2-auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.piv2-auto-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.piv2-auto-item.is-active {
  border-color: #2d6a4f;
  background: #f0fdf4;
}

.piv2-auto-emoji {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.piv2-auto-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 3px;
}

.piv2-auto-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.piv2-auto-tag {
  display: inline-block;
  background: #d8f3dc;
  color: #1a5c3a;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.piv2-footer {
  border-top: 1px solid #f1f5f9;
  padding: 18px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  background: transparent;
}

.piv2-footer-icon {
  color: #94a3b8;
  font-size: 18px;
  flex-shrink: 0;
}

.piv2-btn-gerar,
.piv2-preview-btn.is-primary,
.piv2-btn-pdf,
.piv2-editor-save {
  background: linear-gradient(135deg, #2d6a4f, #52b788);
  color: #fff;
  border-color: #2d6a4f;
}

.piv2-btn-gerar,
.piv2-preview-btn,
.piv2-btn-word,
.piv2-btn-pdf,
.piv2-btn-editar-float,
.piv2-editor-save {
  font-family: "DM Sans", sans-serif;
  transition: all 0.2s;
}

.piv2-btn-gerar {
  flex: 1;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 16px rgba(45, 106, 79, 0.30);
}

.piv2-btn-gerar:hover:not(:disabled),
.piv2-preview-btn.is-primary:hover,
.piv2-editor-save:hover,
.piv2-btn-pdf:hover {
  background: linear-gradient(135deg, #1a5c3a, #2d6a4f);
}

.piv2-btn-gerar:disabled {
  background: #b7e4c7;
  color: #6ab890;
  cursor: not-allowed;
  box-shadow: none;
}

.piv2-preview-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.piv2-preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.piv2-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #374151;
  white-space: nowrap;
}

.piv2-preview-btn:hover {
  border-color: #2d6a4f;
  color: #2d6a4f;
  background: #f0fdf4;
}

.piv2-preview-loading {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
}

.piv2-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #e2e8f0;
  border-top-color: #2d6a4f;
  border-radius: 50%;
  animation: piv2-spin 0.9s linear infinite;
  margin: 0 auto 16px;
}

@keyframes piv2-spin {
  to {
    transform: rotate(360deg);
  }
}

.piv2-loading-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}

.piv2-loading-sub {
  font-size: 13px;
  color: #94a3b8;
}

.piv2-questao {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: #fff;
}

.piv2-questao-head {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.piv2-questao-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #2d6a4f;
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.piv2-questao-nivel {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  margin-left: 8px;
}

.piv2-questao-nivel.is-facil {
  background: #d8f3dc;
  color: #1a5c3a;
}

.piv2-questao-nivel.is-medio {
  background: #fef3c7;
  color: #92400e;
}

.piv2-questao-nivel.is-dificil {
  background: #fde8e8;
  color: #991b1b;
}

.piv2-questao-texto {
  font-size: 14px;
  color: #1e293b;
  line-height: 1.65;
  margin-bottom: 12px;
  white-space: pre-line;
}

.piv2-questao-enunciado {
  display: block;
}

.piv2-questao-alt-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}

.piv2-questao-alt {
  font-size: 13.5px;
  color: #374151;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.65;
}

.piv2-questao-alt-marker {
  width: 22px;
  flex: 0 0 22px;
  color: #1a5c3a;
  font-weight: 700;
}

.piv2-questao-alt-texto {
  flex: 1;
  min-width: 0;
  white-space: pre-line;
}

.piv2-linhas-resposta {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  height: 64px;
  margin-top: 8px;
  background: #fafafa;
}

.piv2-edit-bar {
  padding: 12px 20px;
  text-align: center;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  flex-shrink: 0;
}

.piv2-btn-editar-float {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20);
}

.piv2-btn-editar-float:hover {
  background: #0f172a;
}

.piv2-editor-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 4001;
  flex-direction: column;
}

.piv2-editor-screen.is-active {
  display: flex;
}

.piv2-editor-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.piv2-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.piv2-editor-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  background: #fff;
}

.piv2-editor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.piv2-editor-card-label {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.piv2-editor-textarea {
  width: 100%;
  border: none;
  padding: 14px 16px;
  font-size: 14px;
  font-family: "DM Sans", sans-serif;
  color: #1e293b;
  resize: vertical;
  outline: none;
  min-height: 90px;
  line-height: 1.6;
  background: #fff;
}

.piv2-download-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.50);
  z-index: 4000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.piv2-download-backdrop.is-open {
  display: flex;
}

.piv2-download-modal {
  background: #fff;
  width: 100%;
  max-width: 440px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.piv2-download-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.piv2-download-body {
  padding: 20px 22px;
}

.piv2-download-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.piv2-col-options {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.piv2-col-option {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.piv2-col-option:hover {
  border-color: #52b788;
  background: #f7fdf9;
}

.piv2-col-option.is-selected {
  border-color: #2d6a4f;
  background: #f0fdf4;
}

.piv2-col-option-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.piv2-col-option-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
}

.piv2-download-btns {
  display: flex;
  gap: 10px;
}

.piv2-btn-word,
.piv2-btn-pdf,
.piv2-editor-save {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.piv2-btn-word {
  border: 2px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.piv2-btn-word:hover {
  background: #dbeafe;
}

.piv2-empty {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
}

@media (max-width: 768px) {
  .tool-grid > .piv2-card-btn {
    width: 100%;
    max-width: none;
    min-height: 132px;
    height: 100%;
    padding: 12px 8px 10px;
    border-radius: 18px;
  }

  .piv2-icon-circle {
    width: 50px;
    height: 50px;
  }

  .piv2-label {
    font-size: 0.74rem;
  }

  #overlayProvaInteligenteV2 {
    padding: 0;
    align-items: flex-end;
  }

  .piv2-modal {
    width: 100%;
    max-width: 100%;
    height: 85vh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .piv2-cols {
    grid-template-columns: 1fr;
  }

  .piv2-compare {
    grid-template-columns: 1fr;
  }

  .piv2-auto-grid {
    grid-template-columns: 1fr;
  }

  .piv2-topbar,
  .piv2-preview-topbar,
  .piv2-editor-topbar,
  .piv2-download-header {
    padding: 12px 16px;
  }

  .piv2-body,
  .piv2-preview-body {
    padding: 16px;
  }

  .piv2-form-hero {
    margin: -16px -16px 0;
  }

  .piv2-editor-body {
    padding: 16px;
  }

  .piv2-header {
    padding: 18px 16px;
  }

  .piv2-header-title {
    font-size: 21px;
  }

  .piv2-footer,
  .piv2-preview-actions,
  .piv2-editor-actions,
  .piv2-download-btns,
  .piv2-col-options {
    flex-direction: column;
  }

  .piv2-download-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .piv2-download-modal {
    width: 100%;
    max-width: 100%;
    height: 85vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
  }
}
