/* FontBench — thème sombre, un seul accent (ambre), zéro webfont. */

:root {
  --bg: #101014;
  --surface: #18181f;
  --surface-2: #1f1f28;
  --border: #2a2a34;
  --text: #e6e6ec;
  --muted: #7a7a8c;
  --accent: #ffb627;
  --accent-ink: #1a1305;
  --warn: #ff8f5c;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, "Segoe UI", sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 40px 20px 64px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app,
#stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app {
  max-width: 880px;
  margin: 0 auto;
}

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.head h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.head h1 span { color: var(--accent); }

.head p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* ── Panneaux ────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.04em;
}

textarea::placeholder { color: #43434f; }

textarea:focus-visible,
select:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Contrôles ───────────────────────────────────────────────────────────── */

/* 220px : les six contrôles tiennent en 3 × 2 sur desktop, sans orphelin */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

select,
input[type="number"] {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

input[type="color"]:disabled { opacity: 0.35; cursor: not-allowed; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.check input { accent-color: var(--accent); }

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented button {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}

.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--text); }

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ── Aperçu ──────────────────────────────────────────────────────────────── */

.preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Damier : rend la transparence visible sans image de fond. */
  background-color: #14141a;
  background-image:
    linear-gradient(45deg, #1c1c24 25%, transparent 25%, transparent 75%, #1c1c24 75%),
    linear-gradient(45deg, #1c1c24 25%, transparent 25%, transparent 75%, #1c1c24 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

#output {
  display: block;
  image-rendering: pixelated;
  flex: none;
}

.placeholder {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.meta {
  display: flex;
  gap: 12px;
  margin: 10px 0 0;
  min-height: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.warn { color: var(--warn); }

/* ── Actions ─────────────────────────────────────────────────────────────── */

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions button {
  height: 38px;
  padding: 0 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}

.actions button:hover:not(:disabled) { border-color: var(--muted); }

.actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.actions .primary:hover:not(:disabled) { background: #ffc555; }

.actions button:disabled { opacity: 0.4; cursor: not-allowed; }

.actions button.is-flash {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── Pied de page & erreurs ──────────────────────────────────────────────── */

.foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.foot p { margin: 0 0 6px; }
.foot strong { color: var(--text); font-weight: 600; }

.error {
  margin: 0;
  padding: 12px 14px;
  background: #2a1512;
  border: 1px solid #5c2a20;
  border-radius: var(--radius);
  color: #ffb3a0;
  font-family: var(--mono);
  font-size: 13px;
}

@media (max-width: 640px) {
  body { padding: 24px 14px 40px; }
  .actions { flex-wrap: wrap; }
}
