/* css/style.css */

/* Import Zen Maru Gothic */
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700;900&display=swap');

/* =========================
   RESET / BASE
========================= */
:root{
  /* couleurs "manga mais propre" */

  --header-violet-dark: #1b1630;
  --ink: #0b0b0f;
  --panel: #2a2a3e;
  --paper: #F5F6F8;
  --line: #3a3a52;
  --shadow: rgba(0,0,0,.5);

  /* couleurs du logo */
  --brand-violet: #B87CFF;
  --brand-green:  #46E36B;

  /* accent retiré */
  --accent-border: transparent;
  --accent-border-strong: transparent;

  /* highlight manga discret */
  --manga-glow: rgba(184,124,255,.18);
}

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

html{
  margin: 0 !important;
  padding: 0 !important;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body{
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  font-family:
    "Yu Gothic",
    "YuGothic",
    "游ゴシック",
    "游ゴシック体",
    "Meiryo",
    "Hiragino Kaku Gothic Pro",
    "Hiragino Sans",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;

  line-height:1.6;
  color:#e0e0e0;
  background: var(--paper);
}

/* liens texte */
a{ color: inherit; text-decoration: none; }

/* =========================
   SITE PRESENTATION
========================= */
.site-presentation{
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  position: relative;
}

.presentation-carousel{
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  margin: 0;
}

.presentation-slide{
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.presentation-slide.active{
  opacity: 1;
}

.presentation-slide img{
  width: 100%;
  height: 100%;
  object-fit: cover;

  /* calmer les couleurs + flou global */
  filter:
    blur(3px)
    brightness(1.15)
    contrast(1.05)
    saturate(0.95);

  transform: scale(1.05);
}

.presentation-content{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  z-index: 10;
  color: white;
  padding: .9rem 1.2rem;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 14px;
  backdrop-filter: blur(3px);
}

/* Police identique à la partie résumé */
.presentation-content,
.presentation-content h2,
.presentation-content p{
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
}

/* TITRE */
.presentation-content h2{
  font-size: 1.9rem;
  margin-bottom: .6rem;
  font-weight: 900;

  text-shadow:
    0 2px 4px rgba(0,0,0,0.55);

  opacity: 0;
  animation: fadeInDown 0.8s ease-out 0.3s forwards;
}

/* PREMIER PARAGRAPHE */
.presentation-content > p:first-of-type{
  font-size: 1.15rem;
  margin-bottom: .6rem;

  text-shadow:
    0 1px 3px rgba(0,0,0,0.5);

  opacity: 0;
  animation: fadeInDown 0.8s ease-out 0.8s forwards;
}

/* DERNIER PARAGRAPHE */
.presentation-content > p:last-of-type{
  font-size: 1rem;
  line-height: 1.85;
  white-space: pre-line;

  text-shadow:
    0 1px 3px rgba(0,0,0,0.45);

  opacity: 0;
  animation: fadeInDown 0.8s ease-out 1.3s forwards;
}

/* Animation d'apparition */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flèches de navigation pour la présentation — FLÈCHES ARRONDIES SANS CERCLE */
.presentation-nav-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  background: none;
  border: none;
  padding: 0;

  color: #ffffff;
  font-size: 50px;
  font-weight: 300;

  cursor: pointer;
  z-index: 15;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.25s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Hover violet */
.presentation-nav-arrow:hover{
  color: var(--brand-violet);
  transform: translateY(-50%) scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(184,124,255,0.5));
}

/* Positions inchangées */
.presentation-nav-arrow.prev{
  left: 20px;
}

.presentation-nav-arrow.next{
  right: 20px;
}

.presentation-indicators{
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 11;
}

.indicator{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.3s;
}

.indicator.active{
  background: #B87CFF;
}

/* =========================
   HERO - Titre du tome (BEAUCOUP PLUS D'ESPACE)
========================= */
.hero{
  padding: 8rem 0 1.2rem 0;
  background: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title{
  font-size: 2.2rem;
  font-weight: 900;
  color: #1a1a2e;
  text-align: center;
  margin: 0 auto 2.4rem;
  max-width: 1120px;
  padding: 0 1rem;
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  letter-spacing: 0.05em;
  position: relative;
}

#visitor-count{
  margin-top: 0.7rem;
  margin-right: max(1rem, calc((100% - 1120px) / 2 + 1rem));
  align-self: flex-end;
  width: fit-content;
  background: #ffffff;
  border: 2px solid rgba(184,124,255,.35);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  color: #1a1a2e;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#visitor-count:hover{
  background: var(--brand-violet);
  border-color: var(--brand-violet);
  color: #ffffff;
  transform: scale(1.03);
}

/* =========================
   MAIN LAYOUT
========================= */
.container{
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.6rem 1rem;
}

.main-content{
  display:grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  padding: 2rem;
  min-height: 600px;
  background: #ffffff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 14px 28px var(--shadow);
  position: relative;
  overflow: hidden;
  align-items: start;
}

/* "texture manga" discrète */
.main-content::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(135deg, rgba(184,124,255,.10), transparent 55%);
  opacity: .55;
  pointer-events:none;
}

/* bordure intérieure type cadre */
.main-content::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events:none;
}

/* =========================
   CHAPTERS
========================= */
.chapters-section{
  display:flex;
  flex-direction:column;
  gap: 1.2rem;
  position: relative;
  z-index: 1;
}

#chapters-container{
  display:flex;
  flex-direction:column;
  gap: 1.2rem;
}

.chapter-card{
  display:flex;
  align-items:center;
  gap: 1rem;
  cursor:pointer;
  transition: transform .25s;
  position: relative;
}

.chapter-card:hover{
  transform: translateX(10px);
}

.chapter-icon{
  position:relative;
  width: 70px;
  height: 70px;
  overflow:hidden;
  border-radius: 12px;
  border: 2px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.08);
  box-shadow: 0 10px 18px rgba(0,0,0,.12);
}

.chapter-icon img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit: cover;
  opacity: .85;
  z-index:1;
}

.chapter-icon::after{
  content: attr(data-label);
  position:relative;
  z-index:2;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  height:100%;
  font-weight: 900;
  font-size: 0.8rem;
  line-height: 1.2;
  color:#fff;
  text-shadow: 0 3px 10px rgba(0,0,0,.55);
  text-align: center;
  padding: 0.3rem;
}

