footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

a.back-link {
  color: var(--muted, #a8a8a8);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

a.back-link:hover {
  text-decoration: underline;
}

/* styles.css — v4 (grayscale dark UI, no colored accents) */
:root{
  --bg: #111111;
  --panel: #1a1a1c;
  --line: #2a2a2d;
  --text: #e6e6e6;
  --muted: #a8a8a8;
  --btn: #2a2a2d;
  --btn-hover: #3a3a3a;
  --radius: 14px;
  --gap: 16px;
  --shadow: 0 6px 20px rgba(0,0,0,.45);
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 20% -20%, #1c1c1f, transparent 60%),
    var(--bg);
}

header, footer{ padding: 20px clamp(16px, 4vw, 40px); }
header h1{margin:.2rem 0 0 0; font-weight:700; letter-spacing:.2px}
header p{margin:.3rem 0 0 0; color:var(--muted)}

.container{
  display:grid;
  grid-template-columns: 430px 1fr;
  gap: clamp(16px, 3vw, 28px);
  padding: 0 clamp(16px, 4vw, 40px) 28px;
}

.controls{
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  gap: var(--gap);
  border: 1px solid var(--line);
}

.field{display:flex; flex-direction:column; gap:8px}
.field-row{display:grid; grid-template-columns: 1fr 1fr; gap: var(--gap)}
.field-row.three{grid-template-columns: 1fr 1fr 1fr}

label{font-size:.95rem; color:var(--muted)}
input[type="number"], input[type="color"], select, .colorText{
  width:100%;
  padding:10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:#121214;
  color:var(--text);
  font-family: var(--mono);
}
input[type="color"]{ height:42px; padding:0; }
.colorText.ok{ border-color: #4b4b4b; box-shadow: inset 0 0 0 1px #2e2e2e; }
.colorText.err{ border-color: #5c2b2b; box-shadow: inset 0 0 0 1px #552323; }

.buttons{display:flex; gap:10px; flex-wrap:wrap}
button{
  appearance:none;
  border:none;
  background:var(--btn);
  color:var(--text);
  padding:10px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:600;
  box-shadow: var(--shadow);
  transition: transform .06s ease, background .2s;
  border: 1px solid var(--line);
}
button:hover{ background: var(--btn-hover) }
button:active{ transform: translateY(1px) }

.preview{
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  min-height: 320px;
  border: 1px solid var(--line);
}

canvas{ display:block; max-width:100%; height:auto; image-rendering: pixelated; }

#copyStatus{ min-height: 1.2em; color: var(--muted); font-family: var(--mono); }
.hint{ color: var(--muted); font-size: .9rem; }

/* Tooltip (grayscale) */
.tooltip{
  position: fixed;
  pointer-events: none;
  padding: 6px 8px;
  background: rgba(24,24,26,.92);
  color: #e6e6e6;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 12px/1.2 var(--mono);
  z-index: 50;
  transform: translate(8px, 8px);
  white-space: nowrap;
}

/* #mode width */
#mode {
  width: 150px;
}

/* === RESPONSIVE === */

/* Tablettes */
@media (max-width: 980px) {
  .container {
    grid-template-columns: 1fr;
  }

  .preview {
    min-height: 200px;
  }
}

/* Tablettes petites */
@media (max-width: 600px) {
  .field-row.three {
    grid-template-columns: 1fr;
  }

  .field-row.two-colors {
    grid-template-columns: 1fr;
  }

  #mode {
    width: 100%;
  }

  header h1 {
    font-size: 1.3rem;
  }
}

/* Smartphones */
@media (max-width: 400px) {
  html {
    font-size: 0.8rem;
  }

  .buttons {
    flex-direction: column;
  }

  .buttons button {
    width: 100%;
  }

  .preview {
    min-height: 150px;
    padding: 10px;
  }
}
