* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Position du halo de soleil, pilotée par app.js pour suivre la souris. */
  --halo-x: 50%;
  --halo-y: -160px;
  --azur: #2a9df4;
  --azur-fonce: #1b7fd1;
  --encre: #10314b;
  --brume: #46688a;
  --sable: #fffdf7;
  --soleil: #ffb733;
  --ligne: rgba(16, 49, 75, .08);
  --ombre: 0 8px 30px rgba(16, 49, 75, .10);
  --ombre-haute: 0 16px 40px rgba(16, 49, 75, .14);
}

::selection { background: rgba(42, 157, 244, .25); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--encre);
  background:
    radial-gradient(900px 460px at var(--halo-x) var(--halo-y), rgba(255, 205, 105, .50), transparent 70%),
    linear-gradient(180deg, #cfeaff 0%, #eaf6ff 45%, var(--sable) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 3.25rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

header { text-align: center; }

h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: -0.02em;
}

h1 .dot { color: var(--azur); }

h1 .sun {
  display: inline-block;
  font-size: .7em;
  vertical-align: .15em;
  filter: drop-shadow(0 4px 10px rgba(255, 183, 51, .6));
  animation: cagnard 6s ease-in-out infinite;
}

@keyframes cagnard {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg) translateY(-2px); }
}

.tagline {
  margin-top: .5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  color: var(--brume);
  font-style: italic;
}

.panels {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Petite pastille entre les deux panneaux : le sens de la galéjade. */
.panels::after {
  content: "⇢";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--azur);
  font-size: 1.25rem;
  font-weight: 700;
  border: 1px solid var(--ligne);
  box-shadow: var(--ombre);
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 700px) {
  .panels { grid-template-columns: 1fr; }
  .panels::after { content: "⇣"; }
}

.panel {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  box-shadow: var(--ombre);
  padding: 1.15rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  transition: box-shadow .2s ease, border-color .2s ease;
}

.panel:focus-within {
  border-color: rgba(42, 157, 244, .45);
  box-shadow: var(--ombre-haute), 0 0 0 4px rgba(42, 157, 244, .12);
}

.panel label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #7d9ab5;
}

.panel label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.panel:last-child label { color: var(--azur); }
.panel:last-child label::before { opacity: 1; }

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--encre);
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 49, 75, .2) transparent;
}

textarea::placeholder { color: #a9c2d8; }

.sortie {
  min-height: 260px;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--azur-fonce);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.sortie:empty::before {
  content: attr(data-placeholder);
  color: #a9c2d8;
  font-style: italic;
}

/* Mot marseillais : souligné pointillé, définition au survol. */
.mot {
  position: relative;
  text-decoration: underline dotted;
  text-decoration-color: var(--azur);
  text-underline-offset: 3px;
  cursor: help;
  border-radius: 4px;
  transition: background .12s ease;
}

.mot:hover { background: rgba(42, 157, 244, .10); }

/* Infobulle maison : le title natif est trop capricieux. */
.mot::after {
  content: attr(data-def);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(3px);
  width: max-content;
  max-width: 240px;
  padding: .5rem .7rem;
  border-radius: 10px;
  background: var(--encre);
  color: #fff;
  font-size: .8rem;
  font-style: normal;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(16, 49, 75, .28);
  transition: opacity .12s ease .05s, transform .12s ease .05s;
  z-index: 10;
}

/* La petite flèche sous la bulle. */
.mot::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(3px);
  border: 5px solid transparent;
  border-top-color: var(--encre);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease .05s, transform .12s ease .05s;
  z-index: 10;
}

.mot:hover::after,
.mot:hover::before {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--ligne);
  padding-top: .75rem;
  margin-top: auto;
}

button {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  padding: .5rem 1rem;
  background: #fff;
  color: var(--encre);
  box-shadow: 0 1px 2px rgba(16, 49, 75, .06);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}

button:hover {
  background: #f4faff;
  border-color: rgba(42, 157, 244, .45);
  box-shadow: 0 4px 12px rgba(16, 49, 75, .10);
  transform: translateY(-1px);
}

button:active { transform: translateY(0) scale(.97); }

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(42, 157, 244, .25);
}

/* Bouton principal : copier le résultat. */
#copy {
  background: linear-gradient(135deg, var(--azur), var(--azur-fonce));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 157, 244, .35);
}

#copy:hover {
  background: linear-gradient(135deg, #3fa9f5, var(--azur));
  box-shadow: 0 6px 18px rgba(42, 157, 244, .45);
}

.intensity {
  display: flex;
  justify-content: center;
  gap: .3rem;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 999px;
  padding: .35rem;
  align-self: center;
  box-shadow: var(--ombre);
}

.intensity button {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--brume);
  padding: .5rem 1.1rem;
}

.intensity button:hover {
  background: rgba(42, 157, 244, .10);
  transform: none;
  color: var(--encre);
}

.intensity button.active {
  background: linear-gradient(135deg, var(--azur), var(--azur-fonce));
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 157, 244, .40);
}

/* --- Sections éditoriales (à propos, lexique, FAQ) ----------------------- */

.apropos, .lexique, .faq {
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  box-shadow: var(--ombre);
  padding: 1.5rem 1.75rem;
}

.apropos h2, .lexique h2, .faq h2 {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin-bottom: .75rem;
}

.apropos p, .lexique > p, .faq p {
  line-height: 1.65;
  color: var(--brume);
}

.apropos p + p { margin-top: .65rem; }

.lexique dl {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .4rem 1.5rem;
}

.lexique .entree {
  padding: .3rem 0;
  border-bottom: 1px solid var(--ligne);
  line-height: 1.5;
}

.lexique dt {
  display: inline;
  font-weight: 700;
  color: var(--azur-fonce);
}

.lexique dt::after { content: " — "; font-weight: 400; color: var(--brume); }

.lexique dd { display: inline; color: var(--brume); }

.faq details {
  border-bottom: 1px solid var(--ligne);
  padding: .5rem 0;
}

.faq details:last-child { border-bottom: none; }

.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: .35rem 0;
  list-style-position: outside;
}

.faq summary:hover { color: var(--azur-fonce); }

.faq details p { padding: .35rem 0 .5rem 1.1rem; }

footer {
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .9rem;
  color: #86a3bd;
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  h1 .sun { animation: none; }
  * { transition: none !important; animation: none !important; }
}
