/* Identité « Plage Pop » — flat texturé, contours marqués, ombres sticker.
   Mobile-first, doigts + soleil : boutons >= 48px, contrastes forts. */

@font-face {
  font-family: 'Lilita One';
  src: url('fonts/LilitaOne.woff2') format('woff2');
  font-display: swap;
}

:root {
  --sable: #F7E8C9;
  --coquille: #FFF9EE;
  --encre: #27190D;
  --corail: #E8461F;
  --ocean: #17699E;
  --soleil: #FFC53D;
  --encre-40: rgba(39, 25, 13, .4);
  --display: 'Lilita One', system-ui, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 14px 12px 40px;
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E"),
    var(--sable);
}
.wrap { max-width: 560px; margin: 0 auto; }
.wrap-large { max-width: 760px; margin: 0 auto; }

h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
a { color: var(--ocean); }

/* ---------- barre haute ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.back-btn {
  width: 50px; height: 50px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--coquille); color: var(--encre);
  border: 3px solid var(--encre); border-radius: 50%;
  box-shadow: 3px 3px 0 var(--encre);
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.back-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--encre); }
.back-btn svg { width: 26px; height: 26px; }
.court-badge {
  font-family: var(--display); font-size: 1.6rem;
  background: var(--soleil); border: 3px solid var(--encre); border-radius: 14px;
  padding: .1rem .7rem; box-shadow: 4px 4px 0 var(--encre); transform: rotate(-2deg);
}
.phase-pill {
  font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  background: var(--coquille); border: 2.5px solid var(--encre); border-radius: 999px;
  padding: .32rem .65rem;
}

/* ---------- cartes sticker ---------- */
.card {
  position: relative;
  background: var(--coquille);
  border: 3px solid var(--encre);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--encre);
  padding: 14px;
  margin-bottom: 18px;
}
.card.halftone::after {
  content: ""; position: absolute; right: 10px; bottom: 8px; width: 84px; height: 40px;
  background-image: radial-gradient(var(--encre) 1.3px, transparent 1.3px);
  background-size: 9px 9px; opacity: .12; border-radius: 8px; pointer-events: none;
}
.card h2 { font-size: 1.15rem; margin: 0 0 10px; }

/* ---------- boutons ---------- */
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.btn {
  display: block; width: 100%; min-height: 56px;
  font-family: var(--display); font-size: 1.3rem;
  background: var(--soleil); color: var(--encre);
  border: 3px solid var(--encre); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--encre);
  padding: 10px 16px;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--encre); }
.btn.hot { background: var(--corail); color: var(--coquille); }
.btn.sea { background: var(--ocean); color: var(--coquille); }
.btn.ghost { background: var(--coquille); }
.btn.small { min-height: 48px; font-size: 1.05rem; width: auto; display: inline-block; padding: 8px 14px; border-width: 2.5px; box-shadow: 3px 3px 0 var(--encre); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:active { transform: none; box-shadow: 5px 5px 0 var(--encre); }
:focus-visible { outline: 3px dashed var(--ocean); outline-offset: 3px; }

.chip {
  font-family: var(--display); font-size: 1.35rem;
  min-width: 64px; min-height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--soleil); border: 3px solid var(--encre); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--encre); padding: 0 10px;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--encre); }
.chip.minus { background: var(--coquille); }

