#fv-exercises-fill-form > div > div > h2 {
  margin-top: 0;
  margin-bottom: 3px;
}

.fv-exercisebuilder-instructions,h5 {
  color: #666;
  font-style: italic;
  margin-top: 5px;
  margin-bottom: 0;
  font: 12px/2.3em "Trebuchet MS", Helvetica, sans-serif;
  padding: 0;
}

/* CONTAINER WRAPPER */
.fv-exercisebuilder-container {
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin: 1px auto;
  max-width: 90%;
  padding: 5px;
}

.fv-exercisebuilder-header {
  border-bottom: 2px solid #ddd;
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  text-align: center;
}

.fv-exercisebuilder-form {
  padding: 1px;
}

.fv-exercisebuilder-form .form-item {
  margin-bottom: 15px;
}

.fv-exercisebuilder-text-input {
  max-width: 100px;
}

.fv-exercisebuilder-form input[type="number"] {
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 18px;
  max-width: 100px;
  padding: 8px;
}

.fv-exercisebuilder-form input[type="text"] {
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 18px;
  font-family: Helvetica, Arial, sans-serif;
  max-width: 200px;
  padding: 8px;
}

/*   TABLE   */
.fv-exercisebuilder-table {
  margin-bottom: 0;
  /*width: 95%;*/
  white-space: nowrap;
  /* border-collapse: collapse; */
}

.fv-exercisebuilder-table th {
  background-color: #999;
  border: 1px solid #ddd;
  font-weight: bold;
  min-width: 15px;
  padding: 4px 20px 4px 10px;
}

td {
  padding: 2px 10px 2px 10px!important;
}

.table_id {
  text-align: center;
  padding: 5px 5px;
  width: 10px;
}

.table_tense {
  width: 200px;
}

.table_verb {
  width: 100px;
}

.table_person {
  width: 70px;
  text-align: right;
}

td.table_person {
  text-align: right;
}

.table_input {
  width: 210px;
}

#table_hint {
  width: 50px;
}

.table_answer {
  width: 200px;
}

.fv-exercisebuilder-text-input {
  width: 200px;
}

.fv-exercisebuilder-result {
  background-color: #e8f4ff;
  border-radius: 4px;
  display: inline-block;
  font-weight: bold;
  padding: 5px 5px;
}

.fv-exercisebuilder-result-ok {
  color: #2ca02c;
  font-size: 18px;
}

.fv-exercisebuilder-result-nok {
  color: #d62728;
  font-size: 18px;
}

.hidden-answer {
  color: transparent;
  display: none;
  position: relative;
}

.hidden-answer::after {
  content: "●●●●●";
  position: absolute;
  left: 0;
  color: #ccc;
}

.revealed-answer {
  color: #d9534f; /* Red color for incorrect answers */
  font-weight: bold;
  display: block !important;
}

/* ------------- CARD ------------- */
.fv-exercisebuilder-card-table {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.fv-exercisebuilder-card {
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 15px;
  width: calc(50% - 15px);
  min-width: 300px;
}

.fv-exercisebuilder-card-header {
  background-color: #f5f5f5;
  padding: 10px;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  color: #333;
}

.fv-exercisebuilder-card-body {
  padding: 15px;
}

/* Improved card field layout - label and value on one line */
.fv-exercisebuilder-card-field {
  margin-bottom: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
}

.fv-exercisebuilder-card-label {
  font-weight: bold;
  color: #555;
  margin-right: 10px;
  min-width: 70px;
  flex: 0 0 auto;
}

.fv-exercisebuilder-card-value {
  flex: 1;
}

/* For input fields within card fields */
.fv-exercisebuilder-card-field input[type="text"] {
  flex: 1;
  min-width: 0; /* Important to allow flex shrinking */
  width: 100%;
}

/* Result styles within cards */
.fv-exercisebuilder-card-result {
  margin-top: 5px;
  display: flex;
  justify-content: flex-end;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .fv-exercisebuilder-card {
    width: 100%;
  }
  .fv-exercisebuilder-card-field {
    flex-wrap: wrap;
  }
  .fv-exercisebuilder-card-label {
    margin-bottom: 5px;
    width: 100%;
  }
}

/* BUTTONS  */
#edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 10px;
  justify-content: center;
}

