:root {
  --bg: #f6f3ea;
  --surface: #ffffff;
  --text: #1f2a22;
  --muted: #5f6b62;
  --accent: #2e7d4f;
  --accent-text: #ffffff;
  --border: #e3ded0;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121814;
    --surface: #1c241f;
    --text: #e8eee9;
    --muted: #9aa79e;
    --accent: #6fbf87;
    --accent-text: #0e1a12;
    --border: #2b362f;
    --danger: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

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

h1 { font-size: 28px; line-height: 1.2; margin: 8px 0 4px; }
.muted { color: var(--muted); }

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 48px; height: 48px; border-radius: 12px; }

/* Tuiles des apps */
.apps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px;
  min-height: 132px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.tile:active { transform: scale(0.98); }
.tile .emoji { font-size: 36px; line-height: 1; }
.tile strong { font-size: 18px; }
.tile span { color: var(--muted); font-size: 14px; }
.tile.soon { opacity: 0.55; pointer-events: none; }

/* Formulaires */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin-top: 20px;
}

label { display: block; font-weight: 600; font-size: 15px; margin: 14px 0 6px; }

input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
}
button:disabled { opacity: 0.6; }

.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.link {
  background: none;
  color: var(--accent);
  width: auto;
  min-height: 0;
  padding: 8px 0;
  margin-top: 12px;
  font-weight: 500;
}

.error { color: var(--danger); font-size: 15px; min-height: 1.4em; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.actions { display: grid; gap: 0; margin-top: 8px; justify-items: center; }
.actions > .button, .actions > button:not(.link) { justify-self: stretch; }

/* Entrée « Nos idées » sur l'accueil */
.idees-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -8px; margin-bottom: 8px; padding: 14px 16px; min-height: 56px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; box-shadow: var(--shadow); }
.idees-btn .n { font-size: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.idees-btn .n b { color: var(--accent); }
.idees-btn .n .q { color: #b8860b; font-weight: 700; }
.guide-link { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }

[hidden] { display: none !important; }

/* Toucher façon app : léger enfoncement, pas de sélection de texte sur les boutons. */
button, .tile, .idees-btn, .idea, .button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tile, .idees-btn, .idea { transition: transform .12s ease-out; }
.tile:active, .idees-btn:active, .idea:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { .tile, .idees-btn, .idea { transition: none; } }

/* iPhone : Safari zoome sur un champ écrit en moins de 16 px. Tous les champs en 16 px, le zoom reste possible. */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
