/* ═══════════════════════════════════════════════════════════════
   PLOUF — Direction Artistique Épurée & Minimaliste (MER'MADE)
   Charte graphique : 
   - Principale (Titres & Brand) : #2FAEE0
   - Secondaire (Texte & Structure) : #163C68
   - Tertiaire (CTA & Mise en avant) : #FE6B56
   Typographies : 
   - Titres : Berthold Block
   - Corps : Open Sauce Sans
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Berthold Block';
  src: url('fonts/berthold-block.woff2') format('woff2'),
       url('fonts/berthold-block.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Variables & Palette ── */
:root {
  --sea: #2FAEE0;
  --deep: #163C68;
  --coral: #FE6B56;

  --font: 'Open Sauce Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Berthold Block', 'Paytone One', 'Impact', sans-serif;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-pill: 9999px;

  --transition: 0.15s ease-in-out;
}

/* ── Monde Humain : Épure blanche, typographie bleue, minimalisme suisse ── */
.world-human {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --ink: #163C68;
  --ink-secondary: #4A6785;
  --muted: #8FA4BC;
  --line: #E8EEF5;

  --title: #2FAEE0;
  --accent: #2FAEE0;
  --accent-ink: #FFFFFF;
  --link: #2FAEE0;
  --hl: #FE6B56;

  --hero: #FFFFFF;
  --hero-ink: #163C68;
  --hero-btn: #FE6B56;
  --hero-btn-ink: #FFFFFF;
}

/* ── Monde Sirène : Fidèle à la charte MER'MADE (fond blanc immaculé, cyan éclatant) ── */
.world-mermaid {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --ink: #163C68;
  --ink-secondary: #4A6785;
  --muted: #8FA4BC;
  --line: #E8EEF5;

  --title: #2FAEE0;
  --accent: #2FAEE0;
  --accent-ink: #FFFFFF;
  --link: #2FAEE0;
  --hl: #FE6B56;

  --hero: #FFFFFF;
  --hero-ink: #163C68;
  --hero-btn: #FE6B56;
  --hero-btn-ink: #FFFFFF;
}

/* ── Reset & Structure ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 70px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover {
  opacity: 0.82;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Typographie ── */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--title);
  margin: 0 0 0.5em;
}

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

h2 {
  font-size: 1.6rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 0.75em;
}

small, .muted {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ── Layout & Conteneur ── */
.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ── Navigation Haute ── */
.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 1.8rem/1 var(--display);
  letter-spacing: 0.06em;
  color: var(--sea);
  text-transform: uppercase;
}
.brand:hover {
  text-decoration: none;
  opacity: 0.9;
}
.brand img.logo {
  height: 34px;
  width: auto;
}

.nav {
  margin-left: auto;
  display: flex;
  gap: 22px;
  align-items: center;
}
.nav a {
  color: var(--ink-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.nav a:hover {
  color: var(--sea);
}

.me img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--sea);
}

/* ── Mobile Tabbar ── */
.tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.tabbar a {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}
.tabbar a:hover {
  color: var(--sea);
}
.tabbar span {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 2px;
}

/* ── Cartes & Conteneurs (Zéro ombre, bordure nette) ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 18px 0;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Boutons Minimalistes ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font: 600 0.92rem var(--font);
  letter-spacing: 0.02em;
  background: var(--sea);
  color: #FFFFFF;
  cursor: pointer;
  text-align: center;
  transition: opacity var(--transition), background-color var(--transition);
  min-height: 42px;
}
.btn:hover {
  opacity: 0.9;
  text-decoration: none;
}
.btn:active {
  opacity: 1;
}

.btn.small {
  padding: 7px 14px;
  font-size: 0.82rem;
  min-height: 34px;
}

.btn.big {
  padding: 14px 30px;
  font-size: 1rem;
  min-height: 48px;
  background: var(--coral);
  color: #FFFFFF;
}

.btn.alt {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.alt:hover {
  border-color: var(--sea);
  color: var(--sea);
}

/* ── Flash messages ── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.flash.ok {
  border-color: #22C55E;
  color: #166534;
  background: #F0FDF4;
}
.flash.err {
  border-color: var(--coral);
  color: #991B1B;
  background: #FEF2F2;
}

/* ── Formulaires ── */
.form {
  max-width: 460px;
  margin-inline: auto;
}
.form label {
  display: block;
  margin: 14px 0 0;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  margin-top: 5px;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sea);
}

