:root {
  --ivory: #f7f4ee;
  --paper: #fffdf9;
  --ink: #1c1d22;
  --muted: #5d606b;
  --line: #e3ded4;
  --rose: #b8336a;
  --studio: #131418;
  --focus: #2563eb;
  --nav-space: calc(84px + env(safe-area-inset-bottom));
  --gutter: 16px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--studio);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Les commandes du jeu gardent leur place ; la navigation se pose dans sa zone inférieure réservée. */
#unity-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Boutons du haut : verre sombre, lisibles sur le studio. */
.topbar {
  position: fixed;
  z-index: 15;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(var(--gutter) + env(safe-area-inset-left));
  right: calc(var(--gutter) + env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.chip, .btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.chip {
  background: rgba(28, 29, 34, .62);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
}
.chip--primary { background: rgba(255, 253, 249, .96); color: var(--ink); border-color: transparent; }

.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--ghost { border-color: transparent; padding: 0 12px; }
.btn--block { width: 100%; }
.btn:active, .chip:active { transform: scale(.98); }

/* Chargement et erreurs, centrés sur le studio. */
.loading {
  position: fixed;
  z-index: 10;
  left: 50%;
  top: 46%;
  width: min(240px, calc(100% - 2 * var(--gutter)));
  transform: translate(-50%, -50%);
  text-align: center;
  color: #fff;
}
.loading__text { margin: 0 0 12px; font-size: 15px; }
.loading__bar { height: 4px; background: rgba(255, 255, 255, .24); border-radius: 2px; overflow: hidden; }
.loading__bar > div { width: 0; height: 100%; background: #fff; transition: width .2s ease; }

.message {
  position: fixed;
  z-index: 40;
  left: var(--gutter);
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  max-width: 420px;
  margin: 0 auto;
  padding: 22px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .28);
}
.message p { margin: 0 0 16px; }

/* Barre de navigation en verre, unique repère principal. */
.tabbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  width: min(560px, calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  height: 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: 24px;
  background: rgba(28, 29, 34, .6);
  border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.tab {
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: rgba(255, 255, 255, .78);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab[aria-current="true"] { color: #fff; background: rgba(255, 255, 255, .14); }
.tab[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 4px;
  height: 3px;
  border-radius: 2px;
  background: var(--rose);
}

/* Sections en panneau : elles remplacent visuellement le moteur. */
.sheet {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: var(--nav-space);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ivory);
  color: var(--ink);
}
.sheet__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 24px;
}
/* En-tête blanc uni : le logo Srixon noir et le logo MMF restent lisibles sans fond crème. */
.sheet__head {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px;
  margin: calc(-12px - env(safe-area-inset-top)) calc(-1 * var(--gutter)) 12px;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brands { display: flex; align-items: center; gap: 14px; }
.brand { height: 40px; width: auto; display: block; }
.brand--srixon { height: 26px; }
.club-logo { display: block; width: auto; height: 40px; margin: 0 0 10px; }
.sheet__title { margin: 14px 0 18px; font-size: 28px; line-height: 1.15; font-weight: 700; outline: none; }
.sheet__intro { margin: -6px 0 24px; color: var(--muted); font-size: 17px; }
.sheet-open .topbar, .sheet-open #loading, .sheet-open #message { visibility: hidden; }
.sheet-open .tabbar { background: #25262b; box-shadow: 0 8px 28px #0002; }

.eyebrow { margin: 0 0 4px; color: var(--rose); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.muted, .hint, .note, .count { color: var(--muted); font-size: 15px; }
.hint { margin: 12px 0 0; font-size: 14px; }
.note { margin: 0 0 16px; font-size: 14px; }
.note a { color: var(--ink); }

.course, .practice-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.course { display: grid; grid-template-columns: 1fr; margin-bottom: 14px; }
.course__media { background: #dbe1d6; }
.course__media img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.course__body { padding: 18px var(--gutter) 20px; }
.course__body h3 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
.course__body p { margin: 0 0 14px; }
.course__body .hint { margin: 16px 0 0; font-size: 12px; }
.course__body .hint a { color: inherit; }
.btn--primary { gap: 16px; }
.field-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.field {
  width: 100%;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid #cfc9bd;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}


.filters { display: grid; gap: 4px 12px; margin-bottom: 8px; }
.field-group { min-width: 0; }
.fallback { padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 16px; }
.fallback p { margin: 0 0 12px; }

.stores { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.store { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.store h3 { margin: 0 0 2px; font-size: 17px; line-height: 1.3; }
.store p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.tag { display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px; background: #ece8df; font-size: 12px; font-weight: 600; }
.store a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-weight: 600; font-size: 15px; }
.store .store-source { display: flex; font-weight: 400; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--rose); }
.store .empty { color: var(--muted); }

@media (min-width: 640px) {
  .stores { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 2fr 1fr; align-items: end; }
  .filters .field-group:last-child .field { margin-bottom: 0; }
}
@media (min-width: 900px) {
  .course { grid-template-columns: 1.25fr 1fr; align-items: stretch; }
  .course__media img { height: 100%; min-height: 300px; max-height: 420px; aspect-ratio: auto; }
  .course__body { padding: 28px; display: flex; flex-direction: column; justify-content: center; }
  .course__body .field, .course__body .btn { max-width: 320px; }
  .course__body .btn--block { width: auto; min-width: 200px; }
}
@media (min-width: 1200px) {
  .stores { grid-template-columns: repeat(3, 1fr); }
  .sheet__title { font-size: 34px; }
}

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