/* Shared header chrome: About / Settings dialogs, help menu, stats icon. */
    /* ── About popup ── */
    .howto-overlay {
      display: none; position: fixed; inset: 0; z-index: 100;
      align-items: center; justify-content: center; padding: 1rem;
      background: rgba(0,0,0,0.82);
    }
    .howto-shell { position: relative; width: 92%; max-width: 340px; }
    .howto-card {
      max-height: 86vh; overflow: auto;
      padding: 1.4rem 1.35rem; border-radius: 18px;
      background: var(--card-bg); border: 2px solid var(--card-bd);
      color: var(--card-fg);
    }
    .howto-title { font-size: 1.15rem; font-weight: 800; color: #f0c030; margin-bottom: 0.7rem; }
    .howto-card p { font-size: 0.86rem; line-height: 1.55; margin: 0 0 0.9rem; }
    .howto-logo-inline { width: 1.15em; height: 1.15em; vertical-align: -0.22em; border-radius: 50%; }
    .howto-close-btn {
      display: block; margin: 1rem auto 0; padding: 0.25em 1em;
      font-size: 0.85rem; font-weight: 800; letter-spacing: 0.04em;
      color: #f0c030; background: rgba(240,192,48,0.12);
      border: 2px solid rgba(240,192,48,0.4); border-radius: 10px;
      cursor: pointer;
    }
    .howto-close-btn:active { background: rgba(240,192,48,0.24); }

    /* ── Help menu (the "?" button) ── */
    /* Stats icon — first of the header controls, so it carries the auto margin
       that pushes the group to the right. */
    #stats-btn {
      margin-left: auto; flex-shrink: 0; display: flex; align-items: center;
      padding: 0.25rem 0.35rem; color: #f0c030; line-height: 1;
    }
    #stats-btn svg { width: 1.35rem; height: 1.35rem; display: block; }
    html[data-theme="light"] #stats-btn { color: #895a03; }
    .help-wrap { position: relative; flex-shrink: 0; display: flex; }
    .help-btn {
      display: flex; align-items: center; justify-content: center;
      width: 1.2rem; height: 1.2rem; border-radius: 50%;
      /* Ring weight matched by eye to the stats icon's bar walls, so the header
         icons read as one set (on paper the walls are ~1.8px, but at this size
         a ring needs more than that to look as heavy). */
      border: 2.25px solid #f0c030; background: none; color: #f0c030;
      font-size: 0.6rem; font-weight: 800; cursor: pointer; line-height: 1;
    }
    .help-btn[aria-expanded="true"] { background: var(--menu-hover); }
    #settings-gear { color: #f0c030; }
    .settings-title { color: #f0c030; }
    html[data-theme="light"] .settings-title { color: #895a03; }
    .help-menu {
      position: absolute; top: calc(100% + 0.55rem); right: 0; z-index: 120;
      min-width: 200px; background: var(--menu-bg); color: var(--menu-fg);
      border: 1.5px solid var(--menu-bd); border-radius: 10px; overflow: hidden;
      box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    }
    .help-menu[hidden] { display: none; }
    .help-menu button, .help-menu a {
      display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
      width: 100%; padding: 0.75rem 0.9rem; background: none; border: none;
      border-bottom: 1px solid var(--menu-sep);
      color: inherit; font: inherit; font-size: 0.9rem; text-align: left;
      text-decoration: none; cursor: pointer;
    }
    .help-menu button:last-child, .help-menu a:last-child { border-bottom: none; }
    .help-menu button:hover, .help-menu a:hover,
    .help-menu button:focus-visible, .help-menu a:focus-visible { background: var(--menu-hover); }
    .help-menu .ext { font-size: 0.8rem; opacity: 0.65; }

    /* Light mode: chrome buttons take the same brown ink + border as the text. */
    html[data-theme="light"] .help-btn,
    html[data-theme="light"] #settings-gear {
      color: #895a03; border-color: #895a03;
    }
    /* Close buttons match the game's action pills — dark fill, not washed out. */
    html[data-theme="light"] .howto-close-btn {
      background: #3d2c12; color: #fff; border-color: #e0a92e;
    }
    html[data-theme="light"] .howto-close-btn:active { background: #2a1e0c; }
