:root {
  --grass: #1f7a3a;
  --grass-dark: #17602d;
  --grass-light: #2a9449;
  --line: rgba(255, 255, 255, 0.55);
  --card: #ffffff;
  --ink: #12261a;
  --muted: #5b6b60;
  --accent: #ffd23f;
  --accent-dark: #e0b400;
  --danger: #c62828;
  --ok: #1b8a3e;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--grass);
  /* bandes de tonte + lignes du terrain */
  background-image:
    repeating-linear-gradient(180deg, rgba(255,255,255,0.045) 0 64px, rgba(0,0,0,0.045) 64px 128px);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.hero {
  position: relative;
  color: #fff;
  text-align: center;
  padding: 28px 16px 22px;
  overflow: hidden;
}
.hero::before { /* rond central */
  content: "";
  position: absolute;
  left: 50%; top: -90px;
  width: 220px; height: 220px;
  transform: translateX(-50%);
  border: 3px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after { /* ligne médiane */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 20px;
  border-top: 3px solid var(--line);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
h1 { margin: 0; font-size: 2.3rem; letter-spacing: -0.5px; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.ball { display: inline-block; animation: roll 3s ease-in-out infinite; }
@keyframes roll { 0%,100% { transform: rotate(0) translateY(0);} 50% { transform: rotate(180deg) translateY(-4px);} }
.tagline { margin: 8px 0 16px; font-size: 1.05rem; opacity: .95; }

main { max-width: 560px; margin: 0 auto; padding: 0 12px 24px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 20px;
  margin-bottom: 16px;
}
h2 { margin: 0 0 12px; font-size: 1.35rem; }

.field { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
label, legend { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
.req { color: var(--danger); }

input[type="text"] {
  width: 100%;
  font-size: 1.15rem;
  padding: 14px 14px;
  border: 2px solid #d6e2d9;
  border-radius: 14px;
  background: #f7fbf8;
}
input[type="text"]:focus { outline: none; border-color: var(--grass); background: #fff; }

.chips { display: grid; gap: 8px; }
.chips-days { grid-template-columns: repeat(2, 1fr); }
.chips-3 { grid-template-columns: repeat(3, 1fr); }

.chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 6px;
  border: 2px solid #d6e2d9;
  border-radius: 14px;
  background: #f7fbf8;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.chip:active { transform: scale(.96); }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip .tick { display: none; margin-right: 6px; }
.chip.checked {
  background: var(--grass);
  border-color: var(--grass-dark);
  color: #fff;
}
.chip.checked .tick { display: inline; }
.chip.hour.checked { background: #123d6b; border-color: #0c2b4d; }
.chip.terrain.checked { background: #b5530b; border-color: #8a3f07; }
.chip-stack { display: block; line-height: 1.15; }
.chip .sub { display: block; font-size: .75rem; font-weight: 500; opacity: .85; }
.chip .today-badge { font-size: .7rem; background: var(--accent); color: #3a2c00; border-radius: 8px; padding: 1px 6px; margin-left: 6px; font-weight: 700; }
.chip:focus-within { box-shadow: 0 0 0 3px rgba(255, 210, 63, .8); }

.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btn-mini {
  border: 1px solid #c9d8cd;
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .85rem;
  cursor: pointer;
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #2b2200; box-shadow: 0 4px 0 var(--accent-dark); }
.btn-ghost {
  display: inline-block;
  width: auto;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 2px solid rgba(255,255,255,.7);
  font-size: 1rem;
  padding: 10px 16px;
  border-radius: 999px;
}
.btn-link { background: transparent; color: var(--muted); font-size: .95rem; font-weight: 600; text-decoration: underline; margin-top: 10px; padding: 8px; }

.banner { background: #fff6d6; border: 1px solid #f0d878; border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; font-size: .95rem; }
.error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }

.recap-head { display: flex; align-items: center; justify-content: space-between; }
.live { color: var(--ok); font-size: .8rem; font-weight: 700; }
.muted { color: var(--muted); }

.section-title { font-size: 1.1rem; margin: 18px 0 10px; }

.slot {
  border: 2px solid #e1ebe3;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfdfb;
}
.slot.playable {
  border-color: var(--ok);
  background: linear-gradient(135deg, #e8f8ec, #fffbe0);
}
.slot-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.slot-when { font-weight: 800; font-size: 1.1rem; }
.slot-count { font-weight: 800; white-space: nowrap; }
.slot.playable .slot-count { color: var(--ok); }
.slot-terrain { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.bar { height: 12px; background: #e6eee8; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #6cc281, var(--ok)); border-radius: 999px; transition: width .4s ease; }
.slot-missing { font-size: .95rem; font-weight: 600; color: #8a5a00; }
.names { margin-top: 6px; font-size: .92rem; color: #33443a; line-height: 1.4; }

.respondents { margin-top: 8px; }
.resp-count { font-weight: 800; font-size: 1.05rem; }
.resp-list { list-style: none; padding: 0; margin: 8px 0 0; }
.resp-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 4px; border-bottom: 1px dashed #dde7df;
  font-size: .95rem;
}
.resp-list li:last-child { border-bottom: 0; }
.resp-name { font-weight: 700; }
.resp-detail { color: var(--muted); text-align: right; }

details.matrix { margin-top: 16px; }
details.matrix summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 6px; }
.matrix-table th, .matrix-table td { border: 1px solid #e1ebe3; padding: 5px 4px; text-align: center; }
.matrix-table th { background: #f1f7f2; }
.matrix-table td.playable { background: #c9f0d2; font-weight: 800; }
.matrix-table td.zero { color: #b8c4bb; }
.matrix-day { text-align: left !important; white-space: nowrap; }

footer { text-align: center; padding: 6px 0 10px; }
.admin { opacity: .7; background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }

.toast {
  position: fixed;
  left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #12261a; color: #fff;
  padding: 12px 18px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow);
  z-index: 10; max-width: 90vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) { .ball { animation: none; } }

.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix-table th, .matrix-table td { white-space: nowrap; }
.matrix-table .matrix-day { position: sticky; left: 0; background: #fff; z-index: 1; }
.matrix-table th.matrix-day { background: #f1f7f2; }
