/* ============================================================
   PHONEME MODAL
   ============================================================ */

/* Overlay */
#phonemeModal {
  position: fixed;
  inset: 0;
  z-index: 1040;
  display: none;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  padding: 0;
}
#phonemeModal[style*='display: block'],
#phonemeModal[style*='display:block'] {
  display: flex !important;
}

/* Conteneur interne */
.phoneme-modal-inner {
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Mobile : plein écran */
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
@media (min-width: 640px) {
  .phoneme-modal-inner {
    width: 680px;
    height: auto;
    max-height: 90vh;
    border-radius: 0.5rem;
    border: 1px solid #4c6680;
  }
}

/* ---- Header ---- */
.phoneme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #4c6680;
  flex-shrink: 0;
}
.phoneme-modal-header span {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
.ph-close-btn {
  background: none;
  border: none;
  color: #fadcc2;
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.1s;
}
.ph-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Bouton info dans le header */
.phoneme-modal-header .modal-btn.info-circle {
  position: static;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.phoneme-modal-header .modal-btn.info-circle:hover {
  background: rgba(255, 255, 255, 0.15);
}
.phoneme-modal-header .modal-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* ---- Preview ---- */
.phoneme-modal-preview {
  padding: 8px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #f8fafc;
}
.phoneme-modal-preview label {
  font-size: 11px;
  color: #819ab4;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: block;
}
.phoneme-preview-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
#phonemePreview {
  flex: 1;
  font-size: 18px;
  font-family: monospace;
  padding: 4px 10px;
  border: 1px solid #819ab4;
  border-radius: 6px;
  background: #fff;
  color: #1a202c;
  min-height: 36px;
}

/* Boutons action (| et ⌫) */
.ph-action-btn {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #4c6680;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph-action-btn:hover {
  background: #fadcc2;
}
.ph-action-btn.ph-del {
  width: 32px;
  padding: 0;
}
.ph-action-btn.ph-del:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ---- Corps scrollable ---- */
.phoneme-modal-body {
  overflow-y: auto;
  padding: 12px 14px;
  flex: 1;
}

/* ---- Sections ---- */
.ph-section {
  margin-bottom: 16px;
}
.ph-section:last-child {
  margin-bottom: 0;
}

.ph-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #f67f67; /* orange */
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #fadcc2;
}

/* ---- Tableau consonnes ---- */
.ph-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}
.ph-table {
  border-collapse: collapse;
  min-width: 480px;
  background: #fff;
}
.ph-table td {
  padding: 2px 3px;
  vertical-align: middle;
}
.ph-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
}
.ph-table tbody tr:last-child {
  border-bottom: none;
}

.ph-mode-lbl {
  font-size: 10px;
  font-weight: 600;
  color: #4c6680;
  white-space: nowrap;
  padding-right: 8px;
  text-align: right;
  width: 74px;
}
.ph-lieu-hdr {
  font-size: 10px;
  color: #819ab4;
  text-align: center;
  padding-bottom: 4px;
  white-space: nowrap;
}
.ph-pair {
  display: flex;
  gap: 2px;
  justify-content: center;
}

/* ---- Boutons phonèmes ---- */
.ph-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #819ab4;
  background: #fff;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4c6680;
  transition:
    background 0.1s,
    transform 0.08s;
  flex-shrink: 0;
  padding: 0;
}
.ph-btn:hover,
.ph-btn:active {
  background: #fadcc2;
  color: #4c6680;
  transform: scale(1.1);
}
.ph-btn.ph-son {
  border-style: dashed;
} /* sonore */
.ph-btn.ph-voy {
  border-radius: 50%;
} /* voyelle */

/* ---- Grille voyelles ---- */
.ph-voy-cols {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.ph-voy-sub {
  font-size: 10px;
  color: #819ab4;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.ph-voy-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ph-voy-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ph-voy-lbl {
  font-size: 10px;
  color: #b5adb2;
  width: 65px;
  text-align: right;
  flex-shrink: 0;
}
.ph-voy-grp {
  display: flex;
  gap: 3px;
}

/* ---- Légende ---- */
.ph-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ph-leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #819ab4;
}
.ph-leg-solid {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 1.5px solid #819ab4;
}
.ph-leg-dash {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 1.5px dashed #819ab4;
}
.ph-leg-round {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #819ab4;
}

.ph-voy-row--spacer {
  height: 26px; /* même hauteur qu'une ph-voy-row normale (26px bouton + 4px gap) */
  pointer-events: none;
}
