/* Bouge ! — Style commun clair et sobre */

:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --link: #0a66c2;
  --border: #e5e7eb;
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
  --radius: 12px;
  --space: 20px;
  --space-lg: 28px;
  --maxw: 880px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  place-items: start center;
  padding: var(--space);
}

main.app {
  width: 100%;
  max-width: var(--maxw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 3.2vw, var(--space-lg));
  box-shadow: var(--shadow);
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: clamp(12px, 2.5vw, 20px);
}

h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); }
p { margin: 0 0 8px 0; }
.muted { color: var(--muted); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Grille et cartes (page d'accueil) */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.5vw, 18px);
}

.card {
  background: #fcfcfd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: clamp(12px, 2.6vw, 16px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: inherit;
  display: block;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(2,6,23,0.06); }
.card .title { font-weight: 600; }
.card .desc { color: var(--muted); margin-top: 4px; }

@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
}

/* Panneaux de section (pages internes) */
.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}

.panel-no-pad {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  background: #fff;
}

/* Formulaires */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; margin-bottom: 10px; }
input, select, button, textarea {
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

button {
  font-weight: 600;
  cursor: pointer;
  background: #f3f4f6;
  border-color: #d1d5db;
}
button:hover { background: #eef2f7; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; }

.status { min-height: 1.5em; }
.error { color: #b91c1c; min-height: 1.5em; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 0.96rem; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border); }
thead th { background: #f8fafc; }
tbody tr:nth-child(odd) { background: #fafafa; }

/* Tables responsives */
.table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 520px) {
  table { font-size: 0.9rem; }
  th, td { padding: 8px; white-space: nowrap; }
}

/* Badges simples */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #f3f4f6; border: 1px solid #e5e7eb; font-size: 0.9rem; }

/* Grille d'infos compacte */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* Zone JSON brute */
#rawResponse { max-height: 240px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; }

/* Zones spécifiques à la démo */
#safari, #permissionButton, #safariRecorder {
  display: inline-block;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

/* Accessibilité: focus visible clair et cohérent */
button:focus-visible, a:focus-visible, #safari:focus-visible, #permissionButton:focus-visible, #safariRecorder:focus-visible {
  outline: 3px solid rgba(10, 102, 194, 0.35);
  outline-offset: 2px;
  border-color: #0a66c2;
}

.controls { align-items: center; }

#canvas, #drawingCanvas, #compassCanvas {
  width: 100%;
  height: auto;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

#gameButton {
  width: 100%;
  min-height: 280px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.25rem;
}

#pause { border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px; background: #fff; }

code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; }

.footer { margin-top: 12px; color: var(--muted); font-size: 0.95rem; }