.chapter-title{
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  text-align: center;

  padding: 0.8rem 1.4rem;

  background: #ffffff;
  border: 2px solid var(--brand-violet);
  color:#1a1a2e;
  font-size: 1.05rem;
  font-weight: 900;

  max-width: 420px;
  width: 100%;
  flex: none;

  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(0,0,0,.18);
}


.chapter-title::before{
  content:"";
  position:absolute;
  left: 10px;
  top: 10px;
  width: 10px;
  height: calc(100% - 20px);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--brand-violet), rgba(184,124,255,.55));
  opacity: .55;
}

.chapter-card:hover .chapter-title{
  color: var(--brand-violet);
  border-color: var(--brand-violet);
  text-shadow: none;
  transform: translateY(-1px);
}

/* =========================
   INTRO SIDEBAR (box-shadow réduite)
========================= */
.intro-sidebar{
  background: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 1.7rem;
  height: fit-content;
  box-shadow: 0 8px 16px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
  transition: transform .3s ease, box-shadow .3s ease;
}

.intro-sidebar:hover{
  transform: scale(1.02);
  box-shadow: 0 12px 22px rgba(0,0,0,.35);
}

.intro-sidebar:hover h2{
  color: var(--brand-violet);
}

.intro-sidebar h2{
  font-size: 1.45rem;
  margin-bottom: 1.2rem;
  text-align:center;
  font-weight: 900;
  color: #1a1a2e;
  transition: color .3s;
}

.intro-content{
  overflow-y:auto;
  max-height: 520px;
  padding-right: .25rem;
}

.intro-content p{
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-line;
  color:#2d3142;
}

/* =========================
   LINKS — Rectangle compact
========================= */
.links-section{
  margin-top: 1.2rem;
  padding: 2.2rem 0;
}

.links-section .container{
  max-width: fit-content;
  padding: 1.8rem 2rem;
  background: #ffffff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 14px 28px var(--shadow);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

/* "texture manga" discrète */
.links-section .container::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(135deg, rgba(184,124,255,.10), transparent 55%);
  opacity: .55;
  pointer-events:none;
}

/* bordure intérieure type cadre */
.links-section .container::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events:none;
}

.links-section h2{
  font-size: 1.5rem;
  color:#1a1a2e;
  text-align:center;
  font-weight: 900;
  margin-bottom: 0.6rem;
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
  cursor: default;
}

.links-section:hover h2{
  color: var(--brand-violet);
}

.links-carousel{
  position: relative;
  display:flex;
  align-items:center;
  justify-content: center;
  gap: 1rem;
  max-width: 100%;
  margin: 0 auto;
  z-index: 1;
}

/* Flèches des liens — FLÈCHES ARRONDIES SANS CERCLE */
.carousel-btn{
  background: none;
  border: none;
  box-shadow: none;

  width: auto;
  height: auto;

  color: #000;
  font-size: 42px;
  font-weight: 300;

  cursor: pointer;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.25s ease;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.carousel-btn:hover{
  color: var(--brand-violet);
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(184,124,255,0.4));
}

.carousel-btn .arrow-icon::before{
  content: '‹';
}

.carousel-btn.next .arrow-icon::before{
  content: '›';
}

.links-grid{
  display:flex;
  gap: .8rem;
  overflow-x:auto;
  scroll-behavior:smooth;
  padding: .8rem 0;
  flex:1;
  justify-content: flex-start;
  flex-wrap: nowrap;
  max-width: 520px;
}

