/* Badminton Chaneins : styles communs. Sobre, fort contraste, thèmes clair et sombre. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #0b1620;
  --muted: #4a5866;
  --border: #b8c2cc;
  --primary: #0a5bd3;
  --primary-text: #ffffff;
  --accent: #0b7a3e;
  --danger: #b00020;
  --warn-bg: #fff3c4;
  --flash: #cfe3ff;
  --off-bg: #e3e8ee;
  --off-text: #2f3b47;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #1a212b;
    --text: #f5f8fb;
    --muted: #a9b6c4;
    --border: #46535f;
    --primary: #5aa2ff;
    --primary-text: #04101f;
    --accent: #4cd68a;
    --danger: #ff7a8a;
    --warn-bg: #4a3d0a;
    --flash: #1f4a85;
    --off-bg: #2a3440;
    --off-text: #d3dce6;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 18px/1.35 var(--font);
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 12px 40px; }
h1 { font-size: 26px; margin: 0; }
h2 { margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.stack > * + * { margin-top: 14px; }

.card {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}

/* Boutons */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 10px 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 20px; font-weight: 700;
  touch-action: manipulation;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.secondary { background: var(--surface); }
.btn.big { min-height: 72px; font-size: 24px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.send:disabled { opacity: 1; background: var(--off-bg); color: var(--off-text); border-color: var(--off-text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:focus-visible, .name-btn:focus-visible, .link-btn:focus-visible, input:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.busy::after {
  content: ""; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Bannière */
#banner { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 8px); z-index: 10; max-width: 536px; margin: 0 auto; }
.banner { padding: 14px 16px; border-radius: var(--radius); font-weight: 700; font-size: 18px; border: 2px solid var(--text); background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.banner.error { background: var(--warn-bg); }

/* Code */
label { font-weight: 700; display: block; }
.code-input {
  width: 100%; min-height: 72px; font-size: 32px; text-align: center; letter-spacing: .15em;
  background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: var(--radius);
}
.form-error { color: var(--danger); font-weight: 700; min-height: 1.35em; }

/* Ouverture */
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper-btn { width: 84px; min-height: 84px; font-size: 40px; flex: none; }
.stepper-box { flex: 1; text-align: center; }
.stepper-value { display: block; font-size: 64px; font-weight: 800; line-height: 1; }

/* Salle */
.salle > * + * { margin-top: 14px; }
.salle > .section-title { margin-top: 24px; }
.card-title { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.team { display: grid; gap: 8px; }
.vs { text-align: center; color: var(--muted); font-weight: 700; margin: 8px 0; text-transform: uppercase; font-size: 14px; letter-spacing: .1em; }
.name-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 56px; padding: 8px 14px; text-align: left;
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  touch-action: manipulation;
}
.name-text { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.swap-ico { color: var(--muted); font-size: 22px; flex: none; }
.name-btn.busy .swap-ico { display: none; }
.waited { margin-top: 12px; text-align: center; }
.next-card.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: var(--flash); border-color: var(--primary); } to { background: var(--surface); } }
.empty-card { text-align: center; padding: 28px 16px; }
.empty-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.btn.send { min-height: 72px; font-size: 24px; }
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.courts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.court { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.court.free { border-style: dashed; }
.court-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.court-num { font-weight: 800; font-size: 20px; }
.chrono { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 800; color: var(--accent); }
.court-body { display: flex; gap: 12px; align-items: center; }
.court-names { flex: 1; min-width: 0; }
.court-names p { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.court-names p.muted { font-size: 14px; font-weight: 600; }
.btn.fini { width: auto; flex: none; min-width: 96px; min-height: 64px; }
.foot { margin-top: 28px !important; text-align: center; }
.counts { font-size: 20px; font-weight: 800; }
.foot-nav { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.link-btn { flex: 1; min-height: 56px; background: none; border: 0; color: var(--primary); font-size: 18px; font-weight: 700; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .busy::after { animation: none; }
  .next-card.flash { animation: flash-static 1s steps(1, end); }
}
@keyframes flash-static { from { outline: 4px solid var(--accent); outline-offset: 2px; background: var(--flash); } to { outline: 0 solid transparent; } }