.world-mermaid input,
.world-mermaid select,
.world-mermaid textarea {
  background: var(--surface-alt);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 8px;
}
.check {
  font-weight: 400 !important;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 14px 0;
}
legend {
  color: var(--muted);
  padding: 0 6px;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row > input, .row > label {
  flex: 1;
  min-width: 120px;
}

.hp {
  position: absolute;
  left: -9999px;
  height: 0;
  opacity: 0;
}

/* ── Sélecteur de Monde ── */
.world-pick {
  display: flex;
  gap: 12px;
}
.world-pick .opt {
  flex: 1;
  margin: 0;
}
.opt span {
  display: block;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color var(--transition), color var(--transition);
}
.opt span:hover {
  border-color: var(--sea);
}
.opt input {
  position: absolute;
  opacity: 0;
}
.opt input:checked + span {
  border-color: var(--sea);
  background: var(--surface-alt);
  color: var(--sea);
}

/* ── Hero / Landing Épuré ── */
.hero {
  text-align: center;
  padding: 50px 0 30px;
}
.hero img.logo {
  margin: 0 auto 20px;
  width: 90px;
  height: auto;
}
.hero h1 {
  color: var(--sea);
  margin-bottom: 14px;
}
.hero p {
  max-width: 540px;
  margin: 0 auto 28px;
  color: var(--ink-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.world-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 16px;
  display: block;
  text-align: center;
  transition: border-color var(--transition);
  background: var(--surface);
}
.world-card:hover {
  text-decoration: none;
  border-color: var(--sea);
}
.world-card span {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}
.world-card b {
  font: 700 1.3rem var(--display);
  text-transform: uppercase;
  color: var(--sea);
  display: block;
  margin-bottom: 4px;
}
.world-card small {
  color: var(--muted);
}
.world-card.human {
  border-top: 3px solid var(--sea);
}
.world-card.mermaid {
  border-top: 3px solid var(--deep);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.steps .card {
  text-align: center;
  padding: 20px 14px;
}
.steps h3 {
  color: var(--sea);
  margin-bottom: 6px;
}

/* ── Challenge Hero ── */
.challenge-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sea);
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  margin: 18px 0;
}
.challenge-hero h1 {
  color: var(--sea);
  margin: 10px 0;
}
.challenge-hero p {
  max-width: 520px;
  margin: 0 auto 16px;
  color: var(--ink-secondary);
  font-size: 1rem;
}
.challenge-hero.compact {
  padding: 24px 20px;
}
.challenge-hero.compact h1 {
  font-size: 1.8rem;
}

/* ── Modèle à reproduire (Ex: La Joconde) ── */
.challenge-reference {
  margin: 22px auto 16px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.challenge-reference.compact {
  margin: 14px auto 10px;
  max-width: 240px;
  padding: 12px;
}
.ref-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #FFFFFF;
  background: var(--sea);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
}
.ref-frame {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-frame img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
}
.ref-sub {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  font-weight: 500;
  text-align: center;
}
.participate-ref-box {
  margin: 0 0 20px;
  padding: 16px;
  background: var(--surface-alt);
  border: 1.5px solid var(--sea);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.participate-ref-box .ref-frame.small {
  max-width: 220px;
}
.participate-ref-box .ref-frame.small img {
  max-height: 240px;
}

.badge {
  display: inline-block;
  background: var(--surface-alt);
  color: var(--sea);
  border: 1px solid var(--line);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.countdown {
  margin: 18px 0;
}
.countdown small {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.cd-main {
  font: 700 3.4rem/1 var(--display);
  letter-spacing: 0.04em;
  color: var(--deep);
}
.world-mermaid .cd-main {
  color: #FFFFFF;
}
.cd-sec {
  font: 500 1.2rem var(--display);
  color: var(--sea);
  margin-left: 4px;
}

.challenge-hero.locked .blur-wrap {
  filter: blur(8px);
  user-select: none;
}
.lock-msg {
  margin-top: 14px;
}

/* ── Onglets / Tabs (Flat minimaliste) ── */
.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.tabs a {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  background: transparent;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all var(--transition);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tabs a:hover {
  border-color: var(--sea);
  color: var(--sea);
  text-decoration: none;
}
.tabs a.on {
  background: var(--sea);
  color: #FFFFFF;
  border-color: var(--sea);
}

/* ── Classements ── */
.rank {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.rank li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.rank li:last-child {
  border-bottom: none;
}
.rank .pos {
  font: 700 1.25rem var(--display);
  width: 28px;
  text-align: center;
  color: var(--muted);
}
.rank li:nth-child(1) .pos { color: #EAB308; }
.rank li:nth-child(2) .pos { color: #94A3B8; }
.rank li:nth-child(3) .pos { color: #D97706; }

.rank img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.rank a {
  flex: 1;
  font-weight: 500;
  color: var(--ink);
}
.rank b {
  font-weight: 600;
  color: var(--sea);
  font-size: 0.88rem;
}

.blur {
  filter: blur(6px);
}

/* ── Mini-liste historique ── */
.mine-list {
  display: grid;
  gap: 4px;
}
.mine {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition);
}
.mine:hover {
  background: var(--surface-alt);
  text-decoration: none;
}
.mine img, .mine .vid {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
}
.mine span {
  flex: 1;
}
.mine small {
  display: block;
}
.mine em {
  font-style: normal;
  color: var(--sea);
  font-weight: 600;
}

/* ── Feed & Posts ── */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.post > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.post > header img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}
.post > header a {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}
.post > header small {
  color: var(--muted);
  font-size: 0.78rem;
}

.post .media {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  background: #000000;
}
.single .media {
  aspect-ratio: auto;
  max-height: 75vh;
  object-fit: contain;
}

.masked-box, .media.locked {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  background: var(--surface-alt);
  color: var(--ink-secondary);
}
.masked-box span { font-size: 2rem; }
.media.locked span { font-size: 1.15rem; font-weight: 600; }

.post .cap {
  margin: 10px 14px;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}
.post footer {
  padding: 6px 14px 12px;
}
.post footer form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Réactions ── */
.react {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  color: var(--ink-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  transition: border-color var(--transition), color var(--transition);
}
.react:hover {
  text-decoration: none;
  border-color: var(--sea);
  color: var(--sea);
}
.react.on {
  background: var(--sea);
  color: #FFFFFF;
  border-color: var(--sea);
}

/* ── Commentaires ── */
.comments {
  list-style: none;
  padding: 0;
}
.comments li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.comments li:last-child {
  border-bottom: none;
}
.comments img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.comments a {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}
.comments p {
  margin: 3px 0 0;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

/* ── Participation / Cropper ── */
.participate .pick {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cropper {
  text-align: center;
}
.cropper canvas {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius-sm);
  touch-action: none;
  cursor: grab;
  background: #000000;
}
.current .media {
  max-width: 240px;
  border-radius: var(--radius-sm);
}

/* ── Profil ── */
.profile {
  display: flex;
  gap: 22px;
  align-items: center;
}
.big-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sea);
}
.stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}
.stats b {
  font: 700 1.3rem var(--display);
  color: var(--sea);
}

/* ── Gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.gallery a {
  position: relative;
  aspect-ratio: 1;
  display: block;
  background: var(--surface-alt);
}
.gallery img, .gallery .vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
}
.gallery em {
  position: absolute;
  right: 5px;
  bottom: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 500;
}

/* ── Tables & Admin ── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table td, .table th {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.acts form {
  display: inline;
}

.ticks {
  list-style: none;
  padding: 0;
}
.ticks li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.ticks li:last-child {
  border-bottom: none;
}

.how {
  padding-left: 1.3em;
}
.how li {
  margin: 6px 0;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 10px;
  top: 10px;
  background: var(--ink);
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 999;
}

.demo-bar {
  background: var(--surface-alt);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 8px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}
.demo-bar form {
  display: contents;
}
.demo-bar b {
  color: var(--sea);
}
.demo-bar .btn {
  background: var(--surface);
  color: var(--ink);
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}
.demo-bar .btn:hover {
  border-color: var(--sea);
}

.table-wrap {
  overflow-x: auto;
}
.acts {
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav a:not(.btn) { display: none; }
  .tabbar { display: flex; }
  .nav { margin-left: auto; }

  body { padding-bottom: 84px; }
  .wrap { padding: 18px 14px; }

  .cd-main { font-size: 2.8rem; }

  .profile { flex-direction: column; text-align: center; }
  .stats { justify-content: center; }

  .split { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .world-pick { flex-direction: column; }
  .feed { grid-template-columns: 1fr; }

  .btn.big { width: 100%; }
  .tabs a { flex: 1; }
  .brand { font-size: 1.5rem; }

  .challenge-hero { padding: 24px 16px; }
  .hero { padding: 32px 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