.links-grid::-webkit-scrollbar{ height: 5px; }
.links-grid::-webkit-scrollbar-track{ background: #1a1a2e; border-radius: 999px; }
.links-grid::-webkit-scrollbar-thumb{ background: rgba(184,124,255,.55); border-radius: 999px; }

.link-card{
  background: #ffffff;
  border: 2px solid rgba(184,124,255,.35);
  border-radius: 12px;
  padding: .8rem;
  min-width: 110px;
  text-align:center;
  cursor:pointer;
  flex-shrink:0;

  box-shadow: 0 4px 10px rgba(0,0,0,.18);
  transition: transform .3s ease, border-color .2s, box-shadow .3s ease;
}


.link-card:hover{
  transform: scale(1.06) translateY(-2px);
  border-color: rgba(184,124,255,.75);
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
}

.link-card h3{
  font-size: .85rem;
  font-weight: 800;
  color: #1a1a2e;
  transition: color .2s, text-shadow .2s;
}

.link-card:hover h3{
  color: var(--brand-violet);
  text-shadow: none;
}

.link-icon{
  width: 38px;
  height: 38px;
  background: #F5F6F8;
  border-radius: 50%;
  margin: 0 auto .5rem;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border: 2px solid rgba(184,124,255,.25);
}

.link-icon img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.link-description {
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.72rem;
  margin-top: 4px;
  color: #6b4eff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  pointer-events: none;   /* ← FIX SCROLL */
}

/* =========================
   CHAPTER INDEX (SIDEBAR)
========================= */

.chapter-index{
  position: sticky;
  top: 140px;              /* distance depuis le header */
  width: 200px;
  background: #ffffff;
  border: 2px solid rgba(184,124,255,.35);
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 8px 16px rgba(0,0,0,.25);
  z-index: 2;
}
.chapter-index h3 {
  font-size: 0.95rem;
  font-weight: 900;
  color: #1a1a2e;
  margin-bottom: 1rem;
  text-align: center;
  transition: color 0.2s ease;
}

.chapter-index:hover h3 {
  color: #8b5cf6; /* violet */
}



.chapter-index ul{
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapter-index li{
  margin-bottom: .45rem;
}

.chapter-index a{
  color: #1a1a2e;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: .4rem .6rem;
  border-radius: 6px;
  transition: all .2s;
}

.chapter-index a::before{
  content: '•';
  margin-right: .5rem;
  color: var(--brand-violet);
}

.chapter-index a:hover{
  color: var(--brand-violet);
  background: rgba(184,124,255,.1);
  transform: translateX(5px);
}


/* === FIX VISUEL : ALIGNER AVEC L’INDEX === */
body.chapter-page .chapter-index{
  top: 180px; /* ← ajuste si besoin (160–200px) */
}
body.chapter-page .container-chapter {
    position: relative;
    left: -90px; /* ← ALIGNEMENT EXACT AVEC LE HEADER */
}


/* =========================
   CHAPTER CONTENT
========================= */

/* css/chapter.css - Styles spécifiques aux pages chapitre */

/* CHAPTER 2 */

/* CHAPTER 1 */

/* =========================
   CONTAINER PRINCIPAL CHAPITRE
========================= */
.container-chapter {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 2rem 1rem;

    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: flex-start;

    transform: translateX(-40px); /* ← DÉCALAGE GLOBAL */
    color: #000;
    align-items: start;
}



/* =========================
   INDEX LATÉRAL
========================= */
.container-chapter .chapter-index {
    position: sticky;
    top: 120px;
    background: #ffffff;
    border: 2px solid #B87CFF;
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,.2);
    width: 200px;
    margin-bottom: 20px;
}


.container-chapter .chapter-index h3 {
    font-size: 0.95rem;
    font-weight: 900;
    color: #000;
    margin-bottom: 2rem;
    text-align: center;
    transition: color 0.2s ease;
}



.container-chapter .chapter-index ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.container-chapter .chapter-index li {
    margin-bottom: .45rem;
}

.container-chapter .chapter-index a {
    color: #000;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: .4rem .6rem;
    border-radius: 6px;
    transition: all .2s;
}


/* =========================
   NAVIGATION BETWEEN CHAPTERS
========================= */
.chapter-navigation {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.chapter-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: #ffffff;
    color: #1a1a2e;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    cursor: pointer;
}

.chapter-nav-btn:hover {
    background: #B87CFF;
    color: #ffffff;
    border-color: #B87CFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 124, 255, 0.4);
}

/* Supprimer les flèches - le texte vient du JSON */

/* =========================
   ZONE DE CONTENU PRINCIPALE
========================= */
.container-chapter .main-content-area {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    color: #000;
}

/* Chapter 2 desktop placement with top navigation outside main-content-area */
.chapter-2-page .container-chapter > .chapter-navigation:first-of-type {
    grid-column: 2;
    grid-row: 1;
}

.chapter-2-page .container-chapter > .chapter-index {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.chapter-2-page .container-chapter > .main-content-area {
    grid-column: 2;
    grid-row: 2;
}

/* Police manga pour tout le contenu */
.container-chapter .main-content-area,
.container-chapter .main-content-area p,
.container-chapter .main-content-area li,
.container-chapter .main-content-area span,
.container-chapter .main-content-area div {
    font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
}

/* Exceptions : garder Yu Gothic pour les titres de sous-points */
.container-chapter .housing-type-title {
    font-family: "Yu Gothic", "YuGothic", sans-serif !important;
}

/* =========================
   TITRE DE SECTION
========================= */
.container-chapter .section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #000;
    text-align: center;
    margin-bottom: 1.2rem;
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    position: relative;
    padding-bottom: 0.5rem;
}


/* =========================
   MAIN POINT - Container
========================= */

.container-chapter .main-point {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(0,0,0,.10);
}


/* =========================
   IMAGE DU POINT
========================= */
.container-chapter .point-image {
    margin-bottom: 1.5rem;
    text-align: center;
}

.container-chapter .point-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

/* =========================
   CONTENU DU POINT
========================= */
.container-chapter .point-content {
    background: transparent;
    border-radius: 10px;
    padding: 1.5rem;
}


/* Titre du type (sous-point) */
.container-chapter .housing-type-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 2rem;
    text-align: center;
    font-family: "Yu Gothic", "YuGothic", sans-serif;
}

/* Subtitle - citation */
.container-chapter .housing-subtitle {
    font-family: 'Zen Maru Gothic', "Yu Gothic", sans-serif;
    font-size: 1rem;
    font-style: italic;
    color: #4a4a6a;
    padding: 1rem 1.5rem;
    background: #f5f3ff;
    border: 2px solid #B87CFF;
    border-radius: 12px;
    line-height: 1.6;
    white-space: pre-line;
    display: inline-block;
    max-width: 90%;
    text-align: center;
}

/* Conteneur parent pour centrer la citation */
.container-chapter .housing-subtitle-container {
    text-align: center;
    margin-bottom: 1.5rem;
    width: 100%;
}


/* Description principale */
.container-chapter .housing-description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #000;
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

/* Cards principales pour chaque type de logement */
.container-chapter #section-0 .point-content > div {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
    padding: 1.6rem;
    color: #000;
    position: relative;
    overflow: hidden;
    margin-top: 1.8rem !important;
}

.container-chapter #section-0 .point-content > div:first-child {
    margin-top: 0 !important;
}

.container-chapter #section-0 .housing-type-title {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    text-align: center;
    color: #000;
    transition: color 0.25s ease;
}

.container-chapter #section-0 .housing-description {
    color: #000;
}

/* Chapter emphasis + warning placement */
.container-chapter .highlight-violet {
    color: var(--brand-violet);
    font-weight: 700;
    background: rgba(184,124,255,.18);
    padding: 0.05rem 0.35rem;
    border-radius: 6px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.container-chapter #section-0 .housing-description-text {
    margin: 0 0 1rem 0;
}

.container-chapter #section-0 .housing-warning-block {
    margin: 0.2rem 0 1rem 0;
}

.container-chapter #section-0 .housing-detail-title {
    text-align: center;
    color: #000;
    transition: color 0.25s ease;
}

.container-chapter .housing-detail-title {
    margin: 0 0 0.8rem 0;
}

.container-chapter .housing-detail-text,
.container-chapter .housing-description-text {
    margin-top: 0;
}

.container-chapter #section-0 .housing-description + .housing-detail-title {
    margin-top: 0;
}

.container-chapter #section-0 .housing-description:hover .housing-detail-title,
.container-chapter #section-0 .housing-detail:hover .housing-detail-title {
    color: var(--brand-violet);
}

/* Cards secondaires : Smart Housing & Contract Point */
.container-chapter #section-1 .main-point,
.container-chapter #section-2 .main-point {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(0,0,0,.10);
    overflow: hidden;
}

.container-chapter #section-1 .point-content,
.container-chapter #section-2 .point-content {
    padding: 1.2rem;
    color: #000;
}

.container-chapter #section-1 .housing-type-title,
.container-chapter #section-2 .housing-type-title {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
    text-align: center;
    margin-bottom: 1rem;
    transition: color 0.25s ease;
}

.container-chapter #section-1 .point-content p,
.container-chapter #section-2 .point-content p,
.container-chapter #section-1 .point-content li,
.container-chapter #section-2 .point-content li,
.container-chapter #section-1 .point-content span,
.container-chapter #section-2 .point-content span {
    color: #000;
}

