:root {
  --fond: #f6f4ef;
  --carte: #ffffff;
  --texte: #1d1d1f;
  --legende: #6e6e73;
  --accent: #0a6e4e;
  --bordure: #e0ddd4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 { font-size: 1.5rem; margin-bottom: 0; }
.subtitle { color: var(--legende); margin-top: 4px; }

/* Menu sandwich */
.topbar {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

#menu-btn {
  font-size: 1.2rem;
  line-height: 1;
  padding: 8px 12px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--carte);
  color: var(--texte);
  cursor: pointer;
}

#menu-btn:hover { border-color: var(--accent); color: var(--accent); }

#menu {
  position: absolute;
  top: 100%;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
}

#menu[hidden] { display: none; }

.menu-item {
  font: inherit;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--texte);
  cursor: pointer;
}

.menu-item:hover { background: var(--fond); }
.menu-item.actif { color: var(--accent); font-weight: 600; }

.row select {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  border: 1px solid transparent;
  border-bottom: 1px dashed var(--bordure);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

.row select:focus {
  outline: none;
  border: 1px solid var(--accent);
  background: #fff;
}

h2 {
  font-size: 1.1rem;
  margin: 32px 0 12px;
  border-bottom: 1px solid var(--bordure);
  padding-bottom: 6px;
}

h3 { font-size: 0.95rem; color: var(--legende); margin: 20px 0 8px; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 6px 10px;
  border-radius: 8px;
}

.row:nth-child(odd) { background: var(--carte); }

.row code, .row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

.row input {
  width: 110px;
  border: 1px solid transparent;
  border-bottom: 1px dashed var(--bordure);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

.row input:focus {
  outline: none;
  border: 1px solid var(--accent);
  background: #fff;
}

.valeur {
  color: var(--accent);
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.legende {
  color: var(--legende);
  font-size: 0.85rem;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.presets button {
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  padding: 6px 12px;
  border: 1px solid var(--bordure);
  border-radius: 999px;
  background: var(--carte);
  color: var(--texte);
  cursor: pointer;
}

.presets button:hover { border-color: var(--accent); color: var(--accent); }
.presets button:active { background: var(--accent); color: #fff; }

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.carte {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carte-valeur {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.carte-label {
  color: var(--legende);
  font-size: 0.85rem;
}
