/* ============================================================
   MODAL DE BIENVENUE (.welcome-modal / dialog)
   ============================================================ */

.welcome-modal {
  width: min(94vw, 34rem);
  max-height: min(92vh, 48rem);
  overflow: auto;
  border: 1px solid rgba(226, 180, 93, 0.34);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(226, 180, 93, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 10rem),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 14px),
    rgba(13, 15, 18, 0.98);
  box-shadow:
    0 2rem 5rem rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.welcome-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.welcome-dialog {
  display: grid;
  gap: 1.1rem;
  padding: clamp(1rem, 4vw, 1.6rem);
}

.welcome-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.welcome-header h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.welcome-close {
  flex: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
  .welcome-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
  }
}

.welcome-intro {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

.welcome-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.welcome-feature {
  display: flex;
  gap: 0.85rem;
  align-items: start;
}

.welcome-feature-icon {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 7px;
  background-color: rgba(226, 180, 93, 0.12);
  border: 1px solid rgba(226, 180, 93, 0.18);
  display: grid;
  place-items: center;
}

.welcome-feature-icon::before {
  content: "";
  display: block;
  width: 1rem;
  height: 1rem;
  background-color: var(--accent);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.welcome-feature-icon--mode::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E");
}

.welcome-feature-icon--route::before {
  -webkit-mask-image: var(--icon-route);
  mask-image: var(--icon-route);
}

.welcome-feature-icon--codex::before {
  -webkit-mask-image: var(--icon-book);
  mask-image: var(--icon-book);
}

.welcome-feature-icon--object::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E");
}

.welcome-feature-icon--save::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

.welcome-feature-body {
  display: grid;
  gap: 0.18rem;
  padding-top: 0.3rem;
}

.welcome-feature-body strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.welcome-feature-body span {
  font-size: 0.77rem;
  color: var(--muted);
  line-height: 1.5;
}

.welcome-start {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #0d0f12;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.72rem 1.4rem;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
  margin-top: 0.3rem;
}

@media (hover: hover) {
  .welcome-start:hover {
    opacity: 0.88;
  }
}

@media (max-width: 480px) {
  .welcome-feature-icon {
    display: none;
  }
}

/* ============================================================
   MODAL DE RÉCAP (.recap-modal / dialog)
   ============================================================ */

.recap-modal {
  width: min(94vw, 32rem);
  max-height: min(92vh, 44rem);
  overflow: auto;
  border: 1px solid rgba(226, 180, 93, 0.34);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(226, 180, 93, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 10rem),
    rgba(13, 15, 18, 0.98);
  box-shadow:
    0 2rem 5rem rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.recap-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.recap-dialog {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 1.5rem);
}

.recap-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.recap-title-block {
  display: grid;
  gap: 0.18rem;
}

.recap-title-block h2 {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 700;
  line-height: 1.2;
}

.recap-close {
  flex: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
  .recap-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
  }
}

.recap-intro {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

.recap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.42rem;
  max-height: min(16rem, 38svh);
  overflow-y: auto;
}

.recap-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
}

@media (hover: hover) {
  .recap-item:hover {
    background: rgba(226, 180, 93, 0.08);
    border-color: rgba(226, 180, 93, 0.28);
  }
}

.recap-thumb {
  flex: none;
  width: 2.4rem;
  aspect-ratio: 1024 / 1536;
  border-radius: 4px;
  overflow: hidden;
  background: #080a0d;
  border: 1px solid var(--line-strong);
}

.recap-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recap-item-body {
  display: grid;
  gap: 0.14rem;
  min-width: 0;
}

.recap-item-chapter {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recap-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recap-actions {
  display: grid;
  gap: 0.5rem;
}

.recap-start {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #0d0f12;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.72rem 1.4rem;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
}

@media (hover: hover) {
  .recap-start:hover {
    opacity: 0.88;
  }
}

.recap-dismiss {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.62rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

@media (hover: hover) {
  .recap-dismiss:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--text);
  }
}

/* ============================================================
   BADGE "NOUVEAU" sur les miniatures
   ============================================================ */

.thumb-new-dot {
  position: absolute;
  top: 0.18rem;
  right: 0.18rem;
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px var(--bg);
  pointer-events: none;
}

/* Nécessite position: relative sur .thumb-button */
.thumb-button {
  position: relative;
}

/* Compteur "nouveau" dans le sélecteur de chapitre */
.chapter-new-badge {
  flex: none;
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #0d0f12;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}