.container-chapter #section-0 .point-content span.highlight-violet,
.container-chapter #section-1 .point-content span.highlight-violet,
.container-chapter #section-2 .point-content span.highlight-violet {
    color: var(--brand-violet);
}

/* Harmoniser Smart Housing & Contract Point avec Type de logement */
.container-chapter #section-1 h4,
.container-chapter #section-2 h4 {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
    margin: 0 0 0.8rem 0;
    text-align: center;
}

.container-chapter #section-1 p,
.container-chapter #section-2 p {
    font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #000;
    margin: 0 0 1.2rem 0;
    white-space: pre-line;
}

.container-chapter #section-1 ul,
.container-chapter #section-2 ul,
.container-chapter #section-1 li,
.container-chapter #section-2 li {
    color: #000;
}

.container-chapter #section-1 .housing-detail,
.container-chapter #section-2 .housing-detail {
    margin-top: 1.5rem;
}

.container-chapter #section-1 .housing-detail-title,
.container-chapter #section-2 .housing-detail-title {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
    margin: 0 0 0.8rem 0;
    text-align: center;
    transition: color 0.25s ease;
}

.container-chapter #section-1 .housing-detail-text,
.container-chapter #section-2 .housing-detail-text {
    font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #000;
    margin: 0 0 1.2rem 0;
    white-space: pre-line;
}

.container-chapter #section-2 .housing-detail-list {
    margin-top: 0.8rem;
    padding-left: 1.5rem;
    list-style: disc;
}

.container-chapter #section-2 .housing-detail-item {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #000;
}

.container-chapter #section-0 .chapter4-orange-list,
.container-chapter #section-1 .chapter4-orange-list {
    width: fit-content;
    max-width: 100%;
    display: inline-block;
    align-self: flex-start;
    height: auto;
    min-height: 0;
    white-space: normal;
    padding: 0.7rem 1rem 0.45rem;
    margin: 0.8rem 0 1.2rem 0;
}

.container-chapter #section-0 .chapter4-orange-list h4,
.container-chapter #section-1 .chapter4-orange-list h4 {
    justify-content: flex-start;
    text-align: left;
    margin: 0 0 0.45rem 0;
}

.container-chapter #section-0 .chapter4-orange-list ul,
.container-chapter #section-1 .chapter4-orange-list ul {
    margin: 0;
}

.container-chapter #section-0 .chapter4-orange-list li,
.container-chapter #section-1 .chapter4-orange-list li {
    padding: 0.32rem 0 0.32rem 1.6rem;
    margin: 0;
}

.container-chapter #section-0 .chapter4-section-content .housing-detail {
    margin-top: 1.5rem;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
    padding: 1rem 1.2rem;
    overflow: visible;
}

.container-chapter #section-0 .chapter4-section-content .housing-detail-title {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
    margin: 0 0 0.8rem 0;
    text-align: center;
    transition: color 0.25s ease;
}

.container-chapter #section-0 .chapter4-section-content .housing-detail-text {
    font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #000;
    margin: 0 0 1.2rem 0;
    white-space: pre-line;
}

.container-chapter #section-0 .chapter4-section-content .housing-detail:hover .housing-detail-title {
    color: var(--brand-violet);
}

/* Hover violet sur titres des cards */
.container-chapter #section-0 .point-content > div:hover .housing-type-title {
    color: var(--brand-violet);
}

.container-chapter #section-1 .main-point:hover .housing-type-title,
.container-chapter #section-2 .main-point:hover .housing-type-title {
    color: var(--brand-violet);
}

.container-chapter #section-1 .housing-detail:hover .housing-detail-title,
.container-chapter #section-2 .housing-detail:hover .housing-detail-title {
    color: var(--brand-violet);
}

/* Tip/Warning: permettre le dﾃｩbordement des cards */
.container-chapter #section-0 .point-content > div,
.container-chapter #section-1 .main-point,
.container-chapter #section-2 .main-point,
.container-chapter #section-1 .housing-detail,
.container-chapter #section-2 .housing-detail {
    overflow: visible;
}
/* Cards secondaires pour sections pratiques (Smart Housing + Contract Point) */
.container-chapter #section-1 .housing-detail,
.container-chapter #section-2 .housing-detail {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
    padding: 1rem 1.2rem;
}

/* Chapter 2: make section-0 cards match Renewal Status cards */
.chapter-2-page .container-chapter #section-0 .point-content > div {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
    padding: 1rem 1.2rem;
    margin-top: 1.5rem !important;
}

.chapter-2-page .container-chapter #section-0 .point-content > div:first-child {
    margin-top: 1.5rem !important;
}

.chapter-2-page .container-chapter #section-0 .point-content > div:hover .housing-detail-title {
    color: var(--brand-violet);
}

.chapter-2-page .container-chapter #section-0 .housing-detail-title {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
    margin: 0 0 0.8rem 0;
    text-align: center;
    transition: color 0.25s ease;
}

.chapter-2-page .container-chapter #section-0 .housing-detail-text,
.chapter-2-page .container-chapter #section-0 .housing-description-text {
    font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #000;
    margin: 0 0 1.2rem 0;
    white-space: pre-line;
}

/* =========================
   TIP & WARNING — STYLES COMMUNS
========================= */

.housing-tip,
.housing-warning {
  display: inline-block;
  position: relative;
  cursor: pointer;
  margin: 0 0 0 0.15rem;
  padding: 0.15rem 0.25rem;
  border: 1px solid;
  border-radius: 3px;
  line-height: 1.7;
  vertical-align: baseline;
  font-size: 0.95rem;
  text-align: center;
}

/* Couleurs spécifiques Tips */
.housing-tip {
  background: #f5f3ff;
  border-color: #B87CFF;
}

.housing-tip:hover {
  background: #ede7ff;
}

/* Couleurs spécifiques Warnings */
.housing-warning {
  background: #fff9e6;
  border-color: #ffc107;
}

.housing-warning:hover {
  background: #fff5d6;
}

/* Icônes */
.housing-tip::before {
  content: '💡';
  font-size: 0.9rem;
  display: inline-block;
  line-height: 1;
}

.housing-warning::before {
  content: '⚠️';
  font-size: 0.9rem;
  display: inline-block;
  line-height: 1;
}

/* Agrandissement au hover */
.housing-tip:hover,
.housing-warning:hover {
  transform: scale(1.1);
}

/* =========================
   TIP — BULLE AU SURVOL
========================= */