.fv-exercisebuilder-form .form-actions button,
.fv-exercisebuilder-form .form-actions input[type="submit"] {
  margin: 0;
  padding : .5em .5em;
}

.checkanswers {
  font-weight: bold !important;
  border: revert !important;
}

/* Toggle button styling */
.button_common {
  box-sizing: border-box;
  color : #0a4;
  appearance: none;
  background-color: transparent;
  border-radius: 0.6em;
  cursor: pointer;
  display: flex;
  align-self: center;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  margin: 20px;
  padding: 1.2em 2.8em;
  text-decoration: none;
  text-align: center;
  /*text-transform: uppercase;*/
  font-family: 'Montserrat', sans-serif;
  transition: all 150ms ease-in-out;
}

.button_common:before {
  background-color: initial;
  background-image: linear-gradient(#fff 0, rgba(255, 255, 255, 0) 100%);
  border-radius: 125px;
  content: "";
  height: 50%;
  left: 4%;
  opacity: .5;
  position: absolute;
  top: 0;
  transition: all .3s;
  width: 92%;
}

.button_common:hover {
  box-shadow: rgba(255, 255, 255, .2) 0 3px 15px inset,
  rgba(0, 0, 0, .1) 0 3px 5px, rgba(0, 0, 0, .1) 0 10px 13px;
  transform: scale(1.05);
}

.button_gray {
  border: 2px #ccc;
  color: #aaa;
  box-shadow: 0 0 40px 40px #eee inset, 0 0 0 0 #aaa;
}

.button_fill {
  border: groove!important;
   background-color: #888;
   color: #fff;
   border-radius: 56px;
   cursor: pointer;
   display: inline-block;
   font-family: system-ui,-apple-system,system-ui,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",sans-serif;
   font-size: 18px;
   font-weight: 400;
   outline: 0;
   padding: 16px 21px;
   position: relative;
   text-align: center;
   text-decoration: none;
   transition: all .3s;
   user-select: none;
   -webkit-user-select: none;
   touch-action: manipulation;
}

.button_fill:before {
  background-color: initial;
  background-image: linear-gradient(#fff 0, rgba(255, 255, 255, 0) 100%);
  border-radius: 125px;
  content: "";
  height: 50%;
  left: 4%;
  opacity: .5;
  position: absolute;
  top: 0;
  transition: all .3s;
  width: 92%;
}

.button_fill:hover {
  box-shadow: rgba(255, 255, 255, .2) 0 3px 15px inset,
              rgba(0, 0, 0, .1) 0 3px 5px, rgba(0, 0, 0, .1) 0 10px 13px;
  transform: scale(1.05);
}

@media (min-width: 768px) {
  .button-fill {
    padding: 16px 48px;
  }
}

.fv-exercisebuilder-switches {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: nowrap;
  justify-content: center;
}

/* Tooltip styles (duplicated here for exercise builder) */
.mytooltip {
  position: relative;
  display: inline-block;
}

.mytooltip .tooltiptext {
  background-color: #018fe2; /* match var(--fvbluelight2) from conjugate module */
  color: #fff;
  visibility: hidden;
  width: auto;
  font: 12px/2.3em "Trebuchet MS", Helvetica, sans-serif;
  text-align: center;
  text-wrap: nowrap;
  border-radius: 10px;
  padding: 2px 8px;
  margin: 0 5px;
  position: absolute;
  z-index: 1;
}

.mytooltip:hover .tooltiptext {
  visibility: visible;
}

/* ---------------- Card view: label and value on one line ---------------- */
/* Ensure the label (.fv-exercisebuilder-card-label) and the value
   (.fv-exercisebuilder-card-value) appear on a single line in each field. */
.fv-exercisebuilder-card-field {
  display: flex;
  align-items: baseline; /* better alignment for mixed text sizes */
  gap: 6px;
  flex-wrap: nowrap; /* prevent wrapping to next line */
}

.fv-exercisebuilder-card-label {
  display: inline-block;
  width: auto;
  white-space: nowrap;
  margin-right: 4px;
  /* Align the trailing colon by giving labels a fixed column width */
  flex: 0 0 var(--card-label-width, 120px);
  text-align: right;
  padding-right: 4px;
}

.fv-exercisebuilder-card-value {
  display: inline-block;
  white-space: nowrap; /* keep value with its label on one line */
  min-width: 0; /* allow flexbox to shrink content instead of wrapping */
  /* Ensure the value takes the remaining space */
  flex: 1 1 auto;
}

/* Ensure inline elements inside value remain inline and do not force line breaks */
.fv-exercisebuilder-card-value > * {
  display: inline;
}

/* Inputs within a card field should sit on the same row */
.fv-exercisebuilder-card-field input[type="text"],
.fv-exercisebuilder-card-field input[type="number"],
.fv-exercisebuilder-card-field input[type="search"],
.fv-exercisebuilder-card-field input[type="email"],
.fv-exercisebuilder-card-field input[type="tel"],
.fv-exercisebuilder-card-field input[type="url"] {
  min-width: 0;
  flex: 1 1 auto;
}

/* Default: keep card view hidden on wide screens; JS or media queries will show it */
.fv-exercisebuilder-card-view {
  display: none;
}

/* Default to card view on small screens: hide big table to reduce initial flicker.
   JS behavior will reveal the card view container when width <= 430px. */
@media (max-width: 430px) {
  /* Toggle button styling */
  .pure-button {
    padding: 0.5em 0.5em!important;
  }

  .fv-exercisebuilder-card-body {
    padding: 2px;
  }

  .fv-exercisebuilder-table {
    display: none;
  }

  /* Ensure card view container is visible on small screens */
  .fv-exercisebuilder-card-view {
    display: block;
  }

 .fv-exercisebuilder-card-field {
   /*--card-label-width: 90px;*/
   margin-bottom: 2px;
   font-size: 0.9em;
  }

  .fv-exercisebuilder-card-label {
    display: inline-block;
    font-size: 0.9em;
    width: auto;
    white-space: nowrap;
    margin-right: 0;
    flex: 0 0 var(--card-label-width, 120px);
    text-align: right;
    padding-right: 0;
  }


}


/* Card header: number left, rule hint + round ok/nok icon right (as sentences history cards) */
.fv-exercisebuilder-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fv-exercisebuilder-card-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fv-exercisebuilder-card-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #9e9e9e;
  flex-shrink: 0;
}

.fv-exercisebuilder-card.feedback-ok .fv-exercisebuilder-card-status-icon {
  background-color: #2e7d32;
}

.fv-exercisebuilder-card.feedback-nok .fv-exercisebuilder-card-status-icon {
  background-color: #d32f2f;
}

.fv-exercisebuilder-card-status-icon .feedback-icon {
  color: #fff;
  font-weight: bold;
  font-size: 16px;
}

/* Card view: rule hint tooltip must pop over the card edges and the neighbouring cards */
.fv-exercisebuilder-card {
  overflow: visible;
  position: relative;
}

.fv-exercisebuilder-card:hover,
.fv-exercisebuilder-card:focus-within {
  z-index: 100;
}

.fv-exercisebuilder-card-header {
  border-radius: 5px 5px 0 0;
}

.fv-exercisebuilder-card .mytooltip .tooltiptext {
  z-index: 101;
}

/* In the header the hint sits at the right edge: open the tooltip below it, towards the left */
.fv-exercisebuilder-card-status .mytooltip .tooltiptext {
  top: 100%;
  right: 0;
  left: auto;
  margin: 4px 0 0;
}