/* ---------- match / score ---------- */
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.tname { font-family: var(--display); font-size: clamp(1.5rem, 7vw, 2.2rem); line-height: 1.05; text-align: center; overflow-wrap: anywhere; }
.tname.a { color: var(--corail); }
.tname.b { color: var(--ocean); }
.vs { font-style: italic; font-weight: 700; font-size: 1rem; margin-top: .5rem; opacity: .7; }
.players { list-style: none; margin: 8px 0 0; padding: 0; text-align: center; font-weight: 600; font-size: .95rem; }
.players li { border-top: 2px dashed var(--encre-40); padding: 3px 0; }
.scores { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 6px; }
.snum { font-family: var(--display); font-size: clamp(4rem, 20vw, 6rem); line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.sdash { font-family: var(--display); font-size: 2rem; text-align: center; opacity: .5; }
.pmrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pmcol { display: flex; justify-content: center; gap: 10px; }
.score-input {
  width: 100%; min-height: 64px; text-align: center;
  font-family: var(--display); font-size: 2.4rem; color: var(--encre);
  background: var(--coquille); border: 3px solid var(--encre); border-radius: 14px;
}
.notice { font-weight: 700; text-align: center; margin: 10px 0 0; }
.notice.lock { color: var(--ocean); }
.result-badge {
  font-family: var(--display); font-size: 1rem;
  display: inline-block; background: var(--ocean); color: var(--coquille);
  border: 2.5px solid var(--encre); border-radius: 999px; padding: .2rem .8rem;
  transform: rotate(-2deg); margin-bottom: 8px;
}

/* ---------- classement / planning ---------- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; text-align: left; padding: 4px 6px; opacity: .65; }
td { border-top: 2px dashed var(--encre-40); padding: 7px 6px; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos {
  display: inline-block; width: 27px; height: 27px; text-align: center; line-height: 23px;
  background: var(--soleil); border: 2.5px solid var(--encre); border-radius: 50%;
  font-family: var(--display); font-size: .95rem; margin-right: 6px;
}
tr.inactive td { opacity: .45; text-decoration: line-through; }
.mrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 2px dashed var(--encre-40); padding: 8px 2px; font-weight: 600; font-size: .95rem; }
.mrow:first-of-type { border-top: none; }
.mrow .sc { font-family: var(--display); font-size: 1.1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mrow .who { overflow-wrap: anywhere; }
.tag { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border: 2px solid var(--encre); border-radius: 999px; padding: .1rem .5rem; background: var(--coquille); white-space: nowrap; }
.tag.live { background: var(--corail); color: var(--coquille); }
.tag.done { background: var(--soleil); }

/* ---------- navigation terrains ---------- */
.courts-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.courts-nav a {
  font-family: var(--display); font-size: 1.1rem; text-decoration: none; color: var(--encre);
  background: var(--soleil); border: 3px solid var(--encre); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--encre); padding: 10px 16px; min-height: 48px;
  display: inline-flex; align-items: center;
}
.courts-nav a:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--encre); }

/* ---------- formulaires / admin ---------- */
label { display: block; font-weight: 700; margin: 12px 0 4px; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; font: inherit; color: var(--encre);
  background: var(--coquille); border: 2.5px solid var(--encre); border-radius: 12px;
  padding: 11px 12px; min-height: 48px;
}
textarea { min-height: 140px; resize: vertical; }
.hint { font-size: .85rem; font-weight: 400; opacity: .75; margin: 2px 0 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.flash { background: var(--soleil); border: 3px solid var(--encre); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--encre); padding: 10px 14px; font-weight: 700; margin-bottom: 16px; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=number] { width: 74px; min-height: 44px; padding: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.checkline { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 10px 0; }
.checkline input { width: 22px; height: 22px; }

.offline { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); background: var(--encre); color: var(--coquille); border-radius: 999px; padding: .4rem .9rem; font-weight: 700; font-size: .85rem; display: none; z-index: 10; }
.offline.on { display: block; }

/* ---------- modales maison ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(39, 25, 13, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.modal {
  background: var(--coquille); border: 3px solid var(--encre);
  border-radius: 18px; box-shadow: 6px 6px 0 var(--encre);
  padding: 18px; max-width: 420px; width: 100%;
  transform: scale(.95); opacity: 0;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), opacity 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.modal-backdrop.open { opacity: 1; }
.modal-backdrop.open .modal { transform: scale(1); opacity: 1; }
.modal h3 { font-family: var(--display); font-size: 1.25rem; margin: 0 0 8px; }
.modal p { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; min-height: 52px; font-size: 1.15rem; }

/* compos mêlée dans le planning */
.compo { font-weight: 600; font-size: .9rem; margin: 2px 0; }
.compo .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--encre); margin-right: 6px; }
.compo.a .dot { background: var(--corail); }
.compo.b .dot { background: var(--ocean); }

footer.links { margin-top: 26px; text-align: center; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .courts-nav a { transition: none; }
}