/* Bulle de texte - Design identique aux citations */
.housing-tip::after {
  content: attr(data-tip);

  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);

  /* Design des citations */
  background: #f5f3ff;
  color: #4a4a6a;
  border: 2px solid #B87CFF;
  border-radius: 12px;

  font-family: 'Zen Maru Gothic', "Yu Gothic", sans-serif;
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.8rem 1.2rem;
  line-height: 1.5;

  white-space: normal;
  max-width: 300px;
  width: max-content;
  min-width: 150px;
  text-align: center;

  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;

  box-shadow: 0 4px 12px rgba(184, 124, 255, 0.3);
}

/* Apparition au hover */
.housing-tip:hover::after {
  opacity: 1;
}

/* =========================
   WARNING — BULLE AU SURVOL
========================= */

/* Bulle de texte - Design similaire aux citations mais en jaune */
.housing-warning::after {
  content: attr(data-warning);

  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);

  /* Design jaune/orange pour l'avertissement */
  background: #fff9e6;
  color: #856404;
  border: 2px solid #ffc107;
  border-radius: 12px;

  font-family: 'Zen Maru Gothic', "Yu Gothic", sans-serif;
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.8rem 1.2rem;
  line-height: 1.5;

  white-space: normal;
  max-width: 300px;
  width: max-content;
  min-width: 150px;
  text-align: center;

  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;

  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* Apparition au hover */
.housing-warning:hover::after {
  opacity: 1;
}



/* =========================
   PROS & CONS CONTAINER
========================= */
.container-chapter .proscons-container {
    margin-top: 2rem;
}

/* Bouton déroulant */
.container-chapter .proscons-toggle{
  width: fit-content;      /* ⬅️ clé du problème */
  background: #ffffff;
  color: #1a1a2e;
  border: 2px solid #e0e0e0;

  padding: 1rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;

  display: inline-flex;    /* ⬅️ empêche de prendre toute la ligne */
  align-items: center;
  gap: 0.75rem;

  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}


.container-chapter .proscons-toggle:hover {
    background: #B87CFF;
    color: #ffffff;
    border-color: #B87CFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 124, 255, 0.4);
}

.container-chapter .proscons-arrow {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.container-chapter .proscons-toggle.active .proscons-arrow {
    transform: rotate(180deg);
}

/* Contenu déroulant */
.container-chapter .proscons-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, background-color 0.6s ease, box-shadow 0.6s ease;
}

.container-chapter .proscons-content.active {
    max-height: 1000px;
}

.container-chapter .proscons-content.proscons-highlight {
    border-radius: 12px;
}

.container-chapter .proscons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* =========================
   PROS (Avantages)
========================= */
.container-chapter .pros-section {
    background: #f1fbf2;
    border: 2px solid #6ccf7a;
    border-radius: 10px;
    padding: 1.2rem;
}

.container-chapter .pros-section h4 {
    color: #000;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.container-chapter .pros-section h4::before {
    content: '✔';
    font-size: 1.1rem;
    color: #2ea24c;
}

.container-chapter .pros-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.container-chapter .pros-section li {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0.5rem 0;
    padding-left: 1.6rem;
    position: relative;
    color: #000;
}

.container-chapter #section-1 .pros-section.bank-account-benefits {
    padding: 0.7rem 1rem 0.45rem;
    width: fit-content;
    max-width: 700px;
    display: inline-block;
    align-self: flex-start;
    height: auto;
    min-height: 0;
    white-space: normal;
}

.container-chapter #section-1 .pros-section.bank-account-benefits h4 {
    margin: 0 0 0.45rem 0;
    font-weight: 700;
    justify-content: flex-start;
    text-align: left;
}

.container-chapter #section-1 .pros-section.bank-account-benefits ul {
    margin: 0;
    padding: 0;
}

.container-chapter #section-1 .pros-section.bank-account-benefits li {
    padding: 0.32rem 0 0.32rem 1.6rem;
    text-align: left;
}

/* Chapter5 required_items: même logique compacte que chapter4 */
.container-chapter #section-0 .pros-section.bank-account-benefits {
    padding: 0.7rem 1rem 0.45rem;
    width: fit-content;
    max-width: 100%;
    display: inline-block;
    align-self: flex-start;
    height: auto;
    min-height: 0;
    white-space: normal;
    margin: 0.8rem 0 1.2rem 0;
}

.container-chapter #section-0 .pros-section.bank-account-benefits h4 {
    margin: 0 0 0.45rem 0;
    font-weight: 700;
    justify-content: flex-start;
    text-align: left;
}

.container-chapter #section-0 .pros-section.bank-account-benefits ul {
    margin: 0;
    padding: 0;
}

.container-chapter #section-0 .pros-section.bank-account-benefits li {
    padding: 0.32rem 0 0.32rem 1.6rem;
    text-align: left;
}

.container-chapter .pros-section li::before {
    content: '✔';
    position: absolute;
    left: 0;
    color: #2ea24c;
    font-weight: bold;
}

/* =========================
   CONS (Inconvénients)
========================= */
.container-chapter .cons-section {
    background: #fff7e8;
    border: 2px solid #f2b24c;
    border-radius: 10px;
    padding: 1.2rem;
}

.container-chapter .cons-section h4 {
    color: #000;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.container-chapter .cons-section h4::before {
    content: '⚠';
    font-size: 1.1rem;
    color: #e39a2f;
}

.container-chapter .cons-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.container-chapter .cons-section li {
    font-family: "Yu Gothic", "YuGothic", sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0.5rem 0;
    padding-left: 1.6rem;
    position: relative;
    color: #000;
}

.container-chapter .cons-section li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    color: #e39a2f;
    font-weight: bold;
}


