  :root {
    --panel: #161e1b;
    --panel-2: #1d2824;
    --line: #2a3832;
    --text: #d6e2da;
    --muted: #8a9c92;
    --accent: #8fc29f;
    --accent-ink: #0f1a15;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0; display: flex; overflow: hidden;
    font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
    background: #0c1210; color: var(--text);
  }

  /* ---------- Barre latérale ---------- */
  aside {
    width: 248px; flex: none; overflow-y: auto;
    background: var(--panel); border-right: 1px solid var(--line);
    padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 14px;
  }
  h1 {
    font-family: "Cinzel", Georgia, serif; font-weight: 600; font-size: 20px;
    letter-spacing: .04em; margin: 0; color: #e8efe9;
  }
  h1 small { display: block; font: 12px system-ui, sans-serif; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
  h2 {
    font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--muted); margin: 0 0 6px; font-weight: 600;
  }
  [hidden] { display: none !important; }
  section { display: flex; flex-direction: column; gap: 8px; }

  button { font: inherit; color: inherit; cursor: pointer; }
  .tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tool {
    display: flex; align-items: center; gap: 8px; justify-content: center;
    padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); font-size: 13px;
    background: var(--panel-2); transition: background .15s, border-color .15s;
  }
  .tool svg { width: 14px; height: 14px; }
  .tool:hover { border-color: #3d5048; }
  .tool.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

  /* ---------- Contrôles de flèche ---------- */
  #arrowPanel.hidden, #stylePanel.hidden { display: none; }
  #brushSizeGroup.hidden { display: none; }

  .style-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  }
  .style-btn:hover { border-color: #3d5048; }
  .style-btn canvas { width: 36px; height: 36px; border-radius: 6px; flex: none; display: block; }
  .style-btn small { display: block; color: var(--muted); font-size: 12px; }
  .style-btn b { font-weight: 600; }

  .obj-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .obj { padding: 2px; border-radius: 7px; border: 1px solid var(--line); background: #a3b784; line-height: 0; }
  .obj canvas { width: 100%; height: auto; display: block; }
  .obj:hover { border-color: #4a6157; }
  .obj.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
  .obj-name { font-size: 12px; color: var(--muted); min-height: 1em; }
  .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .row label { color: var(--text); }
  .row output { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
  input[type=range] { width: 100%; accent-color: var(--accent); }
  input[type=color] { width: 44px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0 2px; cursor: pointer; }
  input[type=number] {
    width: 64px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--line);
    background: #111816; color: var(--text); font: inherit;
  }
  input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

  .btn {
    padding: 6px 8px; font-size: 13px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--panel-2); text-align: center;
  }
  .btn:hover { border-color: #3d5048; }
  .btn:disabled { opacity: .4; cursor: default; }
  .btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
  kbd {
    font: 11px ui-monospace, monospace; padding: 1px 5px; border-radius: 4px;
    border: 1px solid var(--line); background: #111816; color: var(--text);
  }

  /* ---------- Zone de carte ---------- */
  main { flex: 1; overflow: auto; position: relative; }
  #stage {
    position: relative; display: inline-block; margin: 28px;
    box-shadow: 0 12px 48px rgba(0,0,0,.55); border-radius: 2px;
  }
  #stage canvas { display: block; }
  #overlay { position: absolute; left: 0; top: 0; cursor: auto; touch-action: none; }

  /* ---------- Modale ---------- */
  .modal {
    position: fixed; inset: 0; background: rgba(4,8,6,.66); display: flex;
    align-items: center; justify-content: center; z-index: 10; padding: 24px;
  }
  .modal.hidden { display: none; }
  .dialog {
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    width: min(720px, 100%); max-height: 100%; overflow: auto; padding: 20px 22px 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
  }
  .dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .dialog h3 { margin: 0; font-family: "Cinzel", Georgia, serif; font-weight: 600; font-size: 18px; }
  .close { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; padding: 4px 8px; }
  .close:hover { color: var(--text); }
  .choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
  .choice {
    display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 10px;
    border: 2px solid var(--line); background: var(--panel-2); text-align: left;
  }
  .choice:hover { border-color: #4a6157; }
  .choice.selected { border-color: var(--accent); }
  .choice canvas { width: 100%; height: auto; border-radius: 6px; display: block; }
  .choice span { font-weight: 600; padding: 0 2px 2px; }
  .export img { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 12px; }
  .export a { color: var(--accent); }