/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .container-chapter {
        transform: none;
        left: 0;
    }

    .container-chapter .chapter-navigation {
        justify-content: space-between;
        flex-wrap: nowrap;
        row-gap: 0.6rem;
        align-self: stretch;
    }

    .container-chapter .chapter-nav-btn {
        flex: 0 0 auto;
    }

    .container-chapter .proscons-grid {
        grid-template-columns: 1fr;
    }

    /* Responsive-only chapter layout: nav row, index centered, content centered */
    body.chapter-page .container-chapter {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    body.chapter-page .container-chapter .main-content-area {
        display: contents;
    }

    body.chapter-page .container-chapter .chapter-navigation {
        order: 0;
        justify-content: space-between;
        flex-wrap: nowrap;
        row-gap: 0.6rem;
        margin-bottom: 0.2rem;
        align-self: stretch;
    }

    body.chapter-page .container-chapter .chapter-navigation:first-of-type {
        order: 0;
    }

    body.chapter-page .container-chapter .chapter-nav-btn.prev {
        margin-right: auto;
    }

    body.chapter-page .container-chapter .chapter-nav-btn.next {
        margin-left: auto;
    }

    body.chapter-page .container-chapter .chapter-index {
        order: 1;
        margin: 0;
        align-self: flex-start;
        position: static;
        top: auto;
    }

    body.chapter-page .container-chapter section {
        order: 2;
    }

    body.chapter-page .container-chapter .section-title {
        margin-bottom: 0.6rem;
    }

    body.chapter-page .container-chapter .main-point {
        margin-top: 0.4rem;
    }

    body.chapter-page .container-chapter .chapter-navigation:last-of-type {
        order: 3;
    }

    /* Chapter 2 responsive flow: top nav -> index -> main content */
    body.chapter-page :is(.chapter-container, .container-chapter) {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.8rem;
        align-items: start;
        transform: none;
    }

    body.chapter-page :is(.chapter-container, .container-chapter) > .chapter-navigation:first-of-type {
        grid-column: 1;
        grid-row: 1;
    }

    body.chapter-page :is(.chapter-container, .container-chapter) > .chapter-index {
        grid-column: 1;
        grid-row: 2;
        margin: 0;
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        position: static;
        top: auto;
    }

    body.chapter-page :is(.chapter-container, .container-chapter) > .main-content-area {
        grid-column: 1;
        grid-row: 3;
        display: block !important;
    }

    body.chapter-page :is(.chapter-container, .container-chapter) > .main-content-area > section {
        margin-bottom: 3rem;
    }

    body.chapter-page :is(.chapter-container, .container-chapter) > .main-content-area > section:last-of-type {
        margin-bottom: 0;
    }
}


@media (max-width: 768px) {
    body.chapter-page .container-chapter .chapter-navigation {
        justify-content: space-between;
        flex-wrap: nowrap;
        align-self: stretch;
    }
}



/* =========================
   RESPONSIVE CHAPTER
========================= */
@media (max-width: 1024px){
  .main-content{ grid-template-columns: 1fr; }
  .intro-sidebar{ order: -1; }
  .footer-info{ grid-template-columns: 1fr; text-align:center; }
  body.chapter-page .container-chapter {left: 0;}
}

@media (max-width: 768px){
  /* Global phone readability: slightly less "tiny" feeling */
  html{ font-size: 16.5px; }
  body{ line-height: 1.65; }
  .container{
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
  .main-content{
    padding: 1.45rem;
    gap: 1.4rem;
  }

  nav{ flex-direction: column; gap: .9rem; }
  .chapter-card{ flex-direction: column; text-align:center; }
  .chapter-title{ min-width:auto; width:100%; }
  .links-carousel{ flex-direction: column; }
  .carousel-btn{ display:none; }

  /* Mobile links section: keep layout lighter while preserving existing design */
  .links-section{
    padding: 2.15rem 0 1.95rem;
  }

  .links-section .container{
    width: calc(100% - 2.2rem);
    max-width: none;
    padding: 1.25rem 0.9rem;
  }

  /* Balanced spacing around the horizontal list */
  .links-carousel{
    width: 100%;
    gap: 0.55rem;
  }

  /* Smoother horizontal swipe with cleaner card flow */
  .links-grid{
    max-width: 100%;
    gap: 0.65rem;
    padding: 0.7rem 0.1rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0.15rem;
    overscroll-behavior-x: contain;
  }

  /* Slightly smaller cards for easier side-scroll on iPhone */
  .link-card{
    min-width: 108px;
    padding: 0.68rem 0.62rem;
    scroll-snap-align: start;
  }

  /* Slightly smaller icon while keeping the same shape/style */
  .link-icon{
    width: 34px;
    height: 34px;
    margin-bottom: 0.45rem;
  }

  /* Reduce text sizes just enough to keep cards readable and compact */
  .link-card h3{
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .link-description{
    font-size: 0.68rem;
    line-height: 1.3;
  }

  /* Index hero/presentation: keep full title + description visible on iPhone */
  body:not(.chapter-page) .presentation-carousel{
    height: 440px;
  }

  body:not(.chapter-page) .presentation-content{
    width: min(92vw, 38rem);
    max-width: 92vw;
    padding: 0.72rem 0.9rem;
  }

  body:not(.chapter-page) .presentation-content h2{
    font-size: 1.35rem;
    line-height: 1.3;
  }

  body:not(.chapter-page) .presentation-content > p:first-of-type{
    font-size: 0.98rem;
    line-height: 1.45;
  }

  body:not(.chapter-page) .presentation-content > p:last-of-type{
    font-size: 0.86rem;
    line-height: 1.6;
  }

  body:not(.chapter-page) .hero-title{
    font-size: 1.9rem;
    line-height: 1.35;
  }
}

@media (max-width: 430px){
  body:not(.chapter-page) .hero{
    padding: 4rem 0 1rem 0;
    isolation: isolate;
  }

  body:not(.chapter-page) .hero::before{
    content: "";
    position: absolute;
    inset: 2.4rem 0.75rem 0.15rem;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.96));
    border: 1px solid rgba(27,22,48,0.08);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
    z-index: 0;
    pointer-events: none;
  }

  body:not(.chapter-page) .hero-title{
    position: relative;
    z-index: 1;
    font-size: 1.56rem;
    line-height: 1.35;
    color: #121428;
    margin-bottom: 1.3rem;
    padding: 0 1.25rem;
    text-shadow: 0 1px 2px rgba(255,255,255,0.75), 0 2px 10px rgba(0,0,0,0.18);
  }

  body:not(.chapter-page) #visitor-count{
    position: relative;
    z-index: 1;
    margin-right: 1rem;
    margin-top: 0.3rem;
    font-size: 0.84rem;
    padding: 0.42rem 0.78rem;
    box-shadow: 0 5px 12px rgba(0,0,0,0.14);
  }
}

/* =========================
   CHAPTER ADS
========================= */
body.chapter-page .chapter-ad-vertical{
  position: fixed;
  right: 10px;
  top: 160px;
  width: 160px;
  height: auto;
  min-height: 600px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: red;
  font-size: 14px;
  font-weight: 700;
  transform: translateX(100%);
  z-index: 5;
}

body.chapter-page .chapter-ad-horizontal{
  width: 100%;
  max-width: 728px;
  height: 90px;
  background: transparent;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: red;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  top: -10px;
}

@media (max-width: 1200px){
  body.chapter-page .chapter-ad-vertical{
    display: none;
  }
}

/* =========================
   CHAPTER ENDING CARD
========================= */
.container-chapter .chapter-ending-wrap{
  width: 100%;
  max-width: 760px;
  margin: 1.2rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.container-chapter .chapter-ending-card{
  width: 100%;
  max-width: none;
  margin: 0;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
}

.container-chapter .chapter-ending-card img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.container-chapter .chapter-feedback-link{
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.95rem;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 10px;
  background: #ffffff;
  color: #1a1a2e;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .2s ease;
}

.container-chapter .chapter-feedback-link:hover{
  background: var(--brand-violet);
  border-color: var(--brand-violet);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Responsive safety for final chapter thank-you block */
.container-chapter section:last-of-type,
.container-chapter section:last-of-type .main-point,
.container-chapter section:last-of-type .point-content {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.container-chapter section:last-of-type .chapter-ending-wrap,
.container-chapter section:last-of-type .chapter-ending-card,
.container-chapter section:last-of-type .chapter-feedback-link {
  position: static;
  inset: auto;
}

.container-chapter section:last-of-type .chapter-ending-wrap {
  width: 100%;
  max-width: 100%;
  align-items: center;
  justify-content: flex-start;
  overflow: visible;
}

.container-chapter section:last-of-type .chapter-ending-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.container-chapter section:last-of-type .chapter-ending-card img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-inline: auto;
}

.container-chapter section:last-of-type .chapter-feedback-link {
  align-self: center;
  max-width: 100%;
  width: auto;
  white-space: normal;
  text-align: center;
}

@media (max-width: 768px) {
  .container-chapter section:last-of-type .chapter-ending-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .container-chapter section:last-of-type .chapter-ending-card {
    width: 100%;
  }

  .container-chapter section:last-of-type .chapter-feedback-link {
    align-self: center;
    margin-inline: auto;
  }
}

@media (max-width: 480px) {
  .container-chapter section:last-of-type .chapter-ending-card {
    padding: clamp(0.7rem, 3vw, 1rem);
  }

  .container-chapter section:last-of-type .chapter-feedback-link {
    width: min(100%, 20rem);
  }
}

/* ===== CONTACT PAGE ===== */
body.contact-page .chapter-container .chapter-index {
  visibility: hidden;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

body.contact-page .chapter-container #chapters .section-title {
  text-align: center;
  transition: color 0.2s ease;
}

body.contact-page .chapter-container #chapters .main-point {
  display: block;
}

body.contact-page .chapter-container #chapters .housing-detail {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}

body.contact-page .chapter-container #chapters .housing-detail-title {
  text-align: center;
  transition: color 0.2s ease;
}

body.contact-page .chapter-container #contact-links-list {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
}

body.contact-page .chapter-container #contact-links-list .chapter-feedback-link {
  align-self: flex-start;
  width: 220px;
  max-width: 100%;
}

body.contact-page .chapter-container #chapters .housing-detail:hover .housing-detail-title,
body.contact-page .chapter-container #chapters .housing-detail-title:hover,
body.contact-page .chapter-container #chapters .section-title:hover {
  color: #b87cff;
}

body.contact-page .chapter-container #chapters:hover .section-title {
  color: #b87cff;
}

body.contact-page .footer-copyright {
  position: relative;
}

body.contact-page #footer-privacy {
  position: absolute;
  left: 0;
  top: 0;
}

@media (max-width: 768px) {
  body.privacy-page .chapter-container {
    margin-bottom: 0.8rem;
  }

  body.privacy-page footer {
    margin-top: 0.8rem;
  }

  body.privacy-page .footer-copyright {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
  }

  body.privacy-page #footer-privacy {
    position: static;
    left: auto;
    top: auto;
    margin: 0;
  }
}

.privacy-contact-links {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
  text-align: left;
}

#privacy-contact-description {
  text-align: left;
}

.privacy-contact-links a {
  display: block;
  text-align: left;
}

.privacy-contact-links .chapter-feedback-link {
  align-self: flex-start;
  justify-content: flex-start;
}

/* ===== COOKIE CONSENT ===== */
.cookie-consent-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1200;
  display: none;
  background: #ffffff;
  border: 2px solid rgba(184,124,255,.35);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0,0,0,.28);
  padding: 0.9rem 1rem;
  color: #1a1a2e;
}

.cookie-consent-banner.show {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.cookie-consent-title,
.cookie-consent-text {
  margin: 0;
}

.cookie-consent-title {
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cookie-consent-text {
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
  flex: 1;
}

.cookie-consent-accept {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 10px;
  background: #ffffff;
  color: #1a1a2e;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.46rem 0.8rem;
  cursor: pointer;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
  white-space: nowrap;
}

.cookie-consent-accept:hover {
  background: var(--brand-violet);
  border-color: var(--brand-violet);
  color: #ffffff;
}

@media (max-width: 900px) {
  .cookie-consent-banner.show {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-consent-accept {
    align-self: flex-end;
  }
}

/* =========================
   CHAPTER 3 - USEFUL APPS
========================= */
.container-chapter #section-2 .useful-apps-main {
  margin-top: 1.5rem;
}

.container-chapter #section-2 .useful-apps-main > .housing-detail-title {
  text-align: center;
}

.container-chapter #section-2 .useful-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.container-chapter #section-2 .useful-app-category-card {
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.container-chapter #section-2 .useful-app-category-card > .housing-detail-title {
  text-align: center;
}

.container-chapter #section-2 .useful-app-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: center;
  flex: 1;
  justify-content: center;
  padding-top: 0.35rem;
}

.container-chapter #section-2 .useful-app-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fafafa;
  transition: border-color 0.2s ease, transform 0.2s ease;
  width: min(100%, 440px);
  transform-origin: center center;
}

.container-chapter #section-2 .useful-app-row:hover {
  border-color: var(--brand-violet);
  transform: scale(1.03);
}

.container-chapter #section-2 .useful-app-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.container-chapter #section-2 .useful-app-icon-fallback {
  background: rgba(0, 0, 0, 0.08);
}

.container-chapter #section-2 .useful-app-text {
  min-width: 0;
}

.container-chapter #section-2 .useful-app-name {
  margin: 0;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  color: #000;
}

.container-chapter #section-2 .useful-app-description {
  margin: 0.12rem 0 0 0;
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #2b2b2b;
  display: flex;
  align-items: center;
  gap: 0;
}

.container-chapter #section-2 .useful-app-description-text {
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.container-chapter #section-2 .useful-app-action {
  display: flex;
  align-items: center;
}

.container-chapter #section-2 .useful-app-get {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 28px;
  border: 1px solid #2f80ed;
  border-radius: 10px;
  background: #2f80ed;
  color: #fff;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  padding: 0 0.65rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.container-chapter #section-2 .useful-app-get:hover {
  background: var(--brand-violet);
  border-color: var(--brand-violet);
  color: #fff;
}

.container-chapter #section-2 .useful-apps-main:hover > .housing-detail-title {
  color: var(--brand-violet);
}

.container-chapter #section-2 .useful-apps-main:hover .useful-app-category-card > .housing-detail-title {
  color: #000;
}

.container-chapter #section-2 .useful-apps-main .useful-app-category-card:hover > .housing-detail-title {
  color: var(--brand-violet);
}

.container-chapter #section-2 .useful-app-row:hover .useful-app-name {
  color: var(--brand-violet);
}

.container-chapter #section-2 .useful-apps-grid > .useful-app-category-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: calc((100% - 1rem) / 2);
  width: 100%;
  justify-self: center;
}

.container-chapter #section-2 .useful-app-ellipsis.housing-warning {
  margin: 0 0 0 0.02rem;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  line-height: 1;
  vertical-align: baseline;
}

.container-chapter #section-2 .useful-app-ellipsis.housing-warning::before {
  content: "...";
  color: #ffc107;
  font-weight: 700;
}

@media (max-width: 768px) {
  .container-chapter #section-2 .useful-apps-grid {
    grid-template-columns: 1fr;
  }

  .container-chapter #section-2 .useful-apps-grid > .useful-app-category-card:last-child:nth-child(odd) {
    grid-column: auto;
    max-width: none;
    justify-self: stretch;
  }
}

/* =========================
   CHAPTER 5 - MEDICAL LISTS
========================= */
.container-chapter #section-0 .chapter5-medical-main,
.container-chapter #section-0 .chapter5-vocabulary-main {
  margin-top: 1.5rem;
}

.container-chapter #section-0 .chapter5-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.container-chapter #section-0 .chapter5-mini-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fafafa;
  padding: 0.6rem 0.7rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
  transform-origin: center center;
}

.container-chapter #section-0 .chapter5-mini-card:hover {
  border-color: var(--brand-violet);
  transform: scale(1.03);
}

.chapter-container .main-content-area {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 0 !important;
}

.chapter-container .main-content-area > .chapter-navigation:first-of-type {
  order: 1 !important;
}

.chapter-container .main-content-area > section {
  order: 2 !important;
  position: static !important;
  inset: auto !important;
  float: none !important;
  transform: none !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

.chapter-container .main-content-area > .chapter-navigation:last-of-type {
  order: 4 !important;
}

.chapter-container section:last-of-type .main-point,
.chapter-container section:last-of-type .point-content,
.chapter-container section:last-of-type .chapter-ending-wrap,
.chapter-container section:last-of-type .chapter-ending-card,
.chapter-container section:last-of-type .chapter-ending-card img,
.chapter-container section:last-of-type .chapter-feedback-link,
.chapter-container .main-content-area > .chapter-ending-wrap,
.chapter-container .main-content-area > .chapter-feedback-link {
  position: static !important;
  inset: auto !important;
  float: none !important;
  transform: none !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

.chapter-container section:last-of-type .point-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
}

.chapter-container section:last-of-type .chapter-ending-wrap,
.chapter-container .main-content-area > .chapter-ending-wrap {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  order: 3 !important;
  clear: both !important;
}

.chapter-container section:last-of-type .chapter-ending-card {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.chapter-container section:last-of-type .chapter-ending-card img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
  object-fit: contain !important;
}

.chapter-container section:last-of-type .chapter-feedback-link,
.chapter-container .main-content-area > .chapter-feedback-link {
  display: inline-flex !important;
  align-self: center !important;
  width: auto !important;
  max-width: 100% !important;
  white-space: normal !important;
  text-align: center !important;
  order: 4 !important;
}

@media (max-width: 1024px) {
  .chapter-container .main-content-area {
    display: flex !important;
    flex-direction: column !important;
  }
}

@media (max-width: 768px) {
  .chapter-container section:last-of-type .chapter-feedback-link,
  .chapter-container .main-content-area > .chapter-feedback-link {
    width: min(100%, 22rem) !important;
  }
}

.container-chapter #section-0 .chapter5-mini-card-title {
  margin: 0;
  font-family: "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
  color: #000;
  transition: color 0.2s ease;
}

.container-chapter #section-0 .chapter5-mini-card-text {
  margin: 0.2rem 0 0 0;
  font-family: 'Zen Maru Gothic', "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #2b2b2b;
  transition: color 0.2s ease;
  white-space: normal;
}

.container-chapter #section-0 .chapter5-mini-card:hover .chapter5-mini-card-title,
.container-chapter #section-0 .chapter5-mini-card:hover .chapter5-mini-card-text {
  color: var(--brand-violet);
}

.container-chapter #section-0 .chapter5-medical-main .chapter5-mini-card-title {
  text-align: center;
}

.container-chapter #section-0 .chapter5-vocabulary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.container-chapter #section-0 .chapter5-vocabulary-group {
  margin-top: 0;
}

.container-chapter #section-0 .chapter5-vocab-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.container-chapter #section-0 .chapter5-vocab-text {
  margin: 0;
  text-align: center;
}

.container-chapter #section-0 .chapter5-medical-main:hover > .housing-detail-title,
.container-chapter #section-0 .chapter5-vocabulary-main:hover > .housing-detail-title {
  color: var(--brand-violet);
}

.container-chapter #section-0 .chapter5-vocabulary-main:hover .chapter5-vocabulary-group > .housing-detail-title {
  color: #000;
}

.container-chapter #section-0 .chapter5-vocabulary-main .chapter5-vocabulary-group:hover > .housing-detail-title {
  color: var(--brand-violet);
}

@media (max-width: 1024px) {
  .container-chapter #section-0 .chapter5-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .container-chapter #section-0 .chapter5-mini-grid {
    grid-template-columns: 1fr;
  }
}
